summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2022-04-04 23:35:21 +0300
committerPavel Machek <pavel@ucw.cz>2022-05-05 11:04:52 +0300
commit4c350c658f946dae81dbbaff25da0a03e9bb0c4b (patch)
tree59c458b9eb904315123b3789acec5e8f673215f3 /drivers/leds
parent5a71917f3b43b9fd6d6ff7b0622a85153bf184cb (diff)
downloadlinux-4c350c658f946dae81dbbaff25da0a03e9bb0c4b.tar.xz
leds: regulator: Add dev helper variable
Instead of repeating the hard to read &pdev->dev just create a local struct device *dev in probe(). Cc: Antonio Ospite <ao2@ao2.it> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-regulator.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/leds/leds-regulator.c b/drivers/leds/leds-regulator.c
index 208c98918433..87b9f46e572b 100644
--- a/drivers/leds/leds-regulator.c
+++ b/drivers/leds/leds-regulator.c
@@ -123,28 +123,29 @@ static int regulator_led_probe(struct platform_device *pdev)
{
struct led_regulator_platform_data *pdata =
dev_get_platdata(&pdev->dev);
+ struct device *dev = &pdev->dev;
struct regulator_led *led;
struct regulator *vcc;
int ret = 0;
if (pdata == NULL) {
- dev_err(&pdev->dev, "no platform data\n");
+ dev_err(dev, "no platform data\n");
return -ENODEV;
}
- vcc = devm_regulator_get_exclusive(&pdev->dev, "vled");
+ vcc = devm_regulator_get_exclusive(dev, "vled");
if (IS_ERR(vcc)) {
- dev_err(&pdev->dev, "Cannot get vcc for %s\n", pdata->name);
+ dev_err(dev, "Cannot get vcc for %s\n", pdata->name);
return PTR_ERR(vcc);
}
- led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
+ led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
if (led == NULL)
return -ENOMEM;
led->cdev.max_brightness = led_regulator_get_max_brightness(vcc);
if (pdata->brightness > led->cdev.max_brightness) {
- dev_err(&pdev->dev, "Invalid default brightness %d\n",
+ dev_err(dev, "Invalid default brightness %d\n",
pdata->brightness);
return -EINVAL;
}
@@ -162,7 +163,7 @@ static int regulator_led_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, led);
- ret = led_classdev_register(&pdev->dev, &led->cdev);
+ ret = led_classdev_register(dev, &led->cdev);
if (ret < 0)
return ret;