driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems.
@ 2019-10-09  3:50 Chandra Annamaneni
  2019-10-09  7:43 ` Greg KH
  2019-10-09  7:57 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Chandra Annamaneni @ 2019-10-09  3:50 UTC (permalink / raw)
  To: gregkh
  Cc: devel, gneukum1, chandra627, michael.scheiderer, fabian.krueger,
	linux-kernel, simon

	Fixed alignment and style issues raised by checkpatch.pl

Signed-off-by: Chandra Annamaneni <chandra627@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 49 ++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 3be33c4..a20f2d7 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -30,19 +30,27 @@
 #include "kpc.h"
 
 static struct mtd_partition p2kr0_spi0_parts[] = {
-	{ .name = "SLOT_0",	.size = 7798784,		.offset = 0,                },
-	{ .name = "SLOT_1",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "SLOT_2",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "SLOT_3",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "CS0_EXTRA",	.size = MTDPART_SIZ_FULL,	.offset = MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_0",	.size = 7798784,	.offset = 0,},
+	{ .name = "SLOT_1",	.size = 7798784,	.offset =
+							 MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_2",	.size = 7798784,	.offset =
+							 MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_3",	.size = 7798784,	.offset =
+							 MTDPART_OFS_NXTBLK},
+	{ .name = "CS0_EXTRA",	.size = MTDPART_SIZ_FULL,	.offset =
+							 MTDPART_OFS_NXTBLK},
 };
 
 static struct mtd_partition p2kr0_spi1_parts[] = {
-	{ .name = "SLOT_4",	.size = 7798784,		.offset = 0,                },
-	{ .name = "SLOT_5",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "SLOT_6",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "SLOT_7",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
-	{ .name = "CS1_EXTRA",	.size = MTDPART_SIZ_FULL,	.offset = MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_4",	.size = 7798784,	.offset = 0,},
+	{ .name = "SLOT_5",	.size = 7798784,	.offset =
+							   MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_6",	.size = 7798784,	.offset =
+							   MTDPART_OFS_NXTBLK},
+	{ .name = "SLOT_7",	.size = 7798784,	.offset =
+							   MTDPART_OFS_NXTBLK},
+	{ .name = "CS1_EXTRA",	.size = MTDPART_SIZ_FULL,	.offset =
+							   MTDPART_OFS_NXTBLK},
 };
 
 static struct flash_platform_data p2kr0_spi0_pdata = {
@@ -50,6 +58,7 @@ static struct flash_platform_data p2kr0_spi0_pdata = {
 	.nr_parts =	ARRAY_SIZE(p2kr0_spi0_parts),
 	.parts =	p2kr0_spi0_parts,
 };
+
 static struct flash_platform_data p2kr0_spi1_pdata = {
 	.name =		"SPI1",
 	.nr_parts =	ARRAY_SIZE(p2kr0_spi1_parts),
@@ -165,7 +174,7 @@ kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
 	u64 val;
 
 	addr += idx;
-	if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0))
+	if (idx == KP_SPI_REG_CONFIG && cs->conf_cache >= 0)
 		return cs->conf_cache;
 
 	val = readq(addr);
@@ -227,8 +236,7 @@ kp_spi_txrx_pio(struct spi_device *spidev, struct spi_transfer *transfer)
 			kp_spi_write_reg(cs, KP_SPI_REG_TXDATA, val);
 			processed++;
 		}
-	}
-	else if (rx) {
+	} else if (rx) {
 		for (i = 0 ; i < c ; i++) {
 			char test = 0;
 
@@ -315,19 +323,18 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
 		if (transfer->speed_hz > KP_SPI_CLK ||
 		    (len && !(rx_buf || tx_buf))) {
 			dev_dbg(kpspi->dev, "  transfer: %d Hz, %d %s%s, %d bpw\n",
-					transfer->speed_hz,
-					len,
-					tx_buf ? "tx" : "",
-					rx_buf ? "rx" : "",
-					transfer->bits_per_word);
+				transfer->speed_hz,
+				len,
+				tx_buf ? "tx" : "",
+				rx_buf ? "rx" : "",
+				transfer->bits_per_word);
 			dev_dbg(kpspi->dev, "  transfer -EINVAL\n");
 			return -EINVAL;
 		}
 		if (transfer->speed_hz &&
 		    transfer->speed_hz < (KP_SPI_CLK >> 15)) {
 			dev_dbg(kpspi->dev, "speed_hz %d below minimum %d Hz\n",
-					transfer->speed_hz,
-					KP_SPI_CLK >> 15);
+				transfer->speed_hz, KP_SPI_CLK >> 15);
 			dev_dbg(kpspi->dev, "  speed_hz -EINVAL\n");
 			return -EINVAL;
 		}
@@ -478,7 +485,7 @@ kp_spi_probe(struct platform_device *pldev)
 	/* register the slave boards */
 #define NEW_SPI_DEVICE_FROM_BOARD_INFO_TABLE(table) \
 	for (i = 0 ; i < ARRAY_SIZE(table) ; i++) { \
-		spi_new_device(master, &(table[i])); \
+		spi_new_device(master, &table[i]); \
 	}
 
 	switch ((drvdata->card_id & 0xFFFF0000) >> 16) {
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems.
  2019-10-09  3:50 [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems Chandra Annamaneni
@ 2019-10-09  7:43 ` Greg KH
  2019-10-09  7:57 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2019-10-09  7:43 UTC (permalink / raw)
  To: Chandra Annamaneni
  Cc: devel, gneukum1, michael.scheiderer, fabian.krueger, linux-kernel, simon

