diff mbox series

[1/2] usb: xhci-plat: Don't include xhci.h

Message ID 900465dc09f1c8e12c4df98d625b9985965951a8.1713310411.git.Thinh.Nguyen@synopsys.com (mailing list archive)
State Superseded
Headers show
Series usb: dwc3: Disable susphy during initialization | expand

Commit Message

Thinh Nguyen April 16, 2024, 11:41 p.m. UTC
The xhci_plat.h should not need to include the entire xhci.h header.
This can cause redefinition in dwc3 if it selectively includes some xHCI
definitions. This is a prerequisite change for a fix to disable suspend
during initialization for dwc3.

Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 drivers/usb/host/xhci-plat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

kernel test robot April 17, 2024, 10:58 a.m. UTC | #1
Hi Thinh,

kernel test robot noticed the following build errors:

[auto build test ERROR on 3d122e6d27e417a9fa91181922743df26b2cd679]

url:    https://github.com/intel-lab-lkp/linux/commits/Thinh-Nguyen/usb-xhci-plat-Don-t-include-xhci-h/20240417-074220
base:   3d122e6d27e417a9fa91181922743df26b2cd679
patch link:    https://lore.kernel.org/r/900465dc09f1c8e12c4df98d625b9985965951a8.1713310411.git.Thinh.Nguyen%40synopsys.com
patch subject: [PATCH 1/2] usb: xhci-plat: Don't include xhci.h
config: arc-allmodconfig (https://download.01.org/0day-ci/archive/20240417/202404171847.XPIgGzM6-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240417/202404171847.XPIgGzM6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404171847.XPIgGzM6-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/usb/host/xhci-rzv2m.c: In function 'xhci_rzv2m_init_quirk':
>> drivers/usb/host/xhci-rzv2m.c:21:33: error: invalid use of undefined type 'struct usb_hcd'
      21 |         struct device *dev = hcd->self.controller;
         |                                 ^~
>> drivers/usb/host/xhci-rzv2m.c:23:32: error: invalid use of undefined type 'struct device'
      23 |         rzv2m_usb3drd_reset(dev->parent, true);
         |                                ^~
   drivers/usb/host/xhci-rzv2m.c: In function 'xhci_rzv2m_start':
   drivers/usb/host/xhci-rzv2m.c:32:16: error: invalid use of undefined type 'struct usb_hcd'
      32 |         if (hcd->regs) {
         |                ^~
>> drivers/usb/host/xhci-rzv2m.c:34:26: error: implicit declaration of function 'readl' [-Werror=implicit-function-declaration]
      34 |                 int_en = readl(hcd->regs + RZV2M_USB3_INTEN);
         |                          ^~~~~
   drivers/usb/host/xhci-rzv2m.c:34:35: error: invalid use of undefined type 'struct usb_hcd'
      34 |                 int_en = readl(hcd->regs + RZV2M_USB3_INTEN);
         |                                   ^~
>> drivers/usb/host/xhci-rzv2m.c:14:33: error: implicit declaration of function 'BIT' [-Werror=implicit-function-declaration]
      14 | #define RZV2M_USB3_INT_XHC_ENA  BIT(0)
         |                                 ^~~
   drivers/usb/host/xhci-rzv2m.c:16:34: note: in expansion of macro 'RZV2M_USB3_INT_XHC_ENA'
      16 | #define RZV2M_USB3_INT_ENA_VAL  (RZV2M_USB3_INT_XHC_ENA \
         |                                  ^~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/host/xhci-rzv2m.c:35:27: note: in expansion of macro 'RZV2M_USB3_INT_ENA_VAL'
      35 |                 int_en |= RZV2M_USB3_INT_ENA_VAL;
         |                           ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/host/xhci-rzv2m.c:36:17: error: implicit declaration of function 'writel' [-Werror=implicit-function-declaration]
      36 |                 writel(int_en, hcd->regs + RZV2M_USB3_INTEN);
         |                 ^~~~~~
   drivers/usb/host/xhci-rzv2m.c:36:35: error: invalid use of undefined type 'struct usb_hcd'
      36 |                 writel(int_en, hcd->regs + RZV2M_USB3_INTEN);
         |                                   ^~
   cc1: some warnings being treated as errors


vim +21 drivers/usb/host/xhci-rzv2m.c

c52c9acc415eb6 Biju Das 2023-01-21  13  
c52c9acc415eb6 Biju Das 2023-01-21 @14  #define RZV2M_USB3_INT_XHC_ENA	BIT(0)
c52c9acc415eb6 Biju Das 2023-01-21  15  #define RZV2M_USB3_INT_HSE_ENA	BIT(2)
c52c9acc415eb6 Biju Das 2023-01-21  16  #define RZV2M_USB3_INT_ENA_VAL	(RZV2M_USB3_INT_XHC_ENA \
c52c9acc415eb6 Biju Das 2023-01-21  17  				 | RZV2M_USB3_INT_HSE_ENA)
c52c9acc415eb6 Biju Das 2023-01-21  18  
c52c9acc415eb6 Biju Das 2023-01-21  19  int xhci_rzv2m_init_quirk(struct usb_hcd *hcd)
c52c9acc415eb6 Biju Das 2023-01-21  20  {
c52c9acc415eb6 Biju Das 2023-01-21 @21  	struct device *dev = hcd->self.controller;
c52c9acc415eb6 Biju Das 2023-01-21  22  
c52c9acc415eb6 Biju Das 2023-01-21 @23  	rzv2m_usb3drd_reset(dev->parent, true);
c52c9acc415eb6 Biju Das 2023-01-21  24  
c52c9acc415eb6 Biju Das 2023-01-21  25  	return 0;
c52c9acc415eb6 Biju Das 2023-01-21  26  }
c52c9acc415eb6 Biju Das 2023-01-21  27  
c52c9acc415eb6 Biju Das 2023-01-21  28  void xhci_rzv2m_start(struct usb_hcd *hcd)
c52c9acc415eb6 Biju Das 2023-01-21  29  {
c52c9acc415eb6 Biju Das 2023-01-21  30  	u32 int_en;
c52c9acc415eb6 Biju Das 2023-01-21  31  
c52c9acc415eb6 Biju Das 2023-01-21  32  	if (hcd->regs) {
c52c9acc415eb6 Biju Das 2023-01-21  33  		/* Interrupt Enable */
c52c9acc415eb6 Biju Das 2023-01-21 @34  		int_en = readl(hcd->regs + RZV2M_USB3_INTEN);
c52c9acc415eb6 Biju Das 2023-01-21  35  		int_en |= RZV2M_USB3_INT_ENA_VAL;
c52c9acc415eb6 Biju Das 2023-01-21 @36  		writel(int_en, hcd->regs + RZV2M_USB3_INTEN);
Greg Kroah-Hartman April 17, 2024, 11:08 a.m. UTC | #2
On Tue, Apr 16, 2024 at 11:41:36PM +0000, Thinh Nguyen wrote:
> The xhci_plat.h should not need to include the entire xhci.h header.
> This can cause redefinition in dwc3 if it selectively includes some xHCI
> definitions. This is a prerequisite change for a fix to disable suspend
> during initialization for dwc3.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
>  drivers/usb/host/xhci-plat.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> index 2d15386f2c50..6475130eac4b 100644
> --- a/drivers/usb/host/xhci-plat.h
> +++ b/drivers/usb/host/xhci-plat.h
> @@ -8,7 +8,9 @@
>  #ifndef _XHCI_PLAT_H
>  #define _XHCI_PLAT_H
>  
> -#include "xhci.h"	/* for hcd_to_xhci() */
> +struct device;
> +struct platform_device;
> +struct usb_hcd;
>  
>  struct xhci_plat_priv {
>  	const char *firmware_name;
> -- 
> 2.28.0
> 

Seems to break the build :(
Thinh Nguyen April 17, 2024, 9:01 p.m. UTC | #3
On Wed, Apr 17, 2024, Greg Kroah-Hartman wrote:
> On Tue, Apr 16, 2024 at 11:41:36PM +0000, Thinh Nguyen wrote:
> > The xhci_plat.h should not need to include the entire xhci.h header.
> > This can cause redefinition in dwc3 if it selectively includes some xHCI
> > definitions. This is a prerequisite change for a fix to disable suspend
> > during initialization for dwc3.
> > 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> > ---
> >  drivers/usb/host/xhci-plat.h | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
> > index 2d15386f2c50..6475130eac4b 100644
> > --- a/drivers/usb/host/xhci-plat.h
> > +++ b/drivers/usb/host/xhci-plat.h
> > @@ -8,7 +8,9 @@
> >  #ifndef _XHCI_PLAT_H
> >  #define _XHCI_PLAT_H
> >  
> > -#include "xhci.h"	/* for hcd_to_xhci() */
> > +struct device;
> > +struct platform_device;
> > +struct usb_hcd;
> >  
> >  struct xhci_plat_priv {
> >  	const char *firmware_name;
> > -- 
> > 2.28.0
> > 
> 
> Seems to break the build :(

Oops.. I missed checking for xhci-rzv2m build.

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 2d15386f2c50..6475130eac4b 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -8,7 +8,9 @@ 
 #ifndef _XHCI_PLAT_H
 #define _XHCI_PLAT_H
 
-#include "xhci.h"	/* for hcd_to_xhci() */
+struct device;
+struct platform_device;
+struct usb_hcd;
 
 struct xhci_plat_priv {
 	const char *firmware_name;