spi: spi-gpio: Make probe function __init_or_module
diff mbox series

Message ID 20190607155631.15072-1-paul@crapouillou.net
State New, archived
Headers show
Series
  • spi: spi-gpio: Make probe function __init_or_module
Related show

Commit Message

Paul Cercueil June 7, 2019, 3:56 p.m. UTC
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@crapouillou.net>
---
 drivers/spi/spi-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown June 7, 2019, 3:59 p.m. UTC | #1
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...
Paul Cercueil June 7, 2019, 4:02 p.m. UTC | #2
Le ven. 7 juin 2019 à 17:59, Mark Brown <broonie@kernel.org> 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.
Mark Brown June 7, 2019, 4:05 p.m. UTC | #3
On Fri, Jun 07, 2019 at 06:02:20PM +0200, Paul Cercueil wrote:
> Le ven. 7 juin 2019 à 17:59, Mark Brown <broonie@kernel.org> 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.
Enrico Weigelt, metux IT consult June 24, 2019, 6:42 p.m. UTC | #4
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

Patch
diff mbox series

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;