[PATCH] pwm: lp3943: Mark parent device's platform data as const

Uwe Kleine-König posted 1 patch 2 weeks, 3 days ago
drivers/pwm/pwm-lp3943.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] pwm: lp3943: Mark parent device's platform data as const
Posted by Uwe Kleine-König 2 weeks, 3 days ago
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