[2/4] batman-adv: Import sparse fixes from mainline.
Commit Message
I fixed sparce warnings as i moved patches from maint to mainline.
This patch move the fixes back to maint.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
bat_sysfs.c | 9 ++++++---
vis.c | 8 ++++----
2 files changed, 10 insertions(+), 7 deletions(-)
Comments
Andrew Lunn wrote:
> diff --git a/bat_sysfs.c b/bat_sysfs.c
> index 7acf8d8..e2c000b 100644
> --- a/bat_sysfs.c
> +++ b/bat_sysfs.c
> @@ -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:
Acked-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Best regards,
Sven
On Sat, May 01, 2010 at 06:34:56PM +0200, Sven Eckelmann wrote:
> Andrew Lunn wrote:
> > diff --git a/bat_sysfs.c b/bat_sysfs.c
> > index 7acf8d8..e2c000b 100644
> > --- a/bat_sysfs.c
> > +++ b/bat_sysfs.c
> > @@ -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
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....
> But to your patch:
>
> Acked-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Thanks
Andrew
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
Marek Lindner wrote:
> 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 ..
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
@@ -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)
@@ -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];