[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917223338.14164-22-marek.behun@nic.cz>
Date: Fri, 18 Sep 2020 00:33:09 +0200
From: Marek Behún <marek.behun@....cz>
To: linux-leds@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
Ondřej Jirman <megous@...ous.com>,
linux-kernel@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
devicetree@...r.kernel.org,
Marek Behún <marek.behun@....cz>,
Linus Walleij <linus.walleij@...aro.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>
Subject: [PATCH leds v2 21/50] 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@....cz>
Cc: Linus Walleij <linus.walleij@...aro.org>
Cc: Bjorn Andersson <bjorn.andersson@...aro.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
Powered by blists - more mailing lists