Re: [PATCH v4] rfkill: Add rfkill-any LED trigger

From: Johannes Berg
Date: Fri Jan 06 2017 - 07:23:01 EST


On Fri, 2017-01-06 at 07:07 +0100, MichaÅ KÄpieÅ wrote:
> Add a new "global" (i.e. not per-rfkill device) LED trigger, rfkill-
> any,
> which may be useful on laptops with a single "radio LED" and multiple
> radio transmitters.ÂÂThe trigger is meant to turn a LED on whenever
> there is at least one radio transmitter active and turn it off
> otherwise.
>
> Signed-off-by: MichaÅ KÄpieÅ <kernel@xxxxxxxxxx>
> ---
> Changes from v3:
>
> Â - Revert introducing a new bitfield and instead defer LED event
> firing
> ÂÂÂÂto a work queue to prevent conditional locking and ensure the
> ÂÂÂÂtrigger can really be used from any context.ÂÂThis also voids the
> ÂÂÂÂneed to take rfkill_global_mutex before calling
> rfkill_set_block()
> ÂÂÂÂin rfkill_resume().

Looks better, but

> +static struct work_struct rfkill_any_work;

At least on module exit you need to cancel this work.

johannes