0
votes

I am just going through below thread which says kernel headers don't want to expose irq's to modules.

Accessing IRQ description array within a module and displaying action names

but I'm not sure why is it so?

Also,I see some of drivers which doesn't make use of irq's ,does it mean these devices are not interuppt driven?

One of such driver is for lm73 sensors linux/drivers/hwmon/lm73.c which is mostly bind to i2c bus and is again a module.

So,how it all happen,how device choose not to be interrupt driven?

1
lm73 just plugs on top of the i2c subsystem, and the i2c driver(of which there are many different variants) is most likely interrupt driven. - nos
@nos But there should some way for device to interrupt its bus also.is not it the case? - Amit Singh Tomar
Perhaps. It depends on the sub system. If you're writing a module that sits on top of an i2c layer, you would rather call functions that the i2c layer has defined. And, if needed, that layer will take care of handing the bus, whether that needs an interrupt or not. That way you're not tied to any particular i2c chip. This is the case for the lm73 module, it is a driver for a sensor at the remote end of an i2c bus, it doesn't need to know how the local end of the i2c bus works as long as it can send messages to the other end. - nos
Thanks @nos for making this valuable comments . It would be really helpful if you can add it as answer and pictorial view on lm73 like drivers communicate with i2c bus from remote end. - Amit Singh Tomar
ok @nos, not a problem. - Amit Singh Tomar

1 Answers

1
votes

You can use IRQ numbers in a module. The question has two concepts; one is an IRQ descripton, which is what the Linux kernel uses to manage interrupts.

The IRQ number itself is used in any module with request_threaded_irq() and functions like it. It is typical for a driver to be passed the IRQ number either through platform_data or a device tree.

You may not use the IRQ descriptions in a module (and I don't know why you would want to). More correctly, converting from an IRQ number to an IRQ description in a module is not allowed. Typically the description is just a large array indexed by the IRQ number, so the irq_to_desc() is a macro in some cases and it is never exported.