pandora-kernel.git
13 years agoACPI: Register EC io ports in /proc/ioports
Thomas Renninger [Fri, 16 Jul 2010 11:11:33 +0000 (13:11 +0200)]
ACPI: Register EC io ports in /proc/ioports

Formerly these have been exposed through /proc/..
Better register them where all IO ports should get registered
and scream loud if someone else claims to use them.

EC data and command port typically should show up like this
then:
...
  0060-0060 : keyboard
  0062-0062 : EC data
  0064-0064 : keyboard
  0066-0066 : EC command
  0070-0071 : rtc0
...

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoACPI: Provide /sys/kernel/debug//ec/ec0/io for binary access to the EC
Thomas Renninger [Fri, 16 Jul 2010 11:11:32 +0000 (13:11 +0200)]
ACPI: Provide /sys/kernel/debug//ec/ec0/io for binary access to the EC

A userspace app to easily read/write the EC can be found here:
ftp://ftp.suse.com/pub/people/trenn/sources/ec/ec_access.c

Multiple ECs are not supported, but shouldn't be hard to add as soon
as the ec driver itself will support them.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoACPI: Provide /sys/kernel/debug/ec/...
Thomas Renninger [Fri, 16 Jul 2010 11:11:31 +0000 (13:11 +0200)]
ACPI: Provide /sys/kernel/debug/ec/...

This patch provides the same information through debugfs, which previously was
provided through /proc/acpi/embedded_controller/*/info

This is the gpe the EC is connected to and whether the global lock
gets used.
The io ports used are added to /proc/ioports in another patch.
Beside the fact that /proc/acpi is deprecated for quite some time,
this info is not needed for applications and thus can be moved
to debugfs instead of a public interface like /sys.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoDocumentation: Add new /sys/kernel/debug/ec/* files to ABI
Thomas Renninger [Fri, 16 Jul 2010 11:11:37 +0000 (13:11 +0200)]
Documentation: Add new /sys/kernel/debug/ec/* files to ABI

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoX86 platform driver: Fix section mismatch in wmi.c
Thomas Renninger [Fri, 16 Jul 2010 11:11:36 +0000 (13:11 +0200)]
X86 platform driver: Fix section mismatch in wmi.c

The .add function must not be declared __init.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoX86 platform drivers: Remove EC dump from thinkpad_acpi
Thomas Renninger [Fri, 16 Jul 2010 11:11:35 +0000 (13:11 +0200)]
X86 platform drivers: Remove EC dump from thinkpad_acpi

There is a general interface for that now (provided by
other patches in this patch series):
/sys/kernel/debug/ec/*/io

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
CC: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
CC: ibm-acpi-devel@lists.sourceforge.net
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoACPI: Remove /proc/acpi/embedded_controller/..
Thomas Renninger [Fri, 16 Jul 2010 11:11:34 +0000 (13:11 +0200)]
ACPI: Remove /proc/acpi/embedded_controller/..

Other patches in this series add the same info to /sys/... and
/proc/ioports.

The info removed should never have been used in an application,
eventually someone read it manually.
/proc/acpi is deprecated for more than a year anyway...

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexey Starikovskiy <astarikovskiy@suse.de>
CC: Len Brown <lenb@kernel.org>
CC: linux-kernel@vger.kernel.org
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agopanasonic-laptop: fix acpi_pcc_write_sset return value
Axel Lin [Wed, 7 Jul 2010 00:21:48 +0000 (08:21 +0800)]
panasonic-laptop: fix acpi_pcc_write_sset return value

In current implementation, acpi_pcc_write_sset return 1
if write is successful, 0 if write is failed.
But all the callers consider acpi_pcc_write_sset return 0
if write is successful and return negtive if write is failed.

This patch changes the implementation of acpi_pcc_write_sset to
return 0 if write is successful, -EIO if write is failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoeeepc-laptop: fix hotplug_disabled module_param permissions
Axel Lin [Tue, 20 Jul 2010 22:19:55 +0000 (15:19 -0700)]
eeepc-laptop: fix hotplug_disabled module_param permissions

The hotplug_disabled module parameter is determinated at the module load
time.  Change the value after the module is loaded does not make sense and
has no effect at all, thus set the permissions to 0444 instead of 0644.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: fix wapf, wlan_status and bluetooth_status module_param permissions
Axel Lin [Tue, 20 Jul 2010 22:19:55 +0000 (15:19 -0700)]
asus-laptop: fix wapf, wlan_status and bluetooth_status module_param permissions

The wapf module parameters defines the behavior of the Fn+Fx wlan key.
The wlan_status and bluetooth_status module parameters are for setting the
wlan/bluetooth status on boot.

All above module parameters are determinated only at the module load time.
 Change the value after the module is loaded does not make sense and has
no effect at all, thus set the permissions to 0444 instead of 0644.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: remove non-used acer_quirks struct definition
Axel Lin [Tue, 20 Jul 2010 22:19:54 +0000 (15:19 -0700)]
acer-wmi: remove non-used acer_quirks struct definition

Remove non-used acer_quirks struct definition.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: fix memory leaks in wmab_execute error path
Axel Lin [Tue, 20 Jul 2010 22:19:53 +0000 (15:19 -0700)]
acer-wmi: fix memory leaks in wmab_execute error path

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER, the caller
must kfree the returned buffer if AE_OK is returned.

Call Trace:
wmab_execute
  -> wmi_evaluate_method
    -> acpi_evaluate_object

Thus if callers of wmab_execute() pass ACPI_ALLOCATE_BUFFER, the return
buffer must be kfreed if wmab_execute return AE_OK.

