* [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues
@ 2014-03-06 23:25 Gary Servin
2014-03-07 2:38 ` Alexandre Courbot
2014-03-12 13:53 ` Linus Walleij
0 siblings, 2 replies; 5+ messages in thread
From: Gary Servin @ 2014-03-06 23:25 UTC (permalink / raw)
To: linus.walleij, gnurou; +Cc: trivial, linux-gpio, linux-kernel, Gary Servin
This coding style issue was detected using the checkpatch.pl script
Signed-off-by: Gary Servin <garyservin@gmail.com>
---
drivers/gpio/gpio-mcp23s08.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 1ac288e..e1734c1 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -173,7 +173,7 @@ static int mcp23s08_read(struct mcp23s08 *mcp, unsigned reg)
tx[0] = mcp->addr | 0x01;
tx[1] = reg;
- status = spi_write_then_read(mcp->data, tx, sizeof tx, rx, sizeof rx);
+ status = spi_write_then_read(mcp->data, tx, sizeof(tx), rx, sizeof(rx));
return (status < 0) ? status : rx[0];
}
@@ -184,7 +184,7 @@ static int mcp23s08_write(struct mcp23s08 *mcp, unsigned reg, unsigned val)
tx[0] = mcp->addr;
tx[1] = reg;
tx[2] = val;
- return spi_write_then_read(mcp->data, tx, sizeof tx, NULL, 0);
+ return spi_write_then_read(mcp->data, tx, sizeof(tx), NULL, 0);
}
static int
@@ -193,13 +193,13 @@ mcp23s08_read_regs(struct mcp23s08 *mcp, unsigned reg, u16 *vals, unsigned n)
u8 tx[2], *tmp;
int status;
- if ((n + reg) > sizeof mcp->cache)
+ if ((n + reg) > sizeof(mcp->cache))
return -EINVAL;
tx[0] = mcp->addr | 0x01;
tx[1] = reg;
tmp = (u8 *)vals;
- status = spi_write_then_read(mcp->data, tx, sizeof tx, tmp, n);
+ status = spi_write_then_read(mcp->data, tx, sizeof(tx), tmp, n);
if (status >= 0) {
while (n--)
vals[n] = tmp[n]; /* expand to 16bit */
@@ -214,7 +214,7 @@ static int mcp23s17_read(struct mcp23s08 *mcp, unsigned reg)
tx[0] = mcp->addr | 0x01;
tx[1] = reg << 1;
- status = spi_write_then_read(mcp->data, tx, sizeof tx, rx, sizeof rx);
+ status = spi_write_then_read(mcp->data, tx, sizeof(tx), rx, sizeof(rx));
return (status < 0) ? status : (rx[0] | (rx[1] << 8));
}
@@ -226,7 +226,7 @@ static int mcp23s17_write(struct mcp23s08 *mcp, unsigned reg, unsigned val)
tx[1] = reg << 1;
tx[2] = val;
tx[3] = val >> 8;
- return spi_write_then_read(mcp->data, tx, sizeof tx, NULL, 0);
+ return spi_write_then_read(mcp->data, tx, sizeof(tx), NULL, 0);
}
static int
@@ -235,12 +235,12 @@ mcp23s17_read_regs(struct mcp23s08 *mcp, unsigned reg, u16 *vals, unsigned n)
u8 tx[2];
int status;
- if ((n + reg) > sizeof mcp->cache)
+ if ((n + reg) > sizeof(mcp->cache))
return -EINVAL;
tx[0] = mcp->addr | 0x01;
tx[1] = reg << 1;
- status = spi_write_then_read(mcp->data, tx, sizeof tx,
+ status = spi_write_then_read(mcp->data, tx, sizeof(tx),
(u8 *)vals, n * 2);
if (status >= 0) {
while (n--)
@@ -567,7 +567,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip)
(mcp->cache[MCP_GPIO] & mask) ? "hi" : "lo",
(mcp->cache[MCP_GPPU] & mask) ? "up" : " ");
/* NOTE: ignoring the irq-related registers */
- seq_printf(s, "\n");
+ seq_puts(s, "\n");
}
done:
mutex_unlock(&mcp->lock);
@@ -789,7 +789,7 @@ static int mcp230xx_probe(struct i2c_client *client,
pullups = pdata->chip[0].pullups;
}
- mcp = kzalloc(sizeof *mcp, GFP_KERNEL);
+ mcp = kzalloc(sizeof(*mcp), GFP_KERNEL);
if (!mcp)
return -ENOMEM;
@@ -925,7 +925,7 @@ static int mcp23s08_probe(struct spi_device *spi)
base = pdata->base;
}
- data = kzalloc(sizeof *data + chips * sizeof(struct mcp23s08),
+ data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08),
GFP_KERNEL);
if (!data)
return -ENOMEM;
--
1.9.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues
2014-03-06 23:25 [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues Gary Servin
@ 2014-03-07 2:38 ` Alexandre Courbot
2014-03-12 13:53 ` Linus Walleij
1 sibling, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2014-03-07 2:38 UTC (permalink / raw)
To: Gary Servin; +Cc: Linus Walleij, trivial, linux-gpio, Linux Kernel Mailing List
On Fri, Mar 7, 2014 at 8:25 AM, Gary Servin <garyservin@gmail.com> wrote:
> This coding style issue was detected using the checkpatch.pl script
Phew. These ones were bad.
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues
2014-03-06 23:25 [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues Gary Servin
2014-03-07 2:38 ` Alexandre Courbot
@ 2014-03-12 13:53 ` Linus Walleij
2014-03-12 20:16 ` Gerhard Sittig
1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2014-03-12 13:53 UTC (permalink / raw)
To: Gary Servin; +Cc: Alexandre Courbot, Jiri Kosina, linux-gpio, linux-kernel
On Fri, Mar 7, 2014 at 12:25 AM, Gary Servin <garyservin@gmail.com> wrote:
> This coding style issue was detected using the checkpatch.pl script
>
> Signed-off-by: Gary Servin <garyservin@gmail.com>
Sometimes the compiler is just too forgiving :-/
Thanks a lot for fixing this, patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues
2014-03-12 13:53 ` Linus Walleij
@ 2014-03-12 20:16 ` Gerhard Sittig
2014-03-14 10:19 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Gerhard Sittig @ 2014-03-12 20:16 UTC (permalink / raw)
To: Linus Walleij
Cc: Gary Servin, Alexandre Courbot, Jiri Kosina, linux-gpio, linux-kernel
On Wed, Mar 12, 2014 at 14:53 +0100, Linus Walleij wrote:
>
> On Fri, Mar 7, 2014 at 12:25 AM, Gary Servin <garyservin@gmail.com> wrote:
>
> > This coding style issue was detected using the checkpatch.pl script
> >
> > Signed-off-by: Gary Servin <garyservin@gmail.com>
>
> Sometimes the compiler is just too forgiving :-/
> Thanks a lot for fixing this, patch applied.
I think the code had no syntax or language issue before. The
cleanup really was about style exclusively (which still is a good
thing). 'sizeof' is an operator, very much like a unary minus or
unary ampersand which neither require parentheses. So either of
"sizeof(x)" as well as "sizeof x" are legal with regard to the C
language. It's just that the community prefers "sizeof(x)" for
the improved readability.
virtually yours
Gerhard Sittig
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues
2014-03-12 20:16 ` Gerhard Sittig
@ 2014-03-14 10:19 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-03-14 10:19 UTC (permalink / raw)
To: Gerhard Sittig
Cc: Gary Servin, Alexandre Courbot, Jiri Kosina, linux-gpio, linux-kernel
On Wed, Mar 12, 2014 at 9:16 PM, Gerhard Sittig <gsi@denx.de> wrote:
> 'sizeof' is an operator, very much like a unary minus or
> unary ampersand which neither require parentheses. So either of
> "sizeof(x)" as well as "sizeof x" are legal with regard to the C
> language. It's just that the community prefers "sizeof(x)" for
> the improved readability.
You're right, amazingly. Thanks for teaching me something new
today!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-14 10:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06 23:25 [PATCH] gpio: mcp23s08: Trivial: Fixed coding style issues Gary Servin
2014-03-07 2:38 ` Alexandre Courbot
2014-03-12 13:53 ` Linus Walleij
2014-03-12 20:16 ` Gerhard Sittig
2014-03-14 10:19 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.