Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
@ 2013-07-15  6:11 Jingoo Han
  2013-07-15 12:00 ` Mark Brown
  2013-07-15 12:10 ` Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Jingoo Han @ 2013-07-15  6:11 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: linux-spi, linux-samsung-soc, 'Joe Perches', Jingoo Han

Fix the following checkpatch error and warnings:

  ERROR: "(foo*)" should be "(foo *)"
  WARNING: line over 80 characters
  WARNING: quoted string split across lines

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
No changes since v1:

 drivers/spi/spi-s3c64xx.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 21ba0a0..dc861c0 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -338,8 +338,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
 	req.cap = DMA_SLAVE;
 	req.client = &s3c64xx_spi_dma_client;
 
-	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
-	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
+	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach,
+						&req, dev, "rx");
+	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach,
+						&req, dev, "tx");
 
 	return 1;
 }
@@ -439,7 +441,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
 
 	/* Acquire DMA channels */
 	sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
-				(void*)sdd->rx_dma.dmach, dev, "rx");
+				(void *)sdd->rx_dma.dmach, dev, "rx");
 	if (!sdd->rx_dma.ch) {
 		dev_err(dev, "Failed to get RX DMA channel\n");
 		ret = -EBUSY;
@@ -447,7 +449,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
 	}
 
 	sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