[akpm@linux-foundation.org: avoid multiple return points, remove unneeded cast, remove unneeded initialisation of `status']
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: fix memory leaks in WMID_set_capabilities and get_wmid_devices
Axel Lin [Tue, 20 Jul 2010 22:19:52 +0000 (15:19 -0700)]
acer-wmi: fix memory leaks in WMID_set_capabilities and get_wmid_devices

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER, the caller
must kfree the returned buffer if AE_OK is returned.

The callers of wmi_query_block() pass ACPI_ALLOCATE_BUFFER, and thus must
check its return value before accessing or kfree() on the buffer.

This patch adds a missing kfree(out.pointer) before exit
WMID_set_capabilities() and get_wmid_devices().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agotoshiba_acpi: rename add_device() and remove_device() to create_toshiba_proc_entries...
Axel Lin [Tue, 20 Jul 2010 22:19:51 +0000 (15:19 -0700)]
toshiba_acpi: rename add_device() and remove_device() to create_toshiba_proc_entries() and remove_toshiba_proc_entries()

To improve readability rename add_device() to
create_toshiba_proc_entries() and rename remove_device() to
remove_toshiba_proc_entries().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Márton Németh <nm127@freemail.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agohp-wmi: add return value checking for input_allocate_device()
Axel Lin [Tue, 20 Jul 2010 22:19:51 +0000 (15:19 -0700)]
hp-wmi: add return value checking for input_allocate_device()

Add error checking and return -ENOMEM if input_allocate_device() fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agotoshiba_acpi: make remove_device() and add_device() void
Axel Lin [Tue, 20 Jul 2010 22:19:50 +0000 (15:19 -0700)]
toshiba_acpi: make remove_device() and add_device() void

remove_device() and add_device() are not related to ACPI APIs, it does not
make sense to return acpi_status for both functions.

Current implementation of add_device() always AE_OK, thus the return value
checking for add_device() always return false for ACPI_FAILURE(status).
This patch makes add_device() to be void and remove the unnecessary return
value checking.

remove_proc_entry() won't fail, thus change remove_device() to be void.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Márton Németh <nm127@freemail.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: fix resource reclaim in error path
Axel Lin [Tue, 20 Jul 2010 22:19:49 +0000 (15:19 -0700)]
acerhdf: fix resource reclaim in error path

Fix resource reclaim in below cases:

1. acerhdf_register_platform() does not properly handle
   platform_device_alloc() failure and platform_device_add() failure This
   patch adds error handing for acerhdf_register_platform().

2. acerhdf_register_platform() return err with acerhdf_dev == NULL.
   as a result, acerhdf_unregister_platform() does not do resource reclaim
   in acerhdf_init() error path.  This patch adds error handing for
   acerhdf_register_platform(), thus correct the error handing path in
   acerhdf_init().  goto out_err instead of err_unreg if
   acerhdf_register_platform() fail.

3. platform_device_del() should only used in error handling.  Current
   implementation missed a platform_device_put() in acerhdf_exit.  This
   patch fixes it by using platform_device_unregister() instead of
   platform_device_del() in acerhdf_unregister_platform.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Peter Feuerer <peter@piie.net>
Cc: Matthew Garrett <mjg@redhat.com>
Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: return proper error for store_ledd if write_acpi_int fail
Axel Lin [Tue, 20 Jul 2010 22:19:48 +0000 (15:19 -0700)]
asus-laptop: return proper error for store_ledd if write_acpi_int fail

In current implementation, store_ledd() does not return error if
write_acpi_int fail.  This patch fixes it by return -ENODEV if
write_acpi_int fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: fix incorrect return value for write_acpi_int_ret if handle is NULL
Axel Lin [Tue, 20 Jul 2010 22:19:47 +0000 (15:19 -0700)]
asus-laptop: fix incorrect return value for write_acpi_int_ret if handle is NULL

According to the comments of write_acpi_int_ret(), write_acpi_int_ret()
should return 0 if write is successful, -1 else.  Thus if handle is NULL,
the write does not happen, it should return -1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agomsi-laptop: make struct rfkill_ops const
Axel Lin [Tue, 20 Jul 2010 22:19:46 +0000 (15:19 -0700)]
msi-laptop: make struct rfkill_ops const

rfkill uses a const struct rfkill_ops pointer.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agofujitsu-laptop: make needlessly global symbols static
Axel Lin [Tue, 20 Jul 2010 22:19:45 +0000 (15:19 -0700)]
fujitsu-laptop: make needlessly global symbols static

The following symbols are needlessly defined global:

logolamp_led
kblamps_led

This patch makes the symbols static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoclassmate-laptop: make needlessly global symbols static
Axel Lin [Tue, 20 Jul 2010 22:19:44 +0000 (15:19 -0700)]
classmate-laptop: make needlessly global symbols static

cmpc_accel_sensitivity_attr is needlessly defined global.
This patch makes the symbol static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Daniel Oliveira Nascimento <don@syst.com.br>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: make needlessly global symbols static
Axel Lin [Tue, 20 Jul 2010 22:19:43 +0000 (15:19 -0700)]
acerhdf: make needlessly global symbols static

The following symbols are needlessly defined global:

thz_dev
cl_dev
acerhdf_dev
acerhdf_dev_ops
acerhdf_cooling_ops

This patch makes the symbols static.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Borislav Petkov <bp@alien8.de>
Acked-by: Peter Feuerer <peter@piie.net>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus_acpi: fix coding style to improve readability
Axel Lin [Tue, 20 Jul 2010 22:19:42 +0000 (15:19 -0700)]
asus_acpi: fix coding style to improve readability

In the case of no match ( hotk->model == END_MODEL ), the only posible
case to return 0 is to have a Samsung P30 detected.  This patch improves
readability by moving related code after if/else clause to be inside if
clause.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus_acpi: fix a memory leak in asus_hotk_get_info()
Axel Lin [Tue, 20 Jul 2010 22:19:41 +0000 (15:19 -0700)]
asus_acpi: fix a memory leak in asus_hotk_get_info()

In the case of no match ( hotk->model == END_MODEL ), model sholud be
kfreed before return AE_OK.

This patch includes below fixes:

1. adds a missing kfree(model) before return AE_OK.

2. asus_hotk_get_info should return int, thus return 0 instead of AE_OK.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agocompal-laptop/fujitsu-laptop/msi-laptop: make dmi_check_cb to return 1 instead of 0
Axel Lin [Tue, 20 Jul 2010 22:19:40 +0000 (15:19 -0700)]
compal-laptop/fujitsu-laptop/msi-laptop: make dmi_check_cb to return 1 instead of 0

dmi_check_system() walks the table running matching functions until
someone returns non zero or we hit the end.

This patch makes dmi_check_cb to return 1 so dmi_check_system() return
immediately when a match is found.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Cc: Matthew Garrett <mjg@redhat.com>a
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agocompal-laptop: add JHL90, battery & hwmon interface
Roald Frederickx [Tue, 20 Jul 2010 22:19:39 +0000 (15:19 -0700)]
compal-laptop: add JHL90, battery & hwmon interface

The driver now supports the Compal JHL90 (which I use) and it has some
added features.  The biggest novelties are a battery interface
(power_supply) and a temperature and fan control interface (hmwon).  It
also adds a power-off feature to the backlight subsystem and it exports a
few files that can enable/disable wake_on_XXX events.

Much of the original code of the old features is still there, but I've
changed some names to keep the naming more coherent with the added
functionalities.  (Sorry for the huge patch)

Some technical stuff about the new driver:

First of all, I'm not sure if the extra features also work on the other
Compal boards.  Currently they only get enabled if the DMI data indicates
you are on a JHL90 board.

Secondly, I've noticed a quirk in my fan controller.  I have to re-send
the wanted pwm-level to the controller every so often.  If I don't do
this, the fanspeed will slowly rise until after a couple of minutes it's
at full speed.  (Note that every normal userland application will probably
update the pwm-level every so often anyway, based on temperature readings,
so this might not be an issue in practice) If this turns out to be a
problem with all the controllers, maybe we should implement a kernel timer
and have the driver re-send the pwm level every XX seconds to make this
transparent to userspace?  (However, I couldn't immediately find a way to
do this cleanly.)

Additional information can be found in the source comments.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: add missing semicolon]
Signed-off-by: Roald Frederickx <roald.frederickx@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agocompal-laptop: uses hwmon interfaces, depends on HWMON
Randy Dunlap [Tue, 20 Jul 2010 22:19:39 +0000 (15:19 -0700)]
compal-laptop: uses hwmon interfaces, depends on HWMON

compal-laptop uses hwmon interfaces, so it should depend on HWMON.

compal-laptop.c:(.devinit.text+0x4071f): undefined reference to `hwmon_device_register'
compal-laptop.c:(.devexit.text+0x6ec0): undefined reference to `hwmon_device_unregister'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Roald Frederickx <roald.frederickx@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agofujitsu-laptop: remove unnecessary input_free_device calls
Axel Lin [Tue, 20 Jul 2010 22:19:34 +0000 (15:19 -0700)]
fujitsu-laptop: remove unnecessary input_free_device calls

input_free_device() should only be used if input_register_device() was not
called yet or if it failed.  This patch removes unnecessary
input_free_device calls.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Matthew Garrett <mjg@redhat.com>a
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: add AO531 and many BIOS versions for 1410, 1810xx and packard bell netbooks
Peter Feuerer [Tue, 20 Jul 2010 22:19:33 +0000 (15:19 -0700)]
acerhdf: add AO531 and many BIOS versions for 1410, 1810xx and packard bell netbooks

Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: driver didn't verify the pointers in which it got product information
Rahul Chaturvedi [Tue, 20 Jul 2010 22:19:33 +0000 (15:19 -0700)]
acerhdf: driver didn't verify the pointers in which it got product information

Driver didn't verify the pointers in which it got product information back
from DMI; on QEMU one of the pointers came back null, which made the
driver crash and subsequently caused a kernel panic.

Signed-off-by: Rahul Chaturvedi <rkc@chromium.org>
Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: remove "chk_off" as it was only needed for T31 netbooks
Peter Feuerer [Tue, 20 Jul 2010 22:19:32 +0000 (15:19 -0700)]
acerhdf: remove "chk_off" as it was only needed for T31 netbooks

Remove "chk_off" as it was only needed for T31 netbooks.  But those
netbooks can also be handled just with "cmd_off" register (0x9e) for
reading the state back.

Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacerhdf: add new BIOS versions
Peter Feuerer [Tue, 20 Jul 2010 22:19:30 +0000 (15:19 -0700)]
acerhdf: add new BIOS versions

Add new BIOS versions for Acer 1410 and 1810xx and Packard Bell netbooks.

Fixed registers of Acer AOA150 BIOS version v0.3114: Old registers caused
Fan to spin up at every temperature check.

Signed-off-by: Peter Feuerer <peter@piie.net>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agohp-wmi: return -ENODEV if BIOS does not export any supported hp wmi guid
Thomas Renninger [Tue, 20 Jul 2010 22:19:29 +0000 (15:19 -0700)]
hp-wmi: return -ENODEV if BIOS does not export any supported hp wmi guid

Signed-off-by: Thomas Renninger <trenn@suse.de>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agotoshiba-acpi: Add an extra couple of keys
Matthew Garrett [Thu, 15 Jul 2010 18:23:42 +0000 (14:23 -0400)]
toshiba-acpi: Add an extra couple of keys

Thomas Bächler reports that his machine generates two keycodes for zooming
in and out. Add these to the default keymap.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Thomas Bächler <thomas@archlinux.org>
13 years agosony-laptop: use platform_device_unregister in sony_pf_remove
Axel Lin [Thu, 1 Jul 2010 02:18:01 +0000 (10:18 +0800)]
sony-laptop: use platform_device_unregister in sony_pf_remove

platform_device_unregister calls platform_device_del and platform_device_put,
thus this change is logically equivalent to original code.

I made this change because the documents in platform.c shows that:
platform_device_del and platform_device_put must _only_ be externally called
in error cases.  All other usage is a bug.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agodell-wmi: fix a memory leak
Axel Lin [Wed, 30 Jun 2010 09:25:46 +0000 (17:25 +0800)]
dell-wmi: fix a memory leak

If dell_new_hk_type is true, dell_legacy_wmi_keymap will point to a memory
allocated in setup_new_hk_map().
In this case, the memory is not freed in current implementation.
This patch fixes the leak by kfree(dell_wmi_keymap) if dell_new_hk_type is true.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: make dmi_matched to return 1 instead of 0
Axel Lin [Wed, 30 Jun 2010 05:32:16 +0000 (13:32 +0800)]
acer-wmi: make dmi_matched to return 1 instead of 0

dmi_check_system() walks the table running matching functions until someone
returns non zero or we hit the end.

This patch makes dmi_matched to return 1 so dmi_check_system() return
immediately when a match is found.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: set permissions on interface file to S_IRUGO
Axel Lin [Wed, 30 Jun 2010 02:20:23 +0000 (10:20 +0800)]
acer-wmi: set permissions on interface file to S_IRUGO

The interface file is not writable, thus set permissions to S_IRUGO.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoasus-laptop: fix a memory leak in asus_laptop_get_info error path
Axel Lin [Tue, 29 Jun 2010 03:09:47 +0000 (11:09 +0800)]
asus-laptop: fix a memory leak in asus_laptop_get_info error path

The callers of write_acpi_int_ret() pass ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

This patch adds a missing kfree(buffer.pointer) before return -ENOMEM
if kstrdup fail.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agowmi: fix a memory leak in wmi_notify_debug
Axel Lin [Mon, 28 Jun 2010 01:30:45 +0000 (09:30 +0800)]
wmi: fix a memory leak in wmi_notify_debug

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
and thus must check its return value before accessing
or kfree() on the buffer.

This patch adds return value checking for wmi_get_event_data()
and adds a missing kfree(obj) in the end of wmi_notify_debug

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agodell-wmi: Add support for eject key on Dell Studio 1555
Islam Amer [Thu, 24 Jun 2010 17:39:47 +0000 (13:39 -0400)]
dell-wmi: Add support for eject key on Dell Studio 1555

Fixes pressing the eject key on Dell Studio 1555 does not work and produces
message :

dell-wmi: Unknown key 0 pressed

Signed-off-by: Islam Amer <pharon@gmail.com>
13 years agorar: Move the RAR driver into the right place as its now clean
Alan Cox [Fri, 18 Jun 2010 13:05:52 +0000 (14:05 +0100)]
rar: Move the RAR driver into the right place as its now clean

We exit staging rar! rar! rar!...

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
13 years agoacer-wmi/hp-wmi: use platform_device_unregister instead of platform_device_del in...
Axel Lin [Thu, 3 Jun 2010 07:18:03 +0000 (15:18 +0800)]
acer-wmi/hp-wmi: use platform_device_unregister instead of platform_device_del in module_exit

platform_device_unregister will also call platform_device_put() to drop reference count.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agowmi: fix memory leak in parse_wdg
Axel Lin [Thu, 3 Jun 2010 03:45:45 +0000 (11:45 +0800)]
wmi: fix memory leak in parse_wdg

This patch properly kfree out.pointer and gblock in error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agodell-laptop: Add another Dell laptop family to the DMI whitelist
Rezwanul Kabir [Wed, 23 Jun 2010 17:02:43 +0000 (12:02 -0500)]
dell-laptop: Add another Dell laptop family to the DMI whitelist

This is to support Precision M4500 and others.

Signed-off-by: Rezwanul Kabir <Rezwanul_Kabir@dell.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoacer-wmi: fix resource reclaim in acer_wmi_init error path
Axel Lin [Tue, 22 Jun 2010 08:17:38 +0000 (16:17 +0800)]
acer-wmi: fix resource reclaim in acer_wmi_init error path

This patch fixes the resource reclaim in acer_wmi_init error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoX86: intel_ips, check for kzalloc properly
Jiri Slaby [Mon, 21 Jun 2010 15:40:15 +0000 (17:40 +0200)]
X86: intel_ips, check for kzalloc properly

Stanse found that there are two NULL checks missing in ips_monitor. So
check their value too and bail out appropriately if the allocation
failed.

While at it, add one more kfree to the fail path. It is not necessary
now, but may be needed in the future when a new allocation is added.
And for completeness.

Also remove unneeded initialization of the variables. They are all set
right after their declaration.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agohp-wmi: add error handling for hp_wmi_init
Axel Lin [Thu, 10 Jun 2010 08:06:40 +0000 (16:06 +0800)]
hp-wmi: add error handling for hp_wmi_init

Current implementation in hp_wmi_init does not check any error and always
return success.
This patch properly handles recource reclaim and return err in error path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agointel_scu_ipc: add definitions for vRTC related command
Feng Tang [Tue, 1 Jun 2010 12:07:34 +0000 (13:07 +0100)]
intel_scu_ipc: add definitions for vRTC related command

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoclassmate-laptop: should check for NULL as retval for rfkill_alloc
Thadeu Lima de Souza Cascardo [Wed, 9 Jun 2010 19:48:39 +0000 (16:48 -0300)]
classmate-laptop: should check for NULL as retval for rfkill_alloc

rfkill_alloc returns NULL when it fails if RFKILL is enabled. When RFKILL is
disabled, its return value of ERR_PTR(-ENODEV) is OK to use as all rfkill
functions will work with it, as they are simply empty stubs.

Reported-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: platform-driver-x86@vger.kernel.org
Cc: mjg@redhat.com
Cc: don@syst.com.br
Cc: rpurdie@rpsys.net
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoIPS driver: add GPU busy and turbo checking
Jesse Barnes [Thu, 20 May 2010 21:27:23 +0000 (14:27 -0700)]
IPS driver: add GPU busy and turbo checking

Be sure to enable GPU turbo by default at load time and check GPU busy
and MCP exceeded status correctly.  Also fix up CPU power comparison and
work around buggy MCH temp reporting.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agox86 platform driver: intelligent power sharing driver
Jesse Barnes [Fri, 14 May 2010 22:41:14 +0000 (15:41 -0700)]
x86 platform driver: intelligent power sharing driver

Intel Core i3/5 platforms with integrated graphics support both CPU and
GPU turbo mode.  CPU turbo mode is opportunistic: the CPU will use any
available power to increase core frequencies if thermal headroom is
available.  The GPU side is more manual however; the graphics driver
must monitor GPU power and temperature and coordinate with a core
thermal driver to take advantage of available thermal and power headroom
in the package.

The intelligent power sharing (IPS) driver is intended to coordinate
this activity by monitoring MCP (multi-chip package) temperature and
power, allowing the CPU and/or GPU to increase their power consumption,
and thus performance, when possible.  The goal is to maximize
performance within a given platform's TDP (thermal design point).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agotimer: add on-stack deferrable timer interfaces
Jesse Barnes [Mon, 10 May 2010 21:26:20 +0000 (14:26 -0700)]
timer: add on-stack deferrable timer interfaces

In some cases (for instance with kernel threads) it may be desireable to
use on-stack deferrable timers to get their power saving benefits.  Add
interfaces to support this for the IPS driver.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoplatform/x86: msi-laptop depends on SERIO_I8042
Randy Dunlap [Sun, 23 May 2010 23:33:17 +0000 (16:33 -0700)]
platform/x86: msi-laptop depends on SERIO_I8042

msi-laptop uses i8042_*() interfaces, so it should depend on
SERIO_I8042.  E.g., when SERIO_I8042=m and MSI_LAPTOP=y:

msi-laptop.c:(.text+0x18a7fe): undefined reference to `i8042_install_filter'
msi-laptop.c:(.init.text+0xd69d): undefined reference to `i8042_remove_filter'
msi-laptop.c:(.exit.text+0x19c3): undefined reference to `i8042_remove_filter'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
13 years agoclassmate-laptop: depends on RFKILL or RFKILL=n
Thadeu Lima de Souza Cascardo [Wed, 26 May 2010 15:00:10 +0000 (12:00 -0300)]
classmate-laptop: depends on RFKILL or RFKILL=n

Randy Dunlap has reported that building classmate-laptop fails when
CONFIG_RFKILL=m and CONFIG_ACPI_CMPC=y. He suggested depending on
RFKILL, but, then, it will not be possible to select classmate-laptop
when RFKILL is off. There's no known problem with building and using
classmate-laptop with RFKILL off. So depend on RFKILL or RFKILL=n.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: platform-driver-x86@vger.kernel.org
Cc: Daniel Oliveira Nascimento <don@syst.com.br>
13 years agodrivers/platform/x86: Eliminate a NULL pointer dereference
Julia Lawall [Thu, 27 May 2010 16:32:15 +0000 (18:32 +0200)]
drivers/platform/x86: Eliminate a NULL pointer dereference

Give different error messages if device_enum is NULL or if its type field
has the wrong value.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E == NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agoX86 platform: hp-wmi Better match the HP WMI query interface
Thomas Renninger [Fri, 21 May 2010 14:42:40 +0000 (16:42 +0200)]
X86 platform: hp-wmi Better match the HP WMI query interface

- Improve error handling, by explictly return zero for success, error otherwise
- WMI query command can have arbitrary input sized params
- WMI query command can have specific output sized params (0, 4, 128,..) byte

I like to go on here, but this is a rather intrusive change that should
be looked at first. I am sure the one or other thing can be done better or
there might be typo/bug somewhere.

This did not get any testing yet, only compile tested.

Next steps could be:
  - Eventually introduce hp_wmi_perform_{read,write}_query macros
  - Introduce new wireless query interface (0x1B)
  - more

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agox86 platform drivers: hp-wmi fix buffer size depending on ACPI version
Thomas Renninger [Fri, 21 May 2010 14:41:43 +0000 (16:41 +0200)]
x86 platform drivers: hp-wmi fix buffer size depending on ACPI version

Depending on ACPI version (1.0 -> 32 bit) an integer could be
32 or 64 bit long. _WED internal concatenates two integers and
the return value will be 8 byte (2* 32 bit) or 16 byte (2* 64 bit)
long, depending on the ACPI version.

Also the data send with the WMI event is defined to be splitted into:
  - Event ID -> 4 bytes
  - Event Data -> 4 bytes

This gets messed up with new ACPI versions.
But it's a HP BIOS bug that may get fixed in the future
-> Support both, 16 and 8 byte _WED buffers.

Also the wrong assumption that from the event data sent, only the
first byte is relevant got cleaned up that it fits event_id/event_data
as described above.

Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: robert.moore@intel.com
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: platform-driver-x86@vger.kernel.org
CC: linux-acpi@vger.kernel.org
13 years agox86 platform drivers: hp-wmi Set placeholder for unimplemented events
Thomas Renninger [Fri, 21 May 2010 14:18:13 +0000 (16:18 +0200)]
x86 platform drivers: hp-wmi Set placeholder for unimplemented events

Rather than print unknown events when we know what caused them

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agox86 platform drivers: hp-wmi Add media key 0x20e8
Thomas Renninger [Fri, 21 May 2010 14:18:12 +0000 (16:18 +0200)]
x86 platform drivers: hp-wmi Add media key 0x20e8

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agox86 platform drivers: hp-wmi Use consistent prefix string for messages.
Thomas Renninger [Fri, 21 May 2010 14:18:11 +0000 (16:18 +0200)]
x86 platform drivers: hp-wmi Use consistent prefix string for messages.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agox86 platform drivers: hp-wmi Catch and log unkown event and key codes correctly
Thomas Renninger [Fri, 21 May 2010 14:18:10 +0000 (16:18 +0200)]
x86 platform drivers: hp-wmi Catch and log unkown event and key codes correctly

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agox86 platform drivers: hp-wmi Reorder event id processing
Thomas Renninger [Fri, 21 May 2010 14:18:09 +0000 (16:18 +0200)]
x86 platform drivers: hp-wmi Reorder event id processing

Event id 0x4 defines the hotkey event.
No need (or even wrong) to query HPWMI_HOTKEY_QUERY if event id is != 0x4.

Reorder the eventcode conditionals and use switch case instead of if/else.
Use an enum for the event ids cases.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
CC: linux-acpi@vger.kernel.org
CC: platform-driver-x86@vger.kernel.org
13 years agointel_menlow: fix memory leaks in error path
Axel Lin [Fri, 21 May 2010 09:10:33 +0000 (17:10 +0800)]
intel_menlow: fix memory leaks in error path

This patch includes below fixes in error path:
1. fix a memory leak if device_create_file failed in
intel_menlow_add_one_attribute
2. properly free added attributes before return error in
intel_menlow_register_sensor error handler
3. properly call acpi_bus_unregister_driver before return error in
intel_menlow_module_init

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
13 years agol2tp: fix export of header file for userspace
James Chapman [Tue, 3 Aug 2010 07:42:17 +0000 (00:42 -0700)]
l2tp: fix export of header file for userspace

The header file l2tp.h should be exported to the installed include/linux/
tree for userspace programs.

This patch fixes compilation errors in L2TP userspace apps which want to
use the new L2TP support introduced in 2.6.35.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocan-raw: Fix skb_orphan_try handling
Oliver Hartkopp [Tue, 3 Aug 2010 07:31:48 +0000 (00:31 -0700)]
can-raw: Fix skb_orphan_try handling

Commit fc6055a5ba31e2c14e36e8939f9bf2b6d586a7f5 (net: Introduce
skb_orphan_try()) allows an early orphan of the skb and takes care on
tx timestamping, which needs the sk-reference in the skb on driver level.
So does the can-raw socket, which has not been taken into account here.

The patch below adds a 'prevent_sk_orphan' bit in the skb tx shared info,
which fixes the problem discovered by Matthias Fuchs here:

      http://marc.info/?t=128030411900003&r=1&w=2

Even if it's not a primary tx timestamp topic it fits well into some skb
shared tx context. Or should be find a different place for the information to
protect the sk reference until it reaches the driver level?

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoRevert "net: remove zap_completion_queue"
David S. Miller [Tue, 3 Aug 2010 07:24:04 +0000 (00:24 -0700)]
Revert "net: remove zap_completion_queue"

This reverts commit 15e83ed78864d0625e87a85f09b297c0919a4797.

As explained by Johannes Berg, the optimization made here is
invalid.  Or, at best, incomplete.

Not only destructor invocation, but conntract entry releasing
must be executed outside of hw IRQ context.

So just checking "skb->destructor" is insufficient.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoUBIFS: fix a memory leak on error path.
Matthieu CASTET [Mon, 2 Aug 2010 09:36:06 +0000 (11:36 +0200)]
UBIFS: fix a memory leak on error path.

In 'mount_ubifs()', in case of 'ubifs_leb_unmap()' falure,
free allocated resources.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
13 years agonet: cleanup inclusion
Changli Gao [Tue, 3 Aug 2010 05:45:49 +0000 (22:45 -0700)]
net: cleanup inclusion

Commit ab95bfe01f9872459c8678572ccadbf646badad0 replaces bridge and macvlan
hooks in __netif_receive_skb(), so dev.c doesn't need to include their headers.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
David S. Miller [Tue, 3 Aug 2010 05:22:46 +0000 (22:22 -0700)]
Merge branch 'master' of /linux/kernel/git/davem/net-2.6

Conflicts:
drivers/net/e1000e/hw.h
net/bridge/br_device.c
net/bridge/br_input.c

13 years agophy/marvell: add 88e1121 interface mode support
Cyril Chemparathy [Mon, 2 Aug 2010 09:44:53 +0000 (09:44 +0000)]
phy/marvell: add 88e1121 interface mode support

This patch adds support for RGMII RX/TX delay configuration on marvell 88e1121
and derivatives.  With this patch, PHY_INTERFACE_MODE_RGMII_*ID modes are now
supported on these devices.

Signed-off-by: Cyril Chemparathy <cyril@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agou32: negative offset fix
stephen hemminger [Mon, 2 Aug 2010 13:44:13 +0000 (13:44 +0000)]
u32: negative offset fix

It was possible to use a negative offset in a u32 match to reference
the ethernet header or other parts of the link layer header.
This fixes the regression caused by:

commit fbc2e7d9cf49e0bf89b9e91fd60a06851a855c5d
Author: Changli Gao <xiaosuo@gmail.com>
Date:   Wed Jun 2 07:32:42 2010 -0700

    cls_u32: use skb_header_pointer() to dereference data safely

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: Fix a typo from "dev" to "ndev"
Henrique Camargo [Mon, 2 Aug 2010 17:10:42 +0000 (17:10 +0000)]
net: Fix a typo from "dev" to "ndev"

The typo was causing compilation errors since "dev" was not defined.

Signed-off-by: Henrique Camargo <henrique.camargo@ensitec.com.br>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoigb: Use irq_synchronize per vector when using MSI-X
Emil Tantilov [Mon, 2 Aug 2010 14:40:52 +0000 (14:40 +0000)]
igb: Use irq_synchronize per vector when using MSI-X

Synchronize all IRQs when using MSI-X. Similar to ixgbe.
Issue was reported on e1000e, but the patch is also valid for igb.

CC: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoixgbevf: fix null pointer dereference due to filter being set for VLAN 0
Alexander Duyck [Mon, 2 Aug 2010 14:59:04 +0000 (14:59 +0000)]
ixgbevf: fix null pointer dereference due to filter being set for VLAN 0

This change corrects an issue that resulted in a null pointer dereference
for the addition of VLAN 0 without any VLANs being registered.  Also this
code removes some unnecessary checks for defines and the unnecessary setting
of VLAN flags since that is now handled within the kernel via the
vlan_features.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoe1000e: Fix irq_synchronize in MSI-X case
Jeff Kirsher [Mon, 2 Aug 2010 14:27:23 +0000 (14:27 +0000)]
e1000e: Fix irq_synchronize in MSI-X case

Based on original patch/work from Jean Delvare <jdelvare@suse.de>
Synchronize all IRQs when in MSI-X IRQ mode.

Jean's original patch hard coded the sync with the 3 possible vectors,
this patch incorporates more flexibility for the future and aligns
with how igb stores the number of vectors into the adapter structure.

CC: Jean Delvare <jdelvare@suse.de>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoe1000e: register pm_qos request on hardware activation
Florian Mickler [Mon, 2 Aug 2010 14:27:00 +0000 (14:27 +0000)]
e1000e: register pm_qos request on hardware activation

The pm_qos_add_request call has to register the pm_qos request with the pm_qos
susbsystem before first use of the pm_qos request via
pm_qos_update_request.

As pm_qos changed to use plists there is no benefit in registering and
unregistering the pm_qos request on ifup/ifdown and thus we move the
registering into e1000_open and the unregistering in e1000_close.

This fixes the following warning:

[    1.786060] WARNING: at kernel/pm_qos_params.c:264
pm_qos_update_request+0x28/0x54()
[    1.786088] Hardware name: Latitude E6500
[    1.787045] pm_qos_update_request() called for unknown object
[    1.787966] Modules linked in:
[    1.788940] Pid: 1, comm: swapper Not tainted 2.6.35-rc5-mmotm0719 #1
[    1.790035] Call Trace:
[    1.791121]  [<ffffffff81037335>] warn_slowpath_common+0x80/0x98
[    1.792205]  [<ffffffff810373e1>] warn_slowpath_fmt+0x41/0x43
[    1.793279]  [<ffffffff81057c14>] pm_qos_update_request+0x28/0x54
[    1.794347]  [<ffffffff8134889e>] e1000_configure+0x421/0x459
[    1.795393]  [<ffffffff8134afbd>] e1000_open+0xbd/0x37c
[    1.796436]  [<ffffffff8105743a>] ? raw_notifier_call_chain+0xf/0x11
[    1.797491]  [<ffffffff8145f948>] __dev_open+0xae/0xe2
[    1.798547]  [<ffffffff8145f997>] dev_open+0x1b/0x49
[    1.799612]  [<ffffffff8146e36e>] netpoll_setup+0x84/0x259
[    1.800685]  [<ffffffff81b5037c>] init_netconsole+0xbc/0x21f
[    1.801744]  [<ffffffff81b5026c>] ? sir_wq_init+0x0/0x35
[    1.802793]  [<ffffffff81b502c0>] ? init_netconsole+0x0/0x21f
[    1.803845]  [<ffffffff810002ff>] do_one_initcall+0x7a/0x12f
[    1.804885]  [<ffffffff81b2ccae>] kernel_init+0x138/0x1c2
[    1.805915]  [<ffffffff81003554>] kernel_thread_helper+0x4/0x10
[    1.806937]  [<ffffffff81590e00>] ? restore_args+0x0/0x30
[    1.807955]  [<ffffffff81b2cb76>] ? kernel_init+0x0/0x1c2
[    1.808958]  [<ffffffff81003550>] ? kernel_thread_helper+0x0/0x10
[    1.809958] ---[ end trace 84b562a00a60539e ]---

Signed-off-by: Florian Mickler <florian@mickler.org>
Tested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Tue, 3 Aug 2010 01:35:17 +0000 (18:35 -0700)]
Merge branch 'next' into for-linus

