History log of /linux-master/drivers/platform/x86/sony-laptop.c
Revision Date Author Comments
# d524e9d6 04-Oct-2023 Jeff Layton <jlayton@kernel.org>

x86: convert to new timestamp accessors

Convert to using the new inode timestamp accessor functions.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Link: https://lore.kernel.org/r/20231004185347.80880-8-jlayton@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>


# 06984c83 12-Mar-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

platform/x86: sony: mark SPI related data as maybe unused

The driver can be compile tested as built-in making certain data unused:

drivers/platform/x86/sony-laptop.c:3290:36: error: ‘sony_device_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230312132624.352703-3-krzysztof.kozlowski@linaro.org
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# ad75bd85 13-Dec-2022 Hans de Goede <hdegoede@redhat.com>

platform/x86: sony-laptop: Don't turn off 0x153 keyboard backlight during probe

The 0x153 version of the kbd backlight control SNC handle has no separate
address to probe if the backlight is there.

This turns the probe call into a set keyboard backlight call with a value
of 0 turning off the keyboard backlight.

Skip probing when there is no separate probe address to avoid this.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1583752
Fixes: 800f20170dcf ("Keyboard backlight control for some Vaio Fit models")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Mattia Dongili <malattia@linux.it>
Link: https://lore.kernel.org/r/20221213122943.11123-1-hdegoede@redhat.com


# e80355dd 08-Dec-2022 ye xingchen <ye.xingchen@zte.com.cn>

platform/x86: sony-laptop: Convert to use sysfs_emit_at() API

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the
value to be returned to user space.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/202212081545178689771@zte.com.cn
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 6c0eb5ba 13-Nov-2022 Dawei Li <set_pte_at@outlook.com>

ACPI: make remove callback of ACPI driver void

For bus-based driver, device removal is implemented as:
1 device_remove()->
2 bus->remove()->
3 driver->remove()

Driver core needs no inform from callee(bus driver) about the
result of remove callback. In that case, commit fc7a6209d571
("bus: Make remove callback return void") forces bus_type::remove
be void-returned.

Now we have the situation that both 1 & 2 of calling chain are
void-returned, so it does not make much sense for 3(driver->remove)
to return non-void to its caller.

So the basic idea behind this change is making remove() callback of
any bus-based driver to be void-returned.

