linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: cdns3: include host-export,h for cdns3_host_init
@ 2019-10-17 12:44 Ben Dooks (Codethink)
  2019-10-18  3:45 ` Pawel Laszczak
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Dooks (Codethink) @ 2019-10-17 12:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ben Dooks (Codethink),
	Greg Kroah-Hartman, Pawel Laszczak, Felipe Balbi, linux-usb

The cdns3_host_init() function is declared in host-export.h
but host.c does not include it. Add the include to have
the declaration present (and remove the declaration of
cdns3_host_exit which is now static).

Fixes the following sparse warning:

drivers/usb/cdns3/host.c:58:5: warning: symbol 'cdns3_host_init' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Pawel Laszczak <pawell@cadence.com>
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: "Ben Dooks
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/cdns3/host-export.h | 1 -
 drivers/usb/cdns3/host.c        | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/host-export.h b/drivers/usb/cdns3/host-export.h
index b498a170b7e8..ae11810f8826 100644
--- a/drivers/usb/cdns3/host-export.h
+++ b/drivers/usb/cdns3/host-export.h
@@ -12,7 +12,6 @@
 #ifdef CONFIG_USB_CDNS3_HOST
 
 int cdns3_host_init(struct cdns3 *cdns);
-void cdns3_host_exit(struct cdns3 *cdns);
 
 #else
 
diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
index 2733a8f71fcd..ad788bf3fe4f 100644
--- a/drivers/usb/cdns3/host.c
+++ b/drivers/usb/cdns3/host.c
@@ -12,6 +12,7 @@
 #include <linux/platform_device.h>
 #include "core.h"
 #include "drd.h"
+#include "host-export.h"
 
 static int __cdns3_host_init(struct cdns3 *cdns)
 {
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] usb: cdns3: include host-export,h for cdns3_host_init
  2019-10-17 12:44 [PATCH] usb: cdns3: include host-export,h for cdns3_host_init Ben Dooks (Codethink)
@ 2019-10-18  3:45 ` Pawel Laszczak
  2019-10-18  9:06   ` Ben Dooks
  0 siblings, 1 reply; 3+ messages in thread
From: Pawel Laszczak @ 2019-10-18  3:45 UTC (permalink / raw)
  To: Ben Dooks (Codethink), linux-kernel
  Cc: Greg Kroah-Hartman, Felipe Balbi, linux-usb

Hi

>The cdns3_host_init() function is declared in host-export.h
>but host.c does not include it. Add the include to have
>the declaration present (and remove the declaration of
>cdns3_host_exit which is now static).
>
>Fixes the following sparse warning:
>
>drivers/usb/cdns3/host.c:58:5: warning: symbol 'cdns3_host_init' was not declared. Should it be static?

It should not be static. It can be called from core.c file.
It will be static only if CONFIG_USB_CDNS3_HOST will not be defined and in
this case function will be declared in host-export.h  as static. 

For me It doesn't look like driver issue. 

>
>Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>---
>Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>Cc: Pawel Laszczak <pawell@cadence.com>
>Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
>Cc: "Ben Dooks
>Cc: linux-usb@vger.kernel.org
>---
> drivers/usb/cdns3/host-export.h | 1 -
> drivers/usb/cdns3/host.c        | 1 +
> 2 files changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/usb/cdns3/host-export.h b/drivers/usb/cdns3/host-export.h
>index b498a170b7e8..ae11810f8826 100644
>--- a/drivers/usb/cdns3/host-export.h
>+++ b/drivers/usb/cdns3/host-export.h
>@@ -12,7 +12,6 @@
> #ifdef CONFIG_USB_CDNS3_HOST
>
> int cdns3_host_init(struct cdns3 *cdns);
>-void cdns3_host_exit(struct cdns3 *cdns);

We can't remove this function. It is invoked from core.c file. 
If you remove it from host-export.h then it will not be visible there. 

>
> #else
>
>diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
>index 2733a8f71fcd..ad788bf3fe4f 100644
>--- a/drivers/usb/cdns3/host.c
>+++ b/drivers/usb/cdns3/host.c
>@@ -12,6 +12,7 @@
> #include <linux/platform_device.h>
> #include "core.h"
> #include "drd.h"
>+#include "host-export.h"

Why host must include this file. This function is implemented
In host.c and is used only in  core.c file . 

>
> static int __cdns3_host_init(struct cdns3 *cdns)
> {
>--
>2.23.0


Regards,
Pawell


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: cdns3: include host-export,h for cdns3_host_init
  2019-10-18  3:45 ` Pawel Laszczak
@ 2019-10-18  9:06   ` Ben Dooks
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Dooks @ 2019-10-18  9:06 UTC (permalink / raw)
  To: Pawel Laszczak, linux-kernel; +Cc: Greg Kroah-Hartman, Felipe Balbi, linux-usb

On 18/10/2019 04:45, Pawel Laszczak wrote:
> Hi
> 
>> The cdns3_host_init() function is declared in host-export.h
>> but host.c does not include it. Add the include to have
>> the declaration present (and remove the declaration of
>> cdns3_host_exit which is now static).
>>
>> Fixes the following sparse warning:
>>
>> drivers/usb/cdns3/host.c:58:5: warning: symbol 'cdns3_host_init' was not declared. Should it be static?
> 
> It should not be static. It can be called from core.c file.
> It will be static only if CONFIG_USB_CDNS3_HOST will not be defined and in
> this case function will be declared in host-export.h  as static.

I know, this isn't being made static, that's a warning.

> For me It doesn't look like driver issue.

>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>> ---
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Pawel Laszczak <pawell@cadence.com>
>> Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
>> Cc: "Ben Dooks
>> Cc: linux-usb@vger.kernel.org
>> ---
>> drivers/usb/cdns3/host-export.h | 1 -
>> drivers/usb/cdns3/host.c        | 1 +
>> 2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/cdns3/host-export.h b/drivers/usb/cdns3/host-export.h
>> index b498a170b7e8..ae11810f8826 100644
>> --- a/drivers/usb/cdns3/host-export.h
>> +++ b/drivers/usb/cdns3/host-export.h
>> @@ -12,7 +12,6 @@
>> #ifdef CONFIG_USB_CDNS3_HOST
>>
>> int cdns3_host_init(struct cdns3 *cdns);
>> -void cdns3_host_exit(struct cdns3 *cdns);
> 
> We can't remove this function. It is invoked from core.c file.
> If you remove it from host-export.h then it will not be visible there.
> 
>>
>> #else
>>
>> diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
>> index 2733a8f71fcd..ad788bf3fe4f 100644
>> --- a/drivers/usb/cdns3/host.c
>> +++ b/drivers/usb/cdns3/host.c
>> @@ -12,6 +12,7 @@
>> #include <linux/platform_device.h>
>> #include "core.h"
>> #include "drd.h"
>> +#include "host-export.h"
> 
> Why host must include this file. This function is implemented
> In host.c and is used only in  core.c file .

The implementation should also have the declaration to ensure
that the implemented function matches the declared prototype in
the header



-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-18  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17 12:44 [PATCH] usb: cdns3: include host-export,h for cdns3_host_init Ben Dooks (Codethink)
2019-10-18  3:45 ` Pawel Laszczak
2019-10-18  9:06   ` Ben Dooks

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).