lkml.org 
[lkml]   [2008]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/8] rfkill: add read-write rfkill switch support
Date
From
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@hmh.eng.br>
> Cc: Ivo van Doorn <IvDoorn@gmail.com>
> Cc: John W. Linville <linville@tuxdriver.com>
> Cc: Dmitry Torokhov <dtor@mail.ru>

I'm going to NACK this patch.

Ivo


\
 
 \ /
  Last update: 2008-04-12 12:39    [W:0.170 / U:3.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site