summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-20 03:24:55 +0300
committerPavel Machek <pavel@ucw.cz>2020-09-30 19:53:27 +0300
commitaf26bebea1199d8cbefd39b42ade40698504afba (patch)
treeb521b834addbbefc43ad779c87176d06dacfbbb6
parent39118499a62623d32c67ffd93d94ed5f27bfc736 (diff)
downloadlinux-af26bebea1199d8cbefd39b42ade40698504afba.tar.xz
leds: pca963x: use devres LED registering function
By using devres version of LED registering function we can remove the .remove method from this driver. The probe method also gets simpler. Signed-off-by: Marek BehĂșn <marek.behun@nic.cz> Cc: Peter Meerwald <p.meerwald@bct-electronic.com> Cc: Ricardo Ribalda <ribalda@kernel.org> Cc: Zahari Petkov <zahari@balena.io> Signed-off-by: Pavel Machek <pavel@ucw.cz>
-rw-r--r--drivers/leds/leds-pca963x.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index c03871f92fec..cbb3bf6c044f 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -432,9 +432,9 @@ static int pca963x_probe(struct i2c_client *client,
if (pdata && pdata->blink_type == PCA963X_HW_BLINK)
pca963x[i].led_cdev.blink_set = pca963x_blink_set;
- err = led_classdev_register(dev, &pca963x[i].led_cdev);
+ err = devm_led_classdev_register(dev, &pca963x[i].led_cdev);
if (err < 0)
- goto exit;
+ return err;
}
/* Disable LED all-call address, and power down initially */
@@ -454,23 +454,6 @@ static int pca963x_probe(struct i2c_client *client,
}
return 0;
-
-exit:
- while (i--)
- led_classdev_unregister(&pca963x[i].led_cdev);
-
- return err;
-}
-
-static int pca963x_remove(struct i2c_client *client)
-{
- struct pca963x *pca963x = i2c_get_clientdata(client);
- int i;
-
- for (i = 0; i < pca963x->chipdef->n_leds; i++)
- led_classdev_unregister(&pca963x->leds[i].led_cdev);
-
- return 0;
}
static struct i2c_driver pca963x_driver = {
@@ -479,7 +462,6 @@ static struct i2c_driver pca963x_driver = {
.of_match_table = of_pca963x_match,
},
.probe = pca963x_probe,
- .remove = pca963x_remove,
.id_table = pca963x_id,
};