RE: [PATCH] usb: gadget: udc: remove redundant initial assignments to the pointer 's'

2017-03-27 Thread YUAN Linyu
Hi,

> -Original Message-
> From: Colin King [mailto:colin.k...@canonical.com]
> Sent: Tuesday, March 28, 2017 6:35 AM
> To: Felipe Balbi; Greg Kroah-Hartman; YUAN Linyu; Bhumika Goyal; Michal
> Nazarewicz; linux-usb@vger.kernel.org
> Cc: kernel-janit...@vger.kernel.org; linux-ker...@vger.kernel.org
> Subject: [PATCH] usb: gadget: udc: remove redundant initial assignments to the
> pointer 's'
> 
> From: Colin Ian King <colin.k...@canonical.com>
> 
> The initial setting of pointer s to the driver name or to the literal
> string "(none)" is redundant as later it is always set to point to
> a different literal string before it is printed log.  Remove this
> redundant code.
> 
> Detected with CoverityScan, CID#1227032, CID#1227033 ("Unused Value")
> 
> Signed-off-by: Colin Ian King <colin.k...@canonical.com>
> ---
>  drivers/usb/gadget/udc/net2272.c | 5 -
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/net2272.c
> b/drivers/usb/gadget/udc/net2272.c
> index 8f85a51bd2b3..dee4eb60d4c2 100644
> --- a/drivers/usb/gadget/udc/net2272.c
> +++ b/drivers/usb/gadget/udc/net2272.c
> @@ -1191,11 +1191,6 @@ registers_show(struct device *_dev, struct
> device_attribute *attr, char *buf)
>   size = PAGE_SIZE;
>   spin_lock_irqsave(>lock, flags);
> 
> - if (dev->driver)
> - s = dev->driver->driver.name;
> - else
> - s = "(none)";
> -
>   /* Main Control Registers */
>   t = scnprintf(next, size, "%s version %s,"
>   "chiprev %02x, locctl %02x\n"
I think it's original purpose is not use driver_name directly in below 
scnprintf function call.
You can change drivers_name below to s.

/* Main Control Registers */
t = scnprintf(next, size, "%s version %s,"
"chiprev %02x, locctl %02x\n"
"irqenb0 %02x irqenb1 %02x "
"irqstat0 %02x irqstat1 %02x\n",
driver_name, driver_vers, dev->chiprev,
> --
> 2.11.0



[PATCH V3] usb: add CONFIG_USB_PCI for system have both PCI HW and non-PCI based USB HW

2017-02-25 Thread yuan linyu
From: yuan linyu <linyu.y...@alcatel-sbell.com.cn>

a lot of embeded system SOC (e.g. freescale T2080) have both
PCI and USB modules. But USB module is controlled by registers directly,
it have no relationship with PCI module.

when say N here it will not build PCI related code in USB driver.

Signed-off-by: yuan linyu <linyu.y...@alcatel-sbell.com.cn>
---
 drivers/usb/Kconfig| 12 +++-
 drivers/usb/Makefile   |  2 +-
 drivers/usb/chipidea/Kconfig   |  2 +-
 drivers/usb/core/Makefile  |  2 +-
 drivers/usb/dwc2/Kconfig   |  2 +-
 drivers/usb/dwc3/Kconfig   |  2 +-
 drivers/usb/gadget/udc/Kconfig |  8 
 drivers/usb/gadget/udc/bdc/Kconfig |  2 +-
 drivers/usb/gadget/udc/net2272.c   |  8 
 drivers/usb/gadget/udc/net2272.h   |  2 +-
 drivers/usb/host/Kconfig   | 10 +-
 drivers/usb/host/Makefile  |  4 +---
 drivers/usb/host/ehci-dbg.c|  2 +-
 drivers/usb/host/ohci-hcd.c|  2 +-
 drivers/usb/host/ohci.h|  2 +-
 drivers/usb/host/pci-quirks.h  |  4 ++--
 drivers/usb/host/uhci-hcd.c|  2 +-
 drivers/usb/host/uhci-hcd.h|  2 +-
 drivers/usb/host/xhci.c|  2 +-
 drivers/usb/isp1760/isp1760-if.c   |  8 
 include/linux/usb/hcd.h|  4 ++--
 21 files changed, 46 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fbe493d44e81..8578b9484f33 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -35,7 +35,6 @@ config USB_COMMON
 config USB_ARCH_HAS_HCD
def_bool y
 
-# ARM SA chips have a non-PCI based "OHCI-compatible" USB host interface.
 config USB
tristate "Support for Host-side USB"
depends on USB_ARCH_HAS_HCD
@@ -73,6 +72,17 @@ config USB
  To compile this driver as a module, choose M here: the
  module will be called usbcore.
 
+config USB_PCI
+   bool "PCI based USB host interface"
+   depends on PCI
+   default y
+   ---help---
+ a lot of embeded system SOC (e.g. freescale T2080) have both
+ PCI and USB modules. But USB module is controlled by registers 
directly,
+ it have no relationship with PCI module.
+
+ when say N here it will  not build PCI related code in USB driver.
+
 if USB
 
 source "drivers/usb/core/Kconfig"
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 7791af6c102c..4e1cf090fd20 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_USB_ISP1760) += isp1760/
 obj-$(CONFIG_USB_MON)  += mon/
 obj-$(CONFIG_USB_MTU3) += mtu3/
 
-obj-$(CONFIG_PCI)  += host/
+obj-$(CONFIG_USB_PCI)  += host/
 obj-$(CONFIG_USB_EHCI_HCD) += host/
 obj-$(CONFIG_USB_ISP116X_HCD)  += host/
 obj-$(CONFIG_USB_OHCI_HCD) += host/
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index fc96f5cdcb5c..51f4157bbecf 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_OF
 
 config USB_CHIPIDEA_PCI
tristate
-   depends on PCI
+   depends on USB_PCI
depends on NOP_USB_XCEIV
default USB_CHIPIDEA
 
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index b99b871c4b9d..250ec1d662d9 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -8,7 +8,7 @@ usbcore-y += devio.o notify.o generic.o quirks.o devices.o
 usbcore-y += port.o
 
 usbcore-$(CONFIG_OF)   += of.o
-usbcore-$(CONFIG_PCI)  += hcd-pci.o
+usbcore-$(CONFIG_USB_PCI)  += hcd-pci.o
 usbcore-$(CONFIG_ACPI) += usb-acpi.o
 
 obj-$(CONFIG_USB)  += usbcore.o
diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
index e838701d6dd5..b6a495e98fd8 100644
--- a/drivers/usb/dwc2/Kconfig
+++ b/drivers/usb/dwc2/Kconfig
@@ -54,7 +54,7 @@ endchoice
 
 config USB_DWC2_PCI
tristate "DWC2 PCI"
-   depends on PCI
+   depends on USB_PCI
depends on USB_GADGET || !USB_GADGET
default n
select NOP_USB_XCEIV
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index c5aa235863e8..4c9e56d8776a 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -70,7 +70,7 @@ config USB_DWC3_EXYNOS
 
 config USB_DWC3_PCI
tristate "PCIe-based Platforms"
-   depends on PCI && ACPI
+   depends on USB_PCI && ACPI
default USB_DWC3
help
  If you're using the DesignWare Core IP with a PCIe, please say
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 4b69f28a9af9..c6cc9d3270ac 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -277,7 +277,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig"
 
 config USB_AMD5536UDC
tristate "AMD5536

[PATCH] usb: add CONFIG_USB_PCI for system have both PCI HW and non-PCI based USB HW

2017-02-15 Thread yuan linyu
From: yuan linyu <linyu.y...@alcatel-sbell.com.cn>

a lot of embeded system SOC (e.g. freescale T2080) have both
PCI and USB modules. But USB module is controlled by registers directly,
it have no relationship with PCI module.

when say N here it will not build PCI related code in USB driver.

Cc: Alan Stern <st...@rowland.harvard.edu>
Signed-off-by: yuan linyu <linyu.y...@alcatel-sbell.com.cn>
---
 drivers/usb/Kconfig| 12 +++-
 drivers/usb/Makefile   |  2 +-
 drivers/usb/chipidea/Kconfig   |  2 +-
 drivers/usb/core/Makefile  |  2 +-
 drivers/usb/dwc2/Kconfig   |  2 +-
 drivers/usb/dwc3/Kconfig   |  2 +-
 drivers/usb/gadget/udc/Kconfig |  8 
 drivers/usb/gadget/udc/bdc/Kconfig |  2 +-
 drivers/usb/gadget/udc/net2272.c   |  8 
 drivers/usb/gadget/udc/net2272.h   |  2 +-
 drivers/usb/host/Kconfig   | 10 +-
 drivers/usb/host/ehci-dbg.c|  2 +-
 drivers/usb/host/ohci-hcd.c|  2 +-
 drivers/usb/host/ohci.h|  2 +-
 drivers/usb/host/pci-quirks.h  |  4 ++--
 drivers/usb/host/uhci-hcd.c|  2 +-
 drivers/usb/host/uhci-hcd.h|  2 +-
 drivers/usb/host/xhci.c|  2 +-
 drivers/usb/isp1760/isp1760-if.c   |  8 
 include/linux/usb/hcd.h|  4 ++--
 20 files changed, 45 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fbe493d..8578b94 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -35,7 +35,6 @@ config USB_COMMON
 config USB_ARCH_HAS_HCD
def_bool y
 
-# ARM SA chips have a non-PCI based "OHCI-compatible" USB host interface.
 config USB
tristate "Support for Host-side USB"
depends on USB_ARCH_HAS_HCD
@@ -73,6 +72,17 @@ config USB
  To compile this driver as a module, choose M here: the
  module will be called usbcore.
 
+config USB_PCI
+   bool "PCI based USB host interface"
+   depends on PCI
+   default y
+   ---help---
+ a lot of embeded system SOC (e.g. freescale T2080) have both
+ PCI and USB modules. But USB module is controlled by registers 
directly,
+ it have no relationship with PCI module.
+
+ when say N here it will  not build PCI related code in USB driver.
+
 if USB
 
 source "drivers/usb/core/Kconfig"
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 7791af6..4e1cf09 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_USB_ISP1760) += isp1760/
 obj-$(CONFIG_USB_MON)  += mon/
 obj-$(CONFIG_USB_MTU3) += mtu3/
 
