Message ID | 1344004239-22868-1-git-send-email-maxime.ripard@free-electrons.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri, Aug 03, 2012 at 04:30:39PM +0200, Maxime Ripard wrote: > If you don't do it, the bus number will be a bogus value, possibly used > for device file names in drivers like spidev. > Do you see any problem with that? Here is the take from Grant. http://thread.gmane.org/gmane.linux.kernel.spi.devel/9839/focus=9863 Regards, Shawn
Le 03/08/2012 16:43, Shawn Guo a écrit : > On Fri, Aug 03, 2012 at 04:30:39PM +0200, Maxime Ripard wrote: >> If you don't do it, the bus number will be a bogus value, possibly used >> for device file names in drivers like spidev. >> > Do you see any problem with that? Here is the take from Grant. > > http://thread.gmane.org/gmane.linux.kernel.spi.devel/9839/focus=9863 Ok, I didn't see this thread, obviously. Thanks, Maxime
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index d6a80a1..d6a73ef 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -527,6 +527,15 @@ static int __devinit mxs_spi_probe(struct platform_device *pdev) if (!master) return -ENOMEM; + if (pdev->id != -1) + master->bus_num = pdev->id; + if (np) { + unsigned long prop; + + of_property_read_u32(np, "cell-index", &prop); + master->bus_num = prop; + } + master->transfer_one_message = mxs_spi_transfer_one; master->setup = mxs_spi_setup; master->cleanup = mxs_spi_cleanup;
If you don't do it, the bus number will be a bogus value, possibly used for device file names in drivers like spidev. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> --- drivers/spi/spi-mxs.c | 9 +++++++++ 1 file changed, 9 insertions(+)