@@ -34,6 +34,7 @@
#define EP93XX_PWMx_INVERT 0x0c
struct ep93xx_pwm {
+ struct platform_device *pdev;
void __iomem *base;
struct clk *clk;
};
@@ -45,16 +46,16 @@ static inline struct ep93xx_pwm *to_ep93xx_pwm(struct pwm_chip *chip)
static int ep93xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
{
- struct platform_device *pdev = to_platform_device(chip->dev);
+ struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
- return ep93xx_pwm_acquire_gpio(pdev);
+ return ep93xx_pwm_acquire_gpio(ep93xx_pwm->pdev);
}
static void ep93xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
{
- struct platform_device *pdev = to_platform_device(chip->dev);
+ struct ep93xx_pwm *ep93xx_pwm = to_ep93xx_pwm(chip);
- ep93xx_pwm_release_gpio(pdev);
+ ep93xx_pwm_release_gpio(ep93xx_pwm->pdev);
}
static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -171,6 +172,8 @@ static int ep93xx_pwm_probe(struct platform_device *pdev)
return PTR_ERR(chip);
ep93xx_pwm = to_ep93xx_pwm(chip);
+ ep93xx_pwm->pdev = pdev;
+
ep93xx_pwm->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ep93xx_pwm->base))
return PTR_ERR(ep93xx_pwm->base);
struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, store a pointer to the parent device in driver data. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/pwm/pwm-ep93xx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)