2019-06-07 15:59:48

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH] spi: spi-gpio: Make probe function __init_or_module

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 <[email protected]>
---
drivers/spi/spi-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index eca9d52ecf65..c242c962772d 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -358,7 +358,7 @@ static void spi_gpio_put(void *data)
spi_master_put(data);
}

-static int spi_gpio_probe(struct platform_device *pdev)
+static int __init_or_module spi_gpio_probe(struct platform_device *pdev)
{
int status;
struct spi_master *master;
--
2.21.0.593.g511ec345e18


2019-06-07 16:03:04

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: spi-gpio: Make probe function __init_or_module

On Fri, Jun 07, 2019 at 05:56:31PM +0200, Paul Cercueil wrote:
> 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.

Hopefully not since we might probe later on if something registers a new
device...


Attachments:
(No filename) (310.00 B)
signature.asc (499.00 B)
Download all attachments

2019-06-07 16:04:23

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH] spi: spi-gpio: Make probe function __init_or_module



Le ven. 7 juin 2019 ? 17:59, Mark Brown <[email protected]> a ?crit :
> On Fri, Jun 07, 2019 at 05:56:31PM +0200, Paul Cercueil wrote:
>> 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.
>
> Hopefully not since we might probe later on if something registers a
> new
> device...

Makes sense. Sorry for the noise.


2019-06-07 16:07:20

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] spi: spi-gpio: Make probe function __init_or_module

On Fri, Jun 07, 2019 at 06:02:20PM +0200, Paul Cercueil wrote:
> Le ven. 7 juin 2019 ? 17:59, Mark Brown <[email protected]> a ?crit :

> > Hopefully not since we might probe later on if something registers a new
> > device...

> Makes sense. Sorry for the noise.

No problem. There used to be an annotation for probe() and remove()
functions but it got removed since hotplug and deferred probe made it
very difficult to ever practically take advanage of it.


Attachments:
(No filename) (472.00 B)
signature.asc (499.00 B)
Download all attachments
Subject: Re: [PATCH] spi: spi-gpio: Make probe function __init_or_module

On 07.06.19 17:59, Mark Brown wrote:
> On Fri, Jun 07, 2019 at 05:56:31PM +0200, Paul Cercueil wrote:
>> 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.
>
> Hopefully not since we might probe later on if something registers a new
> device...
>

Common pitfall. Also fallen into this myself and wondered why
it oops'd :o.


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287