This change, for itself, is for device drivers based on acpi-bus.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Lee Jones <lee@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dawei Li <set_pte_at@outlook.com>
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for drivers/platform/surface/*
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 8d05fc03 30-Sep-2022 Barnabás Pőcze <pobrn@protonmail.com>

platform/x86: use PLATFORM_DEVID_NONE instead of -1

Use the `PLATFORM_DEVID_NONE` constant instead of
hard-coding -1 when creating a platform device.

No functional changes are intended.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Link: https://lore.kernel.org/r/20220930104857.2796923-1-pobrn@protonmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 7842efa5 19-Jul-2022 Andrey Strachuk <strochuk@ispras.ru>

platform/x86: sony-laptop: Remove useless comparisons in sony_pic_read_possible_resource()

Local variable 'p' is initialized by an address
of field of acpi_resource structure, so it does
not make sense to compare 'p' with NULL.

Local variable 'io' is initialized by an address
of field of acpi_resource structure, so it does
not make sense to compare 'io' with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Andrey Strachuk <strochuk@ispras.ru>
Link: https://lore.kernel.org/r/20220719110341.7239-1-strochuk@ispras.ru
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# c4b9ad6b 22-Oct-2021 Ye Guojin <ye.guojin@zte.com.cn>

platform/x86: sony-laptop: replace snprintf in show functions with sysfs_emit

coccicheck complains about the use of snprintf() in sysfs show
functions:
WARNING use scnprintf or sprintf

Use sysfs_emit instead of scnprintf or sprintf makes more sense.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
Link: https://lore.kernel.org/r/20211022090851.1065538-1-ye.guojin@zte.com.cn
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 61982193 19-Oct-2020 Tom Rix <trix@redhat.com>

platform/x86: remove unneeded break

A break is not needed if it is preceded by a return

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20201019133212.12671-1-trix@redhat.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>


# 476d60b1 07-May-2020 Mattia Dongili <malattia@linux.it>

platform/x86: sony-laptop: Make resuming thermal profile safer

The thermal handle object may fail initialization when the module is
loaded in the first place. Avoid attempting to use it on resume then.

Fixes: 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator")
Reported-by: Dominik Mierzejewski <dominik@greysector.net>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207491
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 47828d22 07-May-2020 Mattia Dongili <malattia@linux.it>

platform/x86: sony-laptop: SNC calls should handle BUFFER types

After commit 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer
objects for ASL create_field() operator") ACPICA creates buffers even
when new fields are small enough to fit into an integer.
Many SNC calls counted on the old behaviour.
Since sony-laptop already handles the INTEGER/BUFFER case in
sony_nc_buffer_call, switch sony_nc_int_call to use its more generic
function instead.

Fixes: 6d232b29cfce ("ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator")
Reported-by: Dominik Mierzejewski <dominik@greysector.net>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207491
Reported-by: William Bader <williambader@hotmail.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1830150
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# b40e288b 11-Mar-2020 Takashi Iwai <tiwai@suse.de>

platform/x86: sony-laptop: Use scnprintf() for avoiding potential buffer overflow

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit. Fix it by replacing with scnprintf().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 74ba9207 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
675 mass ave cambridge ma 02139 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 441 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1cbd7a64 24-Apr-2019 Gustavo A. R. Silva <gustavo@embeddedor.com>

platform/x86: sony-laptop: Fix unintentional fall-through

It seems that the default case should return AE_CTRL_TERMINATE, instead
of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK;
otherwise the line of code at the end of the function is unreachable and
makes no sense:

return AE_CTRL_TERMINATE;

This fix is based on the following thread of discussion:

https://lore.kernel.org/patchwork/patch/959782/

Fixes: 33a04454527e ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# c163f90c 15-Feb-2019 Erik Kaneda <erik.kaneda@intel.com>

ACPI/ACPICA: Trivial: fix spelling mistakes and fix whitespace formatting

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# a9a08845 11-Feb-2018 Linus Torvalds <torvalds@linux-foundation.org>

vfs: do bulk POLL* -> EPOLL* replacement

This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do. But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# afc9a42b 03-Jul-2017 Al Viro <viro@zeniv.linux.org.uk>

the rest of drivers/*: annotate ->poll() instances

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# e99e88a9 16-Oct-2017 Kees Cook <keescook@chromium.org>

treewide: setup_timer() -> timer_setup()

This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.

Casting from unsigned long:

void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);

and forced object casts:

void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);

become:

void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);

Direct function assignments:

void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;

have a temporary cast added, along with converting the args:

void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;

And finally, callbacks without a data assignment:

void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);

have their argument renamed to verify they're unused during conversion:

void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);

The conversion is done with the following Coccinelle script:

spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci

@fix_address_of@
expression e;
@@

setup_timer(
-&(e)
+&e
, ...)

// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@

(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)

@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@

(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)

// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@

void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}

// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@

void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}

// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@

void _callback(struct timer_list *t)
{ ... }

// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@

void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}

// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@

void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}

// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@

(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)

// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@

(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)

// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@

_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)

// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@

(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)

@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@

void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}

Signed-off-by: Kees Cook <keescook@chromium.org>


# e4a18052 01-Nov-2017 Markus Elfring <elfring@users.sourceforge.net>

platform/x86: sony-laptop: Drop variable assignment in sony_nc_setup_rfkill()

The local variable "err" will eventually be set to an appropriate value
a bit later. Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# f6c8a317 01-Nov-2017 Markus Elfring <elfring@users.sourceforge.net>

platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill()

Source code review for a specific software refactoring showed the need
for another correction because the error code "-1" was returned so far
if a call of the function "sony_call_snc_handle" failed here.
Thus assign the return value from these two function calls also to
the variable "err" and provide it in case of a failure.

Fixes: d6f15ed876b83a1a0eba1d0473eef58acc95444a ("sony-laptop: use soft rfkill status stored in hw")
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lkml.org/lkml/2017/10/31/463
Link: https://lkml.kernel.org/r/<CAHp75VcMkXCioCzmLE0+BTmkqc5RSOx9yPO0ectVHMrMvewgwg@mail.gmail.com>
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>


# 6faadbbb 14-Sep-2017 Christoph Hellwig <hch@lst.de>

dmi: Mark all struct dmi_system_id instances const

... and __initconst if applicable.

Based on similar work for an older kernel in the Grsecurity patch.

[JD: fix toshiba-wmi build]
[JD: add htcpen]
[JD: move __initconst where checkscript wants it]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jean Delvare <jdelvare@suse.de>


# d791db9a 29-Jun-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

platform/x86: sony-laptop: constify attribute_group and input index array

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group.

The content of sony_laptop_input_index does not change and is declared
as a static global array.

Constify spic_attribute_group and sony_laptop_input_index.

File size before:
text data bss dec hex filename
31273 5176 372 36821 8fd5 drivers/platform/x86/sony-laptop.o

File size After adding 'const':
text data bss dec hex filename
31337 5112 372 36821 8fd5 drivers/platform/x86/sony-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
[dvhart: updated commit message, includes fix suggested by Arnd Bergmann]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>


# 7c0f6ba6 24-Dec-2016 Linus Torvalds <torvalds@linux-foundation.org>

Replace <asm/uaccess.h> with <linux/uaccess.h> globally

This was entirely automated, using the script by Al:

PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*<asm/uaccess.h>'
sed -i -e "s!$PATT!#include <linux/uaccess.h>!" \
$(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c2050a45 14-Sep-2016 Deepa Dinamani <deepa.kernel@gmail.com>

fs: Replace current_fs_time() with current_time()

current_fs_time() uses struct super_block* as an argument.
As per Linus's suggestion, this is changed to take struct
inode* as a parameter instead. This is because the function
is primarily meant for vfs inode timestamps.
Also the function was renamed as per Arnd's suggestion.

Change all calls to current_fs_time() to use the new
current_time() function instead. current_fs_time() will be
deleted.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# ddd9357f 21-Mar-2016 Lawrence Yiu <lawyiu.dev@gmail.com>

sony-laptop: Avoid oops on module unload for older laptops

Older VAIO laptops without the SN00 ACPI method will have the "handles"
variable unset. Return early from sony_nc_function_cleanup when "handles"
is null.

Signed-off-by: Lawrence Yiu <lawyiu.dev@gmail.com>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 800f2017 14-Dec-2015 Mattia Dongili <malattia@linux.it>

Keyboard backlight control for some Vaio Fit models

SVF1521P6EW, SVF1521DCXW, SVF13N1L2ES and likely most SVF*.
do not expose separate timeout controls in auto mode.

Signed-off-by: Dominik Matta <dominik@matta.sk>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 963406ff 24-Sep-2015 Andrzej Hajda <a.hajda@samsung.com>

sony-laptop: Fix handling sony_nc_hotkeys_decode result

sony_nv_hotkeys_decode can return a negative value. real_ev is a u32 variable.
The check for real_ev > 0 is incorrect.

Use an intermediate ret variable.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
[dvhart: clarify commit msg, drop superfluous else block]
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 56d5c34a 16-Jun-2015 Hans de Goede <hdegoede@redhat.com>

sony-laptop: Port to new backlight interface selection API

Port the backlight selection logic to the new backlight interface
selection API.

This commit also removes various obsolete pr_xxx messages related to
backlight interface selection. These are obsolete because they assume
there is only a vendor or acpi backlight driver and no other choice.
Also they are not necessary, if the user wants to know which backlight
interfaces are registered a simple "ls /sys/class/backlight" suffices.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mattia Dongili <malattia@linux.it>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 76fe63f5 05-Feb-2015 Lad, Prabhakar <prabhakar.csengg@gmail.com>

Sony-laptop: Fix sparse warning (make undeclared var static)

Fix the following sparse warning:

sony-laptop.c:1035:29: warning: symbol 'sony_bl_props' was not declared. Should it be static?

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# c6b7ef21 24-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

Sony-laptop: Deletion of an unnecessary check before the function call "pci_dev_put"

The pci_dev_put() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call
is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 00981810 24-Nov-2014 Markus Elfring <elfring@users.sourceforge.net>

platform: x86: Deletion of checks before backlight_device_unregister()

The backlight_device_unregister() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
For msi-wmi.c:
Acked-by: Anisse Astier <anisse@astier.eu>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>


# 3493f414 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

platform: x86: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# dc8f0315 12-Jun-2014 mog422 <admin@mog422.net>

sony-laptop: fix doesn't work lid resume settings on Vaio Pro

Signed-off-by: mog422 <admin@mog422.net>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# e22510ea 20-Mar-2014 Mattia Dongili <malattia@linux.it>

sony-laptop: remove useless sony-laptop versioning

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# d58dc780 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add smart connect control function

The current value is not available through the SNC device and therefore
the attribute is writable only.

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 0380d471 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: adjust keyboard backlight values for off/auto/on

Keyboard backlight can be always off, use some automatic trigger
(activity and light sensor), always on.
The behaviour of the driver changes whereby previously when passed 1 it
tried to turn on backlight immediately now it does nothing. This is
however a bug fix since (a) it makes little sense to turn on the
backlight when control is automatic and (b) this behaviour is
consistent with what the windows driver does.

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 168de1ad 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add hibernate on low battery function

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# c62f1539 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add fan speed regulation function

Rework error exit logic by Mattia Dongili.

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 2a26f341 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add usb charge function

Allows to specify if the USB socket should charge attached devices while
the laptop is suspended to ram.

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 9e04c908 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add panel_id function

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 35312076 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: Add support for lid resume settings on Vaio Pro

Vaio Pro uses a different handle and doesn't support all the options as
other models (only S5 setting v/s S3/4/5).

Minor code rework to generalize functions by Mattia Dongili.

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 94d164dc 20-Mar-2014 Javier Achirica <jachirica@gmail.com>

sony-laptop: add support as Fn+1 as a hot key

Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 2845f477 10-Jan-2014 Colin Ian King <colin.king@canonical.com>

sony-laptop: remove unnecessary assigment of len

The assignment of len = len is unnecessary, so remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 8b48463f 02-Dec-2013 Lv Zheng <lv.zheng@intel.com>

ACPI: Clean up inclusions of ACPI header files

Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
<acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
inclusions and remove some inclusions of those files that aren't
necessary.

First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
should not be included directly from any files that are built for
CONFIG_ACPI unset, because that generally leads to build warnings about
undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set,
<linux/acpi.h> includes those files and for CONFIG_ACPI unset it
provides stub ACPI symbols to be used in that case.

Second, there are ordering dependencies between those files that always
have to be met. Namely, it is required that <acpi/acpi_bus.h> be included
prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
latter depends on are always there. And <acpi/acpi.h> which provides
basic ACPICA type declarations should always be included prior to any other
ACPI headers in CONFIG_ACPI builds. That also is taken care of including
<linux/acpi.h> as appropriate.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# b975dc36 25-Nov-2013 Mattia Dongili <malattia@linux.it>

sony-laptop: do not scribble keyboard backlight registers on resume

Follow-up to commit 294d31e8227c ("sony-laptop: don't change keyboard
backlight settings"): avoid messing up the state on resume. Leave it to
what was before suspending as it's anyway likely that we still don't
know what value we should write to the EC registers. This fix is also
required in 3.12

Cc: stable@vger.kernel.org
Tested-by: Karol Babioch <karol@babioch.de>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# a825bc87 12-Nov-2013 Stephen Gildea <stepheng+linux@gildea.com>

sony-laptop: fixe typos in sony_laptop_input_keycode_map

Signed-off-by: Stephen Gildea <stepheng+linux@gildea.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 1d885f42 29-Oct-2013 Mattia Dongili <malattia@linux.it>

sony-laptop: warn on multiple KBD backlight handles

Some BIOS versions/Vaio models apparently ship with two nearly identical
functions to handle backlight related controls.
The only difference seems to be:
If (LEqual (BUF1, 0x40))
{
Store (0x40, P80H)
Store (BUF2, Local0)
- And (Local0, One, Local0)
+ And (Local0, 0x03, Local0)
Store (Local0, ^^H_EC.KLPC)
}

Avoid erroring out on initialization and messing things up on cleanup
for now since we never call into these methods with anything different
than 1 or 0.
This issue was found on a Sony VPCSE1V9E/BIOS R2087H4.

Cc: Marco Krüger <krgsch@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 294d31e8 18-Aug-2013 Mattia Dongili <malattia@linux.it>

sony-laptop: don't change keyboard backlight settings

Do not touch keyboard backlight unless explicitly passed a module
parameter. In this way we won't make wrong assumptions about what are
good default values since they actually are different from model to
model.

The only side effect is that we won't know what is the current value
until set via the sysfs attributes.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 8a8bce1d 02-Sep-2013 Zhang Rui <rui.zhang@intel.com>

sony-laptop: convert acpi_get_handle() to acpi_has_method()

acpi_has_method() is a new ACPI API introduced to check
the existence of an ACPI control method.

It can be used to replace acpi_get_handle() in the case that
1. the calling function doesn't need the ACPI handle of the control method.
and
2. the calling function doesn't care the reason why the method is unavailable.

Convert acpi_get_handle() to acpi_has_method()
in drivers/platform/x86/sony-laptop.c in this patch.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
CC: Matthew Garrett <matthew.garrett@nebula.com>
CC: Mattia Dongili <malattia@linux.it>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 0b8cb621 09-Aug-2013 Daniel Serpell <daniel.serpell@gmail.com>

sony-laptop: Fix reporting of gfx_switch_status

Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 03a174b3 09-Aug-2013 Wei Yongjun <yongjun_wei@trendmicro.com.cn>

sony-laptop: return a negative error code in sonypi_compat_init()

Return -1 in the error handling case instead of 0, as done elsewhere in
this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 1696d9dc 15-Jul-2013 Thomas Renninger <trenn@suse.de>

ACPI: Remove the old /proc/acpi/event interface

It is quite some time that this one has been deprecated.
Get rid of it.

Should some really important user be overseen, it may be reverted and
the userspace program worked on first, but it is time to do something
to get rid of this old stuff...

Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Matthew Garrett <matthew.garrett@nebula.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 0572b12a 17-Mar-2013 Arthur Wirski <awirski@gmail.com>

sony-laptop: SVS151290S kbd backlight and gfx switch support

SVS151290S series uses handle 0x0163 for keyboard backlight and 0x015B for the graphics switch.

Signed-off-by: Arthur Wirski <awirski@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# f084dbb9 23-Mar-2013 Yinghai Lu <yinghai@kernel.org>

ACPI: Set length even for TYPE_END_TAG acpi resource

Found with a network device in QEMU/KVM guest not working anymore.

Bisected to commit c13085e5
ACPICA: Resource Mgr: Prevent infinite loops in resource walks

That commit will check acpi_resource length strictly which causes
acpi_set_current_resources to return failure and IRQ for PCI
devices is not set properly.

Set length for all those TYPE_END_TAG acpi_resources.

[rjw: Changelog]
Bisected-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 34cf1df3 01-Feb-2013 Dan Carpenter <dan.carpenter@oracle.com>

sony-laptop: leak in error handling sony_nc_lid_resume_setup()

We need to decrement "i" first because the current "i" was not allocated
succesfully. Also we should go free the way down to zero to avoid a
leak.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 7517a17c 20-Dec-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: support basic functions for handle 0x14B and 0x14C

Z series and other recent models have 0x14? for lid and keyboard
backlight.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 3a7abcd8 20-Dec-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: allow reading the status of gfx switch

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 3ec1c398 20-Dec-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: fully enable SNY controlled modems

The call to handlers 0x124 and 0x135 (rfkill control) seems to take a
bitmask to control various states of the device. For our rfkill we need
a fully on/off. SVZ1311Z9R/X's LTE modem needs more bits up.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47751
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Cc: stable@kernel.org


# 496ad9aa 23-Jan-2013 Al Viro <viro@zeniv.linux.org.uk>

new helper: file_inode(file)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 51fac838 23-Jan-2013 Rafael J. Wysocki <rafael.j.wysocki@intel.com>

ACPI: Remove useless type argument of driver .remove() operation

The second argument of ACPI driver .remove() operation is only used
by the ACPI processor driver and the value passed to that driver
through it is always available from the given struct acpi_device
object's removal_type field. For this reason, the second ACPI driver
.remove() argument is in fact useless, so drop it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>


# dcbeec26 20-Dec-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: fix SNC buffer calls when SN06 returns Integers

SN06 in some cases returns an Integer instead of a buffer. While the
code handling the return value was trying to cope with the difference,
the memcpy call was not making any difference between the two types of
acpi_object union. This regression was introduced in 3.5.
While there also rework the return value logic to improve readability.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48671
Cc: <stable@vger.kernel.org>
Cc: Fabrizio Narni <shibotto@gmail.com>
Cc: <mus.svz@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>


# 3567a4e2 09-Aug-2012 Rafael J. Wysocki <rjw@rjwysocki.net>

platform / x86 / PM: Fix unused function warnings for CONFIG_PM_SLEEP

According to compiler warnings, quite some suspend/resume functions
in platform x86 drivers are not used for CONFIG_PM_SLEEP unset, so
add #ifdefs to prevent them from being built in that case.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>


# bb6b98d6 27-Jun-2012 Rafael J. Wysocki <rjw@rjwysocki.net>

sony-laptop: Use struct dev_pm_ops for power management

Make the sony-laptop driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct acpi_device_ops.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>


# 17621e11 27-Jun-2012 Rafael J. Wysocki <rjw@rjwysocki.net>

ACPI / PM: Drop pm_message_t argument from device suspend callback

None of the drivers implementing the ACPI device suspend callback
uses the pm_message_t argument of it, so this argument may be dropped
entirely from that callback. This will simplify switching the ACPI
bus type to PM handling based on struct dev_pm_ops.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>


# a1071a5a 13-Jun-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: correct find_snc_handle failure checks

Since bab7084c745bf4d75b760728387f375fd34dc683, find_snc_handle
returns -EINVAL, not -1.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 56f4a9f7 08-Jun-2012 Dan Carpenter <dan.carpenter@oracle.com>

sony-laptop: fix a couple signedness bugs

This needs to be signed to handle negative error codes.
Remove a redundant check, read_limits is always called with a valid
handle.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# c7a29183 08-Jun-2012 Dan Carpenter <dan.carpenter@oracle.com>

sony-laptop: fix sony_nc_sysfs_store()

We made this an unsigned long and it causes a bug on 64 bit big endian
systems when we try to pass the value to sony_nc_int_call().

Also value has to be signed because validate() returns negative error
codes.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# ca3c2c70 08-Jun-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: input initialization should be done before SNC

SNC needs input devices so better have those ready before starting
handle events.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 014fc8fb 08-Jun-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: add lid backlight support for handle 0x143

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 15aa5c75 10-Jun-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: store battery care limits on batteries

Some models offer the option to store the limits on the battery
(firmware?).

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bb384b52 08-Jun-2012 Marco Chiappero <marco@absence.it>

sony-laptop: notify userspace of GFX switch position changes

Some Vaios come with both integrated and discrete graphics, plus a
switch for choosing one of the two. When the switch position is changed,
a notification is generated.

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 4069d6f8 08-Jun-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: use an enum for SNC event types

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 2b8791c4 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: add touchpad enable/disable function

This setting is stored in the EC and available across reboots.

[malattia@linux.it: group function specific variables in a struct, use
kstrtoul]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 2e526311 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: add missing Fn key combos for 0x100 handlers

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a1e73632 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: add support for more WWAN modems

Also make the initialization function return a value for consistency
with all the other setup functions.

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# aa33924f 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: new keyboard backlight handle

Add support for handle 0x0143 (Vaio SA/SB/SC, CA/CB) and rework the code
to be hable to support different handles for the keyboard backlight
function.

[malattia@linux.it: group function specific variables in a struct]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 88bf1706 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: add high speed battery charging function

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 54535d08 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: support automatic resume on lid open

A few models offer the chance to set whether to resume from S3 and/or S4
when opening the lid.

[malattia@linux.it: create three sysfs files for S3/4/5 rather than
using a single one accepting a bitmask. Support S5 since the DSDT
exports it. Use a struct to hold all the related values, caching of the
current status value rather than re-reading all the time in the sysfs
show function.]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bab7084c 19-May-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: adjust error handling in finding SNC handles

All handles must be greater than 0, also return more meaningful error
codes on invalid conditions.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 49f000ad 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: add thermal profiles support

[malattia@linux.it: support string based profiles names]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 967145a0 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: support battery care functions

Allows limiting the maximum battery charge level to a selectable value
(100%, 80% and 50%).

[malattia@linux.it: group function specific variables in a struct, use
kstrtoul. Allow 0 to 100 values into sysfs files rounding to the actual
limit.]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# ae188715 19-May-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: additional debug statements

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 5fe801a7 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: improve SNC initialization and acpi notify callback code

Loop through the list of SNC handles and run the proper initialization
function for each of the known handles. Also return void in function
where we are not checking the return value anyway.
For notifications we also know which handle is linked to the event and
the code becomes simpler to read with a switch rather than using
convoluted ifs.

[malattia@linux.it: Code reworked to merge the initialization code
improvements and the notify callback changes. Modified the code paths to
allow easier error exit paths. Also fixed some missing break statements
and spelling mistakes.]

Signed-off-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 9e123379 19-May-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: use kstrtoul to parse sysfs values

This avoids surprises like echoing "enable" into a sysfs file and
finding that the feature was actually disabled.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# ebcef1b0 19-May-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: generalise ACPI calls into SNC functions

All calls into the SNC device methods have zero or one arguments and
return an integer or a buffer (some functions go as far as returning an
integer _or_ a buffer depending on the input parameter...).
This allows simplifying a couple of code paths and prepares the field
for other users of functions returning buffers.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 3398241b 19-May-2012 Mattia Dongili <malattia@linux.it>

sony-laptop: fix return path when no ACPI buffer is allocated

The goto target location would still try to free a buffer that was
never allocated.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# d6f15ed8 19-May-2012 Marco Chiappero <marco@absence.it>

sony-laptop: use soft rfkill status stored in hw

The SNC device on recent Vaio laptops also stores the soft status and
leaves it available after reboot. Use it and always set the last soft
and hard status on module load.

[malattia@linux.it: patch taken from a largely modified sony-laptop.c,
smaller modifications to the original code to simplify it]

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 747a562f 16-Nov-2011 John Hughes <john@calvaedi.com>

to fix scancodes returned by sony-laptop driver

Fix scancodes returned by driver to match scancodes used to remap keys.

(Before the patch FN/E returned scancode 0x1B, but to remap scancode
0x14 had to be used).

The scancodes returned by the sony-laptop driver for function keys did not
match the scancodes used to remap keys. Also, since the scancode was sent
to the input subsystem after the mapped keysym the /lib/udev/keymap
utility was confused about which scancode to report for which keysym.

This patch fixes the driver so the correct scancode is shown for each
key. It also adds to the documentation a description of where to find
the scancodes.

Signed-off-by: John Hughes <john@calva.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 6fe6ae56 02-Nov-2011 Josh Boyer <jwboyer@redhat.com>

sony-laptop: Enable keyboard backlight by default

When the keyboard backlight support was originally added, the commit said
to default it to on with a 10 second timeout. That actually wasn't the
case, as the default value is commented out for the kbd_backlight parameter.
Because it is a static variable, it gets set to 0 by default without some
other form of initialization.

However, it seems the function to set the value wasn't actually called
immediately, so whatever state the keyboard was in initially would remain.
Then commit df410d522410e67660 was introduced during the 2.6.39 timeframe to
immediately set whatever value was present (as well as attempt to
restore/reset the state on module removal or resume). That seems to have
now forced the light off immediately when the module is loaded unless
the option kbd_backlight=1 is specified.

Let's enable it by default again (for the first time). This should solve
https://bugzilla.redhat.com/show_bug.cgi?id=728478

Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 6a0d89c2 22-Oct-2011 Yong Zhang <yong.zhang0@gmail.com>

sony-laptop:irq: Remove IRQF_DISABLED

Since commit [e58aa3d2: genirq: Run irq handlers with interrupts disabled],
We run all interrupt handlers with interrupts disabled
and we even check and yell when an interrupt handler
returns with interrupts enabled (see commit [b738a50a:
genirq: Warn when handler enables interrupts]).

So now this flag is a NOOP and can be removed.

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 5ddf9c5f 16-May-2011 Weiping Pan <panweiping3@gmail.com>

platform/x86:delete two unused variables

variable handle is not used in these two functions,
just delete them.

Signed-off-by: Weiping Pan <panweiping3@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 50f581a4 29-Mar-2011 Joe Perches <joe@perches.com>

sony-laptop: Add and use #define pr_fmt

Add pr_fmt.
Remove now unused #define DRV_PRX.
Neaten dprintk macro.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 62d2f23e 09-May-2011 Mattia Dongili <malattia@linux.it>

[PATCH] sony-laptop: limit brightness range to DSDT provided ones

The new style brightness control provides an operating range of 9 values
(seems consistent over a large number of models sharing the same
brightness control methods).
Read and use the minimum and maximum values to limit the backlight
interface between those boundaries.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 6192fa71 05-Apr-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: report failures on setting LCD brightness

Check if we were successful in setting the requested brightness and
report failure in that case.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# df410d52 05-Apr-2011 Marco Chiappero <marco@absence.it>

sony-laptop: keyboard backlight fixes

Restore the original state on module removal, set the latest values on
resume.
When setting the keyboard backlight mode try to turn on/off backlight
immediately.

[malattia@linux.it: patch taken from a largely modified sony-laptop.c,
ported and slightly modified to use defines already available.]

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 855b8bc9 05-Apr-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: only show the handles sysfs file in debug mode

It makes no sense to expose this type of information to userspace unless
the driver was explicitly loaded with the debug option.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# fef34861 02-Apr-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: fix early NULL pointer dereference

The SNC acpi driver could get early notifications before it fully
initializes and that could lead to dereferencing the sony_nc_handles
structure pointer that is still NULL at that stage.
Make sure we return early from the handle lookup function in these
cases.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# c8440336 17-Mar-2011 Lucas De Marchi <lucas.de.marchi@gmail.com>

platform-drivers: x86: fix common misspellings

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 200140bd 27-Feb-2011 Dan Carpenter <error27@gmail.com>

sony-laptop: potential null dereference

In the original code, if "device_enum" was NULL then it would
dereference it when it printed the error message.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 31f00759 26-Feb-2011 Dan Carpenter <error27@gmail.com>

sony-laptop: handle allocation failures

Return -ENOMEM if kzalloc() fails. The callers already handle error
returns.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 7227dedb 26-Feb-2011 Dan Carpenter <error27@gmail.com>

sony-laptop: return negative on failure in sony_nc_add()

There were two places in sony_nc_add() where we returned zero on failure
instead of a negative error code.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# f11113b2 26-Feb-2011 Dan Carpenter <error27@gmail.com>

sony-laptop: make a couple variables static

Sparse complains that these variables should be static.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 7751ab8e 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: implement new backlight control method

Reasonably recent Vaios have a 0x12f or 0x137 handler that exposes a
fine lid backlight regulation with values ranging from 0 to 255.
The patch is based on findings and code from Javier Achirica
<achirica@gmail.com> and Marco Chiappero <marco@absence.it>

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bf155714 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: implement keyboard backlight support

Recent Vaios have the opportunity to control the keyboard backlight via
ACPI calls to the SNC device.
Introduce two module parameters to control how keyboard backlight should
be set at module loading (default to on and with 10 seconds timeout).

Tested-by: Marco Chiappero <marco@absence.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 2a4f0c81 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: cache handles and report them via sysfs

Avoid calling into acpi each time we need to lookup a method handle
and report the available handles to ease collection of information when
debugging issues. Also move initialization of the platform driver
earlier to allow adding files from other setup functions.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 3672329c 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: remove unused Type4 define

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# d6697938 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: use pr_<level> for messages

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 4eeb5022 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: ignore hard switch rfkill events (SPIC)

There is not much use for these events in userspace and handling the
events themselves seems to get in the way of the actual activation of
the rf devices. The SNC device doesn't expose them already.
https://bugzilla.kernel.org/show_bug.cgi?id=15303

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# 56e6e716 18-Feb-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: add some debug printk useful for bug reports

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# bb7ca747 22-Mar-2011 Matthew Garrett <mjg@redhat.com>

backlight: add backlight type

There may be multiple ways of controlling the backlight on a given
machine. Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 1a7d9469 08-Jan-2011 Mattia Dongili <malattia@linux.it>

sony-laptop: support new hotkeys on the P, Z and EC series

Add new mappings for assist, VAIO, zoom and eject buttons present on
refurbished P, Z and EC models.

Reported-by: Gyorgy Jeney <nog.lkml@gmail.com>
Reported-by: Stephan Mueller <smueller@chronox.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# a46a7808 08-Jan-2011 Randy Dunlap <randy.dunlap@oracle.com>

sony-laptop: fix sparse non-ANSI function warning

Fix sparse warning for non-ANSI function declaration:

drivers/platform/x86/sony-laptop.c:1134:35: warning: non-ANSI function declaration of function 'sony_nc_rfkill_update'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <mjg@redhat.com>


# acc2472e 16-Nov-2010 Lionel Debroux <lionel_debroux@yahoo.fr>

backlight: constify backlight_ops

backlight_device_register has been expecting a const "ops" argument, and using
it as such, since 9905a43b2d563e6f89e4c63c4278ada03f2ebb14. Let's make the
remaining backlight_ops instances const.

Inspired by hunks of the grsecurity patch, updated for newer kernels.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 6038f373 15-Aug-2010 Arnd Bergmann <arnd@arndb.de>

llseek: automatically add .llseek fop

All file_operations should get a .llseek operation so we can make
nonseekable_open the default for future file operations without a
.llseek pointer.

The three cases that we can automatically detect are no_llseek, seq_lseek
and default_llseek. For cases where we can we can automatically prove that
the file offset is always ignored, we use noop_llseek, which maintains
the current behavior of not returning an error from a seek.

New drivers should normally not use noop_llseek but instead use no_llseek
and call nonseekable_open at open time. Existing drivers can be converted
to do the same when the maintainer knows for certain that no user code
relies on calling seek on the device file.

The generated code is often incorrectly indented and right now contains
comments that clarify for each added line why a specific variant was
chosen. In the version that gets submitted upstream, the comments will
be gone and I will manually fix the indentation, because there does not
seem to be a way to do that using coccinelle.

Some amount of new code is currently sitting in linux-next that should get
the same modifications, which I will do at the end of the merge window.

Many thanks to Julia Lawall for helping me learn to write a semantic
patch that does all this.

===== begin semantic patch =====
// This adds an llseek= method to all file operations,
// as a preparation for making no_llseek the default.
//
// The rules are
// - use no_llseek explicitly if we do nonseekable_open
// - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos
// - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@
nested_open(...)
{
<+...
nonseekable_open(...)
...+>
}

@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f)
{
<+...
(
nonseekable_open(...)
|
nested_open(...)
)
...+>
}

@ read disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ read_no_fpos disable optional_qualifier exists @
identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
{
... when != off
}

@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}

@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@
ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
{
... when != off
}

@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};

@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};

@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};

@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};

@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};

// use no_llseek if we call nonseekable_open
////////////////////////////////////////////
@ nonseekable1 depends on !has_llseek && has_open @
identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};

@ nonseekable2 depends on !has_llseek @
identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */
};

