Re: [PATCH] driver core: shut down devices asynchronously
From: Lukas Wunner
Date: Wed Aug 16 2023 - 15:53:13 EST
On Wed, Aug 16, 2023 at 02:42:26PM -0500, stuart hayes wrote:
> On 8/16/2023 10:54 AM, Lukas Wunner wrote:
> > Is there a particular reason why you're not using the infrastructure
> > provided by kernel/async.c and <async.h>, such as async_schedule()?
> > It wraps all the work_struct plumbing and also has helpers to await
> > completion. I imagine using that might reduce LoC in this patch.
>
> Not a good one. Let me look into this, thank you.
A word of caution on async_synchronize_cookie(), it awaits the cookies
*before* the one you're passing into the function, so depending on the
use case it may be necessary to add + 1 to the cookie:
https://lore.kernel.org/intel-gfx/20160621075704.GB1821@xxxxxxxxxxxxxxxxxxxxxxxxx/
It's a nasty gotcha. Just so you're aware of it. :)
Thanks,
Lukas