Message ID | dd984c99d43214c39b23f95e9a58f3a675147e69.1386911124.git.rashika.kheria@gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Sat, Dec 14, 2013 at 05:55:42PM +0530, Rashika Kheria wrote: > This patch declares the prototype for the function sbni_probe() in file sbni.c. > > Thus, it also removes the following warning in wan/sbni.c: > drivers/net/wan/sbni.c:224:12: warning: no previous prototype for ‘sbni_probe’ [-Wmissing-prototypes] > > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> > drivers/net/wan/sbni.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c > index 388ddf6..5061ffd 100644 > --- a/drivers/net/wan/sbni.c > +++ b/drivers/net/wan/sbni.c > @@ -221,6 +221,7 @@ static void __init sbni_devsetup(struct net_device *dev) > dev->netdev_ops = &sbni_netdev_ops; > } > > +int __init sbni_probe(int unit); > int __init sbni_probe(int unit) > { > struct net_device *dev; > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Rashika Kheria <rashika.kheria@gmail.com> Date: Sat, 14 Dec 2013 17:55:42 +0530 > This patch declares the prototype for the function sbni_probe() in file sbni.c. > > Thus, it also removes the following warning in wan/sbni.c: > drivers/net/wan/sbni.c:224:12: warning: no previous prototype for ‘sbni_probe’ [-Wmissing-prototypes] > > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> > --- > > This revision fixes the following issues of the previous revision: > Incorrect fix > > drivers/net/wan/sbni.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c > index 388ddf6..5061ffd 100644 > --- a/drivers/net/wan/sbni.c > +++ b/drivers/net/wan/sbni.c > @@ -221,6 +221,7 @@ static void __init sbni_devsetup(struct net_device *dev) > dev->netdev_ops = &sbni_netdev_ops; > } > > +int __init sbni_probe(int unit); > int __init sbni_probe(int unit) This is not the correct way to fix this kind of warning, an exported function needs to appear in a header file so that both the definition and any callers of this function will see the same declaration in that header file.
On Sat, Dec 14, 2013 at 10:26:58PM -0500, David Miller wrote: > From: Rashika Kheria <rashika.kheria@gmail.com> > Date: Sat, 14 Dec 2013 17:55:42 +0530 > > > This patch declares the prototype for the function sbni_probe() in file sbni.c. > > > > Thus, it also removes the following warning in wan/sbni.c: > > drivers/net/wan/sbni.c:224:12: warning: no previous prototype for ‘sbni_probe’ [-Wmissing-prototypes] > > > > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> > > --- > > > > This revision fixes the following issues of the previous revision: > > Incorrect fix > > > > drivers/net/wan/sbni.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c > > index 388ddf6..5061ffd 100644 > > --- a/drivers/net/wan/sbni.c > > +++ b/drivers/net/wan/sbni.c > > @@ -221,6 +221,7 @@ static void __init sbni_devsetup(struct net_device *dev) > > dev->netdev_ops = &sbni_netdev_ops; > > } > > > > +int __init sbni_probe(int unit); > > int __init sbni_probe(int unit) > > This is not the correct way to fix this kind of warning, an exported > function needs to appear in a header file so that both the definition > and any callers of this function will see the same declaration in that > header file. It should, yes; however, in this case, the function is one of several dozen that are directly prototyped and used by drivers/net/Space.c, and there's no header file prototyping any of those functions. Do you have a suggestion for what header file should contain a prototype for this probe function? - Josh Triplett -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Josh Triplett <josh@joshtriplett.org> Date: Sat, 14 Dec 2013 19:41:49 -0800 > On Sat, Dec 14, 2013 at 10:26:58PM -0500, David Miller wrote: >> From: Rashika Kheria <rashika.kheria@gmail.com> >> Date: Sat, 14 Dec 2013 17:55:42 +0530 >> >> > This patch declares the prototype for the function sbni_probe() in file sbni.c. >> > >> > Thus, it also removes the following warning in wan/sbni.c: >> > drivers/net/wan/sbni.c:224:12: warning: no previous prototype for ‘sbni_probe’ [-Wmissing-prototypes] >> > >> > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> >> > --- >> > >> > This revision fixes the following issues of the previous revision: >> > Incorrect fix >> > >> > drivers/net/wan/sbni.c | 1 + >> > 1 file changed, 1 insertion(+) >> > >> > diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c >> > index 388ddf6..5061ffd 100644 >> > --- a/drivers/net/wan/sbni.c >> > +++ b/drivers/net/wan/sbni.c >> > @@ -221,6 +221,7 @@ static void __init sbni_devsetup(struct net_device *dev) >> > dev->netdev_ops = &sbni_netdev_ops; >> > } >> > >> > +int __init sbni_probe(int unit); >> > int __init sbni_probe(int unit) >> >> This is not the correct way to fix this kind of warning, an exported >> function needs to appear in a header file so that both the definition >> and any callers of this function will see the same declaration in that >> header file. > > It should, yes; however, in this case, the function is one of several > dozen that are directly prototyped and used by drivers/net/Space.c, and > there's no header file prototyping any of those functions. > > Do you have a suggestion for what header file should contain a prototype > for this probe function? Then create a Space.h for this. Otherwise if something accidently makes the function signatures not match at the call site vs. the definition, or vice versa, nothing will catch it.
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 388ddf6..5061ffd 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -221,6 +221,7 @@ static void __init sbni_devsetup(struct net_device *dev) dev->netdev_ops = &sbni_netdev_ops; } +int __init sbni_probe(int unit); int __init sbni_probe(int unit) { struct net_device *dev;
This patch declares the prototype for the function sbni_probe() in file sbni.c. Thus, it also removes the following warning in wan/sbni.c: drivers/net/wan/sbni.c:224:12: warning: no previous prototype for ‘sbni_probe’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> --- This revision fixes the following issues of the previous revision: Incorrect fix drivers/net/wan/sbni.c | 1 + 1 file changed, 1 insertion(+)