// use seq_lseek for sequential files
/////////////////////////////////////
@ seq depends on !has_llseek @
identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */
};

// use default_llseek if there is a readdir
///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};

// use default_llseek if at least one of read/write touches f_pos
/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};

@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};

// Use noop_llseek if neither read nor write accesses f_pos
///////////////////////////////////////////////////////////

@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};

@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};

@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};

@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Julia Lawall <julia@diku.dk>
Cc: Christoph Hellwig <hch@infradead.org>


# 08db2b31 30-Jun-2010 Axel Lin <axel.lin@gmail.com>

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>


# 0fc8f274 27-May-2010 Julia Lawall <julia@diku.dk>

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>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

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>


# a19a6ee6 17-Feb-2010 Matthew Garrett <mjg@redhat.com>

backlight: Allow properties to be passed at registration

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>


# c14973f9 10-Jan-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

sony-laptop - fix using of uninitialized variable

CC [M] drivers/platform/x86/sony-laptop.o
drivers/platform/x86/sony-laptop.c: In function 'sony_nc_rfkill_setup':
drivers/platform/x86/sony-laptop.c:1162: warning: 'i' may be used uninitialized in this function

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# cffdde99 24-Dec-2009 Dmitry Torokhov <dmitry.torokhov@gmail.com>

