Re: [PATCH v2 6/6] pwm: jz4740: Use __init_or_module and __exit for .probe and .remove

From: Paul Cercueil
Date: Sat Jun 08 2019 - 06:35:27 EST


I misunderstood what __init_or_module was for. Please ignore this patch
(the rest of the patchset is OK). Sorry for the noise.


Le ven. 7 juin 2019 à 17:44, Paul Cercueil <paul@xxxxxxxxxxxxxxx> a écrit :
This allows the probe function to be dropped after the kernel finished
its initialization, in the case where the driver was not compiled as a
module.

Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>
---

Notes:
v2: New patch

drivers/pwm/pwm-jz4740.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index f901e8a0d33d..1b5077825721 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -145,7 +145,7 @@ static const struct pwm_ops jz4740_pwm_ops = {
.owner = THIS_MODULE,
};

-static int jz4740_pwm_probe(struct platform_device *pdev)
+static int __init_or_module jz4740_pwm_probe(struct platform_device *pdev)
{
struct jz4740_pwm_chip *jz4740;

@@ -169,7 +169,7 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
return pwmchip_add(&jz4740->chip);
}

-static int jz4740_pwm_remove(struct platform_device *pdev)
+static int __exit jz4740_pwm_remove(struct platform_device *pdev)
{
struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);

--
2.21.0.593.g511ec345e18