mirror of https://github.com/torvalds/linux.git
pwm: stmpe: Allow to compile as a module
pwm-stmpe is the only driver that cannot be built as a module. Add the necessary boilerplate to also make this driver modular. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20250215143723.636591-2-u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
parent
4b31eb55db
commit
a2b8191ab6
|
|
@ -646,7 +646,7 @@ config PWM_STM32_LP
|
||||||
will be called pwm-stm32-lp.
|
will be called pwm-stm32-lp.
|
||||||
|
|
||||||
config PWM_STMPE
|
config PWM_STMPE
|
||||||
bool "STMPE expander PWM export"
|
tristate "STMPE expander PWM export"
|
||||||
depends on MFD_STMPE
|
depends on MFD_STMPE
|
||||||
help
|
help
|
||||||
This enables support for the PWMs found in the STMPE I/O
|
This enables support for the PWMs found in the STMPE I/O
|
||||||
|
|
|
||||||
|
|
@ -326,12 +326,33 @@ static int __init stmpe_pwm_probe(struct platform_device *pdev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, chip);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver stmpe_pwm_driver = {
|
static void __exit stmpe_pwm_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
struct pwm_chip *chip = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
pwmchip_remove(chip);
|
||||||
|
stmpe_disable(stmpe, STMPE_BLOCK_PWM);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* stmpe_pwm_remove() lives in .exit.text. For drivers registered via
|
||||||
|
* module_platform_driver_probe() this is ok because they cannot get unbound at
|
||||||
|
* runtime. So mark the driver struct with __refdata to prevent modpost
|
||||||
|
* triggering a section mismatch warning.
|
||||||
|
*/
|
||||||
|
static struct platform_driver stmpe_pwm_driver __refdata = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "stmpe-pwm",
|
.name = "stmpe-pwm",
|
||||||
},
|
},
|
||||||
|
.remove = __exit_p(stmpe_pwm_remove),
|
||||||
};
|
};
|
||||||
builtin_platform_driver_probe(stmpe_pwm_driver, stmpe_pwm_probe);
|
module_platform_driver_probe(stmpe_pwm_driver, stmpe_pwm_probe);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION("STMPE expander PWM");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue