summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-ns2.c
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-18 00:33:32 +0200
committerPavel Machek <pavel@ucw.cz>2020-09-26 21:56:42 +0200
commitb3f96922839a589e8417c31a1837f78382d3f0ab (patch)
tree0a8a0c18ce7d1fe03b2cac65b94f456fe60cb78c /drivers/leds/leds-ns2.c
parentleds: ns2: cosmetic change (diff)
downloadlinux-b3f96922839a589e8417c31a1837f78382d3f0ab.tar.xz
linux-b3f96922839a589e8417c31a1837f78382d3f0ab.zip
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@nic.cz> Cc: Simon Guinot <simon.guinot@sequanux.org> Cc: Simon Guinot <sguinot@lacie.com> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds/leds-ns2.c')
-rw-r--r--drivers/leds/leds-ns2.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 912db40c5118..801b7f851be7 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;
}