On Wed, Feb 1, 2012 at 8:52 AM, Frederic LAMBERT <[email protected]> wrote: > 2012/2/1 Mark Brown <[email protected]> > >> >> 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. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ spi-devel-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spi-devel-general
