diff mbox

[2/3,v4] spi: s3c64xx: for DT platofrms always get the chipselect info from DT node

Message ID 1402578821-27338-2-git-send-email-ch.naveen@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Naveen Krishna Chatradhi June 12, 2014, 1:13 p.m. UTC
Use controller_data structure only for the Non Device tree  platforms.
For Device tree platforms, always derive the chipselect info from
DT node.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Tomasz Figa <t.figa@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Javier Martinez Canillas June 12, 2014, 2:06 p.m. UTC | #1
Hello Naveen,

On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
> 
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index b888c66..f27e15d 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>  	int err;
>  
>  	sdd = spi_master_get_devdata(spi->master);
> -	if (!cs && spi->dev.of_node) {
> +	if (spi->dev.of_node) {
>  		cs = s3c64xx_get_slave_ctrldata(spi);
>  		spi->controller_data = cs;
> -	}
> -
> -	/* For the non-DT platforms derive chip selects from controller data */
> -	if (!spi->dev.of_node)
> +	} else {
> +		/* For the non-DT platforms derive chip
> +		 * selects from controller data
> +		 */
>  		spi->cs_gpio = cs->line;
> +	}
>  
>  	if (IS_ERR_OR_NULL(cs)) {
>  		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
> 

Personally I wouldn't have this change as a separate patch since it's too
related to what you changed in Patch 1. But it's just a nitpick.

Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier
Naveen Krishna Ch June 12, 2014, 4:09 p.m. UTC | #2
Hello Javier,

On 12 June 2014 19:36, Javier Martinez Canillas
<javier.martinez@collabora.co.uk> wrote:
> Hello Naveen,
>
> On 06/12/2014 03:13 PM, Naveen Krishna Chatradhi wrote:
>> Use controller_data structure only for the Non Device tree  platforms.
>> For Device tree platforms, always derive the chipselect info from
>> DT node.
>>
>> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
>> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Tomasz Figa <t.figa@samsung.com>
>> ---
>>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
>> index b888c66..f27e15d 100644
>> --- a/drivers/spi/spi-s3c64xx.c
>> +++ b/drivers/spi/spi-s3c64xx.c
>> @@ -795,14 +795,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
>>       int err;
>>
>>       sdd = spi_master_get_devdata(spi->master);
>> -     if (!cs && spi->dev.of_node) {
>> +     if (spi->dev.of_node) {
>>               cs = s3c64xx_get_slave_ctrldata(spi);
>>               spi->controller_data = cs;
>> -     }
>> -
>> -     /* For the non-DT platforms derive chip selects from controller data */
>> -     if (!spi->dev.of_node)
>> +     } else {
>> +             /* For the non-DT platforms derive chip
>> +              * selects from controller data
>> +              */
>>               spi->cs_gpio = cs->line;
>> +     }
>>
>>       if (IS_ERR_OR_NULL(cs)) {
>>               dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
>>
>
> Personally I wouldn't have this change as a separate patch since it's too
> related to what you changed in Patch 1. But it's just a nitpick.

Patch 1/3 seems to be crowded with multiple changes.
Thought, this would keep the changes cleaner.

>
> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Thanks
>
> Best regards,
> Javier
Doug Anderson June 12, 2014, 11:26 p.m. UTC | #3
Naveen,

On Thu, Jun 12, 2014 at 6:13 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> Use controller_data structure only for the Non Device tree  platforms.
> For Device tree platforms, always derive the chipselect info from
> DT node.
>
> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
> Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Tomasz Figa <t.figa@samsung.com>
> ---
>  drivers/spi/spi-s3c64xx.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

I'm not planning to do an in-depth review of this patch since it seems
that others are on top of it, but I've tested it.  With it (and some
patches that haven't been sent up yet) I can talk to the EC on
exynos5420-pit (which uses device tree for specifying the cs-gpios)

Tested-by: Doug Anderson <dianders@chromium.org>
diff mbox

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index b888c66..f27e15d 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -795,14 +795,15 @@  static int s3c64xx_spi_setup(struct spi_device *spi)
 	int err;
 
 	sdd = spi_master_get_devdata(spi->master);
-	if (!cs && spi->dev.of_node) {
+	if (spi->dev.of_node) {
 		cs = s3c64xx_get_slave_ctrldata(spi);
 		spi->controller_data = cs;
-	}
-
-	/* For the non-DT platforms derive chip selects from controller data */
-	if (!spi->dev.of_node)
+	} else {
+		/* For the non-DT platforms derive chip
+		 * selects from controller data
+		 */
 		spi->cs_gpio = cs->line;
+	}
 
 	if (IS_ERR_OR_NULL(cs)) {
 		dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);