Commit 384461ab authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: Manage owner assignment implicitly for drivers

Instead of requiring each driver to care for assigning the owner member
of struct pwm_ops, handle that implicitly using a macro. Note that the
owner member has to be moved to struct pwm_chip, as the ops structure
usually lives in read-only memory and so cannot be modified.

The upside is that new low level drivers cannot forget the assignment and
save one line each. The pwm-crc driver didn't assign .owner, that's not
a problem in practice though as the driver cannot be compiled as a
module.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> # Intel LPSS
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> # pwm-{bcm,brcm}*.c
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> # sun4i
Acked-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> # pwm-visconti
Acked-by: Heiko Stuebner <heiko@sntech.de> # pwm-rockchip
Acked-by: Michael Walle <michael@walle.cc> # pwm-sl28cpld
Acked-by: Neil Armstrong <neil.armstrong@linaro.org> # pwm-meson
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230804142707.412137-2-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 7a3663c2
...@@ -756,7 +756,6 @@ static const struct pwm_ops mvebu_pwm_ops = { ...@@ -756,7 +756,6 @@ static const struct pwm_ops mvebu_pwm_ops = {
.free = mvebu_pwm_free, .free = mvebu_pwm_free,
.get_state = mvebu_pwm_get_state, .get_state = mvebu_pwm_get_state,
.apply = mvebu_pwm_apply, .apply = mvebu_pwm_apply,
.owner = THIS_MODULE,
}; };
static void __maybe_unused mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip) static void __maybe_unused mvebu_pwm_suspend(struct mvebu_gpio_chip *mvchip)
......
...@@ -1580,7 +1580,6 @@ static const struct pwm_ops ti_sn_pwm_ops = { ...@@ -1580,7 +1580,6 @@ static const struct pwm_ops ti_sn_pwm_ops = {
.free = ti_sn_pwm_free, .free = ti_sn_pwm_free,
.apply = ti_sn_pwm_apply, .apply = ti_sn_pwm_apply,
.get_state = ti_sn_pwm_get_state, .get_state = ti_sn_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int ti_sn_pwm_probe(struct auxiliary_device *adev, static int ti_sn_pwm_probe(struct auxiliary_device *adev,
......
...@@ -1085,7 +1085,6 @@ static const struct pwm_ops lpg_pwm_ops = { ...@@ -1085,7 +1085,6 @@ static const struct pwm_ops lpg_pwm_ops = {
.request = lpg_pwm_request, .request = lpg_pwm_request,
.apply = lpg_pwm_apply, .apply = lpg_pwm_apply,
.get_state = lpg_pwm_get_state, .get_state = lpg_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int lpg_add_pwm(struct lpg *lpg) static int lpg_add_pwm(struct lpg *lpg)
......
...@@ -89,13 +89,13 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) ...@@ -89,13 +89,13 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label)
if (test_bit(PWMF_REQUESTED, &pwm->flags)) if (test_bit(PWMF_REQUESTED, &pwm->flags))
return -EBUSY; return -EBUSY;
if (!try_module_get(pwm->chip->ops->owner)) if (!try_module_get(pwm->chip->owner))
return -ENODEV; return -ENODEV;
if (pwm->chip->ops->request) { if (pwm->chip->ops->request) {
err = pwm->chip->ops->request(pwm->chip, pwm); err = pwm->chip->ops->request(pwm->chip, pwm);
if (err) { if (err) {
module_put(pwm->chip->ops->owner); module_put(pwm->chip->owner);
return err; return err;
} }
} }
...@@ -253,14 +253,16 @@ static bool pwm_ops_check(const struct pwm_chip *chip) ...@@ -253,14 +253,16 @@ static bool pwm_ops_check(const struct pwm_chip *chip)
} }
/** /**
* pwmchip_add() - register a new PWM chip * __pwmchip_add() - register a new PWM chip
* @chip: the PWM chip to add * @chip: the PWM chip to add
* @owner: reference to the module providing the chip.
* *
* Register a new PWM chip. * Register a new PWM chip. @owner is supposed to be THIS_MODULE, use the
* pwmchip_add wrapper to do this right.
* *
* Returns: 0 on success or a negative error code on failure. * Returns: 0 on success or a negative error code on failure.
*/ */
int pwmchip_add(struct pwm_chip *chip) int __pwmchip_add(struct pwm_chip *chip, struct module *owner)
{ {
struct pwm_device *pwm; struct pwm_device *pwm;
unsigned int i; unsigned int i;
...@@ -272,6 +274,8 @@ int pwmchip_add(struct pwm_chip *chip) ...@@ -272,6 +274,8 @@ int pwmchip_add(struct pwm_chip *chip)
if (!pwm_ops_check(chip)) if (!pwm_ops_check(chip))
return -EINVAL; return -EINVAL;
chip->owner = owner;
chip->pwms = kcalloc(chip->npwm, sizeof(*pwm), GFP_KERNEL); chip->pwms = kcalloc(chip->npwm, sizeof(*pwm), GFP_KERNEL);
if (!chip->pwms) if (!chip->pwms)
return -ENOMEM; return -ENOMEM;
...@@ -306,7 +310,7 @@ int pwmchip_add(struct pwm_chip *chip) ...@@ -306,7 +310,7 @@ int pwmchip_add(struct pwm_chip *chip)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pwmchip_add); EXPORT_SYMBOL_GPL(__pwmchip_add);
/** /**
* pwmchip_remove() - remove a PWM chip * pwmchip_remove() - remove a PWM chip
...@@ -338,17 +342,17 @@ static void devm_pwmchip_remove(void *data) ...@@ -338,17 +342,17 @@ static void devm_pwmchip_remove(void *data)
pwmchip_remove(chip); pwmchip_remove(chip);
} }
int devm_pwmchip_add(struct device *dev, struct pwm_chip *chip) int __devm_pwmchip_add(struct device *dev, struct pwm_chip *chip, struct module *owner)
{ {
int ret; int ret;
ret = pwmchip_add(chip); ret = __pwmchip_add(chip, owner);
if (ret) if (ret)
return ret; return ret;
return devm_add_action_or_reset(dev, devm_pwmchip_remove, chip); return devm_add_action_or_reset(dev, devm_pwmchip_remove, chip);
} }
EXPORT_SYMBOL_GPL(devm_pwmchip_add); EXPORT_SYMBOL_GPL(__devm_pwmchip_add);
/** /**
* pwm_request_from_chip() - request a PWM device relative to a PWM chip * pwm_request_from_chip() - request a PWM device relative to a PWM chip
...@@ -979,7 +983,7 @@ void pwm_put(struct pwm_device *pwm) ...@@ -979,7 +983,7 @@ void pwm_put(struct pwm_device *pwm)
pwm_set_chip_data(pwm, NULL); pwm_set_chip_data(pwm, NULL);
pwm->label = NULL; pwm->label = NULL;
module_put(pwm->chip->ops->owner); module_put(pwm->chip->owner);
out: out:
mutex_unlock(&pwm_lock); mutex_unlock(&pwm_lock);
} }
......
...@@ -181,7 +181,6 @@ static int ab8500_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -181,7 +181,6 @@ static int ab8500_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops ab8500_pwm_ops = { static const struct pwm_ops ab8500_pwm_ops = {
.apply = ab8500_pwm_apply, .apply = ab8500_pwm_apply,
.get_state = ab8500_pwm_get_state, .get_state = ab8500_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int ab8500_pwm_probe(struct platform_device *pdev) static int ab8500_pwm_probe(struct platform_device *pdev)
......
...@@ -99,7 +99,6 @@ static int apple_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -99,7 +99,6 @@ static int apple_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops apple_pwm_ops = { static const struct pwm_ops apple_pwm_ops = {
.apply = apple_pwm_apply, .apply = apple_pwm_apply,
.get_state = apple_pwm_get_state, .get_state = apple_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int apple_pwm_probe(struct platform_device *pdev) static int apple_pwm_probe(struct platform_device *pdev)
......
...@@ -170,7 +170,6 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -170,7 +170,6 @@ static int atmel_hlcdc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops atmel_hlcdc_pwm_ops = { static const struct pwm_ops atmel_hlcdc_pwm_ops = {
.apply = atmel_hlcdc_pwm_apply, .apply = atmel_hlcdc_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_at91sam9x5_errata = { static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_at91sam9x5_errata = {
......
...@@ -364,7 +364,6 @@ static const struct pwm_ops atmel_tcb_pwm_ops = { ...@@ -364,7 +364,6 @@ static const struct pwm_ops atmel_tcb_pwm_ops = {
.request = atmel_tcb_pwm_request, .request = atmel_tcb_pwm_request,
.free = atmel_tcb_pwm_free, .free = atmel_tcb_pwm_free,
.apply = atmel_tcb_pwm_apply, .apply = atmel_tcb_pwm_apply,
.owner = THIS_MODULE,
}; };
static struct atmel_tcb_config tcb_rm9200_config = { static struct atmel_tcb_config tcb_rm9200_config = {
......
...@@ -402,7 +402,6 @@ static int atmel_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -402,7 +402,6 @@ static int atmel_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops atmel_pwm_ops = { static const struct pwm_ops atmel_pwm_ops = {
.apply = atmel_pwm_apply, .apply = atmel_pwm_apply,
.get_state = atmel_pwm_get_state, .get_state = atmel_pwm_get_state,
.owner = THIS_MODULE,
}; };
static const struct atmel_pwm_data atmel_sam9rl_pwm_data = { static const struct atmel_pwm_data atmel_sam9rl_pwm_data = {
......
...@@ -183,7 +183,6 @@ static int iproc_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -183,7 +183,6 @@ static int iproc_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops iproc_pwm_ops = { static const struct pwm_ops iproc_pwm_ops = {
.apply = iproc_pwmc_apply, .apply = iproc_pwmc_apply,
.get_state = iproc_pwmc_get_state, .get_state = iproc_pwmc_get_state,
.owner = THIS_MODULE,
}; };
static int iproc_pwmc_probe(struct platform_device *pdev) static int iproc_pwmc_probe(struct platform_device *pdev)
......
...@@ -269,7 +269,6 @@ static int kona_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -269,7 +269,6 @@ static int kona_pwmc_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops kona_pwm_ops = { static const struct pwm_ops kona_pwm_ops = {
.apply = kona_pwmc_apply, .apply = kona_pwmc_apply,
.owner = THIS_MODULE,
}; };
static int kona_pwmc_probe(struct platform_device *pdev) static int kona_pwmc_probe(struct platform_device *pdev)
......
...@@ -129,7 +129,6 @@ static const struct pwm_ops bcm2835_pwm_ops = { ...@@ -129,7 +129,6 @@ static const struct pwm_ops bcm2835_pwm_ops = {
.request = bcm2835_pwm_request, .request = bcm2835_pwm_request,
.free = bcm2835_pwm_free, .free = bcm2835_pwm_free,
.apply = bcm2835_pwm_apply, .apply = bcm2835_pwm_apply,
.owner = THIS_MODULE,
}; };
static int bcm2835_pwm_probe(struct platform_device *pdev) static int bcm2835_pwm_probe(struct platform_device *pdev)
......
...@@ -205,7 +205,6 @@ static const struct pwm_ops berlin_pwm_ops = { ...@@ -205,7 +205,6 @@ static const struct pwm_ops berlin_pwm_ops = {
.request = berlin_pwm_request, .request = berlin_pwm_request,
.free = berlin_pwm_free, .free = berlin_pwm_free,
.apply = berlin_pwm_apply, .apply = berlin_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id berlin_pwm_match[] = { static const struct of_device_id berlin_pwm_match[] = {
......
...@@ -220,7 +220,6 @@ static int brcmstb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -220,7 +220,6 @@ static int brcmstb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops brcmstb_pwm_ops = { static const struct pwm_ops brcmstb_pwm_ops = {
.apply = brcmstb_pwm_apply, .apply = brcmstb_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id brcmstb_pwm_of_match[] = { static const struct of_device_id brcmstb_pwm_of_match[] = {
......
...@@ -77,7 +77,6 @@ static int pwm_clk_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -77,7 +77,6 @@ static int pwm_clk_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pwm_clk_ops = { static const struct pwm_ops pwm_clk_ops = {
.apply = pwm_clk_apply, .apply = pwm_clk_apply,
.owner = THIS_MODULE,
}; };
static int pwm_clk_probe(struct platform_device *pdev) static int pwm_clk_probe(struct platform_device *pdev)
......
...@@ -72,7 +72,6 @@ static int clps711x_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -72,7 +72,6 @@ static int clps711x_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops clps711x_pwm_ops = { static const struct pwm_ops clps711x_pwm_ops = {
.request = clps711x_pwm_request, .request = clps711x_pwm_request,
.apply = clps711x_pwm_apply, .apply = clps711x_pwm_apply,
.owner = THIS_MODULE,
}; };
static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip, static struct pwm_device *clps711x_pwm_xlate(struct pwm_chip *chip,
......
...@@ -241,7 +241,6 @@ static const struct pwm_ops cros_ec_pwm_ops = { ...@@ -241,7 +241,6 @@ static const struct pwm_ops cros_ec_pwm_ops = {
.free = cros_ec_pwm_free, .free = cros_ec_pwm_free,
.get_state = cros_ec_pwm_get_state, .get_state = cros_ec_pwm_get_state,
.apply = cros_ec_pwm_apply, .apply = cros_ec_pwm_apply,
.owner = THIS_MODULE,
}; };
/* /*
......
...@@ -195,7 +195,6 @@ static int dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -195,7 +195,6 @@ static int dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops dwc_pwm_ops = { static const struct pwm_ops dwc_pwm_ops = {
.apply = dwc_pwm_apply, .apply = dwc_pwm_apply,
.get_state = dwc_pwm_get_state, .get_state = dwc_pwm_get_state,
.owner = THIS_MODULE,
}; };
static struct dwc_pwm *dwc_pwm_alloc(struct device *dev) static struct dwc_pwm *dwc_pwm_alloc(struct device *dev)
......
...@@ -159,7 +159,6 @@ static const struct pwm_ops ep93xx_pwm_ops = { ...@@ -159,7 +159,6 @@ static const struct pwm_ops ep93xx_pwm_ops = {
.request = ep93xx_pwm_request, .request = ep93xx_pwm_request,
.free = ep93xx_pwm_free, .free = ep93xx_pwm_free,
.apply = ep93xx_pwm_apply, .apply = ep93xx_pwm_apply,
.owner = THIS_MODULE,
}; };
static int ep93xx_pwm_probe(struct platform_device *pdev) static int ep93xx_pwm_probe(struct platform_device *pdev)
......
...@@ -350,7 +350,6 @@ static const struct pwm_ops fsl_pwm_ops = { ...@@ -350,7 +350,6 @@ static const struct pwm_ops fsl_pwm_ops = {
.request = fsl_pwm_request, .request = fsl_pwm_request,
.free = fsl_pwm_free, .free = fsl_pwm_free,
.apply = fsl_pwm_apply, .apply = fsl_pwm_apply,
.owner = THIS_MODULE,
}; };
static int fsl_pwm_init(struct fsl_pwm_chip *fpc) static int fsl_pwm_init(struct fsl_pwm_chip *fpc)
......
...@@ -185,7 +185,6 @@ static const struct pwm_ops hibvt_pwm_ops = { ...@@ -185,7 +185,6 @@ static const struct pwm_ops hibvt_pwm_ops = {
.get_state = hibvt_pwm_get_state, .get_state = hibvt_pwm_get_state,
.apply = hibvt_pwm_apply, .apply = hibvt_pwm_apply,
.owner = THIS_MODULE,
}; };
static int hibvt_pwm_probe(struct platform_device *pdev) static int hibvt_pwm_probe(struct platform_device *pdev)
......
...@@ -208,7 +208,6 @@ static int img_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -208,7 +208,6 @@ static int img_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops img_pwm_ops = { static const struct pwm_ops img_pwm_ops = {
.apply = img_pwm_apply, .apply = img_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct img_pwm_soc_data pistachio_pwm = { static const struct img_pwm_soc_data pistachio_pwm = {
......
...@@ -332,7 +332,6 @@ static const struct pwm_ops imx_tpm_pwm_ops = { ...@@ -332,7 +332,6 @@ static const struct pwm_ops imx_tpm_pwm_ops = {
.free = pwm_imx_tpm_free, .free = pwm_imx_tpm_free,
.get_state = pwm_imx_tpm_get_state, .get_state = pwm_imx_tpm_get_state,
.apply = pwm_imx_tpm_apply, .apply = pwm_imx_tpm_apply,
.owner = THIS_MODULE,
}; };
static int pwm_imx_tpm_probe(struct platform_device *pdev) static int pwm_imx_tpm_probe(struct platform_device *pdev)
......
...@@ -146,7 +146,6 @@ static int pwm_imx1_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -146,7 +146,6 @@ static int pwm_imx1_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pwm_imx1_ops = { static const struct pwm_ops pwm_imx1_ops = {
.apply = pwm_imx1_apply, .apply = pwm_imx1_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id pwm_imx1_dt_ids[] = { static const struct of_device_id pwm_imx1_dt_ids[] = {
......
...@@ -296,7 +296,6 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -296,7 +296,6 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pwm_imx27_ops = { static const struct pwm_ops pwm_imx27_ops = {
.apply = pwm_imx27_apply, .apply = pwm_imx27_apply,
.get_state = pwm_imx27_get_state, .get_state = pwm_imx27_get_state,
.owner = THIS_MODULE,
}; };
static const struct of_device_id pwm_imx27_dt_ids[] = { static const struct of_device_id pwm_imx27_dt_ids[] = {
......
...@@ -107,7 +107,6 @@ static int lgm_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -107,7 +107,6 @@ static int lgm_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops lgm_pwm_ops = { static const struct pwm_ops lgm_pwm_ops = {
.get_state = lgm_pwm_get_state, .get_state = lgm_pwm_get_state,
.apply = lgm_pwm_apply, .apply = lgm_pwm_apply,
.owner = THIS_MODULE,
}; };
static void lgm_pwm_init(struct lgm_pwm_chip *pc) static void lgm_pwm_init(struct lgm_pwm_chip *pc)
......
...@@ -166,7 +166,6 @@ static int iqs620_pwm_notifier(struct notifier_block *notifier, ...@@ -166,7 +166,6 @@ static int iqs620_pwm_notifier(struct notifier_block *notifier,
static const struct pwm_ops iqs620_pwm_ops = { static const struct pwm_ops iqs620_pwm_ops = {
.apply = iqs620_pwm_apply, .apply = iqs620_pwm_apply,
.get_state = iqs620_pwm_get_state, .get_state = iqs620_pwm_get_state,
.owner = THIS_MODULE,
}; };
static void iqs620_pwm_notifier_unregister(void *context) static void iqs620_pwm_notifier_unregister(void *context)
......
...@@ -216,7 +216,6 @@ static const struct pwm_ops jz4740_pwm_ops = { ...@@ -216,7 +216,6 @@ static const struct pwm_ops jz4740_pwm_ops = {
.request = jz4740_pwm_request, .request = jz4740_pwm_request,
.free = jz4740_pwm_free, .free = jz4740_pwm_free,
.apply = jz4740_pwm_apply, .apply = jz4740_pwm_apply,
.owner = THIS_MODULE,
}; };
static int jz4740_pwm_probe(struct platform_device *pdev) static int jz4740_pwm_probe(struct platform_device *pdev)
......
...@@ -178,7 +178,6 @@ static int keembay_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -178,7 +178,6 @@ static int keembay_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
} }
static const struct pwm_ops keembay_pwm_ops = { static const struct pwm_ops keembay_pwm_ops = {
.owner = THIS_MODULE,
.apply = keembay_pwm_apply, .apply = keembay_pwm_apply,
.get_state = keembay_pwm_get_state, .get_state = keembay_pwm_get_state,
}; };
......
...@@ -216,7 +216,6 @@ static const struct pwm_ops lp3943_pwm_ops = { ...@@ -216,7 +216,6 @@ static const struct pwm_ops lp3943_pwm_ops = {
.request = lp3943_pwm_request, .request = lp3943_pwm_request,
.free = lp3943_pwm_free, .free = lp3943_pwm_free,
.apply = lp3943_pwm_apply, .apply = lp3943_pwm_apply,
.owner = THIS_MODULE,
}; };
static int lp3943_pwm_parse_dt(struct device *dev, static int lp3943_pwm_parse_dt(struct device *dev,
......
...@@ -341,7 +341,6 @@ static const struct pwm_ops lpc18xx_pwm_ops = { ...@@ -341,7 +341,6 @@ static const struct pwm_ops lpc18xx_pwm_ops = {
.apply = lpc18xx_pwm_apply, .apply = lpc18xx_pwm_apply,
.request = lpc18xx_pwm_request, .request = lpc18xx_pwm_request,
.free = lpc18xx_pwm_free, .free = lpc18xx_pwm_free,
.owner = THIS_MODULE,
}; };
static const struct of_device_id lpc18xx_pwm_of_match[] = { static const struct of_device_id lpc18xx_pwm_of_match[] = {
......
...@@ -115,7 +115,6 @@ static int lpc32xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -115,7 +115,6 @@ static int lpc32xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops lpc32xx_pwm_ops = { static const struct pwm_ops lpc32xx_pwm_ops = {
.apply = lpc32xx_pwm_apply, .apply = lpc32xx_pwm_apply,
.owner = THIS_MODULE,
}; };
static int lpc32xx_pwm_probe(struct platform_device *pdev) static int lpc32xx_pwm_probe(struct platform_device *pdev)
......
...@@ -243,7 +243,6 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -243,7 +243,6 @@ static int pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pwm_lpss_ops = { static const struct pwm_ops pwm_lpss_ops = {
.apply = pwm_lpss_apply, .apply = pwm_lpss_apply,
.get_state = pwm_lpss_get_state, .get_state = pwm_lpss_get_state,
.owner = THIS_MODULE,
}; };
struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base, struct pwm_lpss_chip *devm_pwm_lpss_probe(struct device *dev, void __iomem *base,
......
...@@ -229,7 +229,6 @@ static int pwm_mediatek_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -229,7 +229,6 @@ static int pwm_mediatek_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pwm_mediatek_ops = { static const struct pwm_ops pwm_mediatek_ops = {
.apply = pwm_mediatek_apply, .apply = pwm_mediatek_apply,
.owner = THIS_MODULE,
}; };
static int pwm_mediatek_probe(struct platform_device *pdev) static int pwm_mediatek_probe(struct platform_device *pdev)
......
...@@ -335,7 +335,6 @@ static const struct pwm_ops meson_pwm_ops = { ...@@ -335,7 +335,6 @@ static const struct pwm_ops meson_pwm_ops = {
.free = meson_pwm_free, .free = meson_pwm_free,
.apply = meson_pwm_apply, .apply = meson_pwm_apply,
.get_state = meson_pwm_get_state, .get_state = meson_pwm_get_state,
.owner = THIS_MODULE,
}; };
static const char * const pwm_meson8b_parent_names[] = { static const char * const pwm_meson8b_parent_names[] = {
......
...@@ -435,7 +435,6 @@ static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm ...@@ -435,7 +435,6 @@ static int mchp_core_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm
static const struct pwm_ops mchp_core_pwm_ops = { static const struct pwm_ops mchp_core_pwm_ops = {
.apply = mchp_core_pwm_apply, .apply = mchp_core_pwm_apply,
.get_state = mchp_core_pwm_get_state, .get_state = mchp_core_pwm_get_state,
.owner = THIS_MODULE,
}; };
static const struct of_device_id mchp_core_of_match[] = { static const struct of_device_id mchp_core_of_match[] = {
......
...@@ -227,7 +227,6 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip, ...@@ -227,7 +227,6 @@ static int mtk_disp_pwm_get_state(struct pwm_chip *chip,
static const struct pwm_ops mtk_disp_pwm_ops = { static const struct pwm_ops mtk_disp_pwm_ops = {
.apply = mtk_disp_pwm_apply, .apply = mtk_disp_pwm_apply,
.get_state = mtk_disp_pwm_get_state, .get_state = mtk_disp_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int mtk_disp_pwm_probe(struct platform_device *pdev) static int mtk_disp_pwm_probe(struct platform_device *pdev)
......
...@@ -115,7 +115,6 @@ static int mxs_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -115,7 +115,6 @@ static int mxs_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops mxs_pwm_ops = { static const struct pwm_ops mxs_pwm_ops = {
.apply = mxs_pwm_apply, .apply = mxs_pwm_apply,
.owner = THIS_MODULE,
}; };
static int mxs_pwm_probe(struct platform_device *pdev) static int mxs_pwm_probe(struct platform_device *pdev)
......
...@@ -126,7 +126,6 @@ static int ntxec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm_dev, ...@@ -126,7 +126,6 @@ static int ntxec_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm_dev,
} }
static const struct pwm_ops ntxec_pwm_ops = { static const struct pwm_ops ntxec_pwm_ops = {
.owner = THIS_MODULE,
.apply = ntxec_pwm_apply, .apply = ntxec_pwm_apply,
/* /*
* No .get_state callback, because the current state cannot be read * No .get_state callback, because the current state cannot be read
......
...@@ -311,7 +311,6 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip, ...@@ -311,7 +311,6 @@ static int pwm_omap_dmtimer_apply(struct pwm_chip *chip,
static const struct pwm_ops pwm_omap_dmtimer_ops = { static const struct pwm_ops pwm_omap_dmtimer_ops = {
.apply = pwm_omap_dmtimer_apply, .apply = pwm_omap_dmtimer_apply,
.owner = THIS_MODULE,
}; };
static int pwm_omap_dmtimer_probe(struct platform_device *pdev) static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
......
...@@ -505,7 +505,6 @@ static const struct pwm_ops pca9685_pwm_ops = { ...@@ -505,7 +505,6 @@ static const struct pwm_ops pca9685_pwm_ops = {
.get_state = pca9685_pwm_get_state, .get_state = pca9685_pwm_get_state,
.request = pca9685_pwm_request, .request = pca9685_pwm_request,
.free = pca9685_pwm_free, .free = pca9685_pwm_free,
.owner = THIS_MODULE,
}; };
static const struct regmap_config pca9685_regmap_i2c_config = { static const struct regmap_config pca9685_regmap_i2c_config = {
......
...@@ -135,7 +135,6 @@ static int pxa_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -135,7 +135,6 @@ static int pxa_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops pxa_pwm_ops = { static const struct pwm_ops pxa_pwm_ops = {
.apply = pxa_pwm_apply, .apply = pxa_pwm_apply,
.owner = THIS_MODULE,
}; };
#ifdef CONFIG_OF #ifdef CONFIG_OF
......
...@@ -135,7 +135,6 @@ static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -135,7 +135,6 @@ static int raspberrypi_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops raspberrypi_pwm_ops = { static const struct pwm_ops raspberrypi_pwm_ops = {
.get_state = raspberrypi_pwm_get_state, .get_state = raspberrypi_pwm_get_state,
.apply = raspberrypi_pwm_apply, .apply = raspberrypi_pwm_apply,
.owner = THIS_MODULE,
}; };
static int raspberrypi_pwm_probe(struct platform_device *pdev) static int raspberrypi_pwm_probe(struct platform_device *pdev)
......
...@@ -198,7 +198,6 @@ static const struct pwm_ops rcar_pwm_ops = { ...@@ -198,7 +198,6 @@ static const struct pwm_ops rcar_pwm_ops = {
.request = rcar_pwm_request, .request = rcar_pwm_request,
.free = rcar_pwm_free, .free = rcar_pwm_free,
.apply = rcar_pwm_apply, .apply = rcar_pwm_apply,
.owner = THIS_MODULE,
}; };
static int rcar_pwm_probe(struct platform_device *pdev) static int rcar_pwm_probe(struct platform_device *pdev)
......
...@@ -431,7 +431,6 @@ static const struct pwm_ops tpu_pwm_ops = { ...@@ -431,7 +431,6 @@ static const struct pwm_ops tpu_pwm_ops = {
.request = tpu_pwm_request, .request = tpu_pwm_request,
.free = tpu_pwm_free, .free = tpu_pwm_free,
.apply = tpu_pwm_apply, .apply = tpu_pwm_apply,
.owner = THIS_MODULE,
}; };
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
...@@ -228,7 +228,6 @@ static int rockchip_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -228,7 +228,6 @@ static int rockchip_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops rockchip_pwm_ops = { static const struct pwm_ops rockchip_pwm_ops = {
.get_state = rockchip_pwm_get_state, .get_state = rockchip_pwm_get_state,
.apply = rockchip_pwm_apply, .apply = rockchip_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct rockchip_pwm_data pwm_data_v1 = { static const struct rockchip_pwm_data pwm_data_v1 = {
......
...@@ -438,7 +438,6 @@ static const struct pwm_ops rz_mtu3_pwm_ops = { ...@@ -438,7 +438,6 @@ static const struct pwm_ops rz_mtu3_pwm_ops = {
.free = rz_mtu3_pwm_free, .free = rz_mtu3_pwm_free,
.get_state = rz_mtu3_pwm_get_state, .get_state = rz_mtu3_pwm_get_state,
.apply = rz_mtu3_pwm_apply, .apply = rz_mtu3_pwm_apply,
.owner = THIS_MODULE,
}; };
static int rz_mtu3_pwm_pm_runtime_suspend(struct device *dev) static int rz_mtu3_pwm_pm_runtime_suspend(struct device *dev)
......
...@@ -475,7 +475,6 @@ static const struct pwm_ops pwm_samsung_ops = { ...@@ -475,7 +475,6 @@ static const struct pwm_ops pwm_samsung_ops = {
.request = pwm_samsung_request, .request = pwm_samsung_request,
.free = pwm_samsung_free, .free = pwm_samsung_free,
.apply = pwm_samsung_apply, .apply = pwm_samsung_apply,
.owner = THIS_MODULE,
}; };
#ifdef CONFIG_OF #ifdef CONFIG_OF
......
...@@ -203,7 +203,6 @@ static const struct pwm_ops pwm_sifive_ops = { ...@@ -203,7 +203,6 @@ static const struct pwm_ops pwm_sifive_ops = {
.free = pwm_sifive_free, .free = pwm_sifive_free,
.get_state = pwm_sifive_get_state, .get_state = pwm_sifive_get_state,
.apply = pwm_sifive_apply, .apply = pwm_sifive_apply,
.owner = THIS_MODULE,
}; };
static int pwm_sifive_clock_notifier(struct notifier_block *nb, static int pwm_sifive_clock_notifier(struct notifier_block *nb,
......
...@@ -200,7 +200,6 @@ static int sl28cpld_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -200,7 +200,6 @@ static int sl28cpld_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops sl28cpld_pwm_ops = { static const struct pwm_ops sl28cpld_pwm_ops = {
.apply = sl28cpld_pwm_apply, .apply = sl28cpld_pwm_apply,
.get_state = sl28cpld_pwm_get_state, .get_state = sl28cpld_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int sl28cpld_pwm_probe(struct platform_device *pdev) static int sl28cpld_pwm_probe(struct platform_device *pdev)
......
...@@ -189,7 +189,6 @@ static int spear_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -189,7 +189,6 @@ static int spear_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops spear_pwm_ops = { static const struct pwm_ops spear_pwm_ops = {
.apply = spear_pwm_apply, .apply = spear_pwm_apply,
.owner = THIS_MODULE,
}; };
static int spear_pwm_probe(struct platform_device *pdev) static int spear_pwm_probe(struct platform_device *pdev)
......
...@@ -210,7 +210,6 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -210,7 +210,6 @@ static int sprd_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops sprd_pwm_ops = { static const struct pwm_ops sprd_pwm_ops = {
.apply = sprd_pwm_apply, .apply = sprd_pwm_apply,
.get_state = sprd_pwm_get_state, .get_state = sprd_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int sprd_pwm_clk_init(struct sprd_pwm_chip *spc) static int sprd_pwm_clk_init(struct sprd_pwm_chip *spc)
......
...@@ -420,7 +420,6 @@ static const struct pwm_ops sti_pwm_ops = { ...@@ -420,7 +420,6 @@ static const struct pwm_ops sti_pwm_ops = {
.capture = sti_pwm_capture, .capture = sti_pwm_capture,
.apply = sti_pwm_apply, .apply = sti_pwm_apply,
.free = sti_pwm_free, .free = sti_pwm_free,
.owner = THIS_MODULE,
}; };
static irqreturn_t sti_pwm_interrupt(int irq, void *data) static irqreturn_t sti_pwm_interrupt(int irq, void *data)
......
...@@ -189,7 +189,6 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip, ...@@ -189,7 +189,6 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip,
} }
static const struct pwm_ops stm32_pwm_lp_ops = { static const struct pwm_ops stm32_pwm_lp_ops = {
.owner = THIS_MODULE,
.apply = stm32_pwm_lp_apply, .apply = stm32_pwm_lp_apply,
.get_state = stm32_pwm_lp_get_state, .get_state = stm32_pwm_lp_get_state,
}; };
......
...@@ -487,7 +487,6 @@ static int stm32_pwm_apply_locked(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -487,7 +487,6 @@ static int stm32_pwm_apply_locked(struct pwm_chip *chip, struct pwm_device *pwm,
} }
static const struct pwm_ops stm32pwm_ops = { static const struct pwm_ops stm32pwm_ops = {
.owner = THIS_MODULE,
.apply = stm32_pwm_apply_locked, .apply = stm32_pwm_apply_locked,
.capture = IS_ENABLED(CONFIG_DMA_ENGINE) ? stm32_pwm_capture : NULL, .capture = IS_ENABLED(CONFIG_DMA_ENGINE) ? stm32_pwm_capture : NULL,
}; };
......
...@@ -287,7 +287,6 @@ static int stmpe_24xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -287,7 +287,6 @@ static int stmpe_24xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops stmpe_24xx_pwm_ops = { static const struct pwm_ops stmpe_24xx_pwm_ops = {
.apply = stmpe_24xx_pwm_apply, .apply = stmpe_24xx_pwm_apply,
.owner = THIS_MODULE,
}; };
static int __init stmpe_pwm_probe(struct platform_device *pdev) static int __init stmpe_pwm_probe(struct platform_device *pdev)
......
...@@ -325,7 +325,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -325,7 +325,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops sun4i_pwm_ops = { static const struct pwm_ops sun4i_pwm_ops = {
.apply = sun4i_pwm_apply, .apply = sun4i_pwm_apply,
.get_state = sun4i_pwm_get_state, .get_state = sun4i_pwm_get_state,
.owner = THIS_MODULE,
}; };
static const struct sun4i_pwm_data sun4i_pwm_dual_nobypass = { static const struct sun4i_pwm_data sun4i_pwm_dual_nobypass = {
......
...@@ -163,7 +163,6 @@ static int sunplus_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -163,7 +163,6 @@ static int sunplus_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops sunplus_pwm_ops = { static const struct pwm_ops sunplus_pwm_ops = {
.apply = sunplus_pwm_apply, .apply = sunplus_pwm_apply,
.get_state = sunplus_pwm_get_state, .get_state = sunplus_pwm_get_state,
.owner = THIS_MODULE,
}; };
static void sunplus_pwm_clk_release(void *data) static void sunplus_pwm_clk_release(void *data)
......
...@@ -268,7 +268,6 @@ static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -268,7 +268,6 @@ static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops tegra_pwm_ops = { static const struct pwm_ops tegra_pwm_ops = {
.apply = tegra_pwm_apply, .apply = tegra_pwm_apply,
.owner = THIS_MODULE,
}; };
static int tegra_pwm_probe(struct platform_device *pdev) static int tegra_pwm_probe(struct platform_device *pdev)
......
...@@ -205,7 +205,6 @@ static int ecap_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -205,7 +205,6 @@ static int ecap_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops ecap_pwm_ops = { static const struct pwm_ops ecap_pwm_ops = {
.apply = ecap_pwm_apply, .apply = ecap_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id ecap_of_match[] = { static const struct of_device_id ecap_of_match[] = {
......
...@@ -437,7 +437,6 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -437,7 +437,6 @@ static int ehrpwm_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops ehrpwm_pwm_ops = { static const struct pwm_ops ehrpwm_pwm_ops = {
.free = ehrpwm_pwm_free, .free = ehrpwm_pwm_free,
.apply = ehrpwm_pwm_apply, .apply = ehrpwm_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id ehrpwm_of_match[] = { static const struct of_device_id ehrpwm_of_match[] = {
......
...@@ -189,7 +189,6 @@ static int twl4030_pwmled_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -189,7 +189,6 @@ static int twl4030_pwmled_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops twl4030_pwmled_ops = { static const struct pwm_ops twl4030_pwmled_ops = {
.apply = twl4030_pwmled_apply, .apply = twl4030_pwmled_apply,
.owner = THIS_MODULE,
}; };
static int twl6030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm, static int twl6030_pwmled_config(struct pwm_chip *chip, struct pwm_device *pwm,
...@@ -342,7 +341,6 @@ static const struct pwm_ops twl6030_pwmled_ops = { ...@@ -342,7 +341,6 @@ static const struct pwm_ops twl6030_pwmled_ops = {
.apply = twl6030_pwmled_apply, .apply = twl6030_pwmled_apply,
.request = twl6030_pwmled_request, .request = twl6030_pwmled_request,
.free = twl6030_pwmled_free, .free = twl6030_pwmled_free,
.owner = THIS_MODULE,
}; };
static int twl_pwmled_probe(struct platform_device *pdev) static int twl_pwmled_probe(struct platform_device *pdev)
......
...@@ -333,12 +333,10 @@ static const struct pwm_ops twl4030_pwm_ops = { ...@@ -333,12 +333,10 @@ static const struct pwm_ops twl4030_pwm_ops = {
.apply = twl4030_pwm_apply, .apply = twl4030_pwm_apply,
.request = twl4030_pwm_request, .request = twl4030_pwm_request,
.free = twl4030_pwm_free, .free = twl4030_pwm_free,
.owner = THIS_MODULE,
}; };
static const struct pwm_ops twl6030_pwm_ops = { static const struct pwm_ops twl6030_pwm_ops = {
.apply = twl6030_pwm_apply, .apply = twl6030_pwm_apply,
.owner = THIS_MODULE,
}; };
static int twl_pwm_probe(struct platform_device *pdev) static int twl_pwm_probe(struct platform_device *pdev)
......
...@@ -129,7 +129,6 @@ static int visconti_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -129,7 +129,6 @@ static int visconti_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops visconti_pwm_ops = { static const struct pwm_ops visconti_pwm_ops = {
.apply = visconti_pwm_apply, .apply = visconti_pwm_apply,
.get_state = visconti_pwm_get_state, .get_state = visconti_pwm_get_state,
.owner = THIS_MODULE,
}; };
static int visconti_pwm_probe(struct platform_device *pdev) static int visconti_pwm_probe(struct platform_device *pdev)
......
...@@ -221,7 +221,6 @@ static int vt8500_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, ...@@ -221,7 +221,6 @@ static int vt8500_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
static const struct pwm_ops vt8500_pwm_ops = { static const struct pwm_ops vt8500_pwm_ops = {
.apply = vt8500_pwm_apply, .apply = vt8500_pwm_apply,
.owner = THIS_MODULE,
}; };
static const struct of_device_id vt8500_pwm_dt_ids[] = { static const struct of_device_id vt8500_pwm_dt_ids[] = {
......
...@@ -198,7 +198,6 @@ static int xilinx_pwm_get_state(struct pwm_chip *chip, ...@@ -198,7 +198,6 @@ static int xilinx_pwm_get_state(struct pwm_chip *chip,
static const struct pwm_ops xilinx_pwm_ops = { static const struct pwm_ops xilinx_pwm_ops = {
.apply = xilinx_pwm_apply, .apply = xilinx_pwm_apply,
.get_state = xilinx_pwm_get_state, .get_state = xilinx_pwm_get_state,
.owner = THIS_MODULE,
}; };
static const struct regmap_config xilinx_pwm_regmap_config = { static const struct regmap_config xilinx_pwm_regmap_config = {
......
...@@ -258,7 +258,6 @@ static const struct pwm_ops gb_pwm_ops = { ...@@ -258,7 +258,6 @@ static const struct pwm_ops gb_pwm_ops = {
.request = gb_pwm_request, .request = gb_pwm_request,
.free = gb_pwm_free, .free = gb_pwm_free,
.apply = gb_pwm_apply, .apply = gb_pwm_apply,
.owner = THIS_MODULE,
}; };
static int gb_pwm_probe(struct gbphy_device *gbphy_dev, static int gb_pwm_probe(struct gbphy_device *gbphy_dev,
......
...@@ -267,7 +267,6 @@ struct pwm_capture { ...@@ -267,7 +267,6 @@ struct pwm_capture {
* @get_state: get the current PWM state. This function is only * @get_state: get the current PWM state. This function is only
* called once per PWM device when the PWM chip is * called once per PWM device when the PWM chip is
* registered. * registered.
* @owner: helps prevent removal of modules exporting active PWMs
*/ */
struct pwm_ops { struct pwm_ops {
int (*request)(struct pwm_chip *chip, struct pwm_device *pwm); int (*request)(struct pwm_chip *chip, struct pwm_device *pwm);
...@@ -278,13 +277,13 @@ struct pwm_ops { ...@@ -278,13 +277,13 @@ struct pwm_ops {
const struct pwm_state *state); const struct pwm_state *state);
int (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm, int (*get_state)(struct pwm_chip *chip, struct pwm_device *pwm,
struct pwm_state *state); struct pwm_state *state);
struct module *owner;
}; };
/** /**
* struct pwm_chip - abstract a PWM controller * struct pwm_chip - abstract a PWM controller
* @dev: device providing the PWMs * @dev: device providing the PWMs
* @ops: callbacks for this PWM controller * @ops: callbacks for this PWM controller
* @owner: module providing this chip
* @base: number of first PWM controlled by this chip * @base: number of first PWM controlled by this chip
* @npwm: number of PWMs controlled by this chip * @npwm: number of PWMs controlled by this chip
* @of_xlate: request a PWM device given a device tree PWM specifier * @of_xlate: request a PWM device given a device tree PWM specifier
...@@ -295,6 +294,7 @@ struct pwm_ops { ...@@ -295,6 +294,7 @@ struct pwm_ops {
struct pwm_chip { struct pwm_chip {
struct device *dev; struct device *dev;
const struct pwm_ops *ops; const struct pwm_ops *ops;
struct module *owner;
int base; int base;
unsigned int npwm; unsigned int npwm;
...@@ -386,10 +386,12 @@ int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result, ...@@ -386,10 +386,12 @@ int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
int pwm_set_chip_data(struct pwm_device *pwm, void *data); int pwm_set_chip_data(struct pwm_device *pwm, void *data);
void *pwm_get_chip_data(struct pwm_device *pwm); void *pwm_get_chip_data(struct pwm_device *pwm);
int pwmchip_add(struct pwm_chip *chip); int __pwmchip_add(struct pwm_chip *chip, struct module *owner);
#define pwmchip_add(chip) __pwmchip_add(chip, THIS_MODULE)
void pwmchip_remove(struct pwm_chip *chip); void pwmchip_remove(struct pwm_chip *chip);
int devm_pwmchip_add(struct device *dev, struct pwm_chip *chip); int __devm_pwmchip_add(struct device *dev, struct pwm_chip *chip, struct module *owner);
#define devm_pwmchip_add(dev, chip) __devm_pwmchip_add(dev, chip, THIS_MODULE)
struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
unsigned int index, unsigned int index,
......
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