From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH] spi: imx: Remove the use of property "fsl, spi-num-chipselects"
Date: Fri, 24 Jun 2016 18:04:22 +0300 [thread overview]
Message-ID: <1466780662-15866-1-git-send-email-shc_work@mail.ru> (raw)
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(-)
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
next reply other threads:[~2016-06-24 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 15:04 Alexander Shiyan [this message]
2016-06-27 6:47 ` Sascha Hauer
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=1466780662-15866-1-git-send-email-shc_work@mail.ru \
--to=shc_work@mail.ru \
--cc=barebox@lists.infradead.org \
/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