On Tue, Oct 08, 2019 at 08:50:39PM -0700, Chandra Annamaneni wrote:
> 	Fixed alignment and style issues raised by checkpatch.pl

Why is this padded?

Also, you need to break this up into "one logical change per patch",
you can't "fix all style issues" at once, sorry.

Please fix this up and send it as a patch series.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems.
  2019-10-09  3:50 [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems Chandra Annamaneni
  2019-10-09  7:43 ` Greg KH
@ 2019-10-09  7:57 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-10-09  7:57 UTC (permalink / raw)
  To: Chandra Annamaneni
  Cc: devel, gneukum1, michael.scheiderer, fabian.krueger, gregkh,
	linux-kernel, simon

On Tue, Oct 08, 2019 at 08:50:39PM -0700, Chandra Annamaneni wrote:
> diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
> index 3be33c4..a20f2d7 100644
> --- a/drivers/staging/kpc2000/kpc2000_spi.c
> +++ b/drivers/staging/kpc2000/kpc2000_spi.c
> @@ -30,19 +30,27 @@
>  #include "kpc.h"
>  
>  static struct mtd_partition p2kr0_spi0_parts[] = {
> -	{ .name = "SLOT_0",	.size = 7798784,		.offset = 0,                },
> -	{ .name = "SLOT_1",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
> -	{ .name = "SLOT_2",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
> -	{ .name = "SLOT_3",	.size = 7798784,		.offset = MTDPART_OFS_NXTBLK},
> -	{ .name = "CS0_EXTRA",	.size = MTDPART_SIZ_FULL,	.offset = MTDPART_OFS_NXTBLK},
> +	{ .name = "SLOT_0",	.size = 7798784,	.offset = 0,},
> +	{ .name = "SLOT_1",	.size = 7798784,	.offset =
> +							 MTDPART_OFS_NXTBLK},

This looks worse than the original code...  :(  You could maybe make it
a little bit tighter if you used space characters.

	{ .name = "SLOT_0",    .size = 7798784,		 .offset = 0,                },
	{ .name = "SLOT_1",    .size = 7798784,		 .offset = MTDPART_OFS_NXTBLK},
	{ .name = "SLOT_2",    .size = 7798784,		 .offset = MTDPART_OFS_NXTBLK},
	{ .name = "SLOT_3",    .size = 7798784,	         .offset = MTDPART_OFS_NXTBLK},
	{ .name = "CS0_EXTRA", .size = MTDPART_SIZ_FULL, .offset = MTDPART_OFS_NXTBLK},

It still goes over 80 characters, but that's okay.  Or we could just
leave the original code as is.

[ snip ]

>  static struct flash_platform_data p2kr0_spi1_pdata = {
>  	.name =		"SPI1",
>  	.nr_parts =	ARRAY_SIZE(p2kr0_spi1_parts),
> @@ -165,7 +174,7 @@ kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
>  	u64 val;
>  
>  	addr += idx;
> -	if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0))
> +	if (idx == KP_SPI_REG_CONFIG && cs->conf_cache >= 0)

I like these changes but Greg doesn't.  So don't bother with this one.

>  		return cs->conf_cache;
>  
>  	val = readq(addr);

The rest of the changes are fine.  Split them into multiple patches and
resend.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2019-10-09  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  3:50 [PATCH] KPC2000: kpc2000_spi.c: Fix alignment and style problems Chandra Annamaneni
2019-10-09  7:43 ` Greg KH
2019-10-09  7:57 ` Dan Carpenter

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