Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1490557 > unrolled thread

[PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up

Started byBaoyou Xie <baoyou.xie@linaro.org>
First post2016-09-24 07:30 +0200
Last post2016-09-24 16:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up Baoyou Xie <baoyou.xie@linaro.org> - 2016-09-24 07:30 +0200
    Re: [PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up Arnd Bergmann <arnd@arndb.de> - 2016-09-24 11:00 +0200
    Re: [PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-09-24 16:20 +0200

#1490557 — [PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up

FromBaoyou Xie <baoyou.xie@linaro.org>
Date2016-09-24 07:30 +0200
Subject[PATCH 4/6] isdn/hisax: clean function declaration in hscx.c up
Message-ID<skNHc-5m9-17@gated-at.bofh.it>
We get 1 warning when building kernel with W=1:
drivers/isdn/hisax/hscx.c:175:1: warning: no previous prototype for 'open_hscxstate' [-Wmissing-prototypes]

In fact, this function is declared in
drivers/isdn/hisax/elsa_ser.c, but should be
declard in a header file, thus can be recognized in other file.

So this patch moves the declaration into drivers/isdn/hisax/hscx.h.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
---
 drivers/isdn/hisax/elsa_ser.c | 2 +-
 drivers/isdn/hisax/hscx.h     | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c
index a2a358c..34ccc18 100644
--- a/drivers/isdn/hisax/elsa_ser.c
+++ b/drivers/isdn/hisax/elsa_ser.c
@@ -10,6 +10,7 @@
 #include <linux/serial.h>
 #include <linux/serial_reg.h>
 #include <linux/slab.h>
+#include "hscx.h"
 
 #define MAX_MODEM_BUF	256
 #define WAKEUP_CHARS	(MAX_MODEM_BUF / 2)
@@ -419,7 +420,6 @@ static void rs_interrupt_elsa(struct IsdnCardState *cs)
 #endif
 }
 
-extern int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
 extern void modehscx(struct BCState *bcs, int mode, int bc);
 extern void hscx_l2l1(struct PStack *st, int pr, void *arg);
 
diff --git a/drivers/isdn/hisax/hscx.h b/drivers/isdn/hisax/hscx.h
index 1148b4b..fa7bf16 100644
--- a/drivers/isdn/hisax/hscx.h
+++ b/drivers/isdn/hisax/hscx.h
@@ -39,3 +39,4 @@ extern void modehscx(struct BCState *bcs, int mode, int bc);
 extern void clear_pending_hscx_ints(struct IsdnCardState *cs);
 extern void inithscx(struct IsdnCardState *cs);
 extern void inithscxisac(struct IsdnCardState *cs, int part);
+int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
-- 
2.7.4

[toc] | [next] | [standalone]


#1490597

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-24 11:00 +0200
Message-ID<skQYp-7h6-9@gated-at.bofh.it>
In reply to#1490557
On Saturday, September 24, 2016 1:24:22 PM CEST Baoyou Xie wrote:
>  }
>  
> -extern int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);
>  extern void modehscx(struct BCState *bcs, int mode, int bc);
>  extern void hscx_l2l1(struct PStack *st, int pr, void *arg);
>  

The change makes sense, but I would remove the other two declarations
as well, as extern declarations don't belong into .c files.

As far as I can tell, modehscx() already has a declaration in hscx.h,
while hscx_l2l1() doesn't, and the declaration here should be
moved as well.

> diff --git a/drivers/isdn/hisax/hscx.h b/drivers/isdn/hisax/hscx.h
> index 1148b4b..fa7bf16 100644
> --- a/drivers/isdn/hisax/hscx.h
> +++ b/drivers/isdn/hisax/hscx.h
> @@ -39,3 +39,4 @@ extern void modehscx(struct BCState *bcs, int mode, int bc);
>  extern void clear_pending_hscx_ints(struct IsdnCardState *cs);
>  extern void inithscx(struct IsdnCardState *cs);
>  extern void inithscxisac(struct IsdnCardState *cs, int part);
> +int open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs);

For consistency, I would add 'extern' here. We normally leave that out,
but I think if there are lots of declarations in a header file that all
have it, it's better if they are all the same.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1490656

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-09-24 16:20 +0200
Message-ID<skVY5-23O-5@gated-at.bofh.it>
In reply to#1490557
Hello.

On 9/24/2016 8:24 AM, Baoyou Xie wrote:

> We get 1 warning when building kernel with W=1:
> drivers/isdn/hisax/hscx.c:175:1: warning: no previous prototype for 'open_hscxstate' [-Wmissing-prototypes]
>
> In fact, this function is declared in
> drivers/isdn/hisax/elsa_ser.c, but should be
> declard in a header file, thus can be recognized in other file.

    Declared.

> So this patch moves the declaration into drivers/isdn/hisax/hscx.h.
>
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
[...]

MBR, Sergei

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web