-				(void*)sdd->tx_dma.dmach, dev, "tx");
+				(void *)sdd->tx_dma.dmach, dev, "tx");
 	if (!sdd->tx_dma.ch) {
 		dev_err(dev, "Failed to get TX DMA channel\n");
 		ret = -EBUSY;
@@ -1361,16 +1363,14 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
 	if (!sdd->pdev->dev.of_node) {
 		res = platform_get_resource(pdev, IORESOURCE_DMA,  0);
 		if (!res) {
-			dev_warn(&pdev->dev, "Unable to get SPI tx dma "
-					"resource. Switching to poll mode\n");
+			dev_warn(&pdev->dev, "Unable to get SPI tx dma resource. Switching to poll mode\n");
 			sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL;
 		} else
 			sdd->tx_dma.dmach = res->start;
 
 		res = platform_get_resource(pdev, IORESOURCE_DMA,  1);
 		if (!res) {
-			dev_warn(&pdev->dev, "Unable to get SPI rx dma "
-					"resource. Switching to poll mode\n");
+			dev_warn(&pdev->dev, "Unable to get SPI rx dma resource. Switching to poll mode\n");
 			sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL;
 		} else
 			sdd->rx_dma.dmach = res->start;
-- 
1.7.10.4

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

* Re: [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
  2013-07-15  6:11 [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings Jingoo Han
@ 2013-07-15 12:00 ` Mark Brown
  2013-07-15 12:10 ` Joe Perches
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2013-07-15 12:00 UTC (permalink / raw)
  To: Jingoo Han; +Cc: linux-spi, linux-samsung-soc, 'Joe Perches'

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

On Mon, Jul 15, 2013 at 03:11:57PM +0900, Jingoo Han wrote:
> Fix the following checkpatch error and warnings:
> 
>   ERROR: "(foo*)" should be "(foo *)"
>   WARNING: line over 80 characters
>   WARNING: quoted string split across lines

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
  2013-07-15  6:11 [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings Jingoo Han
  2013-07-15 12:00 ` Mark Brown
@ 2013-07-15 12:10 ` Joe Perches
  2013-07-15 23:23   ` Jingoo Han
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-07-15 12:10 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Mark Brown', linux-spi, linux-samsung-soc

On Mon, 2013-07-15 at 15:11 +0900, Jingoo Han wrote:
[]
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
[]
> @@ -338,8 +338,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
[]
> -	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
> -	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
> +	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach,
> +						&req, dev, "rx");
> +	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach,
> +						&req, dev, "tx");

There should be sparse errors here.
sdd->ops->request is unsigned int, not unsigned long.
Care to fix the cast of unsigned to pointer too?

> @@ -439,7 +441,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
>  
>  	/* Acquire DMA channels */
>  	sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
> -				(void*)sdd->rx_dma.dmach, dev, "rx");
> +				(void *)sdd->rx_dma.dmach, dev, "rx");

It seems unsigned to pointer conversions are pretty
rampant in this code.

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

* Re: [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
  2013-07-15 12:10 ` Joe Perches
@ 2013-07-15 23:23   ` Jingoo Han
  2013-07-15 23:37     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Jingoo Han @ 2013-07-15 23:23 UTC (permalink / raw)
  To: 'Joe Perches'
  Cc: 'Mark Brown', linux-spi, linux-samsung-soc, Jingoo Han

On Monday, July 15, 2013 9:10 PM, Joe Perches wrote:
> On Mon, 2013-07-15 at 15:11 +0900, Jingoo Han wrote:
> []
> > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> []
> > @@ -338,8 +338,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
> []
> > -	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
> > -	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
> > +	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach,
> > +						&req, dev, "rx");
> > +	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach,
> > +						&req, dev, "tx");
> 
> There should be sparse errors here.
> sdd->ops->request is unsigned int, not unsigned long.
> Care to fix the cast of unsigned to pointer too?

OK, I will fix it as below:

sdd->rx_dma.ch = (unsigned long *)sdd->ops->request(sdd->rx_dma.dmach,
							&req, dev, "rx");
sdd->tx_dma.ch = (unsigned long *)sdd->ops->request(sdd->tx_dma.dmach,
							&req, dev, "tx");

> 
> > @@ -439,7 +441,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
> >
> >  	/* Acquire DMA channels */
> >  	sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
> > -				(void*)sdd->rx_dma.dmach, dev, "rx");
> > +				(void *)sdd->rx_dma.dmach, dev, "rx");
> 
> It seems unsigned to pointer conversions are pretty
> rampant in this code.

It seems so.
I will look into it, later.

Thank you for your feedback.

Best regards,
Jingoo Han

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

* Re: [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
  2013-07-15 23:23   ` Jingoo Han
@ 2013-07-15 23:37     ` Joe Perches
  2013-07-15 23:40       ` Jingoo Han
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-07-15 23:37 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Mark Brown', linux-spi, linux-samsung-soc

On Tue, 2013-07-16 at 08:23 +0900, Jingoo Han wrote:
> On Monday, July 15, 2013 9:10 PM, Joe Perches wrote:
> > On Mon, 2013-07-15 at 15:11 +0900, Jingoo Han wrote:
> > []
> > > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> > []
> > > @@ -338,8 +338,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
> > []
> > > -	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
> > > -	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
> > > +	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach,
> > > +						&req, dev, "rx");
> > > +	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach,
> > > +						&req, dev, "tx");
> > 
> > There should be sparse errors here.
> > sdd->ops->request is unsigned int, not unsigned long.
> > Care to fix the cast of unsigned to pointer too?
> 
> OK, I will fix it as below:
> 
> sdd->rx_dma.ch = (unsigned long *)sdd->ops->request(sdd->rx_dma.dmach,
> 							&req, dev, "rx");
> sdd->tx_dma.ch = (unsigned long *)sdd->ops->request(sdd->tx_dma.dmach,
> 							&req, dev, "tx");

Which should give you a different error.

The canonical (Small C, not the Ubuntu company)
way to do this is to first cast to unsigned long
then cast to pointer type.

sdd->tx_dma.ch = (unsigned long *)(unsigned long)sdd->ops->request(etc...)

> > It seems unsigned to pointer conversions are pretty
> > rampant in this code.
> 
> It seems so.
> I will look into it, later.

No worries.  Whenever you get 'round to it.

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

* Re: [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings
  2013-07-15 23:37     ` Joe Perches
@ 2013-07-15 23:40       ` Jingoo Han
  0 siblings, 0 replies; 6+ messages in thread
From: Jingoo Han @ 2013-07-15 23:40 UTC (permalink / raw)
  To: 'Joe Perches'
  Cc: 'Mark Brown', linux-spi, linux-samsung-soc, Jingoo Han

On Monday, Tuesday, July 16, 2013 8:37 AM, Joe Perches wrote:
> On Tue, 2013-07-16 at 08:23 +0900, Jingoo Han wrote:
> > On Monday, July 15, 2013 9:10 PM, Joe Perches wrote:
> > > On Mon, 2013-07-15 at 15:11 +0900, Jingoo Han wrote:
> > > []
> > > > diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> > > []
> > > > @@ -338,8 +338,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
> > > []
> > > > -	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
> > > > -	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");
> > > > +	sdd->rx_dma.ch = (void *)sdd->ops->request(sdd->rx_dma.dmach,
> > > > +						&req, dev, "rx");
> > > > +	sdd->tx_dma.ch = (void *)sdd->ops->request(sdd->tx_dma.dmach,
> > > > +						&req, dev, "tx");
> > >
> > > There should be sparse errors here.
> > > sdd->ops->request is unsigned int, not unsigned long.
> > > Care to fix the cast of unsigned to pointer too?
> >
> > OK, I will fix it as below:
> >
> > sdd->rx_dma.ch = (unsigned long *)sdd->ops->request(sdd->rx_dma.dmach,
> > 							&req, dev, "rx");
> > sdd->tx_dma.ch = (unsigned long *)sdd->ops->request(sdd->tx_dma.dmach,
> > 							&req, dev, "tx");
> 
> Which should give you a different error.
> 
> The canonical (Small C, not the Ubuntu company)
> way to do this is to first cast to unsigned long
> then cast to pointer type.
> 
> sdd->tx_dma.ch = (unsigned long *)(unsigned long)sdd->ops->request(etc...)

Oh, sorry.

I will fix it as you guide, and send v4 patch, soon.
I really appreciate your kind guidance. :)

Best regards,
Jingoo Han

> 
> > > It seems unsigned to pointer conversions are pretty
> > > rampant in this code.
> >
> > It seems so.
> > I will look into it, later.
> 
> No worries.  Whenever you get 'round to it.

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

end of thread, other threads:[~2013-07-15 23:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15  6:11 [PATCH V2 2/2] spi: s3c64xx: fix checkpatch error and warnings Jingoo Han
2013-07-15 12:00 ` Mark Brown
2013-07-15 12:10 ` Joe Perches
2013-07-15 23:23   ` Jingoo Han
2013-07-15 23:37     ` Joe Perches
2013-07-15 23:40       ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox