Re: [patch 11/12] usb: core: Replace in_interrupt() in comments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 14, 2020 at 04:52:26PM +0200, Thomas Gleixner wrote:
> From: Ahmed S. Darwish <a.darwish@xxxxxxxxxxxxx>
> 
> The usage of in_interrupt() in drivers is phased out for various reasons.
> 
> Various comments use !in_interrupt() to describe calling context for
> functions which might sleep. That's wrong because the calling context has
> to be preemptible task context, which is not what !in_interrupt()
> describes.
> 
> Replace !in_interrupt() with more accurate plain text descriptions.
> 
> The comment for usb_hcd_poll_rh_status() is misleading as this function is
> called from all kinds of contexts including preemptible task
> context. Remove it as there is obviously no restriction.
> 
> Signed-off-by: Ahmed S. Darwish <a.darwish@xxxxxxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> 
> ---

> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -746,9 +746,6 @@ static int rh_call_control (struct usb_h
>   * Root Hub interrupt transfers are polled using a timer if the
>   * driver requests it; otherwise the driver is responsible for
>   * calling usb_hcd_poll_rh_status() when an event occurs.
> - *
> - * Completions are called in_interrupt(), but they may or may not
> - * be in_irq().

This comment should not be removed; instead it should be changed to say 
that completion handlers are called with interrupts disabled.

> @@ -1691,7 +1690,6 @@ static void usb_giveback_urb_bh(unsigned
>   * @hcd: host controller returning the URB
>   * @urb: urb being returned to the USB device driver.
>   * @status: completion status code for the URB.
> - * Context: in_interrupt()

The comment should be changed to say that the routine runs in a BH 
handler (or however you want to express it).

> --- a/drivers/usb/core/message.c
> +++ b/drivers/usb/core/message.c

> @@ -934,7 +939,7 @@ int usb_get_device_descriptor(struct usb
>  /*
>   * usb_set_isoch_delay - informs the device of the packet transmit delay
>   * @dev: the device whose delay is to be informed
> - * Context: !in_interrupt()
> + * Context: can sleep

Why is this comment different from all the others?

Alan Stern



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux