Skip to contentSkip to conversation

spi: tegra114_spi: Convert to use spi_alloc_slave()

PATCH New Axel Lin 3 participants 8 messages Jun 13, 2013

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 spi: tegra114_spi: Convert to use spi_alloc_slave()

---
Forgot to CC mailing list, so here is a resend.

 drivers/spi/tegra114_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/tegra114_spi.c +1 -3
index b11a0a1..4d2af48 100644
@@ -152,13 +152,11 @@ struct spi_slave *tegra114_spi_setup_slave(unsigned int bus, unsigned int cs,
 		return NULL;
 	}
 
-	spi = malloc(sizeof(struct tegra_spi_slave));
+	spi = spi_alloc_slave(struct tegra_spi_slave, bus, cs);
 	if (!spi) {
 		printf("SPI error: malloc of SPI structure failed\n");
 		return NULL;
 	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
 	spi->ctrl = &spi_ctrls[bus];
 	if (!spi->ctrl) {
 		printf("SPI error: could not find controller for bus %d\n",
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 2/2 spi: tegra20_sflash: Remove redundant code to set bus and cs of struct spi_slave

It's done in spi_alloc_slave(), thus remove the redundant code.

---
 drivers/spi/tegra20_sflash.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/tegra20_sflash.c +0 -2
index 9322ce7..7c3a3fc 100644
@@ -132,8 +132,6 @@ struct spi_slave *tegra20_spi_setup_slave(unsigned int bus, unsigned int cs,
 		printf("SPI error: malloc of SPI structure failed\n");
 		return NULL;
 	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
 	spi->ctrl = &spi_ctrls[bus];
 	if (!spi->ctrl) {
 		printf("SPI error: could not find controller for bus %d\n",
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/2 spi: tegra20_sflash: Remove redundant code to set bus and cs of struct spi_slave

Dear Axel Lin,

Quoted 14 lines

It's done in spi_alloc_slave(), thus remove the redundant code.

---
 drivers/spi/tegra20_sflash.c | 2 --
 1 file changed, 2 deletions(-)
drivers/spi/tegra20_sflash.c +0 -0
index 9322ce7..7c3a3fc 100644
@@ -132,8 +132,6 @@ struct spi_slave *tegra20_spi_setup_slave(unsigned int

bus, unsigned int cs, printf("SPI error: malloc of SPI structure failed\n");

drivers/spi/tegra20_sflash.c struct spi_slave *tegra20_spi_setup_slave(unsigned int bus, unsigned int cs, · line 137

Quoted 7 lines
drivers/spi/tegra20_sflash.c +0 -2
 		return NULL;
 	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
 	spi->ctrl = &spi_ctrls[bus];
 	if (!spi->ctrl) {
 		printf("SPI error: could not find controller for bus %d\n",

Best regards,
Marek Vasut

#5 lore raw

PATCH 1/2 spi: tegra114_spi: Convert to use spi_alloc_slave()

In reply to Axel Lin

Dear Axel Lin,

Quoted 15 lines

---
Forgot to CC mailing list, so here is a resend.

 drivers/spi/tegra114_spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/tegra114_spi.c +0 -1
index b11a0a1..4d2af48 100644
@@ -152,13 +152,11 @@ struct spi_slave *tegra114_spi_setup_slave(unsigned
 int bus, unsigned int cs, return NULL;
 	}
 
-	spi = malloc(sizeof(struct tegra_spi_slave));

drivers/spi/tegra114_spi.c struct spi_slave *tegra114_spi_setup_slave(unsigned · line 162

Quoted 10 lines
drivers/spi/tegra114_spi.c +1 -2
+	spi = spi_alloc_slave(struct tegra_spi_slave, bus, cs);
 	if (!spi) {
 		printf("SPI error: malloc of SPI structure failed\n");
 		return NULL;
 	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
 	spi->ctrl = &spi_ctrls[bus];
 	if (!spi->ctrl) {
 		printf("SPI error: could not find controller for bus %d\n",

Best regards,
Marek Vasut

#6 lore raw

PATCH 1/2 spi: tegra114_spi: Convert to use spi_alloc_slave()

Quoted 30 lines · Marek Vasut

Dear Axel Lin,

Quoted 15 lines

---
Forgot to CC mailing list, so here is a resend.

  drivers/spi/tegra114_spi.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/tegra114_spi.c +0 -1
index b11a0a1..4d2af48 100644
@@ -152,13 +152,11 @@ struct spi_slave *tegra114_spi_setup_slave(unsigned
 int bus, unsigned int cs, return NULL;
  	}
 
-	spi = malloc(sizeof(struct tegra_spi_slave));

drivers/spi/tegra114_spi.c struct spi_slave *tegra114_spi_setup_slave(unsigned · line 162

Quoted 10 lines
drivers/spi/tegra114_spi.c +1 -2
+	spi = spi_alloc_slave(struct tegra_spi_slave, bus, cs);
  	if (!spi) {
  		printf("SPI error: malloc of SPI structure failed\n");
  		return NULL;
  	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
  	spi->ctrl = &spi_ctrls[bus];
  	if (!spi->ctrl) {
  		printf("SPI error: could not find controller for bus %d\n",
Quoted 3 lines

Best regards,
Marek Vasut

--
Thanks,
Jagan.

#3 lore raw

PATCH 2/2 spi: tegra20_sflash: Remove redundant code to set bus and cs of struct spi_slave

In reply to Marek Vasut
Quoted 26 lines · Marek Vasut

Dear Axel Lin,

Quoted 16 lines

It's done in spi_alloc_slave(), thus remove the redundant code.

---
  drivers/spi/tegra20_sflash.c | 2 --
  1 file changed, 2 deletions(-)
drivers/spi/tegra20_sflash.c +0 -0
index 9322ce7..7c3a3fc 100644
@@ -132,8 +132,6 @@ struct spi_slave *tegra20_spi_setup_slave(unsigned int

bus, unsigned int cs, printf("SPI error: malloc of SPI structure failed\n");
return NULL;
}

drivers/spi/tegra20_sflash.c struct spi_slave *tegra20_spi_setup_slave(unsigned int bus, unsigned int cs, · line 137

Quoted 5 lines
drivers/spi/tegra20_sflash.c +0 -2
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
  	spi->ctrl = &spi_ctrls[bus];
  	if (!spi->ctrl) {
  		printf("SPI error: could not find controller for bus %d\n",
Quoted 3 lines

Best regards,
Marek Vasut

--
Thanks,
Jagan.

#7 lore raw

PATCH 1/2 spi: tegra114_spi: Convert to use spi_alloc_slave()

In reply to Axel Lin
Quoted 19 lines · Axel Lin

---
Forgot to CC mailing list, so here is a resend.

  drivers/spi/tegra114_spi.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/tegra114_spi.c +0 -1
index b11a0a1..4d2af48 100644
@@ -152,13 +152,11 @@ struct spi_slave *tegra114_spi_setup_slave(unsigned int bus, unsigned int cs,
  		return NULL;
  	}
 
-	spi = malloc(sizeof(struct tegra_spi_slave));

drivers/spi/tegra114_spi.c struct spi_slave *tegra114_spi_setup_slave(unsigned int bus, unsigned int cs, · line 162

Quoted 10 lines
drivers/spi/tegra114_spi.c +1 -2
+	spi = spi_alloc_slave(struct tegra_spi_slave, bus, cs);
  	if (!spi) {
  		printf("SPI error: malloc of SPI structure failed\n");
  		return NULL;
  	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
  	spi->ctrl = &spi_ctrls[bus];
  	if (!spi->ctrl) {
  		printf("SPI error: could not find controller for bus %d\n",

Applied to u-boot-spi/master

--
Thanks,
Jagan.

#4 lore raw

PATCH 2/2 spi: tegra20_sflash: Remove redundant code to set bus and cs of struct spi_slave

In reply to Axel Lin
Quoted 16 lines · Axel Lin

It's done in spi_alloc_slave(), thus remove the redundant code.

---
drivers/spi/tegra20_sflash.c | 2 --

  1 file changed, 2 deletions(-)
drivers/spi/tegra20_sflash.c +0 -0
index 9322ce7..7c3a3fc 100644

drivers/spi/tegra20_sflash.c struct spi_slave *tegra20_spi_setup_slave(unsigned int bus, unsigned int cs, · line 137

Quoted 8 lines
drivers/spi/tegra20_sflash.c +0 -2
@@ -132,8 +132,6 @@ struct spi_slave *tegra20_spi_setup_slave(unsigned int bus, unsigned int cs,
  		printf("SPI error: malloc of SPI structure failed\n");
  		return NULL;
  	}
-	spi->slave.bus = bus;
-	spi->slave.cs = cs;
  	spi->ctrl = &spi_ctrls[bus];
  	if (!spi->ctrl) {
  		printf("SPI error: could not find controller for bus %d\n",

Applied to u-boot-spi/master

--
Thanks,
Jagan.