* [PATCH] pwm: lp3943: Mark parent device's platform data as const
@ 2026-09-08 16:53 Uwe Kleine-König
2026-11-13 23:37 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2026-09-08 16:53 UTC (permalink / raw)
To: linux-pwm; +Cc: linux-kernel, Lee Jones, mfd, Manush Prajwal
Platform data should never get modified by a driver. So add a respective
`const` which makes it explicit that the pwm-lp3943 driver indeed
doesn't modify platform data.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,
I found this patch opportunity while reviewing another patch to this
driver[1]. A possible followup is to mark struct lp3943::pdata also as
const. I made a note to address at a later point (i.e. when the mfd tree
contains this patch).
Best regards
Uwe
[1] https://lore.kernel.org/linux-pwm/6a9d5187.d63de05c.175391.a17c@mx.google.com
drivers/pwm/pwm-lp3943.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index 10537e74be28..0fde89018d2a 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -21,7 +21,7 @@
struct lp3943_pwm {
struct lp3943 *lp3943;
- struct lp3943_platform_data *pdata;
+ const struct lp3943_platform_data *pdata;
struct lp3943_pwm_map pwm_map[LP3943_NUM_PWMS];
};
@@ -33,7 +33,7 @@ static inline struct lp3943_pwm *to_lp3943_pwm(struct pwm_chip *chip)
static struct lp3943_pwm_map *
lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm)
{
- struct lp3943_platform_data *pdata = lp3943_pwm->pdata;
+ const struct lp3943_platform_data *pdata = lp3943_pwm->pdata;
struct lp3943 *lp3943 = lp3943_pwm->lp3943;
struct lp3943_pwm_map *pwm_map = &lp3943_pwm->pwm_map[hwpwm];
int i, offset;
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
--
2.55.0.11.g153666a7d9bb
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-13 23:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-08 16:53 [PATCH] pwm: lp3943: Mark parent device's platform data as const Uwe Kleine-König
2026-11-13 23:37 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®