Re: spidev.c ?


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*


On Wed, Mar 17, 2021 at 5:41 PM jchludzinski via
<> 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.
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)) {
return PTR_ERR(spidev_class);

status = spi_register_driver(&spidev_spi_driver);
if (status < 0) {
return status;

... 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"


Join to automatically receive all group messages.