Commands with data must set the length in the message.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Found the N014, N051 and CR620 are must the same with N034 there are
load scm serial model. So, this patch move N014, N051 and CR620 dmi
information to right dmi table: msi_load_scm_models_dmi_table[]
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
drivers/platform/x86/eeepc-wmi.c: In function ‘eeepc_wmi_notify’:
drivers/platform/x86/eeepc-wmi.c:209: warning: ‘new’ may be used uninitialized in this function
drivers/platform/x86/eeepc-wmi.c:209: note: ‘new’ was declared here
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Yong Wang <yong.y.wang@intel.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Tejun Heo <tj@kernel.org>
Cc: platform-driver-x86@vger.kernel.org
Acked-By: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
To give people easily an idea what could be WMI driven on their system.
Introduces:
wmi.debug=[01]
Tested on an acer:
ACPI: WMI: DEBUG Event INTEGER_TYPE - 65535
Situation where a driver registers for specific event and debug
handler gets overridden and set again if the registering driver gets
unloaded again is untested, but should work.
Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: platform-driver-x86@vger.kernel.org
CC: mjg59@srcf.ucam.org
CC: corentin.chary@gmail.com
Signed-off-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Clean up i8042 filter, rfkill and cancel delayed work when msi-laptop driver initial fail or exit on MSI scm model.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
There have some MSI netbook change devices state by EC when user press
wlan/bluetooth/wwan function keys. So, add a i8042 filter to sync sw
state with BIOS when function keys pressed.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Setup Wlan/Bluetooth/3G rfkill initial state to sync with the hardware
state from EC 0x2e address.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Use kmemdup when some other buffer is immediately copied into the
allocated region.
A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression from,to,size,flag;
statement S;
@@
- to = \(kmalloc\|kzalloc\)(size,flag);
+ to = kmemdup(from,size,flag);
if (to==NULL || ...) S
- memcpy(to, from, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Use kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
eeepc-wmi uses backlight*() interfaces so it should depend on
BACKLIGHT_CLASS_DEVICE.
eeepc-wmi.c:(.text+0x2d7f54): undefined reference to `backlight_force_update'
eeepc-wmi.c:(.text+0x2d8012): undefined reference to `backlight_device_register'
eeepc-wmi.c:(.devinit.text+0x1c31c): undefined reference to `backlight_device_unregister'
eeepc-wmi.c:(.devexit.text+0x2f8b): undefined reference to `backlight_device_unregister'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: stable@kernel.org
The IPC (inter processor communications) is used to provide the
communications between kernel and system control units on some embedded
Intel x86 platforms.
(Various bits of clean up and restructuring by Alan Cox)
Signed-off-by: Sreedhara DS <sreedhara.ds@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
The RFKILL device shares the same ACPI device used for backlight. So, it
required a new struct sharing both a backlight_device and a rfkill
device.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Document this, it is no fun to try to second guess why this sort of
stuff is in place years after it was added...
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
1. Remove <handle>_path, as its only user was already removed in
a previous commit
2. Move all handle initialization, as well as <handle>_parent and
<handle>_paths to __init.* sections. This reduces the driver's
runtime footprint nicely.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Don't depend on the contents of led_path to know which LED interface
the firmware wants.
This removes the only user of *_path for the thinkpad-acpi ACPI
handlers, which will simplify future code.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Log more human-friendly errors instead of numeric values when
setup_acpi_notify() fails to install a notification handler.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Use acpi_format_exception() in acpi_evalf() instead of logging numeric
errors.
Also, when ACPICA returns an error, we should not be touching the return
object, as it is invalid. In debug mode, acpi_evalf() callers would
printk the returned crap (but fortunately, not use it).
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Use the EC HID (PNP0C09) to locate its main node, instead of a static
list.
Suggested-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg@redhat.com>
Extract the backlight level range size detection from the brightness
subdriver, and allow the other subdrivers access to that information.
This also allows us to relocate some code to a more convenient place.
The moved code was largerly unmodified, except for the return type of
tpacpi_check_std_acpi_brightness_support(), which now is correctly
marked as returning "unsigned int", and and two cosmetic fixes to make
checkpatch.pl happy.
Fixes for the NVRAM polling mode for the brightness hotkeys will need
this.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Move the driver initial greetings out of the first subdriver, as we do a
lot of other initialization before that point, and the initial greetings
should go as soon as the driver decides that it should load.
These greetings are not cosmetic, they make my life easier when users
report bugs.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
The hotkey polling code is supposed to generate hotkey messages as
close to the way the IBM event-based volume hotkey firmware does as
possible, i.e:
* Pressing MUTE issues a mute hotkey event, even if already mute;
* Pressing Volume up/down issues a volume up/down hotkey event,
even if already at maximum or minumum volume;
* The act of unmuting issues a volume up/down event, depending on
which hotkey was used to unmute.
Fix the code to do just that (mute handling was incorrect), and handle
multiple hotkey presses between two polling cycles.
The new code uses the volume_toggle bit in NVRAM only to detect
repeated presses of the mute key and multiple presses of the volume
keys trying to go past the end of the volume scale. This will work
around a bug in recent Lenovo firmware (e.g. T400), which causes the
firmware to not update the volume_toggle bit in certain situations.
Reported-by: Yang Zhe <yangzhe1990@gmail.com>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
The X100e needs some quick fixes to work semi-right with this driver.
There are much better ways to do this, but we can start with a quick
update and do it properly later.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Lenovo is playing around with its ACPI BIOS, and will end up reusing
method names. Their memory is not nearly as long as thinkpad-acpi's...
Secure most of the old IBM codepaths against running in a non-IBM box.
This would happen on the Lenovo X100e in video_init(), for example. We
would misdetect it as an ancient model 570 firmware.
Also, refuse to load the driver if we cannot identify the vendor. No
ACPI ThinkPad in existence lacks this information, AFAIK.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
-tip testing found:
eeepc-wmi.c:(.text+0x36673c): undefined reference to `sparse_keymap_report_event'
drivers/built-in.o: In function `eeepc_wmi_init':
eeepc-wmi.c:(.init.text+0x19cd0): undefined reference to `sparse_keymap_setup'
eeepc-wmi.c:(.init.text+0x19cf0): undefined reference to `sparse_keymap_free'
eeepc-wmi.c:(.init.text+0x19d0b): undefined reference to `sparse_keymap_free'
drivers/built-in.o: In function `eeepc_wmi_exit':
eeepc-wmi.c:(.exit.text+0x2e87): undefined reference to `sparse_keymap_free'
To fix this select INPUT_SPARSEKMAP, like the ASUS driver does.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
We were storing -1 as an unsigned int and as a result the effect of
passing -1 was the same as using 1.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Corentin Chary <corentincj@iksaif.net>
The output of wmi_get_event_data shall be freed before return.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Yong Wang <yong.y.wang@linux.intel.com>
Add backlight support for WMI based Eee PC laptops.
Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
Add a platform device and use it as the parent device of all sub-devices.
Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
Add an eeepc_wmi context structure to manage all the sub-devices
that will be implemented later on. Put input device into it first.
Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reviewed-by: Corentin Chary <corentincj@iksaif.net>
Made necessary by 6992f53349 ("sysfs: Use
one lockdep class per sysfs attribute").
Prevents further "key xxx not in .data" bug-reports. Although some
attributes could probably be converted to static ones, this is left for
people having hardware to test.
Found by this semantic patch:
@ init @
type T;
identifier A;
@@
T {
...
struct device_attribute A;
...
};
@ main extends init @
expression E;
statement S;
identifier err;
T *name;
@@
... when != sysfs_attr_init(&name->A.attr);
(
+ sysfs_attr_init(&name->A.attr);
if (device_create_file(E, &name->A))
S
|
+ sysfs_attr_init(&name->A.attr);
err = device_create_file(E, &name->A);
)
While reviewing, I put the initialization to apropriate places.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg KH <gregkh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Mike Isely <isely@pobox.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Add a WMI driver for Eee PC laptops. Currently it only supports hotkeys.
Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
In function 'asus_laptop_get_info':
warning: passing argument 3 of 'asus_handle_init' from incompatible pointer type
note: expected 'char **' but argument is of type 'const char **'
Introduced by commit c21085108a02e1b838c34f3650c8cc9fbd178615
("asus-laptop: fix style problems reported by checkpath.pl").
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Properly return backlight registration error to parent.
Mark struct backlight_ops as const.
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Acked-by: Harald Welte <laforge@gnumonks.org> (registration failure)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Properly return backlight registration error to parent.
Mark struct backlight_ops as const.
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Reviewed-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Check newly registered backlight_device for error and properly
return error to parent.
Mark struct backlight_ops as const.
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>