sony-laptop - switch from workqueue to a timer

The function that is executing in workqueue context does not need
to sleep so let's switch to a timer which is more lightweight.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>


# c45bc9d6 24-Dec-2009 Dmitry Torokhov <dmitry.torokhov@gmail.com>

sony-laptop - simplify keymap initialization

Also use input_set_capability() helper instead of manipulating
bits directly.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>


# 9593bd07 24-Dec-2009 Dmitry Torokhov <dmitry.torokhov@gmail.com>

sony-laptop - remove private workqueue, use keventd instead

If we reschedule work instead of having work function sleep for 10 msecs
between reads from kfifo we can safely use the main workqueue (keventd)
and not bother with creating driver-private one.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>


# 528809c3 16-Dec-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: enumerate rfkill devices using SN06

SN06 makes sure we get back a longer buffer which seems to be necessary
going forward as the SNC devices describes more and more devices (or
features more precisely). Moreover SN06 should be called with only the
descriptor offset to make sure we hit the rfkill controlling function
(F124 or F135) with a 0 argument to get a full list of features.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Tested-by: Miguel Rodríguez Pérez <miguelrp@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>


# d5a664a3 16-Dec-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: rfkill support for newer models

Vaio Type X and possibly other new models use F135 as the radio
frequency controlling function attached to the SNC device. In the
indexed table this corresponds to 0x0135 (surpise!).

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 7acd72eb 21-Dec-2009 Stefani Seibold <stefani@seibold.net>

