From: Mark Brown <broonie@kernel.org>
To: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
spi-devel-general@lists.sourceforge.net,
linux-samsung-soc@vger.kernel.org, naveenkrishna.ch@gmail.com,
grant.likely@secretlab.ca, jaswinder.singh@linaro.org,
kgene.kim@samsung.com, cpgs@samsung.com,
devicetree@vger.kernel.org, Tomasz Figa <t.figa@samsung.com>
Subject: Re: [PATCH 1/3 v6] spi: s3c64xx: fix broken "cs_gpios" usage in the driver
Date: Mon, 14 Jul 2014 18:25:24 +0100 [thread overview]
Message-ID: <20140714172524.GH6800@sirena.org.uk> (raw)
In-Reply-To: <1405316506-27855-2-git-send-email-ch.naveen@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]
On Mon, Jul 14, 2014 at 11:11:44AM +0530, Naveen Krishna Chatradhi wrote:
> @@ -812,6 +800,10 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
> spi->controller_data = cs;
> }
>
> + /* For the non-DT platforms derive chip selects from controller data */
> + if (!spi->dev.of_node)
> + spi->cs_gpio = cs->line;
> +
> if (IS_ERR_OR_NULL(cs)) {
> dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
> return -ENODEV;
> @@ -819,17 +811,16 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>
> if (!spi_get_ctldata(spi)) {
> /* Request gpio only if cs line is asserted by gpio pins */
> - if (sdd->cs_gpio) {
> - err = gpio_request_one(cs->line, GPIOF_OUT_INIT_HIGH,
> - dev_name(&spi->dev));
> + if (gpio_is_valid(spi->cs_gpio)) {
As previously mentioned gpio_is_valid() is *not* a direct substitute for
checking if the boolean flag cs_gpio has been set since 0 is a valid
GPIO on at least some of these platforms and as discussed several times
already some of the SoCs require the use of the built in chip select.
In general it's quite hard to tie the description in the patch to the
code changes, not helped by the decision to do separate refactorings
like this conversion to gpio_is_valid() as part of the one patch. The
description of the patch now makes some statements about what the
problem that's intended to be fixed is but it still doesn't seem
entirely clear that everything has been thought through fully and tied
to the code.
The original code appears to be buggy which isn't helping anything but
it's hard to have confidence that this isn't going to break some other
use case that currently works given the lack of clarity and the number
of revisions that have been required so far.
I think some combination of smaller changes and a clearer working
through of the before and after states for both DT and non DT cases to
show that everything has been considered would help a lot. I may have
another stare at this but it's worrying how hard I'm needing to think.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-07-14 17:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 5:41 [PATCH 0/3 v6] spi: s3c64xx: use "cs-gpios" in spi node instead of "cs-gpio" Naveen Krishna Chatradhi
2014-07-14 5:41 ` [PATCH 1/3 v6] spi: s3c64xx: fix broken "cs_gpios" usage in the driver Naveen Krishna Chatradhi
2014-07-14 17:25 ` Mark Brown [this message]
2014-07-14 19:01 ` Naveen Krishna Ch
[not found] ` <CAHfPSqAzab931yurSs+3zj=uoFj93FuAdd24AQKm1fZm07Nq8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-14 19:15 ` Mark Brown
2014-07-15 4:03 ` Naveen Krishna Ch
2014-07-15 11:00 ` Mark Brown
2014-07-15 10:38 ` Javier Martinez Canillas
2014-07-15 12:35 ` Mark Brown
2014-07-15 16:55 ` Tomasz Figa
2014-07-15 17:21 ` Naveen Krishna Ch
2014-07-15 17:22 ` Tomasz Figa
2014-07-14 5:41 ` [PATCH 2/3 v6] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node Naveen Krishna Chatradhi
2014-07-14 5:41 ` [PATCH 3/3 v6] ARM: DTS: fix the chip select gpios definition in the SPI nodes Naveen Krishna Chatradhi
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=20140714172524.GH6800@sirena.org.uk \
--to=broonie@kernel.org \
--cc=ch.naveen@samsung.com \
--cc=cpgs@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@secretlab.ca \
--cc=jaswinder.singh@linaro.org \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=naveenkrishna.ch@gmail.com \
--cc=spi-devel-general@lists.sourceforge.net \
--cc=t.figa@samsung.com \
/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