-obj-$(CONFIG_PCI)  += host/
+obj-$(CONFIG_USB_PCI)  += host/
 obj-$(CONFIG_USB_EHCI_HCD) += host/
 obj-$(CONFIG_USB_ISP116X_HCD)  += host/
 obj-$(CONFIG_USB_OHCI_HCD) += host/
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 5e5b9eb..7e915a8 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -19,7 +19,7 @@ config USB_CHIPIDEA_OF
 
 config USB_CHIPIDEA_PCI
tristate
-   depends on PCI
+   depends on USB_PCI
depends on NOP_USB_XCEIV
default USB_CHIPIDEA
 
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index b99b871..250ec1d 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -8,7 +8,7 @@ usbcore-y += devio.o notify.o generic.o quirks.o devices.o
 usbcore-y += port.o
 
 usbcore-$(CONFIG_OF)   += of.o
-usbcore-$(CONFIG_PCI)  += hcd-pci.o
+usbcore-$(CONFIG_USB_PCI)  += hcd-pci.o
 usbcore-$(CONFIG_ACPI) += usb-acpi.o
 
 obj-$(CONFIG_USB)  += usbcore.o
diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
index e838701..b6a495e 100644
--- a/drivers/usb/dwc2/Kconfig
+++ b/drivers/usb/dwc2/Kconfig
@@ -54,7 +54,7 @@ endchoice
 
 config USB_DWC2_PCI
