All of lore.kernel.org
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 14/14] dm-sf: Re-factorize spi_flash_std_probe code
Date: Tue, 27 Oct 2015 12:20:12 -0700	[thread overview]
Message-ID: <562FCE6C.7040103@boundarydevices.com> (raw)
In-Reply-To: <1445971076-17270-14-git-send-email-jteki@openedev.com>

On 10/27/2015 11:37 AM, Jagan Teki wrote:
> spi_flash_probe_tail code looks not in proper shape
> to add more functionalities. hence refactorized
> so-that it's more readable and hence we may extend
> more functionalies to it.
> 
> Signed-off-by: Jagan Teki <jteki@openedev.com>
> ---
>  drivers/mtd/spi/sf_probe.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 319b7e6..87ac33e 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -123,15 +123,12 @@ int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
>  
>  int spi_flash_std_probe(struct udevice *dev)
>  {
> -	struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
> +	struct spi_flash *flash = dev_get_uclass_priv(dev);
>  	struct spi_slave *slave = dev_get_parentdata(dev);
> -	struct spi_flash *flash;
>  	int ret;
>  
> -	debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs);
> -
> -	flash = dev_get_uclass_priv(dev);
>  	flash->dev = dev;
> +	flash->spi = slave;
>  
>  	/* Claim spi bus */
>  	ret = spi_claim_bus(slave);
> @@ -140,17 +137,26 @@ int spi_flash_std_probe(struct udevice *dev)
>  		return ret;
>  	}
>  
> -	ret = spi_flash_scan(slave, flash);
> +	ret = spi_flash_scan(flash);



Is this bisectable ? It doesn't look like it.


>  	if (ret) {
>  		ret = -EINVAL;
> -		goto err_read_id;
> +		goto err_scan;
>  	}
>  
>  #ifdef CONFIG_SPI_FLASH_MTD
>  	ret = spi_flash_mtd_register(flash);
> +	if (ret) {
> +		printf("SF: failed to register mtd device: %d\n", ret);
> +		goto err_mtd;
> +	}
>  #endif
> +	return ret;
>  
> -err_read_id:
> +#ifdef CONFIG_SPI_FLASH_MTD
> +err_mtd:
> +	spi_free_slave(slave);
> +#endif
> +err_scan:
>  	spi_release_bus(slave);
>  	return ret;
>  }
> 

  reply	other threads:[~2015-10-27 19:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 18:37 [U-Boot] [PATCH v5 01/14] sf: spi_flash_validate_params => spi_flash_scan Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 02/14] sf: Move spi_flash_scan code to sf_ops Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 03/14] sf: Move read_id " Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 04/14] sf: probe: Code cleanup Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 05/14] sf: Use static for file-scope functions Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 06/14] sf: Fix Makefile Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 07/14] sf: Use simple name for register access functions Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 08/14] sf: Use flash function pointers in dm_spi_flash_ops Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 09/14] sf: Flash power up read-only based on idcode0 Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 10/14] sf: Use static for file-scope functions Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 11/14] sf: Remove unneeded header includes Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 12/14] sf: probe: Use spi_flash_scan in dm-spi-flash Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 13/14] sf: Re-factorize spi_flash_probe_tail code Jagan Teki
2015-10-27 18:37 ` [U-Boot] [PATCH v5 14/14] dm-sf: Re-factorize spi_flash_std_probe code Jagan Teki
2015-10-27 19:20   ` Troy Kisky [this message]
2015-10-28  5:18     ` Jagan Teki
2015-10-28  5:31       ` Bin Meng
2015-10-28  6:37         ` Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562FCE6C.7040103@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.