[PATCH leds v2 21/50] leds: pm8058: cosmetic change: use helper variable

Marek Behún
2020-09-17T22:35:35Z

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>
---
drivers/leds/leds-pm8058.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/leds/leds-pm8058.c b/drivers/leds/leds-pm8058.c
index e085bf9ffc1de..70b4d06488fec 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;
}

--
2.26.2