Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Uwe Kleine-König and committed by
Uwe Kleine-König
a2b8191a 4b31eb55

+24 -3
+1 -1
drivers/pwm/Kconfig
··· 646 646 will be called pwm-stm32-lp. 647 647 648 648 config PWM_STMPE 649 - bool "STMPE expander PWM export" 649 + tristate "STMPE expander PWM export" 650 650 depends on MFD_STMPE 651 651 help 652 652 This enables support for the PWMs found in the STMPE I/O
+23 -2
drivers/pwm/pwm-stmpe.c
··· 326 326 return ret; 327 327 } 328 328 329 + platform_set_drvdata(pdev, chip); 330 + 329 331 return 0; 330 332 } 331 333 332 - static struct platform_driver stmpe_pwm_driver = { 334 + static void __exit stmpe_pwm_remove(struct platform_device *pdev) 335 + { 336 + struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); 337 + struct pwm_chip *chip = platform_get_drvdata(pdev); 338 + 339 + pwmchip_remove(chip); 340 + stmpe_disable(stmpe, STMPE_BLOCK_PWM); 341 + } 342 + 343 + /* 344 + * stmpe_pwm_remove() lives in .exit.text. For drivers registered via 345 + * module_platform_driver_probe() this is ok because they cannot get unbound at 346 + * runtime. So mark the driver struct with __refdata to prevent modpost 347 + * triggering a section mismatch warning. 348 + */ 349 + static struct platform_driver stmpe_pwm_driver __refdata = { 333 350 .driver = { 334 351 .name = "stmpe-pwm", 335 352 }, 353 + .remove = __exit_p(stmpe_pwm_remove), 336 354 }; 337 - builtin_platform_driver_probe(stmpe_pwm_driver, stmpe_pwm_probe); 355 + module_platform_driver_probe(stmpe_pwm_driver, stmpe_pwm_probe); 356 + 357 + MODULE_DESCRIPTION("STMPE expander PWM"); 358 + MODULE_LICENSE("GPL");