Re: [PATCH 4/8] rfkill: add read-write rfkill switch support

From: Ivo van Doorn
Date: Sat Apr 12 2008 - 06:35:52 EST


Hi,

> Currently, rfkill supports only write-only rfkill switches. There is no
> provision for querying the current switch state from the hardware/firmware.

No that is by design, the input_polled_dev interface is there for polling.

> This is bad on hardware where the switch state can change behind the
> kernel's back (which is rather common). There is no reason to keep kernel
> state incorrect, when we have the possibility to match reality.
>
> There is also the issue of read-only rfkill switches (support to be added
> in a later patch), which absolutely requires support to read the current
> state from the hardware in order to be implemented.

See rt2x00 and b43 in driver-wireless for an example implementation
of pollable input device and rfkill

> In order to implement the read/write functionality:
>
> Add a get_state() hook that is called by the class every time it needs to
> fetch the current state of the switch. Add a call to this hook every time
> the *current* state of the radio plays a role in a decision.
>
> Also add a force_state() method that can be used to forcefully syncronize
> the class' idea of the current state of the switch. This allows for a
> faster implementation of the read/write functionality, as a driver which
> get events on switch changes can avoid the need for a get_state() hook.
>
> If the get_state() hook is left as NULL, current behaviour is maintained,
> so this change is fully backwards compatible with the current rfkill
> drivers.
>
> If the firmware is event driven, leave get_state() NULL in the driver, set
> the initial state properly before registering the rfkill class, and use the
> force_state() method in the driver to keep the class up-to-date.
>
> get_state() can be called by the class from atomic context. It must not
> sleep.
>
> Signed-off-by: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx>
> Cc: Ivo van Doorn <IvDoorn@xxxxxxxxx>
> Cc: John W. Linville <linville@xxxxxxxxxxxxx>
> Cc: Dmitry Torokhov <dtor@xxxxxxx>

I'm going to NACK this patch.

Ivo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/