Skip to contentSkip to conversation

compat: remove stray #endif from compat-2.6.23.c

PATCH New Pavel Roskin 1 participant 3 messages Aug 3, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 compat: remove stray #endif from compat-2.6.23.c

---
 compat/compat-2.6.23.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
compat/compat-2.6.23.c +0 -1
index 67d0075..d31cfb4 100644
@@ -235,5 +235,4 @@ int pci_try_set_mwi(struct pci_dev *dev)
 	return rc;
 }
 EXPORT_SYMBOL(pci_try_set_mwi);
-#endif
 
#1 lore raw

PATCH 2/3 compat: fix iteration over destination multicast addresses

Fix dev_mc_sync() and dev_mc_unsync() in compat-2.6.23.c. When looking for synchronized addresses, put "break" inside the above "if" to break the loop only if there is a match. Otherwise, advance da_to to the next address.

---
 compat/compat-2.6.23.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
compat/compat-2.6.23.c +6 -2
index d31cfb4..365f941 100644
@@ -104,9 +104,11 @@ int dev_mc_sync(struct net_device *to, struct net_device *from)
 		/* 2.6.22 does not have da->da_synced so lets take the long route */
 		while (da_to != NULL) {
 			if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
-				da->da_addrlen == da_to->da_addrlen)
+			    da->da_addrlen == da_to->da_addrlen) {
 				synced = 1;
 				break;
+			}
+			da_to = da_to->next;
 		}
 		if (!synced) {
 			err = __dev_addr_add(&to->mc_list, &to->mc_count,
@@ -160,9 +162,11 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from)
 		/* 2.6.22 does not have da->da_synced so lets take the long route */
 		while (da_to != NULL) {
 			if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 &&
-				da->da_addrlen == da_to->da_addrlen)
+			    da->da_addrlen == da_to->da_addrlen) {
 				synced = true;
 				break;
+			}
+			da_to = da_to->next;
 		}
 		if (!synced) {
 			da = next;
#2 lore raw

PATCH 3/3 compat: don't define genl_register_mc_group() for Linux 2.6.22 and older

In reply to Pavel Roskin

compat-2.6.23.h has a different definition of genl_register_mc_group(). Likewise, don't define genl_unregister_mc_group() for old kernels.

---
 include/linux/compat-2.6.37.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/compat-2.6.37.h +3 -0
index d375746..78b0b38 100644
@@ -91,8 +91,11 @@ int genl_unregister_family(struct genl_family *family);
 
 #define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
 #define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
 #define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
 #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
+#endif
 
 
 extern void led_blink_set(struct led_classdev *led_cdev,