diff mbox series

[V2,06/13] usb: host: isp1362: Replace in_interrupt() usage

Message ID 20201019101110.240285929@linutronix.de (mailing list archive)
State New, archived
Headers show
Series USB: Cleanup in_interupt/in_irq/in_atomic() usage | expand

Commit Message

Thomas Gleixner Oct. 19, 2020, 10:06 a.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
---
V2: Fix silly typo
---
 drivers/usb/host/isp1362.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Greg KH Oct. 28, 2020, 11:27 a.m. UTC | #1
On Mon, Oct 19, 2020 at 12:06:35PM +0200, Thomas Gleixner wrote:
> 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
> ---
> V2: Fix silly typo
> ---
>  drivers/usb/host/isp1362.h |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- 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_hcd, 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
> 

Let's just delete this whole function, if no one is calling it, it
should not be present.  I'll go make up a patch for that...

thanks,

greg k-h
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_hcd, 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