diff mbox

SPI: MXS: Allow to pass the SPI master bus number from the device tree

Message ID 1344004239-22868-1-git-send-email-maxime.ripard@free-electrons.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Maxime Ripard Aug. 3, 2012, 2:30 p.m. UTC
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(+)

Comments

Shawn Guo Aug. 3, 2012, 2:43 p.m. UTC | #1
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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Maxime Ripard Aug. 3, 2012, 4:27 p.m. UTC | #2
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 mbox

Patch

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;