diff mbox series

[06/12] usb: host: isp1362: Replace in_interrupt() usage

Message ID 20201014145727.716783745@linutronix.de
State Superseded
Headers show
Series UBS: Cleanup in_interupt/in_irq/in_atomic() usage | expand

Commit Message

Thomas Gleixner Oct. 14, 2020, 2:52 p.m. UTC
isp1362_show_regs() is a debugging-only function, with no call sites. It
prints the cached value of the HCuPINTENB register if in_interupt() is
true, otherwise it reads the actual register content.

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

Make the conditional based on a function argument.

Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org

---
 drivers/usb/host/isp1362.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

kernel test robot Oct. 14, 2020, 6:49 p.m. UTC | #1
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb-serial/usb-next balbi-usb/testing/next v5.9 next-20201013]
[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/Thomas-Gleixner/UBS-Cleanup-in_interupt-in_irq-in_atomic-usage/20201014-232156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.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/ee4d0a1f1ad7068ce381fd87cac015b76b77de60
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Thomas-Gleixner/UBS-Cleanup-in_interupt-in_irq-in_atomic-usage/20201014-232156
        git checkout ee4d0a1f1ad7068ce381fd87cac015b76b77de60
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa 

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 >>):

   In file included from include/linux/printk.h:405,
                    from include/linux/kernel.h:15,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/usb/host/isp1362-hcd.c:63:
   drivers/usb/host/isp1362.h: In function 'isp1362_show_regs':
