* [B.A.T.M.A.N.] [PATCH] batman-adv: change compat code to remove sparse warning
@ 2013-02-28 11:08 Simon Wunderlich
2013-02-28 11:13 ` Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Simon Wunderlich @ 2013-02-28 11:08 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich
The latest compat patch fixing rtnl ops compile errors from 2.6.32
("batman-adv: add compat support for the new netlink ops") fixes
the compilation, but leaves some sparse errors:
batman-adv/soft-interface.c:573:10: warning: Initializer entry defined twice
batman-adv/soft-interface.c:574:10: also defined here
This patch uses another approach by moving the initializers in a dummy
struct instead. This also removes the sparse errors.
Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
compat.h | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/compat.h b/compat.h
index 64244ac..69c3dc2 100644
--- a/compat.h
+++ b/compat.h
@@ -135,23 +135,19 @@ static inline int batadv_param_set_copystring(const char *val,
#define kstrtoul strict_strtoul
#define kstrtol strict_strtol
-#define batadv_softif_slave_add(x, y) \
-batadv_softif_slave_add(struct net_device *dev, struct ifreq *rq, int cmd)\
-{\
- return -EOPNOTSUPP;\
-}\
-static int __attribute__((unused)) __batadv_softif_slave_add(x, y)
-
-#define batadv_softif_slave_del(x, y) \
-__batadv_softif_slave_del(struct net_device *dev, struct net_device *slave_dev);\
-static int batadv_softif_slave_del(struct net_device *dev, struct ifreq *rq, int cmd)\
-{\
- return -EOPNOTSUPP;\
-}\
-static int __attribute__((unused)) __batadv_softif_slave_del(x, y)
-
-#define ndo_add_slave ndo_do_ioctl
-#define ndo_del_slave ndo_do_ioctl
+/* Hack for removing ndo_add/del_slave at the end of net_device_ops.
+ * This is somewhat ugly because it requires that ndo_validate_addr
+ * is at the end of this struct in soft-interface.c.
+ */
+#define ndo_validate_addr \
+ ndo_validate_addr = eth_validate_addr, \
+}; \
+static const struct { \
+ void *ndo_validate_addr; \
+ void *ndo_add_slave; \
+ void *ndo_del_slave; \
+} __attribute__((unused)) __useless_ops1 = { \
+ .ndo_validate_addr
#endif /* < KERNEL_VERSION(2, 6, 39) */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: change compat code to remove sparse warning
2013-02-28 11:08 [B.A.T.M.A.N.] [PATCH] batman-adv: change compat code to remove sparse warning Simon Wunderlich
@ 2013-02-28 11:13 ` Antonio Quartulli
2013-03-01 2:15 ` Marek Lindner
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-02-28 11:13 UTC (permalink / raw)
To: Simon Wunderlich; +Cc: b.a.t.m.a.n, Simon Wunderlich
[-- Attachment #1: Type: text/plain, Size: 764 bytes --]
On Thu, Feb 28, 2013 at 12:08:47 +0100, Simon Wunderlich wrote:
> The latest compat patch fixing rtnl ops compile errors from 2.6.32
> ("batman-adv: add compat support for the new netlink ops") fixes
> the compilation, but leaves some sparse errors:
> batman-adv/soft-interface.c:573:10: warning: Initializer entry defined twice
> batman-adv/soft-interface.c:574:10: also defined here
>
> This patch uses another approach by moving the initializers in a dummy
> struct instead. This also removes the sparse errors.
>
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Thank you Simon!
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: change compat code to remove sparse warning
2013-02-28 11:13 ` Antonio Quartulli
@ 2013-03-01 2:15 ` Marek Lindner
0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2013-03-01 2:15 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Simon Wunderlich
On Thursday, February 28, 2013 19:13:30 Antonio Quartulli wrote:
> On Thu, Feb 28, 2013 at 12:08:47 +0100, Simon Wunderlich wrote:
> > The latest compat patch fixing rtnl ops compile errors from 2.6.32
> > ("batman-adv: add compat support for the new netlink ops") fixes
> > the compilation, but leaves some sparse errors:
> > batman-adv/soft-interface.c:573:10: warning: Initializer entry defined
> > twice batman-adv/soft-interface.c:574:10: also defined here
> >
> > This patch uses another approach by moving the initializers in a dummy
> > struct instead. This also removes the sparse errors.
> >
> > Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>
> Acked-by: Antonio Quartulli <ordex@autistici.org>
Applied in revision 2caa9e1.
Thanks,
Marek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-01 2:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28 11:08 [B.A.T.M.A.N.] [PATCH] batman-adv: change compat code to remove sparse warning Simon Wunderlich
2013-02-28 11:13 ` Antonio Quartulli
2013-03-01 2:15 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).