tristate "DWC2 PCI"
-   depends on PCI
+   depends on USB_PCI
depends on USB_GADGET || !USB_GADGET
default n
select NOP_USB_XCEIV
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index c5aa235..4c9e56d 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -70,7 +70,7 @@ config USB_DWC3_EXYNOS
 
 config USB_DWC3_PCI
tristate "PCIe-based Platforms"
-   depends on PCI && ACPI
+   depends on USB_PCI && ACPI
default USB_DWC3
help
  If you're using the DesignWare Core IP with a PCIe, please say
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 658b8da..5761767 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -263,7 +263,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig"
 
 config USB_AMD5536UDC
tristate "AMD5536 UDC"
-   depends on PCI
+   depends on USB_PCI
 

[PATCH] usb: add CONFIG_USB_PCI to distinguish PCI/non-PCI based USB

2017-02-14 Thread yuan linyu
From: yuan linyu <linyu.y...@alcatel-sbell.com.cn>

one usage is in embedded system usb host controller is non-PCI based,
chooe N in such system will not compile PCI code/function of USB.

Signed-off-by: yuan linyu <linyu.y...@alcatel-sbell.com.cn>
---
 drivers/usb/Kconfig|  9 -
 drivers/usb/Makefile   |  2 +-
 drivers/usb/chipidea/Kconfig   |  2 +-
 drivers/usb/core/Makefile  |  2 +-
 drivers/usb/dwc2/Kconfig   |  2 +-
 drivers/usb/dwc3/Kconfig   |  2 +-
 drivers/usb/gadget/udc/Kconfig |  8 
 drivers/usb/gadget/udc/bdc/Kconfig |  2 +-
 drivers/usb/gadget/udc/net2272.c   |  8 
 drivers/usb/gadget/udc/net2272.h   |  2 +-
 drivers/usb/host/Kconfig   | 10 +-
 drivers/usb/host/ehci-dbg.c|  2 +-
 drivers/usb/host/ohci-hcd.c|  2 +-
 drivers/usb/host/ohci.h|  2 +-
 drivers/usb/host/pci-quirks.h  |  4 ++--
 drivers/usb/host/uhci-hcd.c|  2 +-
 drivers/usb/host/uhci-hcd.h|  2 +-
 drivers/usb/host/xhci.c|  2 +-
 drivers/usb/isp1760/isp1760-if.c   |  8 
 include/linux/usb/hcd.h|  4 ++--
 20 files changed, 42 insertions(+), 35 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fbe493d..d6558f2 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -35,7 +35,6 @@ config USB_COMMON
 config USB_ARCH_HAS_HCD