kfifo: rename kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out...

rename kfifo_put... into kfifo_in... to prevent miss use of old non in
kernel-tree drivers

ditto for kfifo_get... -> kfifo_out...

Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc
annotations more readable.

Add mini "howto porting to the new API" in kfifo.h

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# e64c026d 21-Dec-2009 Stefani Seibold <stefani@seibold.net>

kfifo: cleanup namespace

change name of __kfifo_* functions to kfifo_*, because the prefix __kfifo
should be reserved for internal functions only.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# c1e13f25 21-Dec-2009 Stefani Seibold <stefani@seibold.net>

kfifo: move out spinlock

Move the pointer to the spinlock out of struct kfifo. Most users in
tree do not actually use a spinlock, so the few exceptions now have to
call kfifo_{get,put}_locked, which takes an extra argument to a
spinlock.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 45465487 21-Dec-2009 Stefani Seibold <stefani@seibold.net>

kfifo: move struct kfifo in place

This is a new generic kernel FIFO implementation.

The current kernel fifo API is not very widely used, because it has to
many constrains. Only 17 files in the current 2.6.31-rc5 used it.
FIFO's are like list's a very basic thing and a kfifo API which handles
the most use case would save a lot of development time and memory
resources.

I think this are the reasons why kfifo is not in use:

- The API is to simple, important functions are missing
- A fifo can be only allocated dynamically
- There is a requirement of a spinlock whether you need it or not
- There is no support for data records inside a fifo

So I decided to extend the kfifo in a more generic way without blowing up
the API to much. The new API has the following benefits:

- Generic usage: For kernel internal use and/or device driver.
- Provide an API for the most use case.
- Slim API: The whole API provides 25 functions.
- Linux style habit.
- DECLARE_KFIFO, DEFINE_KFIFO and INIT_KFIFO Macros
- Direct copy_to_user from the fifo and copy_from_user into the fifo.
- The kfifo itself is an in place member of the using data structure, this save an
indirection access and does not waste the kernel allocator.
- Lockless access: if only one reader and one writer is active on the fifo,
which is the common use case, no additional locking is necessary.
- Remove spinlock - give the user the freedom of choice what kind of locking to use if
one is required.
- Ability to handle records. Three type of records are supported:
- Variable length records between 0-255 bytes, with a record size
field of 1 bytes.
- Variable length records between 0-65535 bytes, with a record size
field of 2 bytes.
- Fixed size records, which no record size field.
- Preserve memory resource.
- Performance!
- Easy to use!

This patch:

Since most users want to have the kfifo as part of another object,
reorganize the code to allow including struct kfifo in another data
structure. This requires changing the kfifo_alloc and kfifo_init
prototypes so that we pass an existing kfifo pointer into them. This
patch changes the implementation and all existing users.

[akpm@linux-foundation.org: fix warning]
Signed-off-by: Stefani Seibold <stefani@seibold.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 4f924ba5 16-Dec-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: add AVMode key mapping

Some models are equipped with an "AVMode" function key that sends
sony-laptop: Unknown event: 0x100 0xa1
sony-laptop: Unknown event: 0x100 0x21
for press and release respectively.

Cc: "Matthew W. S. Bell" <matthew@bells23.org.uk>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 2263576c 12-Nov-2009 Lin Ming <ming.m.lin@intel.com>

ACPICA: Add post-order callback to acpi_walk_namespace

The existing interface only has a pre-order callback. This change
adds an additional parameter for a post-order callback which will
be more useful for bus scans. ACPICA BZ 779.

Also update the external calls to acpi_walk_namespace.

http://www.acpica.org/bugzilla/show_bug.cgi?id=779

Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>


# a0d97d6c 25-Sep-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>

