diff mbox series

[RESEND] usb: mtu3: fix up undefined reference to usb_debug_root

Message ID ee71197a681165aa72cb73c7f6cb402953351805.1558678075.git.chunfeng.yun@mediatek.com (mailing list archive)
State Mainlined
Commit 9610450ea31eb061b9914de2bf6ced424956182d
Headers show
Series [RESEND] usb: mtu3: fix up undefined reference to usb_debug_root | expand

Commit Message

Chunfeng Yun May 24, 2019, 6:11 a.m. UTC
When CONFIG_USB is not set, and CONFIG_USB_GADGET is set,
there is an issue:

ld:
drivers/usb/mtu3/mtu3_debugfs.o: in function 'ssusb_debugfs_create_root':
mtu3_debugfs.c:(.text+0xba3): undefined reference to 'usb_debug_root'

usb_debug_root is only built when CONFIG_USB is enabled, so here drop it
and use NULL instead.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
---
 drivers/usb/mtu3/mtu3_debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Greg Kroah-Hartman May 24, 2019, 7:45 a.m. UTC | #1
On Fri, May 24, 2019 at 02:11:33PM +0800, Chunfeng Yun wrote:
> When CONFIG_USB is not set, and CONFIG_USB_GADGET is set,
> there is an issue:
> 
> ld:
> drivers/usb/mtu3/mtu3_debugfs.o: in function 'ssusb_debugfs_create_root':
> mtu3_debugfs.c:(.text+0xba3): undefined reference to 'usb_debug_root'
> 
> usb_debug_root is only built when CONFIG_USB is enabled, so here drop it
> and use NULL instead.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> ---
>  drivers/usb/mtu3/mtu3_debugfs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Why resend?

> diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
> index 62c57ddc554e..b7c86ccd50b4 100644
> --- a/drivers/usb/mtu3/mtu3_debugfs.c
> +++ b/drivers/usb/mtu3/mtu3_debugfs.c
> @@ -528,8 +528,7 @@ void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
>  
>  void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
>  {
> -	ssusb->dbgfs_root =
> -		debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
> +	ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);

This moves the directory to a new location no matter what the
configuration is. What's wrong with where it is today?  And shoudn't we
create the usb root directory if only gadget is enabled?

thanks,

greg k-h
Chunfeng Yun May 24, 2019, 9:25 a.m. UTC | #2
On Fri, 2019-05-24 at 09:45 +0200, Greg Kroah-Hartman wrote:
> On Fri, May 24, 2019 at 02:11:33PM +0800, Chunfeng Yun wrote:
> > When CONFIG_USB is not set, and CONFIG_USB_GADGET is set,
> > there is an issue:
> > 
> > ld:
> > drivers/usb/mtu3/mtu3_debugfs.o: in function 'ssusb_debugfs_create_root':
> > mtu3_debugfs.c:(.text+0xba3): undefined reference to 'usb_debug_root'
> > 
> > usb_debug_root is only built when CONFIG_USB is enabled, so here drop it
> > and use NULL instead.
> > 
> > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > Acked-by: Randy Dunlap <rdunlap@infradead.org>
> > ---
> >  drivers/usb/mtu3/mtu3_debugfs.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Why resend?
Sorry, I should send it out as v2 due to acked-by is added.

> 
> > diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
> > index 62c57ddc554e..b7c86ccd50b4 100644
> > --- a/drivers/usb/mtu3/mtu3_debugfs.c
> > +++ b/drivers/usb/mtu3/mtu3_debugfs.c
> > @@ -528,8 +528,7 @@ void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
> >  
> >  void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
> >  {
> > -	ssusb->dbgfs_root =
> > -		debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
> > +	ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);
> 
> This moves the directory to a new location no matter what the
> configuration is. What's wrong with where it is today?  
it seems usb_debug_root is only for host, but not for gadget only, it's
defined and created in usb/core/usb.c

> And shoudn't we
> create the usb root directory if only gadget is enabled?
Yes, need modify udc/core.c, it's better if support it, do you want me
to send a patch for it?

Thanks

> 
> thanks,
> 
> greg k-h
Greg Kroah-Hartman May 24, 2019, 11:33 a.m. UTC | #3
On Fri, May 24, 2019 at 05:25:51PM +0800, Chunfeng Yun wrote:
> On Fri, 2019-05-24 at 09:45 +0200, Greg Kroah-Hartman wrote:
> > On Fri, May 24, 2019 at 02:11:33PM +0800, Chunfeng Yun wrote:
> > > When CONFIG_USB is not set, and CONFIG_USB_GADGET is set,
> > > there is an issue:
> > > 
> > > ld:
> > > drivers/usb/mtu3/mtu3_debugfs.o: in function 'ssusb_debugfs_create_root':
> > > mtu3_debugfs.c:(.text+0xba3): undefined reference to 'usb_debug_root'
> > > 
> > > usb_debug_root is only built when CONFIG_USB is enabled, so here drop it
> > > and use NULL instead.
> > > 
> > > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > Acked-by: Randy Dunlap <rdunlap@infradead.org>
> > > ---
> > >  drivers/usb/mtu3/mtu3_debugfs.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > Why resend?
> Sorry, I should send it out as v2 due to acked-by is added.

