Skip to contentSkip to conversation

Enable ALIGN #undef for drivers/net/defxx.c

PATCH In review Steven Barnhart 2 participants 3 messages Dec 29, 2002 – Dec 30, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Enable ALIGN #undef for drivers/net/defxx.c

The following patch #undef's the variable ALIGN in include/linux/cache.h so that drivers/net/defxx.c can use the same variable. Patch has been tested and defxx.c compiles. Please apply.

Steven

--------

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.974 -> 1.975
# include/linux/cache.h 1.5 -> 1.6
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/12/29 [email protected] 1.975
# [PATCH] This patch allows drivers/net/defxx.c to compile and use the variable ALIGN which was left defined by include/linux/cache.h. # --------------------------------------------
#

include/linux/cache.h +1 -1
diff -Nru a/include/linux/cache.h b/include/linux/cache.h
@@ -52,5 +52,5 @@
 #define ____cacheline_maxaligned_in_smp
 #endif
 #endif
-
+#undef ALIGN
 #endif /* __LINUX_CACHE_H */

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.974 -> 1.975
# include/linux/cache.h 1.5 -> 1.6
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/12/29 [email protected] 1.975
# [PATCH] This patch allows drivers/net/defxx.c to compile and use the variable ALIGN which was left defined by include/linux/cache.h. # --------------------------------------------
#

include/linux/cache.h +1 -1
diff -Nru a/include/linux/cache.h b/include/linux/cache.h
@@ -52,5 +52,5 @@
 #define ____cacheline_maxaligned_in_smp
 #endif
 #endif
-
+#undef ALIGN
 #endif /* __LINUX_CACHE_H */
#1 lore raw
Quoted 5 lines · Steven Barnhart

The following patch #undef's the variable ALIGN in include/linux/cache.h so that drivers/net/defxx.c can use the same variable. Patch has been tested and defxx.c compiles. Please apply.

But they're identical. It would be better to formalise the kernel-wideness of ALIGN() and just use it in defxx?

 drivers/net/defxx.h    |    7 -------
 include/linux/cache.h  |    3 +--
 include/linux/kernel.h |    1 +
 3 files changed, 2 insertions(+), 9 deletions(-)
include/linux/cache.h renamed from include/linux/cache.h~align +1 -2
@@ -1,11 +1,10 @@
 #ifndef __LINUX_CACHE_H
 #define __LINUX_CACHE_H
 
+#include <linux/kernel.h>
 #include <linux/config.h>
 #include <asm/cache.h>
 
-#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
-
 #ifndef L1_CACHE_ALIGN
 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
 #endif
drivers/net/defxx.h renamed from drivers/net/defxx.h~align +0 -7
@@ -1669,13 +1669,6 @@ typedef union
 #define XMT_BUFF_K_SA		7				/* six byte source address */
 #define XMT_BUFF_K_DATA		13				/* offset to start of packet data */
 
-/*
- * Macro evaluates to "value" aligned to "size" bytes.  Make sure that
- * "size" is greater than 0 bytes.
- */
-
-#define ALIGN(value,size) ((value + (size - 1)) & ~(size - 1))
-
 /* Macro for checking a "value" is within a specific range */
 
 #define IN_RANGE(value,low,high) ((value >= low) && (value <= high))
include/linux/kernel.h renamed from include/linux/kernel.h~align +1 -0
@@ -28,6 +28,7 @@
 #define STACK_MAGIC	0xdeadbeef
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 
 #define	KERN_EMERG	"<0>"	/* system is unusable			*/
 #define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/

_

#2 lore raw
Quoted 2 lines · Andrew Morton

But they're identical. It would be better to formalise the kernel-wideness of ALIGN() and just use it in defxx?

I agree. At least the bug has a chance of getting fixed.

Quoted 49 lines
 drivers/net/defxx.h    |    7 -------
 include/linux/cache.h  |    3 +--
 include/linux/kernel.h |    1 +
 3 files changed, 2 insertions(+), 9 deletions(-)
include/linux/cache.h renamed from include/linux/cache.h~align +1 -2
@@ -1,11 +1,10 @@
 #ifndef __LINUX_CACHE_H
 #define __LINUX_CACHE_H
 
+#include <linux/kernel.h>
 #include <linux/config.h>
 #include <asm/cache.h>
 
-#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
-
 #ifndef L1_CACHE_ALIGN
 #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
 #endif
drivers/net/defxx.h renamed from drivers/net/defxx.h~align +0 -7
@@ -1669,13 +1669,6 @@ typedef union
 #define XMT_BUFF_K_SA		7				/* six byte source address */
 #define XMT_BUFF_K_DATA		13				/* offset to start of packet data */
 
-/*
- * Macro evaluates to "value" aligned to "size" bytes.  Make sure that
- * "size" is greater than 0 bytes.
- */
-
-#define ALIGN(value,size) ((value + (size - 1)) & ~(size - 1))
-
 /* Macro for checking a "value" is within a specific range */
 
 #define IN_RANGE(value,low,high) ((value >= low) && (value <= high))
include/linux/kernel.h renamed from include/linux/kernel.h~align +1 -0
@@ -28,6 +28,7 @@
 #define STACK_MAGIC	0xdeadbeef
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 
 #define	KERN_EMERG	"<0>"	/* system is unusable			*/
 #define	KERN_ALERT	"<1>"	/* action must be taken immediately	*/

_