Thread (1 message) 1 message, 1 author, 2012-02-01

Re: [PATCH] spi/spi-altera: Allow to explicitely override bus number via dts

From: Grant Likely <hidden>
Date: 2012-02-01 17:57:51
Also in: linux-spi

On Wed, Feb 1, 2012 at 8:52 AM, Frederic LAMBERT [off-list ref] wrote:
2012/2/1 Mark Brown [off-list ref]
quoted
Well, something that walks all block devices on Linux is very
straightforward...  It sounds like you just want logic along the lines
of "find a block device and offer the option of overriding by providing
a specific path for use with a file", is that about right?
Well, yes, excepted that the file *is* equivalent to a block device for my
piece of code!
The answer here is to use the data provided by the kernel to find the
correct device.  Hard coding bus numbers (or any other globally
visible number space for that matter) has all kinds of problems and it
is by design that spi bus drivers are not allowed to choose a bus
number when they are created from DT data.

Instead, your code should either be using udev, or doing the same
thing that udev does to find a specific hardware device.  The uevent
attribute in devices that appear under /dev/bus/spi/devices should be
used to compare with the full device tree path.  I've just written a
patch that should give you the information that you need and I'll cc:
you when I post it.  I'll try to get it merged for v3.4.  This
approach will allow you to find the correct device in a reliable way
that won't be affected by bus numbering changes.

g.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help