>> drivers/usb/host/isp1362.h:799:19: error: 'isp1362_hcd' undeclared (first use in this function)
     799 |  isp1362_show_reg(isp1362_hcd, HCREVISION);
         |                   ^~~~~~~~~~~
   include/linux/dynamic_debug.h:129:15: note: in definition of macro '__dynamic_func_call'
     129 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     157 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:420:2: note: in expansion of macro 'dynamic_pr_debug'
     420 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/usb/host/isp1362.h:543:4: note: in expansion of macro 'pr_debug'
     543 |    pr_debug(fmt); \
         |    ^~~~~~~~
   drivers/usb/host/isp1362.h:789:3: note: in expansion of macro 'DBG'
     789 |   DBG(0, "%-12s[%02x]: %08x\n", #r,     \
         |   ^~~
   drivers/usb/host/isp1362.h:790:37: note: in expansion of macro 'isp1362_read_reg32'
     790 |    ISP1362_REG_NO(ISP1362_REG_##r), isp1362_read_reg32(d, r)); \
         |                                     ^~~~~~~~~~~~~~~~~~
   drivers/usb/host/isp1362.h:799:2: note: in expansion of macro 'isp1362_show_reg'
     799 |  isp1362_show_reg(isp1362_hcd, HCREVISION);
         |  ^~~~~~~~~~~~~~~~
   drivers/usb/host/isp1362.h:799:19: note: each undeclared identifier is reported only once for each function it appears in
     799 |  isp1362_show_reg(isp1362_hcd, HCREVISION);
         |                   ^~~~~~~~~~~
   include/linux/dynamic_debug.h:129:15: note: in definition of macro '__dynamic_func_call'
     129 |   func(&id, ##__VA_ARGS__);  \
         |               ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     157 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:420:2: note: in expansion of macro 'dynamic_pr_debug'
     420 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |  ^~~~~~~~~~~~~~~~
   drivers/usb/host/isp1362.h:543:4: note: in expansion of macro 'pr_debug'
     543 |    pr_debug(fmt); \
         |    ^~~~~~~~
   drivers/usb/host/isp1362.h:789:3: note: in expansion of macro 'DBG'
     789 |   DBG(0, "%-12s[%02x]: %08x\n", #r,     \
         |   ^~~
   drivers/usb/host/isp1362.h:790:37: note: in expansion of macro 'isp1362_read_reg32'
     790 |    ISP1362_REG_NO(ISP1362_REG_##r), isp1362_read_reg32(d, r)); \
         |                                     ^~~~~~~~~~~~~~~~~~
   drivers/usb/host/isp1362.h:799:2: note: in expansion of macro 'isp1362_show_reg'
     799 |  isp1362_show_reg(isp1362_hcd, HCREVISION);
         |  ^~~~~~~~~~~~~~~~

vim +/isp1362_hcd +799 drivers/usb/host/isp1362.h

a9d43091c5be1e7 Lothar Wassmann 2009-07-16  795  
ee4d0a1f1ad7068 Thomas Gleixner 2020-10-14  796  static void __attribute__((__unused__))
ee4d0a1f1ad7068 Thomas Gleixner 2020-10-14  797  isp1362_show_regs(struct isp1362_hcd *isp1362_hc, bool cached_inten)
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  798  {
a9d43091c5be1e7 Lothar Wassmann 2009-07-16 @799  	isp1362_show_reg(isp1362_hcd, HCREVISION);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  800  	isp1362_show_reg(isp1362_hcd, HCCONTROL);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  801  	isp1362_show_reg(isp1362_hcd, HCCMDSTAT);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  802  	isp1362_show_reg(isp1362_hcd, HCINTSTAT);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  803  	isp1362_show_reg(isp1362_hcd, HCINTENB);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  804  	isp1362_show_reg(isp1362_hcd, HCFMINTVL);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  805  	isp1362_show_reg(isp1362_hcd, HCFMREM);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  806  	isp1362_show_reg(isp1362_hcd, HCFMNUM);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  807  	isp1362_show_reg(isp1362_hcd, HCLSTHRESH);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  808  	isp1362_show_reg(isp1362_hcd, HCRHDESCA);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  809  	isp1362_show_reg(isp1362_hcd, HCRHDESCB);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  810  	isp1362_show_reg(isp1362_hcd, HCRHSTATUS);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  811  	isp1362_show_reg(isp1362_hcd, HCRHPORT1);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  812  	isp1362_show_reg(isp1362_hcd, HCRHPORT2);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  813  
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  814  	isp1362_show_reg(isp1362_hcd, HCHWCFG);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  815  	isp1362_show_reg(isp1362_hcd, HCDMACFG);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  816  	isp1362_show_reg(isp1362_hcd, HCXFERCTR);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  817  	isp1362_show_reg(isp1362_hcd, HCuPINT);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  818  
ee4d0a1f1ad7068 Thomas Gleixner 2020-10-14  819  	if (cached_inten)
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  820  		DBG(0, "%-12s[%02x]:     %04x\n", "HCuPINTENB",
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  821  			 ISP1362_REG_NO(ISP1362_REG_HCuPINTENB), isp1362_hcd->irqenb);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  822  	else
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  823  		isp1362_show_reg(isp1362_hcd, HCuPINTENB);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  824  	isp1362_show_reg(isp1362_hcd, HCCHIPID);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  825  	isp1362_show_reg(isp1362_hcd, HCSCRATCH);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  826  	isp1362_show_reg(isp1362_hcd, HCBUFSTAT);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  827  	isp1362_show_reg(isp1362_hcd, HCDIRADDR);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  828  	/* Access would advance fifo
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  829  	 * isp1362_show_reg(isp1362_hcd, HCDIRDATA);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  830  	 */
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  831  	isp1362_show_reg(isp1362_hcd, HCISTLBUFSZ);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  832  	isp1362_show_reg(isp1362_hcd, HCISTLRATE);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  833  	isp1362_show_reg(isp1362_hcd, HCINTLBUFSZ);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  834  	isp1362_show_reg(isp1362_hcd, HCINTLBLKSZ);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  835  	isp1362_show_reg(isp1362_hcd, HCINTLDONE);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  836  	isp1362_show_reg(isp1362_hcd, HCINTLSKIP);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  837  	isp1362_show_reg(isp1362_hcd, HCINTLLAST);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  838  	isp1362_show_reg(isp1362_hcd, HCINTLCURR);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  839  	isp1362_show_reg(isp1362_hcd, HCATLBUFSZ);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  840  	isp1362_show_reg(isp1362_hcd, HCATLBLKSZ);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  841  	/* only valid after ATL_DONE interrupt
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  842  	 * isp1362_show_reg(isp1362_hcd, HCATLDONE);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  843  	 */
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  844  	isp1362_show_reg(isp1362_hcd, HCATLSKIP);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  845  	isp1362_show_reg(isp1362_hcd, HCATLLAST);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  846  	isp1362_show_reg(isp1362_hcd, HCATLCURR);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  847  	isp1362_show_reg(isp1362_hcd, HCATLDTC);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  848  	isp1362_show_reg(isp1362_hcd, HCATLDTCTO);
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  849  }
a9d43091c5be1e7 Lothar Wassmann 2009-07-16  850  

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

Patch

--- a/drivers/usb/host/isp1362.h
+++ b/drivers/usb/host/isp1362.h
@@ -793,7 +793,8 @@  static void isp1362_write_fifo(struct is
 			ISP1362_REG_NO(ISP1362_REG_##r), isp1362_read_reg16(d, r));	\
 }
 
-static void __attribute__((__unused__)) isp1362_show_regs(struct isp1362_hcd *isp1362_hcd)
+static void __attribute__((__unused__))
+isp1362_show_regs(struct isp1362_hcd *isp1362_hc, bool cached_inten)
 {
 	isp1362_show_reg(isp1362_hcd, HCREVISION);
 	isp1362_show_reg(isp1362_hcd, HCCONTROL);
@@ -815,7 +816,7 @@  static void __attribute__((__unused__))
 	isp1362_show_reg(isp1362_hcd, HCXFERCTR);
 	isp1362_show_reg(isp1362_hcd, HCuPINT);
 
-	if (in_interrupt())
+	if (cached_inten)
 		DBG(0, "%-12s[%02x]:     %04x\n", "HCuPINTENB",
 			 ISP1362_REG_NO(ISP1362_REG_HCuPINTENB), isp1362_hcd->irqenb);
 	else