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


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

Module loading with multiple devices...

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date Sat, 21 Feb 2015 02:15:46 -0600
From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.os.linux.development.system
Subject Module loading with multiple devices...
Date Sat, 21 Feb 2015 08:15:45 +0000
Message-ID <87mw47wuha.fsf@gmail.com> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:Y277z+TwPm7jUKso2AB5Ngg04Lc=
MIME-Version 1.0
Content-Type text/plain
Lines 24
X-Usenet-Provider http://www.giganews.com
X-Trace sv3-zOv3xCt34/FS+urMGt6v3I9OfhtBD5GzqeCiTkkn5GwV9oHCcb9DYdgq4FE+iFdtDX+hQwDUS5PpFZd!FmZ2DIXZuQG7dW/BvKuBdJ4o02v6tgrsBI+uy5ipCalfjpFJYvqc2mxS7kmnofPVDA==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 1859
Xref csiph.com comp.os.linux.development.system:726

Show key headers only | 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