Skip to contentSkip to conversation

2.6 drivers/net actisys-sir replace SIZE macros

PATCH In review acripps 2 participants 2 messages Jun 9, 2007

Subsystems (2)
lore
Share & tools
lore

acripps

author
#0 lore raw

PATCH 1/4 2.6 drivers/net actisys-sir replace SIZE macros

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 -0
index 9715ab5..44bf0c2 100644
@@ -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

#1 lore raw

2007/6/9, acripps <[email protected]>:

Quoted 11 lines

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 -0
index 9715ab5..44bf0c2 100644

drivers/net/irda/actisys-sir.c line 48

Quoted 7 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>
 #include <net/irda/irda.h>
 

Maybe I'm just picking, but I don't think you should remove the white line that was put between init.h and irda.h. It seems like the author wanted to distinguish between the headers of 'linux' and those of the networking subsystem.

I would therefore suggest placing kernel.h directly below init.h, leave the white line, and then include irda.h.

Thomas
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors