aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-stmpe.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>2025-02-15 15:37:22 +0100
committerUwe Kleine-König <ukleinek@kernel.org>2025-03-03 10:38:54 +0100
commita2b8191ab695ab4dacd1b923a757e9b548760cec (patch)
treeeb374f83e75ec74c4dcb46f65e6bbfef654835f3 /drivers/pwm/pwm-stmpe.c
parentpwm: Check for CONFIG_PWM using IS_REACHABLE() in main header (diff)
downloadlinux-a2b8191ab695ab4dacd1b923a757e9b548760cec.tar.gz
linux-a2b8191ab695ab4dacd1b923a757e9b548760cec.zip
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>
Diffstat (limited to 'drivers/pwm/pwm-stmpe.c')
-rw-r--r--drivers/pwm/pwm-stmpe.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-stmpe.c b/drivers/pwm/pwm-stmpe.c
index bb91062d5f1d..73f12843999a 100644
--- a/drivers/pwm/pwm-stmpe.c
+++ b/drivers/pwm/pwm-stmpe.c
@@ -326,12 +326,33 @@ static int __init stmpe_pwm_probe(struct platform_device *pdev)
return ret;
}
+ platform_set_drvdata(pdev, chip);
+
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 = {
.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");
: early SN setup fixJesse Barnes1-2/+0 2003-10-08[PATCH] ia64: fix is_headless_node() for systems w/<64pJesse Barnes1-1/+1 2003-10-08[PATCH] ia64: fix SN2 code for GENERIC buildsJesse Barnes1-0/+3 2003-10-08[PATCH] ia64: fix NUMA page table allocation to get memory from the right nodeJesse Barnes2-3/+10 2003-10-08[PATCH] ia64: sys_ia32.c fix for epollJanet Morgan1-27/+29 2003-10-07Linux 2.6.0-test7v2.6.0-test7Linus Torvalds1-1/+1 2003-10-07[PATCH] monotonic seqlock for HPET timerStephen Hemminger1-7/+9 2003-10-07[PATCH] monotonic seqlock for cyclone timerStephen Hemminger1-7/+10 2003-10-07[UDP]: Fix typo in SO_BINDTODEVICE changes.David S. Miller1-2/+2 2003-10-07[NET]: Fix 64-bit bugs in dscc4.cAndi Kleen1-4/+5 2003-10-07[ATM]: Convert VCC list to hash.Chas Williams8-70/+121 2003-10-07[ATM]: Eliminate atm_find_ci().Chas Williams16-334/+132 2003-10-07[VLAN]: Do not modify the data of shared SKBs.Tommy Christensen1-1/+5 2003-10-07Revert the move of ptrinfo - it may make NOMMU compile, but itLinus Torvalds2-73/+75 2003-10-07[IPVS]: Avoid returning NF_DROP from the packet schedulers.Julian Anastasov3-8/+19