2024-04-28 17:16:04

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 1/2] leds: lp50xx: Remove an unused field in struct lp50xx_led

In "struct lp50xx_led", the 'bank_modules' field is unused.
Remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile tested only.

It was added added in the initial commit 242b81170fb8 ("leds: lp50xx: Add
the LP50XX family of the RGB LED driver") but was never used.
---
drivers/leds/leds-lp50xx.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
index 68c4d9967d68..407eddcf17c0 100644
--- a/drivers/leds/leds-lp50xx.c
+++ b/drivers/leds/leds-lp50xx.c
@@ -265,7 +265,6 @@ static const struct lp50xx_chip_info lp50xx_chip_info_tbl[] = {
struct lp50xx_led {
struct led_classdev_mc mc_cdev;
struct lp50xx *priv;
- unsigned long bank_modules;
u8 ctrl_bank_enabled;
int led_number;
};
--
2.44.0



2024-04-28 17:25:38

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 2/2] leds: lp50xx: Remove an unused field in struct lp50xx

In "struct lp50xx", the 'num_of_banked_leds' field is only written and is
never used.
Moreover, storing such an information in the 'priv' structure looks
pointless.

So, remove it.

Signed-off-by: Christophe JAILLET <[email protected]>
---
Compile tested only.
---
drivers/leds/leds-lp50xx.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
index 407eddcf17c0..175d4b06659b 100644
--- a/drivers/leds/leds-lp50xx.c
+++ b/drivers/leds/leds-lp50xx.c
@@ -278,7 +278,6 @@ struct lp50xx_led {
* @dev: pointer to the devices device struct
* @lock: lock for reading/writing the device
* @chip_info: chip specific information (ie num_leds)
- * @num_of_banked_leds: holds the number of banked LEDs
* @leds: array of LED strings
*/
struct lp50xx {
@@ -289,7 +288,6 @@ struct lp50xx {
struct device *dev;
struct mutex lock;
const struct lp50xx_chip_info *chip_info;
- int num_of_banked_leds;

/* This needs to be at the end of the struct */
struct lp50xx_led leds[];
@@ -403,8 +401,6 @@ static int lp50xx_probe_leds(struct fwnode_handle *child, struct lp50xx *priv,
return -EINVAL;
}

- priv->num_of_banked_leds = num_leds;
-
ret = fwnode_property_read_u32_array(child, "reg", led_banks, num_leds);
if (ret) {
dev_err(priv->dev, "reg property is missing\n");
--
2.44.0


2024-05-02 17:11:54

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH 1/2] leds: lp50xx: Remove an unused field in struct lp50xx_led

On Sun, 28 Apr 2024 19:15:24 +0200, Christophe JAILLET wrote:
> In "struct lp50xx_led", the 'bank_modules' field is unused.
> Remove it.
>
> Found with cppcheck, unusedStructMember.
>
>

Applied, thanks!

[1/2] leds: lp50xx: Remove an unused field in struct lp50xx_led
commit: 221db0183bebbee146922b5816419bdc9b5425ff
[2/2] leds: lp50xx: Remove an unused field in struct lp50xx
commit: dd66d058565a705980e6d55bd6592958531221b9

--
Lee Jones [李琼斯]