linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] spi/imx: two spi-imx cleanup
@ 2012-07-13  2:51 Hui Wang
       [not found] ` <1342147889-25043-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Wang @ 2012-07-13  2:51 UTC (permalink / raw)
  To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

The patches has already sent to Sascha Hauer and got his Ack.
Now resend them to Mark Brown for review.

Hui Wang (2):
  spi/imx: remove redundant config.speed_hz setting
  spi/imx: use gpio_is_valid to determine if a gpio is valid

 drivers/spi/spi-imx.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

-- 
1.7.6


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] spi/imx: remove redundant config.speed_hz setting
       [not found] ` <1342147889-25043-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-13  2:51   ` Hui Wang
       [not found]     ` <1342147889-25043-2-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Wang @ 2012-07-13  2:51 UTC (permalink / raw)
  To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

The config.speed_hz is just setted at the two lines ahead of it,
obviously we don't need to copy the code to set the config.speed_hz
again. Remove it for a cleanup.

Cc: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Hui Wang <jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-imx.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 47877d6..c12052f 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -688,8 +688,6 @@ static int spi_imx_setupxfer(struct spi_device *spi,
 		config.speed_hz = spi->max_speed_hz;
 	if (!config.bpw)
 		config.bpw = spi->bits_per_word;
-	if (!config.speed_hz)
-		config.speed_hz = spi->max_speed_hz;
 
 	/* Initialize the functions for transfer */
 	if (config.bpw <= 8) {
-- 
1.7.6


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] spi/imx: use gpio_is_valid to determine if a gpio is valid
       [not found]     ` <1342147889-25043-2-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-13  2:51       ` Hui Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Hui Wang @ 2012-07-13  2:51 UTC (permalink / raw)
  To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Use gpio_is_valid() to replace "gpio >= 0" or "gpio < 0".

Cc: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Hui Wang <jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-imx.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index c12052f..e834ff8 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -626,7 +626,7 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active)
 	int active = is_active != BITBANG_CS_INACTIVE;
 	int dev_is_lowactive = !(spi->mode & SPI_CS_HIGH);
 
-	if (gpio < 0)
+	if (!gpio_is_valid(gpio))
 		return;
 
 	gpio_set_value(gpio, dev_is_lowactive ^ active);
@@ -736,7 +736,7 @@ static int spi_imx_setup(struct spi_device *spi)
 	dev_dbg(&spi->dev, "%s: mode %d, %u bpw, %d hz\n", __func__,
 		 spi->mode, spi->bits_per_word, spi->max_speed_hz);
 
-	if (gpio >= 0)
+	if (gpio_is_valid(gpio))
 		gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1);
 
 	spi_imx_chipselect(spi, BITBANG_CS_INACTIVE);
@@ -789,11 +789,11 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
 
 	for (i = 0; i < master->num_chipselect; i++) {
 		int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
-		if (cs_gpio < 0 && mxc_platform_info)
+		if (!gpio_is_valid(cs_gpio) && mxc_platform_info)
 			cs_gpio = mxc_platform_info->chipselect[i];
 
 		spi_imx->chipselect[i] = cs_gpio;
-		if (cs_gpio < 0)
+		if (!gpio_is_valid(cs_gpio))
 			continue;
 
 		ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME);
@@ -895,7 +895,7 @@ out_release_mem:
 	release_mem_region(res->start, resource_size(res));
 out_gpio_free:
 	while (--i >= 0) {
-		if (spi_imx->chipselect[i] >= 0)
+		if (gpio_is_valid(spi_imx->chipselect[i]))
 			gpio_free(spi_imx->chipselect[i]);
 	}
 	spi_master_put(master);
@@ -920,7 +920,7 @@ static int __devexit spi_imx_remove(struct platform_device *pdev)
 	iounmap(spi_imx->base);
 
 	for (i = 0; i < master->num_chipselect; i++)
-		if (spi_imx->chipselect[i] >= 0)
+		if (gpio_is_valid(spi_imx->chipselect[i]))
 			gpio_free(spi_imx->chipselect[i]);
 
 	spi_master_put(master);
-- 
1.7.6


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] spi/imx: two spi-imx cleanup
       [not found]     ` <20120710172011.GC30009-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-07-12  9:53       ` Hui Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Hui Wang @ 2012-07-12  9:53 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Hui Wang,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E

Hi Mark,

Understand from Grant's mail's discussion that you are picking up the spi change, Could you please queue these two patches in your tree?

Regards,
Hui.



Sascha Hauer wrote:
> On Tue, Jul 10, 2012 at 05:44:21PM +0800, Hui Wang wrote:
>   
>> Two straight-forward cleanup
>>
>> Hui Wang (2):
>>   spi/imx: remove redundant config.speed_hz setting
>>   spi/imx: use gpio_is_valid to determine if a gpio is valid
>>     
>
> both:
>
> Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>
>
>   
>>  drivers/spi/spi-imx.c |   14 ++++++--------
>>  1 files changed, 6 insertions(+), 8 deletions(-)
>>
>> -- 
>> 1.7.6
>>
>>
>>     
>
>   


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] spi/imx: two spi-imx cleanup
       [not found] ` <1341913463-10128-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-10 17:20   ` Sascha Hauer
       [not found]     ` <20120710172011.GC30009-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2012-07-10 17:20 UTC (permalink / raw)
  To: Hui Wang; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, Jul 10, 2012 at 05:44:21PM +0800, Hui Wang wrote:
> Two straight-forward cleanup
> 
> Hui Wang (2):
>   spi/imx: remove redundant config.speed_hz setting
>   spi/imx: use gpio_is_valid to determine if a gpio is valid

both:

Acked-by: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>


> 
>  drivers/spi/spi-imx.c |   14 ++++++--------
>  1 files changed, 6 insertions(+), 8 deletions(-)
> 
> -- 
> 1.7.6
> 
> 

-- 
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 |

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] spi/imx: two spi-imx cleanup
@ 2012-07-10  9:44 Hui Wang
       [not found] ` <1341913463-10128-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Hui Wang @ 2012-07-10  9:44 UTC (permalink / raw)
  To: s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, grant.likely-s3s/WqlpOiPyB63q8FvJNQ
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Two straight-forward cleanup

Hui Wang (2):
  spi/imx: remove redundant config.speed_hz setting
  spi/imx: use gpio_is_valid to determine if a gpio is valid

 drivers/spi/spi-imx.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

-- 
1.7.6


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-07-13  2:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-13  2:51 [PATCH 0/2] spi/imx: two spi-imx cleanup Hui Wang
     [not found] ` <1342147889-25043-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-13  2:51   ` [PATCH 1/2] spi/imx: remove redundant config.speed_hz setting Hui Wang
     [not found]     ` <1342147889-25043-2-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-13  2:51       ` [PATCH 2/2] spi/imx: use gpio_is_valid to determine if a gpio is valid Hui Wang
  -- strict thread matches above, loose matches on Subject: below --
2012-07-10  9:44 [PATCH 0/2] spi/imx: two spi-imx cleanup Hui Wang
     [not found] ` <1341913463-10128-1-git-send-email-jason77.wang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-10 17:20   ` Sascha Hauer
     [not found]     ` <20120710172011.GC30009-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-12  9:53       ` Hui Wang

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).