sony-laptop: re-read the rfkill state when resuming from suspend

Without this, the hard-blocked state will be reported incorrectly if
the hardware switch is changed while the laptop is suspended.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Tested-by: Norbert Preining <preining@logic.at>
Acked-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 50fab076 24-Sep-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>

sony-laptop: check for rfkill hard block at load time

"I recently (on a flight) I found out that when I boot with the hard-switch
activated, so turning off all wireless activity on my laptop, the state
is not correctly announced in /dev/rfkill (reading it with rfkill command,
or my own gnome applet)...

After turning off and on again the hard-switch the events were right."

We can fix this by querying the firmware at load time and calling
rfkill_set_hw_state().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Tested-by: Norbert Preining <preining@logic.at>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Mattia Dongili <malattia@linux.it>
CC: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 5e6f9725 15-Sep-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>

sony-laptop: Don't unregister the SPIC driver if it wasn't registered

This fixes a warning when the module is unloaded on machines without SPIC.

------------[ cut here ]------------
WARNING: at drivers/base/driver.c:261 driver_unregister+0x6e/0x80()
Hardware name: OEM
Unexpected driver unregister!
Modules linked in: sony_laptop(-) rfkill af_packet i915
drm i2c_algo_bit cfbcopyarea i2c_core cfbimgblt cfbfillrect binfmt_misc
ipv6 kvm_intel kvm acpi_cpufreq cpufreq_userspace cpufreq_powersave
cpufreq_stats acpi_pad ac video output battery pci_slot sbs sbshc
container iptable_filter ip_tables x_tables ext2 fuse
snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss
snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi_event
snd_seq snd_timer snd_seq_device snd fan sg serio_raw sr_mod cdrom
soundcore button thermal processor thermal_sys floppy snd_page_alloc
pcspkr intel_agp evdev [last unloaded: asus_atk0110]
Pid: 8136, comm: modprobe Not tainted 2.6.31-rc8debug #50
Call Trace:
[<ffffffff8121ec7e>] ? driver_unregister+0x6e/0x80
[<ffffffff81047577>] warn_slowpath_common+0x87/0xb0
[<ffffffff81047624>] warn_slowpath_fmt+0x64/0x70
[<ffffffff8119a360>] ? kobject_release+0x0/0x1f0
[<ffffffff8119a267>] ? kobject_put+0x27/0x60
[<ffffffff8121d346>] ? bus_put+0x16/0x20
[<ffffffff8121d406>] ? bus_remove_driver+0xb6/0xf0
[<ffffffff8121ec7e>] driver_unregister+0x6e/0x80
[<ffffffff811cab50>] acpi_bus_unregister_driver+0x10/0x12
[<ffffffffa035e86c>] sony_laptop_exit+0x2c/0x2e [sony_laptop]
[<ffffffff8107ddc6>] sys_delete_module+0x176/0x230
[<ffffffff8107186d>] ? trace_hardirqs_on_caller+0x14d/0x1a0
[<ffffffff81350a04>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[<ffffffff8100bdab>] system_call_fastpath+0x16/0x1b
---[ end trace f638b6a59b19703e ]---

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 922553f2 15-Sep-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: remove _INI call at init time

This is unnecessary as OSPM is supposed to call the method already when
the device is discovered.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# d1e0de92 15-Sep-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: SPIC unset IRQF_SHARED, set IRQF_DISABLED

The SPIC irq is not really shareable, the IO port cannot be cleared and
always returns some data so there is no real way to understand if the irq
is for us or not. Moreover the _PRS acpi method says the irq is not
shareable.
In addition to this, in some cases, an additional write to the IO port has
to be performed in order to properly decode the event received from the
device. This generates another interrupt which may overlap with the
previous one. In the future this is going to be important for properly
decoding events.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 31df7144 15-Sep-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: remove device_ctrl and the SPIC mini drivers

Having separate drivers for SPIC showed to be useless, only type3 has a
slightly different behaviour than the others and there seem to be no real
conflict between them.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 15b8dd53 28-Jun-2009 Bob Moore <robert.moore@intel.com>

ACPICA: Major update for acpi_get_object_info external interface

Completed a major update for the acpi_get_object_info external interface.
Changes include:
- Support for variable, unlimited length HID, UID, and CID strings
- Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.)
- Call the _SxW power methods on behalf of a device object
- Determine if a device is a PCI root bridge
- Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO.
These changes will require an update to all callers of this interface.
See the ACPICA Programmer Reference for details.

Also, update all invocations of acpi_get_object_info interface

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>


# e1f8a19e 10-Jun-2009 Johannes Berg <johannes@sipsolutions.net>

sony: fix rfkill code again

When the hard state changes, we shouldn't set the soft
state to blocked as well -- we have no such indication
from the device in that case so leave it untouched.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13458.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 869fb3a4 08-Jun-2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>

sony-laptop: no need to unblock rfkill on load

The re-written rfkill core ensures rfkill devices are initialized to
the system default state. The core calls set_block after registration
so the driver shouldn't need to.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# fc240e3f 07-Jun-2009 Johannes Berg <johannes@sipsolutions.net>

sony: fix rfkill code

During the rfkill conversion I added code to call
sony_nc_rfkill_set with the wrong argument, causing
a segfault Reinette reported. The compiler could not
catch that because the argument is, and needs to be,
void *.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 19d337df 02-Jun-2009 Johannes Berg <johannes@sipsolutions.net>

rfkill: rewrite

This patch completely rewrites the rfkill core to address
the following deficiencies:

* all rfkill drivers need to implement polling where necessary
rather than having one central implementation

* updating the rfkill state cannot be done from arbitrary
contexts, forcing drivers to use schedule_work and requiring
lots of code

* rfkill drivers need to keep track of soft/hard blocked
internally -- the core should do this

* the rfkill API has many unexpected quirks, for example being
asymmetric wrt. alloc/free and register/unregister

* rfkill can call back into a driver from within a function the
driver called -- this is prone to deadlocks and generally
should be avoided

* rfkill-input pointlessly is a separate module

* drivers need to #ifdef rfkill functions (unless they want to
depend on or select RFKILL) -- rfkill should provide inlines
that do nothing if it isn't compiled in

* the rfkill structure is not opaque -- drivers need to initialise
it correctly (lots of sanity checking code required) -- instead
force drivers to pass the right variables to rfkill_alloc()

* the documentation is hard to read because it always assumes the
reader is completely clueless and contains way TOO MANY CAPS

* the rfkill code needlessly uses a lot of locks and atomic
operations in locked sections

* fix LED trigger to actually change the LED when the radio state
changes -- this wasn't done before

Tested-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> [thinkpad]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 53005a0a 12-Apr-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: always try to unblock rfkill on load

This fixes an inconsistent behaviour when loading the driver with the
switch on or off. In the former case you would also need to soft unblock
the switch via the sysfs file entries to really disable rfkill, in the
latter you wouldn't.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Cc: Matthias Welwarsky <matze@welwarsky.de>
Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>


# c35d4b35 12-Apr-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: fix bogus error message display on resume