13 years agoInput: adp5588-keypad - fix NULL dereference in adp5588_gpio_add()
Dmitry Torokhov [Tue, 3 Aug 2010 01:33:26 +0000 (18:33 -0700)]
Input: adp5588-keypad - fix NULL dereference in adp5588_gpio_add()

The kpad structure is assigned to i2c client via i2s_set_clientdata()
at the end of adp5588_probe(), but in adp5588_gpio_add() we tried to
access it (via dev_get_drvdata! which is not nice at all) causing an
oops.

Let's pass pointer to kpad directly into adp5588_gpio_add() and
adp5588_gpio_remove() to avoid accessing driver data before it is
set up.

Also split out building of gpiomap into a separate function to
clear the logic.

Reported-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
13 years agoip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice
Changli Gao [Sat, 31 Jul 2010 13:25:08 +0000 (13:25 +0000)]
ip_fragment: fix subtracting PPPOE_SES_HLEN from mtu twice

6c79bf0f2440fd250c8fce8d9b82fcf03d4e8350 subtracts PPPOE_SES_HLEN from mtu at
the front of ip_fragment(). So the later subtraction should be removed. The
MTU of 802.1q is also 1500, so MTU should not be changed.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Bart De Schuymer <bdschuym@pandora.bo>
----
 net/ipv4/ip_output.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Signed-off-by: Bart De Schuymer <bdschuym@pandora.bo>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: Add getsockopt support for TCP thin-streams
