Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.system > #726

Module loading with multiple devices...

From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.os.linux.development.system
Subject Module loading with multiple devices...
Date 2015-02-21 08:15 +0000
Message-ID <87mw47wuha.fsf@gmail.com> (permalink)

Show all headers | View raw


I've written a device driver for an FPGA peripheral (with DMA channels
to/from the processing) that works well, with the device enumerated in
the device-tree.  What I need to to is create multiple instances of that
device, and have the driver manage them.

The original driver creates 

/dev/mydev0

with device_create(), and then manipulated from userspace with ioctl()s.

My question is, if I have multiple instances of the device in the device
tree, how does the kernel load the driver, and how do I need to manage
the creation of the device class and any references counts to that device
class at driver load/unload time.

Is the probe() function run once per device, or just once at module
load?  Is the idea then to have the class pointer a static variable in
the module (i.e. just one shared between all instances) and keep all
instance variables (IRQ, dma channels) in the dynamically allocated
structures?

 

Back to comp.os.linux.development.system | Previous | Next | Find similar


Thread

Module loading with multiple devices... Gareth Owen <gwowen@gmail.com> - 2015-02-21 08:15 +0000

csiph-web