2011-08-03 05:03:34

by Pavel Roskin

[permalink] [raw]
Subject: [PATCH 1/3] compat: remove stray #endif from compat-2.6.23.c

Signed-off-by: Pavel Roskin <[email protected]>
---
compat/compat-2.6.23.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/compat/compat-2.6.23.c b/compat/compat-2.6.23.c
index 67d0075..d31cfb4 100644
--- a/compat/compat-2.6.23.c
+++ b/compat/compat-2.6.23.c
@@ -235,5 +235,4 @@ int pci_try_set_mwi(struct pci_dev *dev)
return rc;
}
EXPORT_SYMBOL(pci_try_set_mwi);
-#endif



2011-08-03 05:03:42

by Pavel Roskin

[permalink] [raw]
Subject: [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.

Signed-off-by: Pavel Roskin <[email protected]>
---
compat/compat-2.6.23.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/compat/compat-2.6.23.c b/compat/compat-2.6.23.c
index d31cfb4..365f941 100644
--- a/compat/compat-2.6.23.c
+++ b/compat/compat-2.6.23.c
@@ -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;

2011-08-03 05:04:00

by Pavel Roskin

[permalink] [raw]
Subject: [PATCH 3/3] compat: don't define genl_register_mc_group() for Linux 2.6.22 and older

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.

Signed-off-by: Pavel Roskin <[email protected]>
---
include/linux/compat-2.6.37.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h
index d375746..78b0b38 100644
--- a/include/linux/compat-2.6.37.h
+++ b/include/linux/compat-2.6.37.h
@@ -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,