sony_backlight_update_status returns 0 on success -1 on failure (i.e.: the
return value from acpi_callsetfunc. The return value in the resume path
was broken and thus always displaying a bogus warning about not being able
to restore the brightness level.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# a83021a2 12-Apr-2009 Almer S. Tigelaar <almer@gnome.org>

sony-laptop: SNC input event 38 fix

Fixes the "unknown input event 38" messages. ANYBUTTON_RELEASED is now
treated the same way as FN_KEY_RELEASED.

Signed-off-by: Almer S. Tigelaar <almer@gnome.org>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 560e84ac 12-Apr-2009 Almer S. Tigelaar <almer@gnome.org>

sony-laptop: SNC 127 Initialization Fix

Fixes additional special key initialization for SNC 127 key events.
Verified / tested on a Sony VAIO SR model.

Signed-off-by: Almer S. Tigelaar <almer@gnome.org>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 226fced3 12-Apr-2009 Almer S. Tigelaar <almer@gnome.org>

sony-laptop: Duplicate SNC 127 Event Fix

Fixes a duplicate mapping in the SNC sony_127_events structure.

Signed-off-by: Almer S. Tigelaar <almer@gnome.org>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 621cac85 27-Mar-2009 Johannes Berg <johannes@sipsolutions.net>

rfkill: remove user_claim stuff

Almost all drivers do not support user_claim, so remove it
completely and always report -EOPNOTSUPP to userspace. Since
userspace cannot really drive rfkill _anyway_ (due to the
odd restrictions imposed by the documentation) having this
code is just pointless.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>


# 8037d6e6 07-Apr-2009 Bjorn Helgaas <bjorn.helgaas@hp.com>

sony-laptop: use .notify method instead of installing handler directly

This patch adds a .notify() method. The presence of .notify() causes
Linux/ACPI to manage event handlers and notify handlers on our behalf,
so we don't have to install and remove them ourselves.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
CC: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 16dd55f3 01-Apr-2009 Matthias Welwarsky <matze@welwarsky.de>

sony-laptop: fix event reporting for new style events

In short Fn key events are always reported through acpi.
The input layer gets all the old style events and only those new style
events that, after being decoded, are mapped to an locally represented
events.
rfkill only update the rfkill device status.

Signed-off-by: Matthias Welwarsky <matze@welwarsky.de>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 6479efb6 01-Apr-2009 Matthias Welwarsky <matze@welwarsky.de>

sony-laptop: new style events typo fixes

Signed-off-by: Matthias Welwarsky <matze@welwarsky.de>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# ff07a53a 01-Apr-2009 Alessio Igor Bogani <abogani@texware.it>

sony-laptop: Fix some typos in log messages (Unabe/Unable)

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 4ef4cbb3 26-Mar-2009 Alessio Igor Bogani <abogani@texware.it>

sony-laptop: Kill the BKL

Signed-off-by: Alessio Igor Bogani <abogani@texware.it>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 37418347 26-Mar-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: update copyright

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# c9f1e6f6 26-Mar-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: Make sony_pic_set_wwanpower not take mutexes

For consistency with __sony_pic_set_bluetoothpower, this is also needed
later to allow setting the wwanpower attribute from the resume path and
only lock the mutex once.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# f5acf5e8 26-Mar-2009 Anton Veretenenko <anton@veretenenko.ru>

sony-laptop: Add FW specific hotkey events

Signed-off-by: Anton Veretenenko <anton@veretenenko.ru>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 3ad1b761 26-Mar-2009 Sergey Yanovich <ynvich@gmail.com>

sony-laptop: notify the hardware of a state change in wwanpower

Signed-off-by: Sergey Yanovich <ynvich@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# d5b02695 26-Mar-2009 ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>

sony-laptop: detect the ICH9 chipset as Type3

Signed-off-by: ISHIKAWA Mutsumi <ishikawa@hanzubon.jp>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 2b24ef09 26-Mar-2009 Alan Cox <alan@lxorguk.ukuu.org.uk>

sony-laptop: Eliminate BKL in ioctls

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 1cae7103 26-Mar-2009 Harald Jenny <harald@a-little-linux-box.at>

sony-laptop: VGN-A317M hotkey support

This laptop has 5 SPIC managed buttons above the keyboard:
sound + and - as well as brightness, zoom and S1.
Possibly the entire VGN-A serie behaves the same.

Signed-off-by: Harald Jenny <harald@a-little-linux-box.at>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# e93c8a68 26-Mar-2009 Mattia Dongili <malattia@linux.it>

sony-laptop: merge Type4 into Type3

Creating Type4 was a mistake in the first place. Some users report that
also Type3 vaios require the same extra hotkey handling which the Type4
for was menat to guard from.
Merging down Type4 into Type3 will just remove a useless distinction.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 45c7942b 26-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org>

sony-laptop: Add support for extended hotkeys

Recent Sony SR-series machines have an additional set of buttons accessed
via the 0x127 method rather than the 0x100 method. Add support for these.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 6cc056bc 26-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org>

sony-laptop: Add rfkill support on new models

Newer Vaios provide a full featured rfkill implementation via their
platform methods. Add support for enumerating the available devices and
providing rfkill access to them. Support for the physical kill switch is
added, with the devices moving into the HARD_BLOCKED state when toggled.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 9b57896e 26-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org>

sony-laptop: Add support for extra keyboard events

The current sony-laptop code assumes that the keyboard event method is
always located at slot 2 in the platform code. Remove this assumption and
add support for some additional hotkeys.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 82734bfc 26-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org>

sony-laptop: Enable EC on newer hardware

The latest Vaios can execute certain codepaths in two ways - either using
system management mode or using pure ACPI methods. The latter is only used
if the OS has called the ECON method. Ensure that this is done where the
method is available.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# badf26f0 26-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org>

sony-laptop: Add support for new Sony platform API

Newer Sony Vaios provide a new API for accessing platform functionality. It
consists of a set of standardised methods for enabling events and performing
queries. These are each identified by a unique handle. This patch adds
support for calling functions based on their handle and ports the existing
code for these machines over to it.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>


# 60aa4924 01-Feb-2009 Jonathan Corbet <corbet@lwn.net>

Rationalize fasync return values

Most fasync implementations do something like:

return fasync_helper(...);

But fasync_helper() will return a positive value at times - a feature used
in at least one place. Thus, a number of other drivers do:

err = fasync_helper(...);
if (err < 0)
return err;
return 0;

In the interests of consistency and more concise code, it makes sense to
map positive return values onto zero where ->fasync() is called.

Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>


# 41b16dce 30-Nov-2008 Len Brown <len.brown@intel.com>

create drivers/platform/x86/ from drivers/misc/

Move x86 platform specific drivers from drivers/misc/
to a new home under drivers/platform/x86/.

The community has been maintaining x86 vendor-specific
platform specific drivers under /drivers/misc/ for a few years.
The oldest ones started life under drivers/acpi.
They moved out of drivers/acpi/ because they don't actually
implement the ACPI specification, but either simply
use ACPI, or implement vendor-specific ACPI extensions.

In the future we anticipate...
drivers/misc/ will go away.
other architectures will create drivers/platform/<arch>

Signed-off-by: Len Brown <len.brown@intel.com>