pwm: bcm-iproc: Prevent unloading the driver module while in use
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 17 Oct 2019 19:22:18 +0000 (21:22 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 8 Nov 2019 17:38:06 +0000 (18:38 +0100)
The owner member of struct pwm_ops must be set to THIS_MODULE to
increase the reference count of the module such that the module cannot
be removed while its code is in use.

Fixes: daa5abc41c80 ("pwm: Add support for Broadcom iProc PWM controller")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-bcm-iproc.c

index 56c38cfae92ca9285d69e6bd6596cd80d95fcae7..1f829edd8ee709c18b0b247c8ca945c607d4d505 100644 (file)
@@ -187,6 +187,7 @@ static int iproc_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 static const struct pwm_ops iproc_pwm_ops = {
        .apply = iproc_pwmc_apply,
        .get_state = iproc_pwmc_get_state,
+       .owner = THIS_MODULE,
 };
 
 static int iproc_pwmc_probe(struct platform_device *pdev)