spidev.c driver on the ppc8247 (kernel 2.6.27.19)
Daniel Ng
daniel.ng1234 at gmail.com
Fri Mar 20 12:19:54 EST 2009
On Thu, Mar 19, 2009 at 7:32 PM, Daniel Ng <daniel.ng1234 at gmail.com> wrote:
>
> So, I tried to call spidev_probe() directly from the probe() function
> of my SPI Controller driver. However in this case spidev_probe()
> failed because its call to device_create_drvdata() failed with error
> code ENODEV. Why would this be?
>
> This is how I make the call from my SPI Controller driver:
>
> spidev_probe(to_spi_device(&ofdev->dev));
>
> And this is the relevant code in spidev_probe():
>
> dev = device_create_drvdata(spidev_class, &spi->dev, spidev->devt,
> spidev, "spidev%d.%d",
> /*spi->master->bus_num*/0, spi->chip_select);
It looks like spidev_class was uninitialised because spidev_init() had
not yet been called. To force spidev_init() to be called before my SPI
Controller's driver initialisation, I just used:
subsys_initcall(spidev_init);
This seems to do the job...
More information about the Linuxppc-dev
mailing list