Re: [PATCH v2 0/3] device tree spidev solution - driver_override for SPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What needs to happen is to write the device name to the spidev driver's
bind attribute to manually attach.  Because of driver_override, this
will work, rather than fail as it does without.

Unfortunately, "bind" is an attribute of the driver while udev is
responding to a uevent for the device.  So there's no handy ATTR{bind}
to use.

I don't recall the exact udev magic, but I did verify it can be done. I think it needed udev to run a command, something like:
RUN+="echo %k > %S/%p/subsystem/drivers/spidev/bind"

Thanks. It turned out to be a bit more complicated because attributes set by ATTR{driver_override}+="spidev" only take effect after the rule has been processed, apparently. It's quite easy to hack around this. Here's a complete rule which works for me:

# cannot use ATTR{driver_override}+="spidev" because it apparently only runs after the PROGRAM ACTION=="add|change", SUBSYSTEM=="spi", ENV{MODALIAS}=="spi:my-device-from-device-tree", PROGRAM+="/bin/sh -c 'echo spidev > %S%p/driver_override && echo %k > %S%p/subsystem/drivers/spidev/bind'"

Thanks for pointing me in the right direction, Trent and Geert.

With kind regards,
Jan




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux