Skip to contentSkip to conversation

*** SUBJECT HERE ***

PATCH In review Andrew Lunn 3 participants 20 messages May 1, 2010 Staging

lore
Share & tools
lore
#0 lore raw

cover *** SUBJECT HERE ***

Hi Marek

I'm preparing a set of patches for GregKH for linux-next. I compared the resulting mainline tree to maint and found a few differences. These patches bring maint into line with linux-next.

I've no idea if these patches affect backwards compatibility with old kernels. The last one might...

Andrew Lunn (4):
batman-adv: Update README to match mainline README.
batman-adv: Import sparse fixes from mainline.
batman-adv: whitespace fixes from mainline.
batman-adv: include cleanup: Update gfp.h and slab.h includes to
prepare for breaking implicit...

 README           |   35 +++++++++--------------------------
 bat_sysfs.c      |    9 ++++++---
 bitarray.c       |    2 +-
 device.c         |    3 +--
 main.h           |    5 +++--
 routing.c        |    3 ++-
 send.c           |    3 ++-
 soft-interface.c |    2 +-
 vis.c            |   14 +++++++-------
 9 files changed, 32 insertions(+), 44 deletions(-)
#1 lore raw

PATCH 1/4 batman-adv: Update README to match mainline README.

---
 README |   35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 deletions(-)
README +9 -26
index 4c2a6c6..e2a7271 100644
@@ -15,19 +15,6 @@ above B.A.T.M.A.N. Advanced, prominent examples are: IPv4, IPv6, DHCP, IPX.
 This is batman-advanced implemented as Linux kernel driver. It does not depend
 on any network (other) driver, and can be used on wifi as well as ethernet,
 vpn, etc ... (anything with ethernet-style layer 2).
-It compiles against and should work with Linux 2.6.20 - 2.6.33. Supporting older
-versions is not planned, but it's probably easy to backport it. If you work on a
-backport, feel free to contact us.  :-)
-
-COMPILE
--------
-To compile against your currently installed kernel, just type:
-
-# make
-
-if you want to compile against some other kernel, use:
-
-# make KERNELPATH=/path/to/kernel
 
 USAGE
 -----
@@ -123,15 +110,11 @@ dmesg | grep batman-adv
 
 When investigating problems with your mesh network it is sometimes
 necessary to see more detail debug messages. This must be enabled when
-compiling the batman-adv module. When building batman-adv as part of
-kernel, use "make menuconfig" and enable the option
-"B.A.T.M.A.N. debugging". When compiling outside of the kernel tree it
-is necessary to edit the file Makefile.kbuild and uncomment the line
-
-#EXTRA_CFLAGS += -DCONFIG_BATMAN_ADV_DEBUG
+compiling the batman-adv module. Use "make menuconfig" and enable the
+option "B.A.T.M.A.N. debugging".
 
 The additional debug output is by default disabled. It can be enabled
-either at kernel modules load time or during run time. To enable debug
+either at kernel module load time or during run time. To enable debug
 output at module load time, add the module parameter debug=<value>.
 <value> can take one of four values.
 
@@ -160,12 +143,12 @@ to see the debug messages.
 BATCTL
 ------
 
-B.A.T.M.A.N.  advanced  operates on layer 2 and thus all hosts partici-
-pating in the virtual switch are completely transparent for all  proto-
-cols above layer 2. Therefore the common diagnosis tools do not work as
-expected. To overcome these problems batctl was created. At the  moment
-the  batctl contains ping, traceroute, tcpdump and interfaces to the
-kernel module settings.
+B.A.T.M.A.N.  advanced operates on layer 2 and thus all hosts
+participating in the virtual switch are completely transparent for all
+protocols above layer 2. Therefore the common diagnosis tools do not
+work as expected. To overcome these problems batctl was created. At
+the moment the batctl contains ping, traceroute, tcpdump and
+interfaces to the kernel module settings.
 
 For more information, please see the manpage (man batctl).
 
Signature · 1 line
1.7.1
#2 lore raw

Re: [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Update README to match mainline README.

Quoted 17 lines · Andrew Lunn
---
 README |   35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 deletions(-)
README +0 -0
index 4c2a6c6..e2a7271 100644
@@ -15,19 +15,6 @@ above B.A.T.M.A.N. Advanced, prominent examples are:

IPv4, IPv6, DHCP, IPX. This is batman-advanced implemented as Linux kernel driver. It does not depend on any network (other) driver, and can be used on wifi as well as ethernet, vpn, etc ... (anything with ethernet-style layer 2).

README +0 -3
-It compiles against and should work with Linux 2.6.20 - 2.6.33. Supporting older
-versions is not planned, but it's probably easy to backport it. If you work on a
-backport, feel free to contact us.  :-)

README above B.A.T.M.A.N. Advanced, prominent examples are: IPv4, IPv6, DHCP, IPX. · line 30

Quoted 10 lines
README +0 -10
-
-COMPILE
--------
-To compile against your currently installed kernel, just type:
-
-# make
-
-if you want to compile against some other kernel, use:
-
-# make KERNELPATH=/path/to/kernel

This should not be removed from maint or trunk.

Quoted 4 lines

USAGE
-----

README +0 -0
@@ -123,15 +110,11 @@ dmesg | grep batman-adv
 

README dmesg | grep batman-adv · line 114

Quoted 10 lines
README +2 -6
 When investigating problems with your mesh network it is sometimes
 necessary to see more detail debug messages. This must be enabled when
-compiling the batman-adv module. When building batman-adv as part of
-kernel, use "make menuconfig" and enable the option
-"B.A.T.M.A.N. debugging". When compiling outside of the kernel tree it
-is necessary to edit the file Makefile.kbuild and uncomment the line
-
-#EXTRA_CFLAGS += -DCONFIG_BATMAN_ADV_DEBUG
+compiling the batman-adv module. Use "make menuconfig" and enable the
+option "B.A.T.M.A.N. debugging".

This should not be changed in maint or trunk.

Quoted 14 lines
README +1 -5
 The additional debug output is by default disabled. It can be enabled
-either at kernel modules load time or during run time. To enable debug
+either at kernel module load time or during run time. To enable debug
 output at module load time, add the module parameter debug=<value>.
 <value> can take one of four values.
 
@@ -160,12 +143,12 @@ to see the debug messages.
 BATCTL
 ------
 
-B.A.T.M.A.N.  advanced  operates on layer 2 and thus all hosts partici-
-pating in the virtual switch are completely transparent for all  proto-
-cols above layer 2. Therefore the common diagnosis tools do not work as
-expected. To overcome these problems batctl was created. At the  moment

README to see the debug messages. · line 153

Quoted 10 lines
README +6 -2
-the  batctl contains ping, traceroute, tcpdump and interfaces to the
-kernel module settings.
+B.A.T.M.A.N.  advanced operates on layer 2 and thus all hosts
+participating in the virtual switch are completely transparent for all
+protocols above layer 2. Therefore the common diagnosis tools do not
+work as expected. To overcome these problems batctl was created. At
+the moment the batctl contains ping, traceroute, tcpdump and
+interfaces to the kernel module settings.
 
 For more information, please see the manpage (man batctl).

This looks fine :)

Best regards,
Sven

#3 lore raw

Re: [B.A.T.M.A.N.] [PATCH 1/4] batman-adv: Update README to match mainline README.

Quoted 5 lines · Sven Eckelmann
Quoted 4 lines · Andrew Lunn
---
 README |   35 +++++++++--------------------------
 1 files changed, 9 insertions(+), 26 deletions(-)

Humm. The README actually needs a lot of work. It still talks about using proc for files which are now in /sys. It is probably better to wait for Marek to update README then look at synchronizing what can be synchronized.

Andrew

#4 lore raw

PATCH 2/4 batman-adv: Import sparse fixes from mainline.

In reply to Andrew Lunn

I fixed sparce warnings as i moved patches from maint to mainline. This patch move the fixes back to maint.

---
 bat_sysfs.c |    9 ++++++---
 vis.c       |    8 ++++----
 2 files changed, 10 insertions(+), 7 deletions(-)
bat_sysfs.c +6 -3
index 7acf8d8..e2c000b 100644
@@ -357,7 +357,8 @@ void sysfs_del_meshif(struct net_device *dev)
 static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
 			       char *buff)
 {
-	struct net_device *net_dev = to_net_dev(to_dev(kobj->parent));
+	struct device *dev = to_dev(kobj->parent);
+	struct net_device *net_dev = to_net_dev(dev);
 	struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
 
 	if (!batman_if)
@@ -371,7 +372,8 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
 static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
 				char *buff, size_t count)
 {
-	struct net_device *net_dev = to_net_dev(to_dev(kobj->parent));
+	struct device *dev = to_dev(kobj->parent);
+	struct net_device *net_dev = to_net_dev(dev);
 	struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
 	int status_tmp = -1;
 
@@ -409,7 +411,8 @@ static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
 static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
 				 char *buff)
 {
-	struct net_device *net_dev = to_net_dev(to_dev(kobj->parent));
+	struct device *dev = to_dev(kobj->parent);
+	struct net_device *net_dev = to_net_dev(dev);
 	struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);
 
 	if (!batman_if)
vis.c +4 -4
index 3144439..bac1401 100644
@@ -103,7 +103,7 @@ static int vis_info_choose(void *data, int size)
 
 /* insert interface to the list of interfaces of one originator, if it
  * does not already exist in the list */
-void vis_data_insert_interface(const uint8_t *interface,
+static void vis_data_insert_interface(const uint8_t *interface,
 				      struct hlist_head *if_list,
 				      bool primary)
 {
@@ -124,7 +124,7 @@ void vis_data_insert_interface(const uint8_t *interface,
 	hlist_add_head(&entry->list, if_list);
 }
 
-ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list)
+static ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list)
 {
 	struct if_list_entry *entry;
 	struct hlist_node *pos;
@@ -144,8 +144,8 @@ ssize_t vis_data_read_prim_sec(char *buff, struct hlist_head *if_list)
 }
 
 /* read an entry  */
-ssize_t vis_data_read_entry(char *buff, struct vis_info_entry *entry,
-			    uint8_t *src, bool primary)
+static ssize_t vis_data_read_entry(char *buff, struct vis_info_entry *entry,
+				   uint8_t *src, bool primary)
 {
 	char to[40];
 
Signature · 1 line
1.7.1
Acked-by on v1 2/4
#5 lore raw

Re: [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Import sparse fixes from mainline.

bat_sysfs.c void sysfs_del_meshif(struct net_device *dev) · line 362

Quoted 12 lines · Andrew Lunn
bat_sysfs.c +2 -1
index 7acf8d8..e2c000b 100644
@@ -357,7 +357,8 @@ void sysfs_del_meshif(struct net_device *dev)
 static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute
 *attr, char *buff)
 {
-	struct net_device *net_dev = to_net_dev(to_dev(kobj->parent));
+	struct device *dev = to_dev(kobj->parent);
+	struct net_device *net_dev = to_net_dev(dev);
 	struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);

This has not real something to do with this patch (which is good), but to_net_dev was added in v2.6.20-236-g43cb76d and the README still states that we are compatible with linux 2.6.20. I think we must change that to 2.6.25 (explanation below).

I did a build test with 2.6.19-2.6.28 (have to update my buildenv...):

* 2.6.19: fails in many ways
* 2.6.20: fails in bat_sys.c
* 2.6.21: warnings in bat_sys.c (better call it fail)
* 2.6.22: warnings in bat_sys.c (better call it fail)
* 2.6.23: fails
* 2.6.24: fails
* 2.6.25: ok
* 2.6.26: ok
* 2.6.27: ok
* 2.6.28: ok

But to your patch:

Best regards,
Sven

#6 lore raw

Re: [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Import sparse fixes from mainline.

Quoted 21 lines · Sven Eckelmann

bat_sysfs.c void sysfs_del_meshif(struct net_device *dev) · line 362

Quoted 12 lines · Andrew Lunn
bat_sysfs.c +2 -1
index 7acf8d8..e2c000b 100644
@@ -357,7 +357,8 @@ void sysfs_del_meshif(struct net_device *dev)
 static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute
 *attr, char *buff)
 {
-	struct net_device *net_dev = to_net_dev(to_dev(kobj->parent));
+	struct device *dev = to_dev(kobj->parent);
+	struct net_device *net_dev = to_net_dev(dev);
 	struct batman_if *batman_if = get_batman_if_by_netdev(net_dev);

This has not real something to do with this patch (which is good), but to_net_dev was added in v2.6.20-236-g43cb76d and the README still states that we are compatible with linux 2.6.20. I think we must change that to 2.6.25 (explanation below).

I did a build test with 2.6.19-2.6.28 (have to update my buildenv...):

Quoted 10 lines

* 2.6.19: fails in many ways
* 2.6.20: fails in bat_sys.c
* 2.6.21: warnings in bat_sys.c (better call it fail)
* 2.6.22: warnings in bat_sys.c (better call it fail)
* 2.6.23: fails
* 2.6.24: fails
* 2.6.25: ok
* 2.6.26: ok
* 2.6.27: ok
* 2.6.28: ok

Simon is good at testing with older kernels and fixing problems. I guess we can expect a patch to compat.h sometime soon to fix this....

Quoted 3 lines

But to your patch:

Thanks
Andrew

#7 lore raw

Re: [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Import sparse fixes from mainline.

In reply to Sven Eckelmann
Quoted 4 lines · On Sunday 02 May 2010 00:34:56 Sven Eckelmann wrote:

This has not real something to do with this patch (which is good), but to_net_dev was added in v2.6.20-236-g43cb76d and the README still states
that we are compatible with linux 2.6.20. I think we must change that to 2.6.25 (explanation below).

I ran into a bat_sysfs issue today regarding kobject_create_and_add() on 2.6.21 and made a fix for it. With that patch it compiles fine but it needs some more testing though. I did not see any complaints about to_net_dev. It seems to be there: include/linux/netdevice.h line 538.
We still might have some issues on 2.6.20 ..

Cheers,
Marek

#8 lore raw

Re: [B.A.T.M.A.N.] [PATCH 2/4] batman-adv: Import sparse fixes from mainline.

Quoted 4 lines · Marek Lindner
Quoted 3 lines · On Sunday 02 May 2010 00:34:56 Sven Eckelmann wrote:

This has not real something to do with this patch (which is good), but to_net_dev was added in v2.6.20-236-g43cb76d and the README still states

Quoted 8 lines
Quoted 2 lines

that we are compatible with linux 2.6.20. I think we must change that to 2.6.25 (explanation below).

I ran into a bat_sysfs issue today regarding kobject_create_and_add() on 2.6.21 and made a fix for it. With that patch it compiles fine but it needs some more testing though. I did not see any complaints about to_net_dev. It seems to be there: include/linux/netdevice.h line 538.
We still might have some issues on 2.6.20 ..

Yes, v2.6.20-236-g43cb76d was merged into v2.6.21-rc1.

I started to create a compat lib with the new kobject stuff, but as you have done it already... nice reaction time ;)

The v2.6.20 stuff seems even more tricky as the data stored in the structs was changed too. The new stuff looks nice, but it gets really ugly if we want to support both.

Best regards.
Sven

#9 lore raw

PATCH 3/4 batman-adv: whitespace fixes from mainline.

In reply to Andrew Lunn

The mainline driver has some whitespace patches which are not in maint. This patch brings imports them.

---
 bitarray.c |    2 +-
 main.h     |    4 ++--
 routing.c  |    3 ++-
 send.c     |    3 ++-
 vis.c      |    6 +++---
 5 files changed, 10 insertions(+), 8 deletions(-)
bitarray.c +1 -1
index 437cff8..2fef6e3 100644
@@ -150,7 +150,7 @@ char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff,
 
 	/* sequence number is much newer, probably missed a lot of packets */
 
-	if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE) 
+	if ((seq_num_diff >= TQ_LOCAL_WINDOW_SIZE)
 		|| (seq_num_diff < EXPECTED_SEQNO_RANGE)) {
 		bat_dbg(DBG_BATMAN,
 			"We missed a lot of packets (%i) !\n",
main.h +2 -2
index 2ce3b45..55e2214 100644
@@ -69,8 +69,8 @@
 #define MODULE_ACTIVE 1
 #define MODULE_DEACTIVATING 2
 
-#define BCAST_QUEUE_LEN		256
-#define BATMAN_QUEUE_LEN 	256
+#define BCAST_QUEUE_LEN 256
+#define BATMAN_QUEUE_LE	256
 
 /*
  * Debug Messages
routing.c +2 -1
index 0ab8f89..cd2b4d6 100644
@@ -875,7 +875,8 @@ int recv_unicast_packet(struct sk_buff *skb)
 
 	/* TTL exceeded */
 	if (unicast_packet->ttl < 2) {
-		printk(KERN_WARNING "batman-adv:Warning - can't forward unicast packet from %pM to %pM: ttl exceeded\n", ethhdr->h_source, unicast_packet->dest);
+		printk(KERN_WARNING "batman-adv:Warning - can't forward unicast packet from %pM to %pM: ttl exceeded\n",
+		       ethhdr->h_source, unicast_packet->dest);
 		return NET_RX_DROP;
 	}
 
send.c +2 -1
index caec6ef..8413ddc 100644
@@ -128,7 +128,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
 	if (batman_if->if_status != IF_ACTIVE)
 		return;
 
-	packet_num = buff_pos = 0;
+	packet_num = 0;
+	buff_pos = 0;
 	batman_packet = (struct batman_packet *)
 		(forw_packet->packet_buff);
 
vis.c +3 -3
index bac1401..ff511ca 100644
@@ -40,9 +40,9 @@
     * before adding more than 127 to the starting value - it is a predecessor,
     * when adding 128 - it is neither a predecessor nor a successor,
     * after adding more than 127 to the starting value - it is a successor */
-#define seq_before(x,y) ({typeof(x) _dummy = (x - y); \
-                         _dummy > smallest_signed_int(_dummy); })
-#define seq_after(x,y) seq_before(y,x)
+#define seq_before(x, y) ({typeof(x) _dummy = (x - y); \
+			  _dummy > smallest_signed_int(_dummy); })
+#define seq_after(x, y) seq_before(y, x)
 
 struct hashtable_t *vis_hash;
 DEFINE_SPINLOCK(vis_hash_lock);
