[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917223338.14164-45-marek.behun@nic.cz>
Date: Fri, 18 Sep 2020 00:33:32 +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>,
Simon Guinot <simon.guinot@...uanux.org>,
Simon Guinot <sguinot@...ie.com>,
Vincent Donnefort <vdonnefort@...il.com>,
Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH leds v2 44/50] leds: ns2: 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: Simon Guinot <simon.guinot@...uanux.org>
Cc: Simon Guinot <sguinot@...ie.com>
Cc: Vincent Donnefort <vdonnefort@...il.com>
Cc: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Cc: Linus Walleij <linus.walleij@...aro.org>
---
drivers/leds/leds-ns2.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 912db40c51183..801b7f851be7a 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -185,7 +185,7 @@ static struct attribute *ns2_led_attrs[] = {
ATTRIBUTE_GROUPS(ns2_led);
static int
-create_ns2_led(struct platform_device *pdev, struct ns2_led *led,
+create_ns2_led(struct device *dev, struct ns2_led *led,
const struct ns2_led_of_one *template)
{
int ret;
@@ -216,7 +216,7 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led *led,
led->sata = (mode == NS_V2_LED_SATA) ? 1 : 0;
led->cdev.brightness = (mode == NS_V2_LED_OFF) ? LED_OFF : LED_FULL;
- return devm_led_classdev_register(&pdev->dev, &led->cdev);
+ return devm_led_classdev_register(dev, &led->cdev);
}
static int ns2_leds_parse_one(struct device *dev, struct device_node *np,
@@ -313,28 +313,27 @@ MODULE_DEVICE_TABLE(of, of_ns2_leds_match);
static int ns2_led_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct ns2_led_of *ofdata;
struct ns2_led *leds;
int i;
int ret;
- ofdata = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_of),
- GFP_KERNEL);
+ ofdata = devm_kzalloc(dev, sizeof(struct ns2_led_of), GFP_KERNEL);
if (!ofdata)
return -ENOMEM;
- ret = ns2_leds_parse_of(&pdev->dev, ofdata);
+ ret = ns2_leds_parse_of(dev, ofdata);
if (ret)
return ret;
- leds = devm_kzalloc(&pdev->dev, array_size(sizeof(*leds),
- ofdata->num_leds),
+ leds = devm_kzalloc(dev, array_size(sizeof(*leds), ofdata->num_leds),
GFP_KERNEL);
if (!leds)
return -ENOMEM;
for (i = 0; i < ofdata->num_leds; i++) {
- ret = create_ns2_led(pdev, &leds[i], &ofdata->leds[i]);
+ ret = create_ns2_led(dev, &leds[i], &ofdata->leds[i]);
if (ret < 0)
return ret;
}
--
2.26.2
Powered by blists - more mailing lists