Then please document that below the --- line, otherwise I have no idea :(

> > > diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
> > > index 62c57ddc554e..b7c86ccd50b4 100644
> > > --- a/drivers/usb/mtu3/mtu3_debugfs.c
> > > +++ b/drivers/usb/mtu3/mtu3_debugfs.c
> > > @@ -528,8 +528,7 @@ void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
> > >  
> > >  void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
> > >  {
> > > -	ssusb->dbgfs_root =
> > > -		debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
> > > +	ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);
> > 
> > This moves the directory to a new location no matter what the
> > configuration is. What's wrong with where it is today?  
> it seems usb_debug_root is only for host, but not for gadget only, it's
> defined and created in usb/core/usb.c

True, but you just moved the root if usb core is present too.

> > And shoudn't we
> > create the usb root directory if only gadget is enabled?
> Yes, need modify udc/core.c, it's better if support it, do you want me
> to send a patch for it?

Yes please, let's see what that looks like.

thanks,

greg k-h
Chunfeng Yun May 27, 2019, 2:56 a.m. UTC | #4
On Fri, 2019-05-24 at 13:33 +0200, Greg Kroah-Hartman wrote:
> On Fri, May 24, 2019 at 05:25:51PM +0800, Chunfeng Yun wrote:
> > On Fri, 2019-05-24 at 09:45 +0200, Greg Kroah-Hartman wrote:
> > > On Fri, May 24, 2019 at 02:11:33PM +0800, Chunfeng Yun wrote:
> > > > When CONFIG_USB is not set, and CONFIG_USB_GADGET is set,
> > > > there is an issue:
> > > > 
> > > > ld:
> > > > drivers/usb/mtu3/mtu3_debugfs.o: in function 'ssusb_debugfs_create_root':
> > > > mtu3_debugfs.c:(.text+0xba3): undefined reference to 'usb_debug_root'
> > > > 
> > > > usb_debug_root is only built when CONFIG_USB is enabled, so here drop it
> > > > and use NULL instead.
> > > > 
> > > > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > Acked-by: Randy Dunlap <rdunlap@infradead.org>
> > > > ---
> > > >  drivers/usb/mtu3/mtu3_debugfs.c | 3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > Why resend?
> > Sorry, I should send it out as v2 due to acked-by is added.
> 
> Then please document that below the --- line, otherwise I have no idea :(
Ok
> 
> > > > diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
> > > > index 62c57ddc554e..b7c86ccd50b4 100644
> > > > --- a/drivers/usb/mtu3/mtu3_debugfs.c
> > > > +++ b/drivers/usb/mtu3/mtu3_debugfs.c
> > > > @@ -528,8 +528,7 @@ void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
> > > >  
> > > >  void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
> > > >  {
> > > > -	ssusb->dbgfs_root =
> > > > -		debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
> > > > +	ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);
> > > 
> > > This moves the directory to a new location no matter what the
> > > configuration is. What's wrong with where it is today?  
> > it seems usb_debug_root is only for host, but not for gadget only, it's
> > defined and created in usb/core/usb.c
> 
> True, but you just moved the root if usb core is present too.
It's an easy way, and other dual-role driver also uses NULL

> 
> > > And shoudn't we
> > > create the usb root directory if only gadget is enabled?
> > Yes, need modify udc/core.c, it's better if support it, do you want me
> > to send a patch for it?
> 
> Yes please, let's see what that looks like.
I'll do it.

Thanks
> 
> thanks,
> 
> greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/mtu3/mtu3_debugfs.c b/drivers/usb/mtu3/mtu3_debugfs.c
index 62c57ddc554e..b7c86ccd50b4 100644
--- a/drivers/usb/mtu3/mtu3_debugfs.c
+++ b/drivers/usb/mtu3/mtu3_debugfs.c
@@ -528,8 +528,7 @@  void ssusb_dr_debugfs_init(struct ssusb_mtk *ssusb)
 
 void ssusb_debugfs_create_root(struct ssusb_mtk *ssusb)
 {
-	ssusb->dbgfs_root =
-		debugfs_create_dir(dev_name(ssusb->dev), usb_debug_root);
+	ssusb->dbgfs_root = debugfs_create_dir(dev_name(ssusb->dev), NULL);
 }
 
 void ssusb_debugfs_remove_root(struct ssusb_mtk *ssusb)