Re: spidev.c ?


Zoran
 

I am guessing here.... But what do you have while executing the
following command being in /sys
as root?

root@arm:/sys# find . -name spi*

Zee
_______

On Wed, Mar 17, 2021 at 5:41 PM jchludzinski via
lists.yoctoproject.org
<jchludzinski=vivaldi.net@...> wrote:


In the YOCTO/Linux source tree there's drivers/spi/ which has all the source for SPI drivers. There's only 1 file, spidev.c, which has:

static int __init spidev_init(void)
{
int status;

/* Claim our 256 reserved device numbers. Then register a class
* that will key udev/mdev to add/remove /dev nodes. Last, register
* the driver which manages those device numbers.
*/
BUILD_BUG_ON(N_SPI_MINORS > 256);
status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops);
if (status < 0)
return status;

spidev_class = class_create(THIS_MODULE, "spidev");
if (IS_ERR(spidev_class)) {
unregister_chrdev(SPIDEV_MAJOR, spidev_spi_driver.driver.name);
return PTR_ERR(spidev_class);
}

status = spi_register_driver(&spidev_spi_driver);
if (status < 0) {
class_destroy(spidev_class);
unregister_chrdev(SPIDEV_MAJOR, spidev_spi_driver.driver.name);
}
return status;
}
module_init(spidev_init);

... for creating device files in udev.

So when I use 'make nconfig' to specifiy that I want a loadable module for the ALTERA SPI driver, why don't I see a spidev.o file in drivers/spi/ ?

How does spi-altera.ko create device files without a call to register_chrdev(...).

How is it a loadable module without module_init(...)?

When I separately build spidev.c as an .ko and try loading it, I get: "Device or resourse busy"

---John


Join yocto@lists.yoctoproject.org to automatically receive all group messages.