def_bool y
 
-# ARM SA chips have a non-PCI based "OHCI-compatible" USB host interface.
 config USB
tristate "Support for Host-side USB"
depends on USB_ARCH_HAS_HCD
@@ -73,6 +72,14 @@ config USB
  To compile this driver as a module, choose M here: the
  module will be called usbcore.
 
+config USB_PCI
+   bool "PCI based USB host interface"
+   depends on PCI
+   default y
+   ---help---
+ if system have both PCI and USB,  but USB is non-PCI related,
+ say N here allow PCI related code not compiled.
+
 if USB
 
 source "drivers/usb/core/Kconfig"
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 7791af6..4e1cf09 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_USB_ISP1760) += isp1760/
 obj-$(CONFIG_USB_MON)  += mon/
 obj-$(CONFIG_USB_MTU3) += mtu3/
 
-obj-$(CONFIG_PCI)  += host/
+obj-$(CONFIG_USB_PCI)  += host/
 obj-$(CONFIG_USB_EHCI_HCD) += host/
 obj-$(CONFIG_USB_ISP116X_HCD)  += host/
 obj-$(CONFIG_USB_OHCI_HCD) += host/
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 5e5b9eb..7e915a8 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -19,7 +19,7 @@ config USB_CHIPIDEA_OF
 
 config USB_CHIPIDEA_PCI
tristate
-   depends on PCI
+   depends on USB_PCI
depends on NOP_USB_XCEIV
default USB_CHIPIDEA
 
diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
index b99b871..250ec1d 100644
--- a/drivers/usb/core/Makefile
+++ b/drivers/usb/core/Makefile
@@ -8,7 +8,7 @@ usbcore-y += devio.o notify.o generic.o quirks.o devices.o
 usbcore-y += port.o
 
 usbcore-$(CONFIG_OF)   += of.o
-usbcore-$(CONFIG_PCI)  += hcd-pci.o
+usbcore-$(CONFIG_USB_PCI)  += hcd-pci.o
 usbcore-$(CONFIG_ACPI) += usb-acpi.o
 
 obj-$(CONFIG_USB)  += usbcore.o
diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
index e838701..b6a495e 100644
--- a/drivers/usb/dwc2/Kconfig
+++ b/drivers/usb/dwc2/Kconfig
@@ -54,7 +54,7 @@ endchoice
 
 config USB_DWC2_PCI
tristate "DWC2 PCI"
-   depends on PCI
+   depends on USB_PCI
depends on USB_GADGET || !USB_GADGET
default n
select NOP_USB_XCEIV
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index c5aa235..4c9e56d 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -70,7 +70,7 @@ config USB_DWC3_EXYNOS
 
 config USB_DWC3_PCI
tristate "PCIe-based Platforms"
-   depends on PCI && ACPI
+   depends on USB_PCI && ACPI
default USB_DWC3
help
  If you're using the DesignWare Core IP with a PCIe, please say
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 658b8da..5761767 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -263,7 +263,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig"
 
 config USB_AMD5536UDC
tristate "AMD5536 UDC"
-   depends on PCI
+   depends on USB_PCI
help
   The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge.
   It is a USB Highspeed DMA capable USB device controller. Beside ep0
@@ -313,7 +313,7 @@ config USB_NET2272_DMA
 
 config USB_NET2280
tristate "NetChip NET228x / PLX USB3x8x"
-   depends on PCI