Commit aac1b805 authored by Uwe Kleine-König's avatar Uwe Kleine-König

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: default avatarChunyan Zhang <zhang.lyra@gmail.com>
Link: https://lore.kernel.org/r/f85771f4bf659c0fdee30cf117b87fd877bad5e4.1707900770.git.u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent 0f14aca0
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment