[patch V2 04/15] orinoco_usb: Use the regular completion interfaces

Greg Kroah-Hartman gregkh at linuxfoundation.org
Thu Mar 19 19:40:53 AEDT 2020


On Wed, Mar 18, 2020 at 09:43:06PM +0100, Thomas Gleixner wrote:
> From: Thomas Gleixner <tglx at linutronix.de>
> 
> The completion usage in this driver is interesting:
> 
>   - it uses a magic complete function which according to the comment was
>     implemented by invoking complete() four times in a row because
>     complete_all() was not exported at that time.
> 
>   - it uses an open coded wait/poll which checks completion:done. Only one wait
>     side (device removal) uses the regular wait_for_completion() interface.
> 
> The rationale behind this is to prevent that wait_for_completion() consumes
> completion::done which would prevent that all waiters are woken. This is not
> necessary with complete_all() as that sets completion::done to UINT_MAX which
> is left unmodified by the woken waiters.
> 
> Replace the magic complete function with complete_all() and convert the
> open coded wait/poll to regular completion interfaces.
> 
> This changes the wait to exclusive wait mode. But that does not make any
> difference because the wakers use complete_all() which ignores the
> exclusive mode.
> 
> Reported-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
> Cc: Kalle Valo <kvalo at codeaurora.org>
> Cc: "David S. Miller" <davem at davemloft.net>
> Cc: linux-wireless at vger.kernel.org
> Cc: netdev at vger.kernel.org
> ---
> V2: New patch to avoid conversion to swait functions later.
> ---
>  drivers/net/wireless/intersil/orinoco/orinoco_usb.c |   21 ++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)
> 
> --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
> +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
> @@ -365,17 +365,6 @@ static struct request_context *ezusb_all
>  	return ctx;
>  }
>  
> -
> -/* Hopefully the real complete_all will soon be exported, in the mean
> - * while this should work. */
> -static inline void ezusb_complete_all(struct completion *comp)
> -{
> -	complete(comp);
> -	complete(comp);
> -	complete(comp);
> -	complete(comp);
> -}

That's so funny... :(

Reviewed-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>


More information about the Linuxppc-dev mailing list