Skip to contentSkip to conversation

Drivers: SPI: spi_slave struct has no member called bus nor cs.

PATCH New Ahmed Samir Khalil 2 participants 2 messages Jun 11, 2016 – Jun 17, 2016 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: SPI: spi_slave struct has no member called bus nor cs.

In case of Driver Model, spi_slave structure (in spi.c) doesn't have member called bus or cs. Compiler error will be reported when using the new Driver Model while assigning bus & cs to non-members. This compiler error becomes obvious while applying the step-by-step documented in spi-howto.txt

---
 drivers/spi/spi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/spi.c +2 -0
index 7d81fbd..b02c7ab 100644
@@ -31,8 +31,10 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 	if (ptr) {
 		memset(ptr, '\0', size);
 		slave = (struct spi_slave *)(ptr + offset);
+#ifndef CONFIG_DM_SPI
 		slave->bus = bus;
 		slave->cs = cs;
+#endif
 		slave->wordlen = SPI_DEFAULT_WORDLEN;
 	}
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Drivers: SPI: spi_slave struct has no member called bus nor cs.

Hi Ahmen,

Quoted 16 lines · Ahmed Samir Khalil

In case of Driver Model, spi_slave structure (in spi.c) doesn't have member called bus or cs. Compiler error will be reported when using the new Driver Model while assigning bus & cs to non-members. This compiler error becomes obvious while applying the step-by-step documented in spi-howto.txt

---
 drivers/spi/spi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/spi/spi.c +0 -0
index 7d81fbd..b02c7ab 100644

drivers/spi/spi.c void *spi_do_alloc_slave(int offset, int size, unsigned int bus, · line 40

Quoted 10 lines
drivers/spi/spi.c +2 -0
@@ -31,8 +31,10 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
        if (ptr) {
                memset(ptr, '\0', size);
                slave = (struct spi_slave *)(ptr + offset);
+#ifndef CONFIG_DM_SPI
                slave->bus = bus;
                slave->cs = cs;
+#endif
                slave->wordlen = SPI_DEFAULT_WORDLEN;
        }
 

This file should not be built when CONFIG_DM_SPI is enabled. Are you using the latest mainline U-Boot?

Regards,
Simon