All of lore.kernel.org
 help / color / mirror / Atom feed
* [xilinx-xlnx:xlnx_rebase_v5.15 394/1080] drivers/usb/dwc3/otg.c:291:13: warning: variable 'osts' set but not used
@ 2022-04-06 17:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-06 17:10 UTC (permalink / raw)
  To: Anurag Kumar Vulisha
  Cc: kbuild-all, linux-arm-kernel, Michal Simek, Piyush Mehta, Manish Narani

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head:   6474115d882fd9e82731ac2473875dc3e8ac9acc
commit: d0fdd1b604fc3e7687a1033469542076a6bb8733 [394/1080] usb: dwc3: gadget: Add new platform_data.h file
config: sparc-randconfig-r032-20220406 (https://download.01.org/0day-ci/archive/20220407/202204070132.GjEw2GSR-lkp@intel.com/config)
compiler: sparc64-linux-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/Xilinx/linux-xlnx/commit/d0fdd1b604fc3e7687a1033469542076a6bb8733
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15
        git checkout d0fdd1b604fc3e7687a1033469542076a6bb8733
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash drivers/usb/dwc3/

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/otg.c: In function 'start_host':
>> drivers/usb/dwc3/otg.c:291:13: warning: variable 'osts' set but not used [-Wunused-but-set-variable]
     291 |         u32 osts;
         |             ^~~~
   drivers/usb/dwc3/otg.c: At top level:
>> drivers/usb/dwc3/otg.c:418:5: warning: no previous prototype for 'dwc3_otg_host_release' [-Wmissing-prototypes]
     418 | int dwc3_otg_host_release(struct usb_hcd *hcd)
         |     ^~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/otg.c:1323:5: warning: no previous prototype for 'otg_main_thread' [-Wmissing-prototypes]
    1323 | int otg_main_thread(void *data)
         |     ^~~~~~~~~~~~~~~
>> drivers/usb/dwc3/otg.c:1885:5: warning: no previous prototype for 'otg_host_release' [-Wmissing-prototypes]
    1885 | int otg_host_release(struct usb_otg *otg)
         |     ^~~~~~~~~~~~~~~~
   drivers/usb/dwc3/otg.c: In function 'store_hnp':
   drivers/usb/dwc3/otg.c:1975:20: error: 'dwc->gadget' is a pointer; did you mean to use '->'?
    1975 |         dwc->gadget.host_request_flag = 1;
         |                    ^
         |                    ->
   drivers/usb/dwc3/otg.c: At top level:
>> drivers/usb/dwc3/otg.c:2040:6: warning: no previous prototype for 'dwc_usb3_remove_dev_files' [-Wmissing-prototypes]
    2040 | void dwc_usb3_remove_dev_files(struct device *dev)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/otg.c:2050:5: warning: no previous prototype for 'dwc3_otg_create_dev_files' [-Wmissing-prototypes]
    2050 | int dwc3_otg_create_dev_files(struct device *dev)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +/osts +291 drivers/usb/dwc3/otg.c

d50e8d7c931f49 Piyush Mehta 2022-01-26  285  
d50e8d7c931f49 Piyush Mehta 2022-01-26  286  static int start_host(struct dwc3_otg *otg)
d50e8d7c931f49 Piyush Mehta 2022-01-26  287  {
d50e8d7c931f49 Piyush Mehta 2022-01-26  288  	int ret = -ENODEV;
d50e8d7c931f49 Piyush Mehta 2022-01-26  289  	int flg;
d50e8d7c931f49 Piyush Mehta 2022-01-26  290  	u32 octl;
d50e8d7c931f49 Piyush Mehta 2022-01-26 @291  	u32 osts;
d50e8d7c931f49 Piyush Mehta 2022-01-26  292  	u32 ocfg;
d50e8d7c931f49 Piyush Mehta 2022-01-26  293  	u32 dctl;
d50e8d7c931f49 Piyush Mehta 2022-01-26  294  	struct usb_hcd *hcd;
d50e8d7c931f49 Piyush Mehta 2022-01-26  295  	struct xhci_hcd *xhci;
d50e8d7c931f49 Piyush Mehta 2022-01-26  296  
d50e8d7c931f49 Piyush Mehta 2022-01-26  297  	otg_dbg(otg, "\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  298  
d50e8d7c931f49 Piyush Mehta 2022-01-26  299  	if (!otg->otg.host)
d50e8d7c931f49 Piyush Mehta 2022-01-26  300  		return -ENODEV;
d50e8d7c931f49 Piyush Mehta 2022-01-26  301  
d50e8d7c931f49 Piyush Mehta 2022-01-26  302  	/*
d50e8d7c931f49 Piyush Mehta 2022-01-26  303  	 * Prevent the host USBCMD.HCRST from resetting OTG core by setting
d50e8d7c931f49 Piyush Mehta 2022-01-26  304  	 * OCFG.OTGSftRstMsk
d50e8d7c931f49 Piyush Mehta 2022-01-26  305  	 */
d50e8d7c931f49 Piyush Mehta 2022-01-26  306  	ocfg = otg_read(otg, OCFG);
d50e8d7c931f49 Piyush Mehta 2022-01-26  307  	ocfg |= DWC3_OCFG_SFTRSTMASK;
d50e8d7c931f49 Piyush Mehta 2022-01-26  308  	otg_write(otg, OCFG, ocfg);
d50e8d7c931f49 Piyush Mehta 2022-01-26  309  
d50e8d7c931f49 Piyush Mehta 2022-01-26  310  	dctl = otg_read(otg, DCTL);
d50e8d7c931f49 Piyush Mehta 2022-01-26  311  	if (dctl & DWC3_DCTL_RUN_STOP) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  312  		otg_dbg(otg, "Disabling the RUN/STOP bit\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  313  		dctl &= ~DWC3_DCTL_RUN_STOP;
d50e8d7c931f49 Piyush Mehta 2022-01-26  314  		otg_write(otg, DCTL, dctl);
d50e8d7c931f49 Piyush Mehta 2022-01-26  315  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  316  
d50e8d7c931f49 Piyush Mehta 2022-01-26  317  	if (!set_peri_mode(otg, PERI_MODE_HOST)) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  318  		otg_err(otg, "Failed to start host\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  319  		return -EINVAL;
d50e8d7c931f49 Piyush Mehta 2022-01-26  320  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  321  
d50e8d7c931f49 Piyush Mehta 2022-01-26  322  	hcd = container_of(otg->otg.host, struct usb_hcd, self);
d50e8d7c931f49 Piyush Mehta 2022-01-26  323  	xhci = hcd_to_xhci(hcd);
d50e8d7c931f49 Piyush Mehta 2022-01-26  324  	otg_dbg(otg, "hcd=%p xhci=%p\n", hcd, xhci);
d50e8d7c931f49 Piyush Mehta 2022-01-26  325  
d50e8d7c931f49 Piyush Mehta 2022-01-26  326  	if (otg->host_started) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  327  		otg_info(otg, "Host already started\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  328  		goto skip;
d50e8d7c931f49 Piyush Mehta 2022-01-26  329  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  330  
d50e8d7c931f49 Piyush Mehta 2022-01-26  331  	/* Start host driver */
d50e8d7c931f49 Piyush Mehta 2022-01-26  332  
d50e8d7c931f49 Piyush Mehta 2022-01-26  333  	*(struct xhci_hcd **)hcd->hcd_priv = xhci;
d50e8d7c931f49 Piyush Mehta 2022-01-26  334  	ret = usb_add_hcd(hcd, otg->hcd_irq, IRQF_SHARED);
d50e8d7c931f49 Piyush Mehta 2022-01-26  335  	if (ret) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  336  		otg_err(otg, "%s: failed to start primary hcd, ret=%d\n",
d50e8d7c931f49 Piyush Mehta 2022-01-26  337  			__func__, ret);
d50e8d7c931f49 Piyush Mehta 2022-01-26  338  		return ret;
d50e8d7c931f49 Piyush Mehta 2022-01-26  339  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  340  
d50e8d7c931f49 Piyush Mehta 2022-01-26  341  	*(struct xhci_hcd **)xhci->shared_hcd->hcd_priv = xhci;
d50e8d7c931f49 Piyush Mehta 2022-01-26  342  	if (xhci->shared_hcd) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  343  		ret = usb_add_hcd(xhci->shared_hcd, otg->hcd_irq, IRQF_SHARED);
d50e8d7c931f49 Piyush Mehta 2022-01-26  344  		if (ret) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  345  			otg_err(otg,
d50e8d7c931f49 Piyush Mehta 2022-01-26  346  				"%s: failed to start secondary hcd, ret=%d\n",
d50e8d7c931f49 Piyush Mehta 2022-01-26  347  				__func__, ret);
d50e8d7c931f49 Piyush Mehta 2022-01-26  348  			usb_remove_hcd(hcd);
d50e8d7c931f49 Piyush Mehta 2022-01-26  349  			return ret;
d50e8d7c931f49 Piyush Mehta 2022-01-26  350  		}
d50e8d7c931f49 Piyush Mehta 2022-01-26  351  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  352  
d50e8d7c931f49 Piyush Mehta 2022-01-26  353  	otg->host_started = 1;
d50e8d7c931f49 Piyush Mehta 2022-01-26  354  skip:
d50e8d7c931f49 Piyush Mehta 2022-01-26  355  	hcd->self.otg_port = 1;
d50e8d7c931f49 Piyush Mehta 2022-01-26  356  	if (xhci->shared_hcd)
d50e8d7c931f49 Piyush Mehta 2022-01-26  357  		xhci->shared_hcd->self.otg_port = 1;
d50e8d7c931f49 Piyush Mehta 2022-01-26  358  
d50e8d7c931f49 Piyush Mehta 2022-01-26  359  	set_capabilities(otg);
d50e8d7c931f49 Piyush Mehta 2022-01-26  360  
d50e8d7c931f49 Piyush Mehta 2022-01-26  361  	/* Power the port only for A-host */
d50e8d7c931f49 Piyush Mehta 2022-01-26  362  	if (otg->otg.state == OTG_STATE_A_WAIT_VRISE) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  363  		/* Spin on xhciPrtPwr bit until it becomes 1 */
d50e8d7c931f49 Piyush Mehta 2022-01-26  364  		osts = otg_read(otg, OSTS);
d50e8d7c931f49 Piyush Mehta 2022-01-26  365  		flg = otg3_handshake(otg, OSTS,
d50e8d7c931f49 Piyush Mehta 2022-01-26  366  				OSTS_XHCI_PRT_PWR,
d50e8d7c931f49 Piyush Mehta 2022-01-26  367  				OSTS_XHCI_PRT_PWR,
d50e8d7c931f49 Piyush Mehta 2022-01-26  368  				1000);
d50e8d7c931f49 Piyush Mehta 2022-01-26  369  		if (flg) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  370  			otg_dbg(otg, "Port is powered by xhci-hcd\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  371  			/* Set port power control bit */
d50e8d7c931f49 Piyush Mehta 2022-01-26  372  			octl = otg_read(otg, OCTL);
d50e8d7c931f49 Piyush Mehta 2022-01-26  373  			octl |= OCTL_PRT_PWR_CTL;
d50e8d7c931f49 Piyush Mehta 2022-01-26  374  			otg_write(otg, OCTL, octl);
d50e8d7c931f49 Piyush Mehta 2022-01-26  375  		} else {
d50e8d7c931f49 Piyush Mehta 2022-01-26  376  			otg_dbg(otg, "Port is not powered by xhci-hcd\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  377  		}
d50e8d7c931f49 Piyush Mehta 2022-01-26  378  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  379  
d50e8d7c931f49 Piyush Mehta 2022-01-26  380  	return ret;
d50e8d7c931f49 Piyush Mehta 2022-01-26  381  }
d50e8d7c931f49 Piyush Mehta 2022-01-26  382  
d50e8d7c931f49 Piyush Mehta 2022-01-26  383  static int stop_host(struct dwc3_otg *otg)
d50e8d7c931f49 Piyush Mehta 2022-01-26  384  {
d50e8d7c931f49 Piyush Mehta 2022-01-26  385  	struct usb_hcd *hcd;
d50e8d7c931f49 Piyush Mehta 2022-01-26  386  	struct xhci_hcd *xhci;
d50e8d7c931f49 Piyush Mehta 2022-01-26  387  
d50e8d7c931f49 Piyush Mehta 2022-01-26  388  	otg_dbg(otg, "\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  389  
d50e8d7c931f49 Piyush Mehta 2022-01-26  390  	if (!otg->host_started) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  391  		otg_info(otg, "Host already stopped\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  392  		return 1;
d50e8d7c931f49 Piyush Mehta 2022-01-26  393  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  394  
d50e8d7c931f49 Piyush Mehta 2022-01-26  395  	if (!otg->otg.host)
d50e8d7c931f49 Piyush Mehta 2022-01-26  396  		return -ENODEV;
d50e8d7c931f49 Piyush Mehta 2022-01-26  397  
d50e8d7c931f49 Piyush Mehta 2022-01-26  398  	otg_dbg(otg, "%s: turn off host %s\n",
d50e8d7c931f49 Piyush Mehta 2022-01-26  399  		__func__, otg->otg.host->bus_name);
d50e8d7c931f49 Piyush Mehta 2022-01-26  400  
d50e8d7c931f49 Piyush Mehta 2022-01-26  401  	if (work_pending(&otg->hp_work.work)) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  402  		while (!cancel_delayed_work(&otg->hp_work))
d50e8d7c931f49 Piyush Mehta 2022-01-26  403  			msleep(20);
d50e8d7c931f49 Piyush Mehta 2022-01-26  404  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  405  
d50e8d7c931f49 Piyush Mehta 2022-01-26  406  	hcd = container_of(otg->otg.host, struct usb_hcd, self);
d50e8d7c931f49 Piyush Mehta 2022-01-26  407  	xhci = hcd_to_xhci(hcd);
d50e8d7c931f49 Piyush Mehta 2022-01-26  408  
d50e8d7c931f49 Piyush Mehta 2022-01-26  409  	if (xhci->shared_hcd)
d50e8d7c931f49 Piyush Mehta 2022-01-26  410  		usb_remove_hcd(xhci->shared_hcd);
d50e8d7c931f49 Piyush Mehta 2022-01-26  411  	usb_remove_hcd(hcd);
d50e8d7c931f49 Piyush Mehta 2022-01-26  412  
d50e8d7c931f49 Piyush Mehta 2022-01-26  413  	otg->host_started = 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  414  	otg->dev_enum = 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  415  	return 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  416  }
d50e8d7c931f49 Piyush Mehta 2022-01-26  417  
d50e8d7c931f49 Piyush Mehta 2022-01-26 @418  int dwc3_otg_host_release(struct usb_hcd *hcd)
d50e8d7c931f49 Piyush Mehta 2022-01-26  419  {
d50e8d7c931f49 Piyush Mehta 2022-01-26  420  	struct usb_bus *bus;
d50e8d7c931f49 Piyush Mehta 2022-01-26  421  	struct usb_device *rh;
d50e8d7c931f49 Piyush Mehta 2022-01-26  422  	struct usb_device *udev;
d50e8d7c931f49 Piyush Mehta 2022-01-26  423  
d50e8d7c931f49 Piyush Mehta 2022-01-26  424  	if (!hcd)
d50e8d7c931f49 Piyush Mehta 2022-01-26  425  		return -EINVAL;
d50e8d7c931f49 Piyush Mehta 2022-01-26  426  
d50e8d7c931f49 Piyush Mehta 2022-01-26  427  	bus = &hcd->self;
d50e8d7c931f49 Piyush Mehta 2022-01-26  428  	if (!bus->otg_port)
d50e8d7c931f49 Piyush Mehta 2022-01-26  429  		return 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  430  
d50e8d7c931f49 Piyush Mehta 2022-01-26  431  	rh = bus->root_hub;
d50e8d7c931f49 Piyush Mehta 2022-01-26  432  	udev = usb_hub_find_child(rh, bus->otg_port);
d50e8d7c931f49 Piyush Mehta 2022-01-26  433  	if (!udev)
d50e8d7c931f49 Piyush Mehta 2022-01-26  434  		return 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  435  
d50e8d7c931f49 Piyush Mehta 2022-01-26  436  	if (udev->config && udev->parent == udev->bus->root_hub) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  437  		struct usb_otg20_descriptor *desc;
d50e8d7c931f49 Piyush Mehta 2022-01-26  438  
d50e8d7c931f49 Piyush Mehta 2022-01-26  439  		if (__usb_get_extra_descriptor(udev->rawdescriptors[0],
d50e8d7c931f49 Piyush Mehta 2022-01-26  440  				le16_to_cpu(udev->config[0].desc.wTotalLength),
d7c92a2d32b6fe Piyush Mehta 2022-01-26  441  				USB_DT_OTG, (void **)&desc, sizeof(*desc)) ==
d7c92a2d32b6fe Piyush Mehta 2022-01-26  442  				0) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  443  			int err;
d50e8d7c931f49 Piyush Mehta 2022-01-26  444  
d50e8d7c931f49 Piyush Mehta 2022-01-26  445  			dev_info(&udev->dev, "found OTG descriptor\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  446  			if ((desc->bcdOTG >= 0x0200) &&
d50e8d7c931f49 Piyush Mehta 2022-01-26  447  			    (udev->speed == USB_SPEED_HIGH)) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  448  				err = usb_control_msg(udev,
d50e8d7c931f49 Piyush Mehta 2022-01-26  449  						usb_sndctrlpipe(udev, 0),
d50e8d7c931f49 Piyush Mehta 2022-01-26  450  						USB_REQ_SET_FEATURE, 0,
d50e8d7c931f49 Piyush Mehta 2022-01-26  451  						USB_DEVICE_TEST_MODE,
d50e8d7c931f49 Piyush Mehta 2022-01-26  452  						7 << 8,
d50e8d7c931f49 Piyush Mehta 2022-01-26  453  						NULL, 0, USB_CTRL_SET_TIMEOUT);
d50e8d7c931f49 Piyush Mehta 2022-01-26  454  				if (err < 0) {
d50e8d7c931f49 Piyush Mehta 2022-01-26  455  					dev_info(&udev->dev,
d50e8d7c931f49 Piyush Mehta 2022-01-26  456  						"can't initiate HNP from host: %d\n",
d50e8d7c931f49 Piyush Mehta 2022-01-26  457  						err);
d50e8d7c931f49 Piyush Mehta 2022-01-26  458  					return -1;
d50e8d7c931f49 Piyush Mehta 2022-01-26  459  				}
d50e8d7c931f49 Piyush Mehta 2022-01-26  460  			}
d50e8d7c931f49 Piyush Mehta 2022-01-26  461  		} else {
d50e8d7c931f49 Piyush Mehta 2022-01-26  462  			dev_info(&udev->dev, "didn't find OTG descriptor\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  463  		}
d50e8d7c931f49 Piyush Mehta 2022-01-26  464  	} else {
d50e8d7c931f49 Piyush Mehta 2022-01-26  465  		dev_info(&udev->dev,
d50e8d7c931f49 Piyush Mehta 2022-01-26  466  			 "udev->config NULL or udev->parent != udev->bus->root_hub\n");
d50e8d7c931f49 Piyush Mehta 2022-01-26  467  	}
d50e8d7c931f49 Piyush Mehta 2022-01-26  468  
d50e8d7c931f49 Piyush Mehta 2022-01-26  469  	return 0;
d50e8d7c931f49 Piyush Mehta 2022-01-26  470  }
d50e8d7c931f49 Piyush Mehta 2022-01-26  471  

:::::: The code at line 291 was first introduced by commit
:::::: d50e8d7c931f49b3c396fd2aa71dc6f76604f61d usb: dwc3: otg: fix broken OTG HNP feature

:::::: TO: Piyush Mehta <piyush.mehta@xilinx.com>
:::::: CC: Michal Simek <michal.simek@xilinx.com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-06 17:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 17:10 [xilinx-xlnx:xlnx_rebase_v5.15 394/1080] drivers/usb/dwc3/otg.c:291:13: warning: variable 'osts' set but not used kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.