public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
@ 2009-11-05 13:46 Thiago Farina
  2009-11-10 23:01 ` Thiago Farina
  2009-11-11  0:09 ` Harik
  0 siblings, 2 replies; 6+ messages in thread
From: Thiago Farina @ 2009-11-05 13:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thiago Farina

This macro is a duplicated of ARRAY_SIZE defined in kernel api,
so just use it instead.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 drivers/serial/68328serial.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index d935b2d..d761109 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -153,8 +153,6 @@ static int baud_table[] = {
 	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
 	9600, 19200, 38400, 57600, 115200, 0 };
 
-#define BAUD_TABLE_SIZE (sizeof(baud_table)/sizeof(baud_table[0]))
-
 /* Sets or clears DTR/RTS on the requested line */
 static inline void m68k_rtsdtr(struct m68k_serial *ss, int set)
 {
@@ -1406,15 +1404,15 @@ static void m68328_set_baud(void)
 	USTCNT = ustcnt & ~USTCNT_TXEN;
 
 again:
-	for (i = 0; i < sizeof(baud_table) / sizeof(baud_table[0]); i++)
+	for (i = 0; i < ARRAY_SIZE(baud_table); i++)
 		if (baud_table[i] == m68328_console_baud)
 			break;
-	if (i >= sizeof(baud_table) / sizeof(baud_table[0])) {
+	if (i >= ARRAY_SIZE(baud_table)) {
 		m68328_console_baud = 9600;
 		goto again;
 	}
 
-	UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) | 
+	UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) |
 		PUT_FIELD(UBAUD_PRESCALER, hw_baud_table[i].prescale);
 	ustcnt &= ~(USTCNT_PARITYEN | USTCNT_ODD_EVEN | USTCNT_STOP | USTCNT_8_7);
 	ustcnt |= USTCNT_8_7;
@@ -1435,7 +1433,7 @@ int m68328_console_setup(struct console *cp, char *arg)
 	if (arg)
 		n = simple_strtoul(arg,NULL,0);
 
-	for (i = 0; i < BAUD_TABLE_SIZE; i++)
+	for (i = 0; i < ARRAY_SIZE(baud_table); i++)
 		if (baud_table[i] == n)
 			break;
 	if (i < BAUD_TABLE_SIZE) {
-- 
1.6.5.1.61.ge79999


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

* Re: [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
  2009-11-05 13:46 [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro Thiago Farina
@ 2009-11-10 23:01 ` Thiago Farina
  2009-11-11  0:09 ` Harik
  1 sibling, 0 replies; 6+ messages in thread
From: Thiago Farina @ 2009-11-10 23:01 UTC (permalink / raw)
  To: linux-kernel

Ping?

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

* Re: [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
  2009-11-05 13:46 [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro Thiago Farina
  2009-11-10 23:01 ` Thiago Farina
@ 2009-11-11  0:09 ` Harik
  2009-11-11  0:11   ` Greg KH
  1 sibling, 1 reply; 6+ messages in thread
From: Harik @ 2009-11-11  0:09 UTC (permalink / raw)
  To: Thiago Farina
  Cc: linux-kernel, Greg Kroah-Hartman, Alan Cox, Andrew Morton,
	Alexey Dobriyan, Kay Sievers

On Thu, Nov 5, 2009 at 8:46 AM, Thiago Farina <tfransosi@gmail.com> wrote:
> This macro is a duplicated of ARRAY_SIZE defined in kernel api,
> so just use it instead.

> -       UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) |
> +       UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) |

Random bit of whitespace got in the patch

Since nobody directly owns this file, CCing maintainers listed for serial_core

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

* Re: [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
  2009-11-11  0:09 ` Harik
@ 2009-11-11  0:11   ` Greg KH
  2009-11-11  0:29     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2009-11-11  0:11 UTC (permalink / raw)
  To: Harik
  Cc: Thiago Farina, linux-kernel, Alan Cox, Andrew Morton,
	Alexey Dobriyan, Kay Sievers

On Tue, Nov 10, 2009 at 07:09:30PM -0500, Harik wrote:
> On Thu, Nov 5, 2009 at 8:46 AM, Thiago Farina <tfransosi@gmail.com> wrote:
> > This macro is a duplicated of ARRAY_SIZE defined in kernel api,
> > so just use it instead.
> 
> > -       UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) |
> > +       UBAUD = PUT_FIELD(UBAUD_DIVIDE,    hw_baud_table[i].divisor) |
> 
> Random bit of whitespace got in the patch

What patch?

> Since nobody directly owns this file, CCing maintainers listed for serial_core

Sure, care to point me at a correct one?

thanks,

greg k-h

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

* Re: [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
  2009-11-11  0:11   ` Greg KH
@ 2009-11-11  0:29     ` Andrew Morton
  2009-11-11 12:19       ` Thiago Farina
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-11-11  0:29 UTC (permalink / raw)
  To: Greg KH
  Cc: Harik, Thiago Farina, linux-kernel, Alan Cox, Alexey Dobriyan,
	Kay Sievers

On Tue, 10 Nov 2009 16:11:00 -0800
Greg KH <gregkh@suse.de> wrote:

> On Tue, Nov 10, 2009 at 07:09:30PM -0500, Harik wrote:
> > On Thu, Nov 5, 2009 at 8:46 AM, Thiago Farina <tfransosi@gmail.com> wrote:
> > > This macro is a duplicated of ARRAY_SIZE defined in kernel api,
> > > so just use it instead.
> > 
> > > - __ __ __ UBAUD = PUT_FIELD(UBAUD_DIVIDE, __ __hw_baud_table[i].divisor) |
> > > + __ __ __ UBAUD = PUT_FIELD(UBAUD_DIVIDE, __ __hw_baud_table[i].divisor) |
> > 
> > Random bit of whitespace got in the patch
> 
> What patch?

That patch!

> > Since nobody directly owns this file, CCing maintainers listed for serial_core
> 
> Sure, care to point me at a correct one?

I got it.

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

* Re: [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro.
  2009-11-11  0:29     ` Andrew Morton
@ 2009-11-11 12:19       ` Thiago Farina
  0 siblings, 0 replies; 6+ messages in thread
From: Thiago Farina @ 2009-11-11 12:19 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greg KH, Harik, linux-kernel, Alan Cox, Alexey Dobriyan,
	Kay Sievers

On Tue, Nov 10, 2009 at 10:29 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> I got it.

Thanks Andrew, sorry for the confusion about cc'ed people, that was
because get_maintainer.pl does not return anyone, so I didn't know who
should be copied. But will pay more attention on this next time.

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

end of thread, other threads:[~2009-11-11 12:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 13:46 [PATCH] drivers/serial: remove BAUD_TABLE_SIZE macro Thiago Farina
2009-11-10 23:01 ` Thiago Farina
2009-11-11  0:09 ` Harik
2009-11-11  0:11   ` Greg KH
2009-11-11  0:29     ` Andrew Morton
2009-11-11 12:19       ` Thiago Farina

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