Josh Hunt [Fri, 30 Jul 2010 13:49:35 +0000 (13:49 +0000)]
net: Add getsockopt support for TCP thin-streams

Initial TCP thin-stream commit did not add getsockopt support for the new
socket options: TCP_THIN_LINEAR_TIMEOUTS and TCP_THIN_DUPACK. This adds support
for them.

Signed-off-by: Josh Hunt <johunt@akamai.com>
Tested-by: Andreas Petlund <apetlund@simula.no>
Acked-by: Andreas Petlund <apetlund@simula.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: update driver version
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:24 +0000 (13:19 +0000)]
cxgb4: update driver version

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: add new PCI IDs
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:23 +0000 (13:19 +0000)]
cxgb4: add new PCI IDs

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: fix wrong shift direction
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:22 +0000 (13:19 +0000)]
cxgb4: fix wrong shift direction

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: support running the driver on PCI functions besides 0
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:21 +0000 (13:19 +0000)]
cxgb4: support running the driver on PCI functions besides 0

Add support for running the driver on any PCI function.  Mostly this
entails replacing a constant 0 in a number of calls with the variable
function number.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: advertise NETIF_F_TSO_ECN
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:20 +0000 (13:19 +0000)]
cxgb4: advertise NETIF_F_TSO_ECN

