From: Mark Brown Date: Sun, 19 Feb 2017 16:40:41 +0000 (+0000) Subject: Merge remote-tracking branches 'regulator/topic/s2mpa01', 'regulator/topic/supplies... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fad9cd45edf558b5886219d58986a88a83926bbf;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge remote-tracking branches 'regulator/topic/s2mpa01', 'regulator/topic/supplies' and 'regulator/topic/tps65217' into regulator-next --- fad9cd45edf558b5886219d58986a88a83926bbf diff --cc drivers/regulator/core.c index 6ea646466a07,04baac9a165b,bcf67abd1cd2,04baac9a165b..53d4fc70dbd0 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@@@@ -1601,47 -1593,49 -1606,49 -1593,49 +1614,47 @@@@@ struct regulator *_regulator_get(struc return ERR_PTR(-EINVAL); } --- if (dev) --- devname = dev_name(dev); - - if (have_full_constraints()) - ret = -ENODEV; - else - ret = -EPROBE_DEFER; - - rdev = regulator_dev_lookup(dev, id, &ret); - if (rdev) - goto found; +++ rdev = regulator_dev_lookup(dev, id); +++ if (IS_ERR(rdev)) { +++ ret = PTR_ERR(rdev); - - if (have_full_constraints()) - - ret = -ENODEV; - - else - - ret = -EPROBE_DEFER; - - - - rdev = regulator_dev_lookup(dev, id, &ret); - - if (rdev) - - goto found; - - --- regulator = ERR_PTR(ret); +++ /* +++ * If regulator_dev_lookup() fails with error other +++ * than -ENODEV our job here is done, we simply return it. +++ */ +++ if (ret != -ENODEV) +++ return ERR_PTR(ret); --- /* --- * If we have return value from dev_lookup fail, we do not expect to --- * succeed, so, quit with appropriate error value --- */ --- if (ret && ret != -ENODEV) --- return regulator; +++ if (!have_full_constraints()) { +++ dev_warn(dev, +++ "incomplete constraints, dummy supplies not allowed\n"); +++ return ERR_PTR(-ENODEV); +++ } --- if (!devname) --- devname = "deviceless"; +++ switch (get_type) { +++ case NORMAL_GET: +++ /* +++ * Assume that a regulator is physically present and +++ * enabled, even if it isn't hooked up, and just +++ * provide a dummy. +++ */ +++ dev_warn(dev, +++ "%s supply %s not found, using dummy regulator\n", +++ devname, id); +++ rdev = dummy_regulator_rdev; +++ get_device(&rdev->dev); +++ break; --- /* --- * Assume that a regulator is physically present and enabled --- * even if it isn't hooked up and just provide a dummy. --- */ --- if (have_full_constraints() && allow_dummy) { --- pr_warn("%s supply %s not found, using dummy regulator\n", --- devname, id); +++ case EXCLUSIVE_GET: +++ dev_warn(dev, +++ "dummy supplies not allowed for exclusive requests\n"); +++ /* fall through */ --- rdev = dummy_regulator_rdev; --- get_device(&rdev->dev); --- goto found; --- /* Don't log an error when called from regulator_get_optional() */ --- } else if (!have_full_constraints() || exclusive) { --- dev_warn(dev, "dummy supplies not allowed\n"); +++ default: +++ return ERR_PTR(-ENODEV); +++ } } --- return regulator; --- ---found: if (rdev->exclusive) { regulator = ERR_PTR(-EPERM); put_device(&rdev->dev);