summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-pm8058.c
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-18 01:33:09 +0300
committerPavel Machek <pavel@ucw.cz>2020-09-26 22:56:40 +0300
commitfb270ba0d9ba76bf40326ac328024fe35b05c1f6 (patch)
tree937cfa07309fbf606bfa31a867cbbc07864626fa /drivers/leds/leds-pm8058.c
parenteed951bbf737bb728006b1d248af6341abf79cd8 (diff)
downloadlinux-fb270ba0d9ba76bf40326ac328024fe35b05c1f6.tar.xz
leds: pm8058: cosmetic change: use helper variable
Use helper variable dev instead of always writing &pdev->dev. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds/leds-pm8058.c')
-rw-r--r--drivers/leds/leds-pm8058.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c
index f19bd0563ee5..db0699462e0d 100644
--- a/drivers/leds/leds-pm8058.c
+++ b/drivers/leds/leds-pm8058.c
@@ -88,29 +88,32 @@ static enum led_brightness pm8058_led_get(struct led_classdev *cled)
static int pm8058_led_probe(struct platform_device *pdev)
{
struct led_init_data init_data = {};
+ struct device *dev = &pdev->dev;
struct pm8058_led *led;
- struct device_node *np = dev_of_node(&pdev->dev);
+ struct device_node *np;
int ret;
struct regmap *map;
const char *state;
enum led_brightness maxbright;
- led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
+ led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
if (!led)
return -ENOMEM;
- led->ledtype = (u32)(unsigned long)of_device_get_match_data(&pdev->dev);
+ led->ledtype = (u32)(unsigned long)of_device_get_match_data(dev);
- map = dev_get_regmap(pdev->dev.parent, NULL);
+ map = dev_get_regmap(dev->parent, NULL);
if (!map) {
- dev_err(&pdev->dev, "Parent regmap unavailable.\n");
+ dev_err(dev, "Parent regmap unavailable.\n");
return -ENXIO;
}
led->map = map;
+ np = dev_of_node(dev);
+
ret = of_property_read_u32(np, "reg", &led->reg);
if (ret) {
- dev_err(&pdev->dev, "no register offset specified\n");
+ dev_err(dev, "no register offset specified\n");
return -EINVAL;
}
@@ -143,10 +146,9 @@ static int pm8058_led_probe(struct platform_device *pdev)
init_data.fwnode = of_fwnode_handle(np);
- ret = devm_led_classdev_register_ext(&pdev->dev, &led->cdev,
- &init_data);
+ ret = devm_led_classdev_register_ext(dev, &led->cdev, &init_data);
if (ret) {
- dev_err(&pdev->dev, "Failed to register LED for %pOF\n", np);
+ dev_err(dev, "Failed to register LED for %pOF\n", np);
return ret;
}