From: Daniel Mack <daniel.mack@holoplot.com>
To: linux-leds@vger.kernel.org
Cc: pavel@kernel.org, lee@kernel.org, robh@kernel.org,
devicetree@vger.kernel.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH v2 3/3] leds: is31f132xx: re-order code to remove forward declarations
Date: Fri, 14 Nov 2025 10:46:40 +0100 [thread overview]
Message-ID: <20251114094640.4096054-4-daniel.mack@holoplot.com> (raw)
In-Reply-To: <20251114094640.4096054-1-daniel.mack@holoplot.com>
From: Daniel Mack <daniel@zonque.org>
Move the chipdef structs after the functions they reference so that forward
declarations become unnecessary.
Signed-off-by: Daniel Mack <daniel@zonque.org>
---
drivers/leds/leds-is31fl32xx.c | 136 ++++++++++++++++-----------------
1 file changed, 65 insertions(+), 71 deletions(-)
diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c
index 26664fad91ae..05e28257ca4b 100644
--- a/drivers/leds/leds-is31fl32xx.c
+++ b/drivers/leds/leds-is31fl32xx.c
@@ -103,77 +103,6 @@ struct is31fl32xx_chipdef {
int (*sw_shutdown_func)(struct is31fl32xx_priv *priv, bool enable);
};
-static const struct is31fl32xx_chipdef is31fl3236_cdef = {
- .channels = 36,
- .shutdown_reg = 0x00,
- .pwm_update_reg = 0x25,
- .global_control_reg = 0x4a,
- .reset_reg = 0x4f,
- .pwm_register_base = 0x01,
- .led_control_register_base = 0x26,
- .enable_bits_per_led_control_register = 1,
- .brightness_steps = 256,
-};
-
-static const struct is31fl32xx_chipdef is31fl3235_cdef = {
- .channels = 28,
- .shutdown_reg = 0x00,
- .pwm_update_reg = 0x25,
- .global_control_reg = 0x4a,
- .reset_reg = 0x4f,
- .pwm_register_base = 0x05,
- .led_control_register_base = 0x2a,
- .enable_bits_per_led_control_register = 1,
- .brightness_steps = 256,
-};
-
-static const struct is31fl32xx_chipdef is31fl3218_cdef = {
- .channels = 18,
- .shutdown_reg = 0x00,
- .pwm_update_reg = 0x16,
- .global_control_reg = IS31FL32XX_REG_NONE,
- .reset_reg = 0x17,
- .pwm_register_base = 0x01,
- .led_control_register_base = 0x13,
- .enable_bits_per_led_control_register = 6,
- .brightness_steps = 256,
-};
-
-static int is31fl3216_reset(struct is31fl32xx_priv *priv);
-static int is31fl3216_software_shutdown(struct is31fl32xx_priv *priv,
- bool enable);
-static const struct is31fl32xx_chipdef is31fl3216_cdef = {
- .channels = 16,
- .shutdown_reg = IS31FL32XX_REG_NONE,
- .pwm_update_reg = 0xB0,
- .global_control_reg = IS31FL32XX_REG_NONE,
- .reset_reg = IS31FL32XX_REG_NONE,
- .pwm_register_base = 0x10,
- .pwm_registers_reversed = true,
- .led_control_register_base = 0x01,
- .enable_bits_per_led_control_register = 8,
- .reset_func = is31fl3216_reset,
- .sw_shutdown_func = is31fl3216_software_shutdown,
- .brightness_steps = 256,
-};
-
-static int is31fl3293_reset(struct is31fl32xx_priv *priv);
-static int is31fl3293_software_shutdown(struct is31fl32xx_priv *priv,
- bool enable);
-static const struct is31fl32xx_chipdef is31fl3293_cdef = {
- .channels = 3,
- .shutdown_reg = IS31FL32XX_REG_NONE,
- .pwm_update_reg = 0x28,
- .pwm_update_value = 0xc5,
- .global_control_reg = IS31FL32XX_REG_NONE,
- .reset_reg = IS31FL32XX_REG_NONE,
- .pwm_register_base = 0x19,
- .led_control_register_base = IS31FL32XX_REG_NONE,
- .brightness_steps = 4096,
- .reset_func = is31fl3293_reset,
- .sw_shutdown_func = is31fl3293_software_shutdown,
-};
-
static int is31fl32xx_write(struct is31fl32xx_priv *priv, u8 reg, u8 val)
{
int ret;
@@ -525,6 +454,71 @@ static int is31fl32xx_parse_dt(struct device *dev,
return 0;
}
+static const struct is31fl32xx_chipdef is31fl3236_cdef = {
+ .channels = 36,
+ .shutdown_reg = 0x00,
+ .pwm_update_reg = 0x25,
+ .global_control_reg = 0x4a,
+ .reset_reg = 0x4f,
+ .pwm_register_base = 0x01,
+ .led_control_register_base = 0x26,
+ .enable_bits_per_led_control_register = 1,
+ .brightness_steps = 256,
+};
+
+static const struct is31fl32xx_chipdef is31fl3235_cdef = {
+ .channels = 28,
+ .shutdown_reg = 0x00,
+ .pwm_update_reg = 0x25,
+ .global_control_reg = 0x4a,
+ .reset_reg = 0x4f,
+ .pwm_register_base = 0x05,
+ .led_control_register_base = 0x2a,
+ .enable_bits_per_led_control_register = 1,
+ .brightness_steps = 256,
+};
+
+static const struct is31fl32xx_chipdef is31fl3218_cdef = {
+ .channels = 18,
+ .shutdown_reg = 0x00,
+ .pwm_update_reg = 0x16,
+ .global_control_reg = IS31FL32XX_REG_NONE,
+ .reset_reg = 0x17,
+ .pwm_register_base = 0x01,
+ .led_control_register_base = 0x13,
+ .enable_bits_per_led_control_register = 6,
+ .brightness_steps = 256,
+};
+
+static const struct is31fl32xx_chipdef is31fl3216_cdef = {
+ .channels = 16,
+ .shutdown_reg = IS31FL32XX_REG_NONE,
+ .pwm_update_reg = 0xB0,
+ .global_control_reg = IS31FL32XX_REG_NONE,
+ .reset_reg = IS31FL32XX_REG_NONE,
+ .pwm_register_base = 0x10,
+ .pwm_registers_reversed = true,
+ .led_control_register_base = 0x01,
+ .enable_bits_per_led_control_register = 8,
+ .reset_func = is31fl3216_reset,
+ .sw_shutdown_func = is31fl3216_software_shutdown,
+ .brightness_steps = 256,
+};
+
+static const struct is31fl32xx_chipdef is31fl3293_cdef = {
+ .channels = 3,
+ .shutdown_reg = IS31FL32XX_REG_NONE,
+ .pwm_update_reg = 0x28,
+ .pwm_update_value = 0xc5,
+ .global_control_reg = IS31FL32XX_REG_NONE,
+ .reset_reg = IS31FL32XX_REG_NONE,
+ .pwm_register_base = 0x19,
+ .led_control_register_base = IS31FL32XX_REG_NONE,
+ .brightness_steps = 4096,
+ .reset_func = is31fl3293_reset,
+ .sw_shutdown_func = is31fl3293_software_shutdown,
+};
+
static const struct of_device_id of_is31fl32xx_match[] = {
{ .compatible = "issi,is31fl3293", .data = &is31fl3293_cdef, },
{ .compatible = "issi,is31fl3236", .data = &is31fl3236_cdef, },
--
2.51.1
next prev parent reply other threads:[~2025-11-14 9:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 9:46 [PATCH v2 0/3] leds: is31f132xx: add support for is31fl3293 Daniel Mack
2025-11-14 9:46 ` [PATCH v2 1/3] dt-bindings: leds: add issi,is31fl3293 to leds-is31fl32xx Daniel Mack
2025-11-14 17:53 ` Conor Dooley
2025-11-14 9:46 ` [PATCH v2 2/3] leds: is31f132xx: add support for is31fl3293 Daniel Mack
2025-11-14 9:46 ` Daniel Mack [this message]
2025-11-20 10:42 ` [PATCH v2 0/3] " Lee Jones
2025-11-20 10:44 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251114094640.4096054-4-daniel.mack@holoplot.com \
--to=daniel.mack@holoplot.com \
--cc=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox