summaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-14 10:32:36 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-22 14:38:54 +0100
commitaac1b805a61ced530b4d427354a205b4bbff69c6 (patch)
treecca1ab8c6d23c21a3f444e634d7168c0ad22f50e /drivers/pwm
parent0f14aca0dca2492f8a55221f6d9a117924f0ba0e (diff)
pwm: sprd: Drop duplicated tracking of the parent device
The pwmchip stores a pointer to the parent device, so there is no need to store another copy in driver private data. Drop struct sprd_pwm_chip::dev and use the pwm_chip's parent pointer instead. Tested-by: Chunyan Zhang <zhang.lyra@gmail.com> Link: https://lore.kernel.org/r/f85771f4bf659c0fdee30cf117b87fd877bad5e4.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-sprd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/pwm/pwm-sprd.c b/drivers/pwm/pwm-sprd.c
index 2e87666ad2b9..a38f50c3dc00 100644
--- a/drivers/pwm/pwm-sprd.c
+++ b/drivers/pwm/pwm-sprd.c
@@ -34,7 +34,6 @@ struct sprd_pwm_chn {
struct sprd_pwm_chip {
void __iomem *base;
- struct device *dev;
struct pwm_chip chip;
struct sprd_pwm_chn chn[SPRD_PWM_CHN_NUM];
};
@@ -85,7 +84,7 @@ static int sprd_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
*/
ret = clk_bulk_prepare_enable(SPRD_PWM_CHN_CLKS_NUM, chn->clks);
if (ret) {
- dev_err(spc->dev, "failed to enable pwm%u clocks\n",
+ dev_err(pwmchip_parent(chip), "failed to enable pwm%u clocks\n",
pwm->hwpwm);
return ret;
}
@@ -182,7 +181,7 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
ret = clk_bulk_prepare_enable(SPRD_PWM_CHN_CLKS_NUM,
chn->clks);
if (ret) {
- dev_err(spc->dev,
+ dev_err(pwmchip_parent(chip),
"failed to enable pwm%u clocks\n",
pwm->hwpwm);
return ret;
@@ -265,7 +264,6 @@ static int sprd_pwm_probe(struct platform_device *pdev)
if (IS_ERR(spc->base))
return PTR_ERR(spc->base);
- spc->dev = &pdev->dev;
memcpy(spc->chn, chn, sizeof(chn));
spc->chip.dev = &pdev->dev;