kernel 2.6 size macro clean ups in
Subsystems (2)
removed the MAX_SPEEDS macro in favor of the more generic ARRAY_SIZE macro defined in kernel.h
Also cleaned up trailing whitespaces.
Compile tested, no issues found at compile time.
drivers/net/irda/actisys-sir.c +16 -18
@@ -1,8 +1,8 @@/********************************************************************* -* +* * Filename: actisys.c * Version: 1.1 -* Description: Implementation for the ACTiSYS IR-220L and IR-220L+ +* Description: Implementation for the ACTiSYS IR-220L and IR-220L+ * dongles * Status: Beta. * Authors: Dag Brattli <[email protected]> (initially)
@@ -11,20 +11,20 @@* Created at: Wed Oct 21 20:02:35 1998 * Modified at: Sun Oct 27 22:02:13 2002 * Modified by: Martin Diehl <[email protected]> -* +* * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1999 Jean Tourrilhes * Copyright (c) 2002 Martin Diehl -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. -* +* * Neither Dag Brattli nor University of Troms������ admit liability nor -* provide warranty for any of this software. This material is +* provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. -* +* ********************************************************************/ /*
@@ -48,7 +48,7 @@#include "sir-dev.h" -/* +/* * Define the timing of the pulses we send to the dongle (to reset it, and * to toggle speeds). Basically, the limit here is the propagation speed of * the signals through the serial port, the dongle being much faster. Any
@@ -67,8 +67,6 @@/* Note : the 220L doesn't support 38400, but we will fix that below */ static unsigned baud_rates[] = {9600 ,19200 ,57600 ,115200 ,38400 }; -#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) -static struct dongle_driver act220l = { .owner =THIS_MODULE , .driver_name ="Actisys ACT-220L" ,
@@ -166,17 +164,17 @@int i =0 ;IRDA_DEBUG (4 ,"%s(), speed=%d (was %d)\n" , __FUNCTION__, - speed, dev->speed); + speed, dev->speed);/* dongle was already resetted from irda_request state machine, * we are in known state (dongle default) */ -/* +/* * Now, we can set the speed requested. Send RTS pulses until we -* reach the target speed +* reach the target speed */ -for (i =0 ; i <MAX_SPEEDS ; i++) { +for (i =0 ; i <ARRAY_SIZE (baud_rates); i++) {if (speed == baud_rates[i]) { dev->speed = speed;break ;
@@ -191,7 +189,7 @@ }/* Check if life is sweet... */ -if (i >=MAX_SPEEDS ) { +if (i >=ARRAY_SIZE (baud_rates)) {actisys_reset (dev); ret = -EINVAL ;/* This should not happen */ }
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
This patch includes a bunch of white-space changes. I recommend passing -B to the diff command.
Jaco
Quoted 108 lines · Aaron Cripps
------------------------------------------------------------------------
removed the
MAX_SPEEDSmacro in favor of the more genericARRAY_SIZEmacro defined inkernel.h
Also cleaned up trailing whitespaces.
Compile tested, no issues found at compile time.Signed-off-by Aaron Cripps <[email protected]>diff -Nuar
linux-2.6/drivers/net/irda/actisys-sir.clinux-2.6-patched/drivers/net/irda/actisys-sir.cdrivers/net/irda/actisys-sir.c +16
-19@@ -1,8 +1,8 @@/********************************************************************* -* +* * Filename: actisys.c * Version: 1.1 -* Description: Implementation for the ACTiSYS IR-220L and IR-220L+ +* Description: Implementation for the ACTiSYS IR-220L and IR-220L+ * dongles * Status: Beta. * Authors: Dag Brattli <[email protected]> (initially) @@ -11,20 +11,20 @@* Created at: Wed Oct 21 20:02:35 1998 * Modified at: Sun Oct 27 22:02:13 2002 * Modified by: Martin Diehl <[email protected]> -* +* * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. * Copyright (c) 1999 Jean Tourrilhes * Copyright (c) 2002 Martin Diehl -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. -* +* * Neither Dag Brattli nor University of Tromsø admit liability nor -* provide warranty for any of this software. This material is +* provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. -* +* ********************************************************************/ /* @@ -48,7 +48,7 @@#include "sir-dev.h" -/* +/* * Define the timing of the pulses we send to the dongle (to reset it, and * to toggle speeds). Basically, the limit here is the propagation speed of * the signals through the serial port, the dongle being much faster. Any @@ -67,8 +67,6 @@/* Note : the 220L doesn't support 38400, but we will fix that below */ static unsigned baud_rates[] = {9600 ,19200 ,57600 ,115200 ,38400 }; -#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) -static struct dongle_driver act220l = { .owner =THIS_MODULE , .driver_name ="Actisys ACT-220L" ,@@ -166,17 +164,17 @@int i =0 ;IRDA_DEBUG (4 ,"%s(), speed=%d (was %d)\n" , __FUNCTION__, - speed, dev->speed); + speed, dev->speed);/* dongle was already resetted from irda_request state machine, * we are in known state (dongle default) */ -/* +/* * Now, we can set the speed requested. Send RTS pulses until we -* reach the target speed +* reach the target speed */ -for (i =0 ; i <MAX_SPEEDS ; i++) { +for (i =0 ; i <ARRAY_SIZE (baud_rates); i++) {if (speed = baud_rates[i]) { dev->speed = speed;break ;@@ -191,7 +189,7 @@ }/* Check if life is sweet... */ -if (i >=MAX_SPEEDS ) { +if (i >=ARRAY_SIZE (baud_rates)) {actisys_reset (dev); ret = -EINVAL ;/* This should not happen */ } ------------------------------------------------------------------------
Quoted 4 lines
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
In reply to Aaron CrippsQuoted 4 lines · Jaco Kroon
This patch includes a bunch of white-space changes. I recommend passing -B to the diff command.
Jaco
Actually, I did that on purpose, as is mentioned in the Patch. The whitespace changes are "harmless" and
make for "better formatted" code. (okay, so the formatting is the same, but at least the code after the whitespace
changes is somewhat uniform).
-acripps
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
In reply to Aaron CrippsQuoted 11 lines · Aaron Cripps
Quoted 4 lines · Jaco Kroon
This patch includes a bunch of white-space changes. I recommend passing -B to the diff command.
Jaco
Actually, I did that on purpose, as is mentioned in the Patch. The whitespace changes are "harmless" and
make for "better formatted" code. (okay, so the formatting is the same, but at least the code after the whitespace
changes is somewhat uniform).
-acripps
Perhaps, but then these are two different "changes" and should probably be separate patches.
Jaco
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
In reply to Aaron CrippsQuoted 4 lines · On Wed, 30 May 2007 00:17:15 +0200 Jaco Kroon wrote:
Quoted 3 lines · Aaron Cripps
Quoted 2 lines · Jaco Kroon
This patch includes a bunch of white-space changes. I recommend passing -B to the diff command.
We really don't want to risk mis-applying a patch.
Quoted 10 lines
Quoted 7 lines
Quoted 1 line
Jaco
Actually, I did that on purpose, as is mentioned in the Patch. The whitespace changes are "harmless" and
make for "better formatted" code. (okay, so the formatting is the same, but at least the code after the whitespace
changes is somewhat uniform).
-acrippsPerhaps, but then these are two different "changes" and should probably be separate patches.
Agreed.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
In reply to Aaron CrippsQuoted 8 lines · Randy Dunlap
Quoted 4 lines · On Wed, 30 May 2007 00:17:15 +0200 Jaco Kroon wrote:
Quoted 3 lines · Aaron Cripps
Quoted 2 lines · Jaco Kroon
This patch includes a bunch of white-space changes. I recommend passing -B to the diff command.
We really don't want to risk mis-applying a patch.
-B and -b does two different things. -B will simply ignore the diff between two lines IFF the only changes is whitespace. In other words, if the destination line is the same as the source except for whitespace it'll pretend the destination is the same in terms of whitespace as well.
-b however is dangerous. It breaks things. Avoid.
Jaco
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
this is a simple patch to remove the MAX_SPEEDS macro in favor of the more generic ARRAY_SIZE(arr) macro defined in kernel.h
drivers/net/irda/actisys-sir.c +0 -2
@@ -67,8 +67,6 @@ static int actisys_reset(struct sir_dev *);/* Note : the 220L doesn't support 38400, but we will fix that below */ static unsigned baud_rates[] = {9600 ,19200 ,57600 ,115200 ,38400 }; -#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) -static struct dongle_driver act220l = { .owner =THIS_MODULE , .driver_name ="Actisys ACT-220L" ,
@@ -176,7 +174,7 @@ static int actisys_change_speed(struct sir_dev *dev,
unsigned speed)
* Now, we can set the speed requested. Send RTS pulses until we
* reach the target speed
*/
- for (i = 0; i < MAX_SPEEDS; i++) {
+ for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
if (speed = baud_rates[i]) {
dev->speed = speed;
break;
@@ -191,7 +189,7 @@ static int actisys_change_speed(struct sir_dev *dev,
unsigned speed)
}
/* Check if life is sweet... */
- if (i >= MAX_SPEEDS) {
+ if (i >= ARRAY_SIZE(baud_rates)) {
actisys_reset(dev);
ret = -EINVAL; /* This should not happen */
}_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
this is a simple patch to remove the MAX_SPEEDS macro in favor of the more generic ARRAY_SIZE(arr) macro defined in kernel.h
RE: Forgot the #import <linux/kernel.h> statement. It's there now.
drivers/net/irda/actisys-sir.c +0 -0
@@ -43,7 +43,7 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/init.h>
-
+#include <linux/kernel.h>
#include <net/irda/irda.h>
#include "sir-dev.h"
@@ -67,8 +67,6 @@ static int actisys_reset(struct sir_dev *);
/* Note : the 220L doesn't support 38400, but we will fix that below */ static unsigned baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
-#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) -
static struct dongle_driver act220l = {
.owner = THIS_MODULE,
.driver_name = "Actisys ACT-220L",
@@ -176,7 +174,7 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed)
* Now, we can set the speed requested. Send RTS pulses until we
* reach the target speed
*/
- for (i = 0; i < MAX_SPEEDS; i++) {
+ for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
if (speed = baud_rates[i]) {
dev->speed = speed;
break;
@@ -191,7 +189,7 @@ static int actisys_change_speed(struct sir_dev *dev,
unsigned speed)
}
/* Check if life is sweet... */
- if (i >= MAX_SPEEDS) {
+ if (i >= ARRAY_SIZE(baud_rates)) {
actisys_reset(dev);
ret = -EINVAL; /* This should not happen */
}_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] Re: [PATCH ARRAY_SIZE 1/4] kernel 2.6 size macro clean ups
In reply to Aaron CrippsQuoted 13 lines · Aaron Cripps
this is a simple patch to remove the
MAX_SPEEDSmacro in favor of the more
genericARRAY_SIZE(arr)macro defined inkernel.h
RE: Forgot the #import <linux/kernel.h> statement. It's there now.Signed-off-by Aaron Cripps <[email protected]>drivers/net/irda/actisys-sir.c +0
-0
drivers/net/irda/actisys-sir.c line 46
Quoted 5 lines
drivers/net/irda/actisys-sir.c +1
-1@@ -43,7 +43,7 @@#include <linux/module.h> #include <linux/delay.h> #include <linux/init.h> - +#include <linux/kernel.h>
The patch is space-padded, please fix your client (or use ex the script "sendpatchset") and send again. (The patch seemed correct otherwise)
drivers/net/irda/actisys-sir.c static int actisys_reset(struct sir_dev *); · line 71
Quoted 9 lines
drivers/net/irda/actisys-sir.c +0
-2#include <net/irda/irda.h> #include "sir-dev.h" @@ -67,8 +67,6 @@ static int actisys_reset(struct sir_dev *);/* Note : the 220L doesn't support 38400, but we will fix that below */ static unsigned baud_rates[] = {9600 ,19200 ,57600 ,115200 ,38400 }; -#define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0])) -
Can anyone explain why the number of possible speeds are called MAX_SPEEDS? Maybe it should have been NUM_MAX_SPEEDS...
Richard Knutsson
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors