From: Oleksij Rempel <ore-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Trent Piepho <tpiepho-cgc2CodaaHDQT0dZR+AlfA@public.gmane.org>
Cc: "linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"fabio.estevam-3arQi8VN3Tc@public.gmane.org"
<fabio.estevam-3arQi8VN3Tc@public.gmane.org>,
"shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"gerg-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org"
<gerg-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
"kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org"
<kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: Re: [PATCH 1/4] spi: imx: GPIO based chip selects should not be required
Date: Thu, 19 Oct 2017 12:17:16 +0200 [thread overview]
Message-ID: <20171019101715.wmm6avnoyb5r3bsv@pengutronix.de> (raw)
In-Reply-To: <1507918921.24265.8.camel-cgc2CodaaHDQT0dZR+AlfA@public.gmane.org>
On Fri, Oct 13, 2017 at 06:22:01PM +0000, Trent Piepho wrote:
> The driver will fail to load if no gpio chip selects are specified,
> this patch changes this so that it no longer fails.
>
> It's possible to use all native chip selects, in which case there is
> no reason to have a gpio chip select array. This is what happens if
> the *optional* device tree property "cs-gpios" is omitted.
>
> The spi core already checks for the absence of gpio chip selects in
> the master and assigns any slaves the gpio_cs value of -ENOENT.
>
> Signed-off-by: Trent Piepho <tpiepho-cgc2CodaaHDQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/spi/spi-imx.c | 29 +++++++++++++----------------
> 1 file changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index babb15f07995..07e6250f2dad 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -1457,22 +1457,19 @@ static int spi_imx_probe(struct platform_device *pdev)
> goto out_clk_put;
> }
>
> - if (!master->cs_gpios) {
> - dev_err(&pdev->dev, "No CS GPIOs available\n");
> - ret = -EINVAL;
> - goto out_clk_put;
> - }
> -
> - for (i = 0; i < master->num_chipselect; i++) {
> - if (!gpio_is_valid(master->cs_gpios[i]))
> - continue;
> -
> - ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i],
> - DRIVER_NAME);
> - if (ret) {
> - dev_err(&pdev->dev, "Can't get CS GPIO %i\n",
> - master->cs_gpios[i]);
> - goto out_clk_put;
> + /* Request GPIO CS lines, if any */
> + if (master->cs_gpios) {
> + for (i = 0; i < master->num_chipselect; i++) {
> + if (!gpio_is_valid(master->cs_gpios[i]))
> + continue;
> +
> + ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i],
> + DRIVER_NAME);
> + if (ret) {
> + dev_err(&pdev->dev, "Can't get CS GPIO %i\n",
> + master->cs_gpios[i]);
> + goto out_clk_put;
> + }
> }
> }
>
> --
> 2.13.6
Reviewed-by: Oleksij Rempel <o.rempel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
--
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 |
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-10-19 10:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 18:22 [PATCH 1/4] spi: imx: GPIO based chip selects should not be required Trent Piepho
[not found] ` <1507918921.24265.8.camel-cgc2CodaaHDQT0dZR+AlfA@public.gmane.org>
2017-10-19 10:17 ` Oleksij Rempel [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-13 19:54 Trent Piepho
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=20171019101715.wmm6avnoyb5r3bsv@pengutronix.de \
--to=ore-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=fabio.estevam-3arQi8VN3Tc@public.gmane.org \
--cc=gerg-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
--cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tpiepho-cgc2CodaaHDQT0dZR+AlfA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).