Signature · 1 line
1.7.1
#10 lore raw

Re: [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: whitespace fixes from mainline.

Quoted 4 lines · Andrew Lunn

The mainline driver has some whitespace patches which are not in maint. This patch brings imports them.

Please be aware that this one conflicts heavily with
* [PATCH-maint 1/2] batman-adv: Fix whitespace problems criticized by checkpatch.pl
* [PATCH-maint 2/2v2] batman-adv: Reduce max characters on a line to 80

Only following part seems to be new:

Quoted 5 lines
send.c +0 -0
index caec6ef..8413ddc 100644

send.c static void send_packet_to_if(struct forw_packet · line 135

Quoted 9 lines
send.c +2 -1
@@ -128,7 +128,8 @@ static void send_packet_to_if(struct forw_packet
 *forw_packet, if (batman_if->if_status != IF_ACTIVE)
 		return;
 
-	packet_num = buff_pos = 0;
+	packet_num = 0;
+	buff_pos = 0;
 	batman_packet = (struct batman_packet *)
 		(forw_packet->packet_buff);
 

Best regards,
Sven

#11 lore raw

PATCH 1/1 Staging: batman-adv: send.c: Checkpatch cleanup

From: Andrea Gelmini <[email protected]>

drivers/staging/batman-adv/send.c:137: CHECK: multiple assignments should be avoided

---
 drivers/staging/batman-adv/send.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/batman-adv/send.c +2 -1
index 2a9fac8..ff7b1f1 100644
@@ -134,7 +134,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
 	if (batman_if->if_active != IF_ACTIVE)
 		return;
 
-	packet_num = buff_pos = 0;
+	packet_num = 0;
+	buff_pos = 0;
 	batman_packet = (struct batman_packet *)
 		(forw_packet->packet_buff);
 
Signature · 1 line
1.7.1
#12 lore raw

Re: [B.A.T.M.A.N.] [PATCH] Staging: batman-adv: send.c: Checkpatch cleanup

Quoted 16 lines · Sven Eckelmann

From: Andrea Gelmini <[email protected]>

drivers/staging/batman-adv/send.c:137: CHECK: multiple assignments should be avoided

---
 drivers/staging/batman-adv/send.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/batman-adv/send.c +0 -0
index 2a9fac8..ff7b1f1 100644

drivers/staging/batman-adv/send.c static void send_packet_to_if(struct forw_packet *forw_packet, · line 141

Quoted 9 lines
drivers/staging/batman-adv/send.c +2 -1
@@ -134,7 +134,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet,
 	if (batman_if->if_active != IF_ACTIVE)
 		return;
 
-	packet_num = buff_pos = 0;
+	packet_num = 0;
+	buff_pos = 0;
 	batman_packet = (struct batman_packet *)
 		(forw_packet->packet_buff);
 

I was too lazy to go searching upstream. We can just import this patch and use your three checkpatch patches.

Andrew

#13 lore raw

Re: [B.A.T.M.A.N.] [PATCH 3/4] batman-adv: whitespace fixes from mainline.

In reply to Sven Eckelmann
Quoted 9 lines · Sven Eckelmann
Quoted 4 lines · Andrew Lunn

The mainline driver has some whitespace patches which are not in maint. This patch brings imports them.

Please be aware that this one conflicts heavily with
* [PATCH-maint 1/2] batman-adv: Fix whitespace problems criticized by checkpatch.pl
* [PATCH-maint 2/2v2] batman-adv: Reduce max characters on a line to 80

Yes. I was expecting that. It would be nice if your three patches got into maint sooner rather than later. I guess it is a superset of these fixes, plus other fixes.

I'm happy to wait for your patches.

Andrew

#14 lore raw

PATCH 4/4 batman-adv: include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...

In reply to Andrew Lunn

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files.

2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files.

3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch.

---
 device.c         |    3 +--
 main.h           |    1 +
 soft-interface.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
device.c +1 -2
index 5f7655b..b2ecba2 100644
@@ -20,6 +20,7 @@
  */
 
 #include <linux/device.h>
+#include <linux/slab.h>
 #include "main.h"
 #include "device.h"
 #include "send.h"
@@ -27,8 +28,6 @@
 #include "hash.h"
 #include "hard-interface.h"
 
-#include "compat.h"
-
 static struct class *batman_class;
 
 static int Major;	/* Major number assigned to our device driver */
main.h +1 -0
index 55e2214..6749ce0 100644
@@ -113,6 +113,7 @@ extern int bat_debug_type(int type);
 #include <linux/kthread.h>	/* kernel threads */
 #include <linux/pkt_sched.h>	/* schedule types */
 #include <linux/workqueue.h>	/* workqueue */
+#include <linux/slab.h>
 #include <net/sock.h>		/* struct sock */
 #include <linux/jiffies.h>
 #include "types.h"
soft-interface.c +1 -1
index 37a1f44..c3b5288 100644
@@ -26,9 +26,9 @@
 #include "translation-table.h"
 #include "types.h"
 #include "hash.h"
+#include <linux/slab.h>
 #include <linux/ethtool.h>
 #include <linux/etherdevice.h>
-#include "compat.h"
 
 static uint16_t bcast_seqno = 1; /* give own bcast messages seq numbers to avoid
 				  * broadcast storms */
Signature · 1 line
1.7.1
#15 lore raw

Re: [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...

Quoted 13 lines · Andrew Lunn
device.c +1 -0
index 5f7655b..b2ecba2 100644
@@ -20,6 +20,7 @@
  */
 
 #include <linux/device.h>
+#include <linux/slab.h>
 #include "main.h"
 #include "device.h"
 #include "send.h"

device.c line 33

Quoted 8 lines
device.c +0 -2
@@ -27,8 +28,6 @@
 #include "hash.h"
 #include "hard-interface.h"
 
-#include "compat.h"
-
 static struct class *batman_class;
 
 static int Major;	/* Major number assigned to our device driver */

Can you explain why it is here ok to remove compat.h in maint?

Best regards,
Sven

#16 lore raw

Re: [B.A.T.M.A.N.] [PATCH 4/4] batman-adv: include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...

Quoted 17 lines · Sven Eckelmann
Quoted 16 lines · Andrew Lunn
device.c +1 -0
index 5f7655b..b2ecba2 100644
@@ -20,6 +20,7 @@
  */
 
 #include <linux/device.h>
+#include <linux/slab.h>
 #include "main.h"
 #include "device.h"
 #include "send.h"
@@ -27,8 +28,6 @@
 #include "hash.h"
 #include "hard-interface.h"
 
Quoted 7 lines

device.c line 33

Quoted 5 lines
device.c +0 -2
-#include "compat.h"
-
 static struct class *batman_class;
 
 static int Major;	/* Major number assigned to our device driver */

Can you explain why it is here ok to remove compat.h in maint?

It is not. My error. I will fix this.

Andrew

#17 lore raw
In reply to Andrew Lunn

Hi Andrew, Sven,

Quoted 3 lines

I'm preparing a set of patches for GregKH for linux-next. I compared the resulting mainline tree to maint and found a few differences. These patches bring maint into line with linux-next.

thanks for the many patches. I'll go through this pile and submit them asap.

Regards,
Marek

#18 lore raw
Quoted 8 lines · Marek Lindner

Hi Andrew, Sven,

Quoted 3 lines

I'm preparing a set of patches for GregKH for linux-next. I compared the resulting mainline tree to maint and found a few differences. These patches bring maint into line with linux-next.

thanks for the many patches. I'll go through this pile and submit them asap.

I suggest you add Sven's checkpatch patches first and then let me produce new patches on top of that.

Andrew

#19 lore raw
Quoted 2 lines · On Sunday 02 May 2010 02:17:29 Andrew Lunn wrote:

I suggest you add Sven's checkpatch patches first and then let me produce new patches on top of that.

Ok, Sven's patches are in the repos now. Thanks to his hint I also committed
https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-May/002557.html
and
https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2010-May/002566.html
as they seemed to be clean. No need to resend them.

Regards,
Marek