The device supports TSO+ECN.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: get on-chip queue info from FW and create a memory window for them
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:19 +0000 (13:19 +0000)]
cxgb4: get on-chip queue info from FW and create a memory window for them

Get info about the availability of Tx on-chip queues from FW and if they
are supported set up a memory window for them.  iw_cxgb4 will be using them.
Move the existing window setup later in the init sequence, after we have
collected the new info.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: fix TSO descriptors
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:18 +0000 (13:19 +0000)]
cxgb4: fix TSO descriptors

Commit 1704d74894912b8ecc3e95cecd7bde336a0b1bf2 ("cxgb4vf: small changes
to message processing structures/macros") was incomplete and causes cxgb4
to write bad TSO descriptors.  Fix that up by reverting the offending part
of that commit and adjusting field accesses now that they are one level
deeper.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: don't offload Rx checksums for IPv6 fragments
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:17 +0000 (13:19 +0000)]
cxgb4: don't offload Rx checksums for IPv6 fragments

The checksum provided by the device doesn't include the L3 headers,
as IPv6 expects.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocxgb4: disable an interrupt that is neither used nor serviced
Dimitris Michailidis [Mon, 2 Aug 2010 13:19:16 +0000 (13:19 +0000)]
cxgb4: disable an interrupt that is neither used nor serviced

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agohp100: unmap memory on error path
Dan Carpenter [Mon, 2 Aug 2010 23:08:43 +0000 (16:08 -0700)]
hp100: unmap memory on error path

There was an error path where "mem_ptr_virt" didn't get unmapped.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoTulip: don't initialize SBE xT3E3 WAN ports.
Krzysztof Hałasa [Mon, 2 Aug 2010 23:03:29 +0000 (16:03 -0700)]
Tulip: don't initialize SBE xT3E3 WAN ports.

SBE 2T3E3 cards use DECchips 21143 but they need a different driver.
Don't even try to use a normal tulip driver with them.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net/wan/farsync.c: Use standard pr_<level>
Joe Perches [Mon, 2 Aug 2010 23:01:35 +0000 (16:01 -0700)]
drivers/net/wan/farsync.c: Use standard pr_<level>

Remove locally defined equivalents

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoMerge branch 'vhost-net-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mst...
David S. Miller [Mon, 2 Aug 2010 22:54:07 +0000 (15:54 -0700)]
Merge branch 'vhost-net-next' of git://git./linux/kernel/git/mst/vhost

13 years agotg3: Update version to 3.113
Matt Carlson [Mon, 2 Aug 2010 11:26:08 +0000 (11:26 +0000)]
tg3: Update version to 3.113

This patch updates the tg3 version to 3.113.

Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: Migrate tg3_flags to phy_flags
Matt Carlson [Mon, 2 Aug 2010 11:26:07 +0000 (11:26 +0000)]
tg3: Migrate tg3_flags to phy_flags

This patch moves most of the phy related flag definitions over to the
phyflags member and changes the code accordingly.

Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: Create phy_flags and migrate phy_is_low_power
Matt Carlson [Mon, 2 Aug 2010 11:26:06 +0000 (11:26 +0000)]
tg3: Create phy_flags and migrate phy_is_low_power

This patch deletes the link_config.phy_is_low_power flag and creates a
new phy_flags device member to store all phy related settings.  All the
code is converted accordingly.

Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: Add phy-related preprocessor constants
Matt Carlson [Mon, 2 Aug 2010 11:26:05 +0000 (11:26 +0000)]
tg3: Add phy-related preprocessor constants

This patch replaces some instances of hardcoded phy register values with
preprocessor equivalents.

Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agotg3: Add error reporting to tg3_phydsp_write()
Matt Carlson [Mon, 2 Aug 2010 11:26:04 +0000 (11:26 +0000)]
tg3: Add error reporting to tg3_phydsp_write()

This patch adds error reporting to the tg3_phydsp_write() function and
converts a few more locations to use this function over the inlined
equivalent.

Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>