batman-adv: purge unnecessary include

Message ID 1304348024-11681-1-git-send-email-lindner_marek@yahoo.de (mailing list archive)
State Rejected, archived
Headers

Commit Message

Marek Lindner May 2, 2011, 2:53 p.m. UTC
  Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 compat.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
  

Comments

Sven Eckelmann May 2, 2011, 3:02 p.m. UTC | #1
On Monday 02 May 2011 16:53:44 Marek Lindner wrote:
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
[,,,,]
>  #include <linux/version.h>	/* LINUX_VERSION_CODE */
> -#include "bat_sysfs.h"		/* struct bat_attribute */

This is necessary for kernels older than 2.6.24

make -C /home/batman/build_test/linux-build/linux-2.6.23/ REVISION=v2011.1.0-81-g89079ae-dirty M=/home/batman/batman-adv 
PWD=/home/batman/batman-adv -j 1 modules
make[1]: Entering directory `/home/batman/build_test/linux-build/linux-2.6.23'
  CC [M]  /home/batman/batman-adv/aggregation.o
In file included from /home/batman/batman-adv/main.h:117,
                 from /home/batman/batman-adv/aggregation.c:22:
/home/batman/batman-adv/compat.h: In function ‘bat_wrapper_show’:
/home/batman/batman-adv/compat.h:112: error: dereferencing pointer to incomplete type
/home/batman/batman-adv/compat.h:112: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/home/batman/batman-adv/compat.h:112: warning: initialization from incompatible pointer type
/home/batman/batman-adv/compat.h:112: error: invalid use of undefined type ‘struct bat_attribute’
/home/batman/batman-adv/compat.h:114: error: dereferencing pointer to incomplete type
/home/batman/batman-adv/compat.h:115: error: dereferencing pointer to incomplete type
/home/batman/batman-adv/compat.h: In function ‘bat_wrapper_store’:
/home/batman/batman-adv/compat.h:124: error: dereferencing pointer to incomplete type
/home/batman/batman-adv/compat.h:124: warning: type defaults to ‘int’ in declaration of ‘__mptr’
/home/batman/batman-adv/compat.h:124: warning: initialization from incompatible pointer type
/home/batman/batman-adv/compat.h:124: error: invalid use of undefined type ‘struct bat_attribute’
/home/batman/batman-adv/compat.h:126: error: dereferencing pointer to incomplete type
/home/batman/batman-adv/compat.h:127: error: dereferencing pointer to incomplete type
make[2]: *** [/home/batman/batman-adv/aggregation.o] Error 1
make[1]: *** [_module_/home/batman/batman-adv] Error 2
make[1]: Leaving directory `/home/batman/build_test/linux-build/linux-2.6.23'
make: *** [all] Error 2
  
Marek Lindner May 2, 2011, 3:09 p.m. UTC | #2
On Monday 02 May 2011 17:02:32 Sven Eckelmann wrote:
> On Monday 02 May 2011 16:53:44 Marek Lindner wrote:
> > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> 
> [,,,,]
> 
> >  #include <linux/version.h>   /* LINUX_VERSION_CODE */
> >
> > -#include "bat_sysfs.h"               /* struct bat_attribute */
> 
> This is necessary for kernels older than 2.6.24


Aarrrgh, I was afraid of something like that. We are running into an include 
dependency issue as soon as bat_sysfs.h contains something like "struct 
bat_priv" which is likely to come soon ...
Any better idea how to fix this ?

Regards,
Marek
  
Sven Eckelmann May 2, 2011, 3:22 p.m. UTC | #3
On Monday 02 May 2011 17:09:31 Marek Lindner wrote:
> On Monday 02 May 2011 17:02:32 Sven Eckelmann wrote:
> > On Monday 02 May 2011 16:53:44 Marek Lindner wrote:
> > > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> > 
> > [,,,,]
> > 
> > >  #include <linux/version.h>   /* LINUX_VERSION_CODE */
> > > 
> > > -#include "bat_sysfs.h"               /* struct bat_attribute */
> > 
> > This is necessary for kernels older than 2.6.24
> 
> Aarrrgh, I was afraid of something like that. We are running into an
> include dependency issue as soon as bat_sysfs.h contains something like
> "struct bat_priv" which is likely to come soon ...
> Any better idea how to fix this ?

Declaring everything below 2.6.24 as obsolete? Other solutions can be 
developed after arriving at home.

Kind regards,
	Sven
  
Sven Eckelmann May 2, 2011, 3:27 p.m. UTC | #4
On Monday 02 May 2011 17:09:31 Marek Lindner wrote:
> On Monday 02 May 2011 17:02:32 Sven Eckelmann wrote:
> > On Monday 02 May 2011 16:53:44 Marek Lindner wrote:
> > > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> > 
> > [,,,,]
> > 
> > >  #include <linux/version.h>   /* LINUX_VERSION_CODE */
> > > 
> > > -#include "bat_sysfs.h"               /* struct bat_attribute */
> > 
> > This is necessary for kernels older than 2.6.24
> 
> Aarrrgh, I was afraid of something like that. We are running into an
> include dependency issue as soon as bat_sysfs.h contains something like
> "struct bat_priv" which is likely to come soon ...
> Any better idea how to fix this ?

Wait a second - why do you want to have a struct bat_priv in bat_sysfs.h? 
Isn't it possible to use 'struct bat_priv*" for a function declaration? 
'struct bat_priv;' can be used as forward declaration and used below in a 
function declaration.

struct bat_priv;
void test(struct bat_priv* a)
{
}

Kind regards,
	Sven
  
Antonio Quartulli May 2, 2011, 3:47 p.m. UTC | #5
On Mon, May 02, 2011 at 05:27:36PM +0200, Sven Eckelmann wrote:
> On Monday 02 May 2011 17:09:31 Marek Lindner wrote:
> > On Monday 02 May 2011 17:02:32 Sven Eckelmann wrote:
> > > On Monday 02 May 2011 16:53:44 Marek Lindner wrote:
> > > > Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> > > 
> > > [,,,,]
> > > 
> > > >  #include <linux/version.h>   /* LINUX_VERSION_CODE */
> > > > 
> > > > -#include "bat_sysfs.h"               /* struct bat_attribute */
> > > 
> > > This is necessary for kernels older than 2.6.24
> > 
> > Aarrrgh, I was afraid of something like that. We are running into an
> > include dependency issue as soon as bat_sysfs.h contains something like
> > "struct bat_priv" which is likely to come soon ...
> > Any better idea how to fix this ?
> 
> Wait a second - why do you want to have a struct bat_priv in bat_sysfs.h? 
> Isn't it possible to use 'struct bat_priv*" for a function declaration? 
> 'struct bat_priv;' can be used as forward declaration and used below in a 
> function declaration.
> 
> struct bat_priv;
> void test(struct bat_priv* a)
> {
> }
> 

Just tested and it works!

Thank you Sven


Regards,
  

Patch

diff --git a/compat.h b/compat.h
index 0c5ad82..bddf7e2 100644
--- a/compat.h
+++ b/compat.h
@@ -26,7 +26,6 @@ 
 #define _NET_BATMAN_ADV_COMPAT_H_
 
 #include <linux/version.h>	/* LINUX_VERSION_CODE */
-#include "bat_sysfs.h"		/* struct bat_attribute */
 
 #ifndef IPPROTO_UDP
 #define IPPROTO_UDP 17