diff mbox series

[U-Boot,021/080] sf_probe: Merge spi_flash_probe_tail into spi_flash_probe

Message ID 20170929125238.26226-21-mario.six@gdsys.cc
State Accepted
Commit 36890ff0d00f6c44631a6453b355f8af1b5ddd53
Delegated to: Wolfgang Denk
Headers show
Series [U-Boot,001/080] mpc8308rdb: Fix style violation | expand

Commit Message

Mario Six Sept. 29, 2017, 12:51 p.m. UTC
spi_flash_probe_tail is now only called from spi_flash_probe, hence we
can merge its body into spi_flash_probe.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 drivers/mtd/spi/sf_probe.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Simon Glass Oct. 9, 2017, 4:47 a.m. UTC | #1
On 29 September 2017 at 06:51, Mario Six <mario.six@gdsys.cc> wrote:
> spi_flash_probe_tail is now only called from spi_flash_probe, hence we
> can merge its body into spi_flash_probe.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>
> ---
>  drivers/mtd/spi/sf_probe.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 68009a6328..09143d7868 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -55,10 +55,16 @@  err_read_id:
 }
 
 #ifndef CONFIG_DM_SPI_FLASH
-static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
+struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
+				  unsigned int max_hz, unsigned int spi_mode)
 {
+	struct spi_slave *bus;
 	struct spi_flash *flash;
 
+	bus = spi_setup_slave(busnum, cs, max_hz, spi_mode);
+	if (!bus)
+		return NULL;
+
 	/* Allocate space if needed (not used by sf-uclass */
 	flash = calloc(1, sizeof(*flash));
 	if (!flash) {
@@ -76,17 +82,6 @@  static struct spi_flash *spi_flash_probe_tail(struct spi_slave *bus)
 	return flash;
 }
 
-struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs,
-				  unsigned int max_hz, unsigned int spi_mode)
-{
-	struct spi_slave *bus;
-
-	bus = spi_setup_slave(busnum, cs, max_hz, spi_mode);
-	if (!bus)
-		return NULL;
-	return spi_flash_probe_tail(bus);
-}
-
 void spi_flash_free(struct spi_flash *flash)
 {
 #ifdef CONFIG_SPI_FLASH_MTD