mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] spi: imx: Remove the use of property "fsl, spi-num-chipselects"
Date: Mon, 27 Jun 2016 08:47:06 +0200	[thread overview]
Message-ID: <20160627064706.GU20657@pengutronix.de> (raw)
In-Reply-To: <1466780662-15866-1-git-send-email-shc_work@mail.ru>

On Fri, Jun 24, 2016 at 06:04:22PM +0300, Alexander Shiyan wrote:
> The "fsl,spi-num-chipselects" property will be marked obsolete soon.
> This patch updates the driver to be ready to such changes.
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/spi/imx_spi.c | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
> index 99ec228..dc7a8c8 100644
> --- a/drivers/spi/imx_spi.c
> +++ b/drivers/spi/imx_spi.c
> @@ -515,23 +515,16 @@ static __maybe_unused struct spi_imx_devtype_data spi_imx_devtype_data_2_3 = {
>  static int imx_spi_dt_probe(struct imx_spi *imx)
>  {
>  	struct device_node *node = imx->master.dev->device_node;
> -	int ret, i;
> -	u32 num_cs;
> +	int i;
>  
>  	if (!node)
>  		return -ENODEV;
>  
> -	ret = of_property_read_u32(node, "fsl,spi-num-chipselects", &num_cs);
> -	if (ret)
> -		return ret;
> -
> -	imx->master.num_chipselect = num_cs;
> -	imx->cs_array = xzalloc(sizeof(u32) * num_cs);
> +	imx->master.num_chipselect = of_gpio_named_count(node, "cs-gpios");
> +	imx->cs_array = xzalloc(sizeof(u32) * imx->master.num_chipselect);
>  
> -	for (i = 0; i < num_cs; i++) {
> -		int cs_gpio = of_get_named_gpio(node, "cs-gpios", i);
> -		imx->cs_array[i] = cs_gpio;
> -	}
> +	for (i = 0; i < imx->master.num_chipselect; i++)
> +		imx->cs_array[i] = of_get_named_gpio(node, "cs-gpios", i);
>  
>  	return 0;
>  }
> -- 
> 2.4.9
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2016-06-27  6:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 15:04 Alexander Shiyan
2016-06-27  6:47 ` Sascha Hauer [this message]

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=20160627064706.GU20657@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=shc_work@mail.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox