rfkill: preserve state across suspend
commit6f9a16c31f1eabda9ff2b16fb26c154d8acf6a58
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Tue, 11 Nov 2008 22:26:56 +0000 (11 20:26 -0200)
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Tue, 11 Nov 2008 22:27:02 +0000 (11 20:27 -0200)
treed17fecd926f8780c0ffc06b3139917ba36e97010
parentcdb6fefb860d4080410834c253e9ff401697483c
rfkill: preserve state across suspend

The rfkill class API requires that the driver connected to a class
call rfkill_force_state() on resume to update the real state of the
rfkill controller, OR that it provides a get_state() hook.

This means there is potentially a hidden call in the resume code flow
that changes rfkill->state (i.e. rfkill_force_state()), so the
previous state of the transmitter was being lost.

The simplest and most future-proof way to fix this is to explicitly
store the pre-sleep state on the rfkill structure, and restore from
that on resume.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
include/linux/rfkill.h
net/rfkill/rfkill.c