diff mbox series

[V0,3/7] usb: dwc3: drd: Register the eud connector child node for dwc3

Message ID 2006cf6c5662f70ca3348b683551bae4a8e4a0e2.1633343547.git.schowdhu@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series Add Embedded USB Debugger (EUD) driver | expand

Commit Message

Souradeep Chowdhury Oct. 4, 2021, 11:16 a.m. UTC
Register the child node for dwc3 which is the "eud_usb_connector".
The eud driver will be able to switch the usb role from device to
host and vice versa using the role switch property of dwc3 node.

Signed-off-by: Souradeep Chowdhury <schowdhu@codeaurora.org>
---
 drivers/usb/dwc3/drd.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

kernel test robot Oct. 5, 2021, 4:42 a.m. UTC | #1
Hi Souradeep,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.15-rc3 next-20210922]
[cannot apply to balbi-usb/testing/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Souradeep-Chowdhury/Add-Embedded-USB-Debugger-EUD-driver/20211004-191901
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: i386-randconfig-a004-20211004 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c0039de2953d15815448b4b3c3bafb45607781e0)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/4f53df1d9b6786f951384f59e3ffa7fed1817a2d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Souradeep-Chowdhury/Add-Embedded-USB-Debugger-EUD-driver/20211004-191901
        git checkout 4f53df1d9b6786f951384f59e3ffa7fed1817a2d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/usb/dwc3/drd.c:171:47: warning: variable 'con_np' set but not used [-Wunused-but-set-variable]
           struct device_node      *np = dev->of_node, *con_np;
                                                        ^
   1 warning generated.


vim +/con_np +171 drivers/usb/dwc3/drd.c

   167	
   168	static int dwc3_register_eud(struct dwc3 *dwc)
   169	{
   170		struct device           *dev = dwc->dev;
 > 171		struct device_node      *np = dev->of_node, *con_np;
   172		int                     ret;
   173	
   174		con_np = of_get_child_by_name(np, "eud_usb_connector");
   175		if (!np) {
   176			dev_dbg(dev, "no usb_connector child node specified\n");
   177			return 0;
   178		}
   179	
   180		ret = of_platform_populate(np, NULL, NULL, dev);
   181		if (ret) {
   182			dev_err(dev, "failed to register usb_connector - %d\n", ret);
   183			return ret;
   184		}
   185	
   186		return 0;
   187	}
   188	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Oct. 5, 2021, 12:32 p.m. UTC | #2
Hi Souradeep,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on robh/for-next linus/master v5.15-rc3 next-20210922]
[cannot apply to balbi-usb/testing/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Souradeep-Chowdhury/Add-Embedded-USB-Debugger-EUD-driver/20211004-191901
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/4f53df1d9b6786f951384f59e3ffa7fed1817a2d
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Souradeep-Chowdhury/Add-Embedded-USB-Debugger-EUD-driver/20211004-191901
        git checkout 4f53df1d9b6786f951384f59e3ffa7fed1817a2d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/usb/dwc3/drd.c: In function 'dwc3_register_eud':
>> drivers/usb/dwc3/drd.c:171:54: error: variable 'con_np' set but not used [-Werror=unused-but-set-variable]
     171 |         struct device_node      *np = dev->of_node, *con_np;
         |                                                      ^~~~~~
   cc1: all warnings being treated as errors


vim +/con_np +171 drivers/usb/dwc3/drd.c

   167	
   168	static int dwc3_register_eud(struct dwc3 *dwc)
   169	{
   170		struct device           *dev = dwc->dev;
 > 171		struct device_node      *np = dev->of_node, *con_np;
   172		int                     ret;
   173	
   174		con_np = of_get_child_by_name(np, "eud_usb_connector");
   175		if (!np) {
   176			dev_dbg(dev, "no usb_connector child node specified\n");
   177			return 0;
   178		}
   179	
   180		ret = of_platform_populate(np, NULL, NULL, dev);
   181		if (ret) {
   182			dev_err(dev, "failed to register usb_connector - %d\n", ret);
   183			return ret;
   184		}
   185	
   186		return 0;
   187	}
   188	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index d7f7683..f55e473 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -11,6 +11,7 @@ 
 #include <linux/of_graph.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
+#include <linux/of_platform.h>
 
 #include "debug.h"
 #include "core.h"
@@ -164,6 +165,27 @@  static int dwc3_otg_get_irq(struct dwc3 *dwc)
 	return irq;
 }
 
+static int dwc3_register_eud(struct dwc3 *dwc)
+{
+	struct device           *dev = dwc->dev;
+	struct device_node      *np = dev->of_node, *con_np;
+	int                     ret;
+
+	con_np = of_get_child_by_name(np, "eud_usb_connector");
+	if (!np) {
+		dev_dbg(dev, "no usb_connector child node specified\n");
+		return 0;
+	}
+
+	ret = of_platform_populate(np, NULL, NULL, dev);
+	if (ret) {
+		dev_err(dev, "failed to register usb_connector - %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 void dwc3_otg_init(struct dwc3 *dwc)
 {
 	u32 reg;
@@ -580,6 +602,9 @@  int dwc3_drd_init(struct dwc3 *dwc)
 		ret = dwc3_setup_role_switch(dwc);
 		if (ret < 0)
 			return ret;
+		ret = dwc3_register_eud(dwc);
+		if (ret < 0)
+			return ret;
 	} else if (dwc->edev) {
 		dwc->edev_nb.notifier_call = dwc3_drd_notifier;
 		ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,