Input: uinput - fix race that can block nonblocking read
Consider two threads calling read() on the same uinput-fd, both
non-blocking. Assume there is data-available so both will simultaneously
pass:
udev->head == udev->tail
Then the first thread goes to sleep and the second one pops the message
from the queue. Now assume udev->head == udev->tail. If the first thread
wakes up it will call wait_event_*() and sleep in the waitq. This
effectively turns the non-blocking FD into a blocking one.
We fix this by attempting to fetch events from the queue first and only
if we fail to retrieve any events we either return -EAGAIN (in case of
non-blocing read) or wait until there are more events.
This also fixes incorrect return code (we were returning 0 instead of
-EAGAIN for non-blocking reads) when an event is "stolen" by another
thread. Blocking reads will now continue to wait instead of returning 0
in this scenario.
Count of 0 continues to be a special case, as per spec: we will check for
device existence and whether there are events in the queue, but no events
will be actually retrieved.
Reported-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
David Herrmann [Mon, 30 Jul 2012 05:48:31 +0000 (22:48 -0700)]
Input: uinput - return -EINVAL when read buffer size is too small
Let's check whether the user-supplied buffer is actually big enough and
return -EINVAL if it is not. This differs from current behavior, which
caused 0 to be returned and actually does not make any sense, as
broken application will simply repeat the read getting into endless
loop.
Note that we treat 0 as a special case, according to the standard:
"Before any action described below is taken, and if nbyte is zero,
the read() function may detect and return errors as described below.
In the absence of errors, or if error detection is not performed,
the read() function shall return zero and have no other results."
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Input: gpio_keys - report a wakeup_event for a button press
In order to avoid races with suspend, a wakeup event must register as
such by calling pm_wakeup_event() or pm_stay_awake(). This will ensure
that the current suspend cycle aborts.
When the user-space visible event is created in the interrupt handler
(gpio_keys_irq_isr), a simple pm_wakeup_event() with no delay is
sufficient as suspend will synchronise with all interrupt delivery.
When the user-space visible event is created later
(gpio_keys_gpio_isr), we need to bracket the event with
pm_stay_awake() and pm_relax().
Input: synaptics - handle out of bounds values from the hardware
The touchpad on the Acer Aspire One D250 will report out of range values
in the extreme lower portion of the touchpad. These appear as abrupt
changes in the values reported by the hardware from very low values to
very high values, which can cause unexpected vertical jumps in the
position of the mouse pointer.
What seems to be happening is that the value is wrapping to a two's
compliment negative value of higher resolution than the 13-bit value
reported by the hardware, with the high-order bits being truncated. This
patch adds handling for these values by converting them to the
appropriate negative values.
The only tricky part about this is deciding when to treat a number as
negative. It stands to reason that if out of range values can be
reported on the low end then it could also happen on the high end, so
not all out of range values should be treated as negative. The approach
taken here is to split the difference between the maximum legitimate
value for the axis and the maximum possible value that the hardware can
report, treating values greater than this number as negative and all
other values as positive. This can be tweaked later if hardware is found
that operates outside of these parameters.
Input: spear_keyboard - reconfigure operating frequency on suspend
On some platform it may happen that the input clock to keyboard may
change during suspend, thus impacting its wakeup capability.
There is no means for keyboard driver to know this frequency before
hand. Hence introduce a platform data 'suspended_rate' which indicates
the frequency during suspend at which keyboard operates.
Accordingly reprogram keyboard while going into suspend and restore
original configuration at the time of resume.
Dan Carpenter [Sun, 8 Jul 2012 01:17:54 +0000 (18:17 -0700)]
Input: ff-memless - fix a couple min_t() casts
envelope->attack_level is a u16 type. We're trying to clamp it here
so it's between 0 and 0x7fff. Unfortunately, the cast to __s16 turns
all the values larger than 0x7fff into negative numbers and min_t()
thinks they are less than 0x7fff. envelope_level is an int so now
we've got negative values stored there.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Daniel Kurtz [Sun, 8 Jul 2012 01:08:51 +0000 (18:08 -0700)]
Input: synaptics - print firmware ID and board number at init
Read the Firmware ID and Board Number from a synaptics device at init
and display them in the system log.
Device behavior is very board and firmware dependent.
It may prove useful for users to include this information when providing
bug reports or other feedback.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: spear_keyboard - generalize keyboard frequency configuration
Current implementation hard coded keyboard frequency configuration
assuming input clock as fixed APB (83 MHz). Generalize the configuration
using clock framework APIs.
All SPEAr keyboard registers are 32 bit wide and are word aligned. This
patch aligns all io access to be word size using relaxed version of
readl/writel.
Apparently GCC can't figure out that we bail if we fail to query device
and will not try to use 'features':
drivers/input/touchscreen/wacom_i2c.c: In function ‘wacom_i2c_probe’:
drivers/input/touchscreen/wacom_i2c.c:177:20: warning: ‘features.fw_version’
may be used uninitialized in this function [-Wmaybe-uninitialized]
Input: imx_keypad - use clk_prepare_enable/clk_disable_unprepare()
Adapt clock handling to the new i.mx clock framework and fix the following
warning:
input: imx-keypad as /devices/platform/imx-keypad/input/input0
------------[ cut here ]------------
WARNING: at drivers/clk/clk.c:511 __clk_enable+0x98/0xa8()
Modules linked in:
[<c001a680>] (unwind_backtrace+0x0/0xf4) from [<c002452c>] (warn_slowpath_commo)
[<c002452c>] (warn_slowpath_common+0x48/0x60) from [<c0024560>] (warn_slowpath_)
[<c0024560>] (warn_slowpath_null+0x1c/0x24) from [<c02c4ec4>] (__clk_enable+0x9)
[<c02c4ec4>] (__clk_enable+0x98/0xa8) from [<c02c4ef8>] (clk_enable+0x24/0x5c)
[<c02c4ef8>] (clk_enable+0x24/0x5c) from [<c027ac6c>] (imx_keypad_open+0x28/0xc)
[<c027ac6c>] (imx_keypad_open+0x28/0xc8) from [<c0274b14>] (input_open_device+0)
[<c0274b14>] (input_open_device+0x78/0xa8) from [<c01ec884>] (kbd_connect+0x60/)
[<c01ec884>] (kbd_connect+0x60/0x80) from [<c0273b94>] (input_attach_handler+0x)
[<c0273b94>] (input_attach_handler+0x220/0x258) from [<c02755d4>] (input_regist)
[<c02755d4>] (input_register_device+0x31c/0x390) from [<c038da1c>] (imx_keypad_)
[<c038da1c>] (imx_keypad_probe+0x2e4/0x3b8) from [<c020326c>] (platform_drv_pro)
[<c020326c>] (platform_drv_probe+0x18/0x1c) from [<c0201f64>] (driver_probe_dev)
[<c0201f64>] (driver_probe_device+0x84/0x210) from [<c020217c>] (__driver_attac)
[<c020217c>] (__driver_attach+0x8c/0x90) from [<c02008f8>] (bus_for_each_dev+0x)
[<c02008f8>] (bus_for_each_dev+0x68/0x90) from [<c0201064>] (bus_add_driver+0xa)
[<c0201064>] (bus_add_driver+0xa4/0x23c) from [<c020275c>] (driver_register+0x7)
[<c020275c>] (driver_register+0x78/0x12c) from [<c00087c0>] (do_one_initcall+0x)
[<c00087c0>] (do_one_initcall+0x34/0x188) from [<c04b9310>] (kernel_init+0xe4/0)
[<c04b9310>] (kernel_init+0xe4/0x1a8) from [<c0015bd8>] (kernel_thread_exit+0x0)
---[ end trace 1d550e891d03d7ce ]---
Sebastian Zenker reported that driver swaps x and y samples when the
touchscreen leads are connected in accordance with the datasheet
specification. Transposed axis can be typically corrected by touch
screen calibration however this bug also negatively influences touch
pressure measurements.
Add an option to correct x and y axis.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Reported-and-tested-by: Sebastian Zenker <sebastian.zenker@gmx.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Henrik Rydberg [Thu, 5 Jul 2012 18:55:24 +0000 (20:55 +0200)]
Revert "Input: atmel_mxt_ts - warn if sysfs could not be created"
Dmitry: I understand that I am a bit late to the party :) but I do not
agree with this change. Failure to create attributes is not sometihng
that user could cause (at least not easily) and thus would not be a
setup issue but something more severe. I believe we should fail
loading the driver so sysfs attribute breakage will be noticed as soon
as possible, instead of discovering it much much later in the process.
Henrik Rydberg [Wed, 27 Jun 2012 07:53:47 +0000 (09:53 +0200)]
Input: MT - Include win8 support
The newly released HID protocol for win8 multitouch devices is capable
of transmitting more information about each touch. In particular, it
includes details useful for touch alignment. This patch completes the
MT protocol with the ABS_MT_TOOL_X/Y events, and documents how to map
win8 devices.
Cc: Stephane Chatty <chatty@enac.fr> Cc: Benjamin Tissoires <benjamin.tissoires@enac.fr> Cc: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Input: request threaded-only IRQs with IRQF_ONESHOT
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail. This patch adds the
IRQF_ONESHOT to input drivers where it is missing. Not modified by
this patch are those drivers where the requested IRQ will always be a
nested IRQ (e.g. because it's part of an MFD), since for this special
case IRQF_ONESHOT is not required to be specified when requesting the
IRQ.
Linus Torvalds [Sat, 30 Jun 2012 23:01:50 +0000 (16:01 -0700)]
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC fixes from Olof Johansson:
"Another week, another batch of fixes.
All are small, contained, targeted fixes for explicit problems --
mostly build and boot failures across i.MX, OMAP, Renesas/Shmobile and
Samsung."
* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
ARM: imx6q: fix suspend regression caused by common clk migration
ARM: OMAP4470: Fix OMAP4470 boot failure
ARM: EXYNOS: Fix EXYNOS_DEV_DMA Kconfig entry
ARM: OMAP2+: nand: fix build error when CONFIG_MTD_ONENAND_OMAP2=n
ARM: shmobile: r8a7779: Route all interrupts to ARM
ARM: shmobile: kzm9d: use late init machine hook
ARM: shmobile: kzm9g: use late init machine hook
ARM: mach-shmobile: armadillo800eva: Use late init machine hook
ARM: SAMSUNG: Fix for S3C2412 EBI memory mapping
ARM: mach-shmobile: add missing GPIO IRQ configuration on mackerel
ARM: mach-shmobile: Fix build when SMP is enabled and EMEV2 is not enabled
ARM: shmobile: sh7372: bugfix: chclr_offset base
ARM: shmobile: sh73a0: bugfix: SY-DMAC number
ARM: SAMSUNG: Should check for IS_ERR(clk) instead of NULL
Randy Dunlap [Sat, 30 Jun 2012 22:37:24 +0000 (15:37 -0700)]
printk.c: fix kernel-doc warnings
Fix kernel-doc warnings in printk.c: use correct parameter name.
Warning(kernel/printk.c:2429): No description found for parameter 'buf'
Warning(kernel/printk.c:2429): Excess function parameter 'line' description in 'kmsg_dump_get_buffer'
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Randy Dunlap [Sat, 30 Jun 2012 22:30:46 +0000 (15:30 -0700)]
linux/irq.h: fix kernel-doc warning
Fix kernel-doc warning. This struct member was removed in commit 875682648b89 ("irq: Remove irq_chip->release()") so remove its
associated kernel-doc entry also.
Warning(include/linux/irq.h:338): Excess struct/union/enum/typedef member 'release' description in 'irq_chip'
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Cc: Richard Weinberger <richard@nod.at> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Shawn Guo [Tue, 5 Jun 2012 07:16:43 +0000 (15:16 +0800)]
ARM: imx6q: fix suspend regression caused by common clk migration
When moving to common clk framework, the imx6q clks rom and mmdc_ch1_axi
get different on/off states than old clk driver, which breaks suspend
function. There might be a better way to manage these clocks, but let's
takes the old clk driver approach to fix the regression first.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Olof Johansson <olof@lixom.net>
Linus Torvalds [Sat, 30 Jun 2012 18:11:58 +0000 (11:11 -0700)]
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Pull ACPI & Power Management patches from Len Brown.
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
acpi_pad: fix power_saving thread deadlock
ACPI video: Still use ACPI backlight control if _DOS doesn't exist
ACPI, APEI, Avoid too much error reporting in runtime
ACPI: Add a quirk for "AMILO PRO V2030" to ignore the timer overriding
ACPI: Remove one board specific WARN when ignoring timer overriding
ACPI: Make acpi_skip_timer_override cover all source_irq==0 cases
ACPI, x86: fix Dell M6600 ACPI reboot regression via DMI
ACPI sysfs.c strlen fix
Linus Torvalds [Sat, 30 Jun 2012 17:11:24 +0000 (10:11 -0700)]
Merge tag 'driver-core-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver Core fixes from Greg Kroah-Hartman:
"Here is a number of printk() fixes, specifically a few reported by the
crazy blog program that ships in SUSE releases (that's "boot log" and
not "web log", it predates the general "blog" terminology by many
years), and the restoration of the continuation line functionality
reported by Stephen and others. Yes, the changes seem a bit big this
late in the cycle, but I've been beating on them for a while now, and
Stephen has even optimized it a bit, so all looks good to me.
The other change in here is a Documentation update for the stable
kernel rules describing how some distro patches should be backported,
to hopefully drive a bit more response from the distros to the stable
kernel releases.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'driver-core-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
printk: Optimize if statement logic where newline exists
printk: flush continuation lines immediately to console
syslog: fill buffer with more than a single message for SYSLOG_ACTION_READ
Revert "printk: return -EINVAL if the message len is bigger than the buf size"
printk: fix regression in SYSLOG_ACTION_CLEAR
stable: Allow merging of backports for serious user-visible performance issues
Stuart Hayes [Wed, 13 Jun 2012 21:10:45 +0000 (16:10 -0500)]
acpi_pad: fix power_saving thread deadlock
The acpi_pad driver can get stuck in destroy_power_saving_task()
waiting for kthread_stop() to stop a power_saving thread. The problem
is that the isolated_cpus_lock mutex is owned when
destroy_power_saving_task() calls kthread_stop(), which waits for a
power_saving thread to end, and the power_saving thread tries to
acquire the isolated_cpus_lock when it calls round_robin_cpu(). This
patch fixes the issue by making round_robin_cpu() use its own mutex.
https://bugzilla.kernel.org/show_bug.cgi?id=42981
Cc: stable@vger.kernel.org Signed-off-by: Stuart Hayes <Stuart_Hayes@Dell.com> Signed-off-by: Len Brown <len.brown@intel.com>
Some platforms don't have _DOS control method, but the ACPI
backlight still works.
We should not invoke _DOS for these platforms.
https://bugzilla.kernel.org/show_bug.cgi?id=43168
Cc: Igor Murzov <intergalactic.anonymous@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Linus Torvalds [Sat, 30 Jun 2012 02:05:41 +0000 (19:05 -0700)]
Merge tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael J. Wysocki:
* Fix for a bug in async suspend error code path causing parents to
wait forever for their children in case of a suspend error from
Mandeep Singh Baines (-stable metarial).
* Fix for a suspend regression related to earlier changes in the ACPI
cpuidle driver from Deepthi Dharwar.
* tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM / ACPI: Fix suspend/resume regression caused by cpuidle cleanup.
PM / Sleep: Prevent waiting forever on asynchronous suspend after abort
Steven Rostedt [Fri, 29 Jun 2012 15:40:11 +0000 (11:40 -0400)]
printk: Optimize if statement logic where newline exists
In reviewing Kay's fix up patch: "printk: Have printk() never buffer its
data", I found two if statements that could be combined and optimized.
Put together the two 'cont.len && cont.owner == current' if statements
into a single one, and check if we need to call cont_add(). This also
removes the unneeded double cont_flush() calls.
Linus Torvalds [Fri, 29 Jun 2012 20:50:11 +0000 (13:50 -0700)]
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc fixes from Benjamin Herrenschmidt:
"Here are a few powerpc fixes. Arguably some of this should have come
to you earlier but I'm only just catching up after my medical leave.
Mostly these fixes regressions, a couple are long standing bugs."
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
powerpc/pseries: Fix software invalidate TCE
powerpc: check_and_cede_processor() never cedes
powerpc/ftrace: Do not trace restore_interrupts()
powerpc: Fix Section mismatch warnings in prom_init.c
ppc64: fix missing to check all bits of _TIF_USER_WORK_MASK in preempt
powerpc: Fix uninitialised error in numa.c
powerpc: Fix BPF_JIT code to link with multiple TOCs
Linus Torvalds [Fri, 29 Jun 2012 17:29:21 +0000 (10:29 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull oprofile fixlet from Ingo Molnar.
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
oprofile: perf: use NR_CPUS instead or nr_cpumask_bits for static array
Kay Sievers [Thu, 28 Jun 2012 07:38:53 +0000 (09:38 +0200)]
printk: flush continuation lines immediately to console
Continuation lines are buffered internally, intended to merge the
chunked printk()s into a single record, and to isolate potentially
racy continuation users from usual terminated line users.
This though, has the effect that partial lines are not printed to
the console in the moment they are emitted. In case the kernel
crashes in the meantime, the potentially interesting printed
information would never reach the consoles.
Here we share the continuation buffer with the console copy logic,
and partial lines are always immediately flushed to the available
consoles. They are still buffered internally to improve the
readability and integrity of the messages and minimize the amount
of needed record headers to store.
Signed-off-by: Kay Sievers <kay@vrfy.org> Tested-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:24 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - parse T6 reports
The normal messages sent after boot or NVRAM update are T6 reports,
containing a status, and the config memory checksum. Parse them and dump
a useful info message.
This patch tested on an MXT224E.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:23 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - send all MT-B slots in one input report
Each interrupt contains information for all contacts with changing
properties. Process all of this information at once, and send it all in a
a single input report (ie input events ending in EV_SYN/SYN_REPORT).
This patch was tested using an MXT224E.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:22 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - use T9 reportid range to init number of mt slots
Atmel mxt devices can report one finger for each T9 reportid.
Therefore, this range can be used to report the max number of MT-B slots
to userspace instead of assuming a fixed 10.
Note that mxt_initialized() must complete early, since the input_dev
properties now depend on values in the object table.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:20 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - cache T9 reportid range when reading object table
Streamline interrupt processing by caching the T9 reportid range when
first reading the object table.
In the process, refactor reading the object descriptor table.
First, since the object_table entries are now exactly the same layout
in device memory and in the driver, allocate an appropriately sized
array and fetch the entire table directly into it in a single i2c
transaction. Since a 6 byte table object requires 10 bytes to read,
doing this dramatically reduces overhead.
Note: The cached T9 reportid's are initialized to 0, which is an invalid
reportid. Thus, the checks in the interrupt handler will always fail for
devices that do not support the T9 object. Therefore, after doing a
firmware update, the old object table is destroyed and all cached object
values are reset to 0, before reading the new object table, in case
the new firmware does not have the old objects.
This patch tested on an MXT224E.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:19 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - refactor when and how object table is freed
The Object Table is freed in three cases:
1) When the driver is being removed.
2) In the error path of mxt_initialize().
3) Just after a firmware update, when a new object table is
about to be read.
For cases 2 & 3, the driver is not immediately unloaded, so this patch
refactors these cases to use a common cleanup function. It also refactors
the mxt_initialize error paths to ensure that this cleanup happens.
Note: mxt_update_fw_store() does not handle errors during mxt_initialize().
A proposed fix for this is in a subsequent patchset.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:17 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - simplify event reporting
Instead of carrying around per-finger state in the driver instance, just
report each finger as it arrives to the input layer, and let the input
layer (evdev) hold the event state (which it does anyway).
Note: this driver does not really do MT-B properly. Each input report
(a group of input events followed by a SYN_REPORT) only contains data for
a single contact. When multiple fingers are present on a device, each is
properly reported in its own MT_SLOT. However, there is only ever one
MT_SLOT per SYN_REPORT. This is fixed in a subsequent patch.
This patch was tested with an mXT224E.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:16 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - add sysfs entries to read fw and hw version
Make firmware and hardware version strings available to userspace.
This is useful, for example, to allow a userspace program to implement
a firwmare update policy.
Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:11 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - return errors from i2c layer
The i2c layer can report a variety of errors, including -ENXIO for an i2c
NAK. Instead of treating them all as -EIO, pass the actual i2c layer
error up to the caller.
However, still report as -EIO the unlikely case that a transaction was
partially completed, and no error message was returned from i2c_*().
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:10 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - print all instances when dumping objects
For objects with multiple instances, dump them all, prepending each with
its "Instance #".
[rydberg@euromail.se: break out mxt_show_instance()] Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:09 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - print less overhead when dumping objects
Conserve limited (PAGE_SIZE) sysfs output buffer space by only showing
readable objects and not printing the object's index, which is not useful
to userspace.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:06 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - don't read T5 when dumping objects
T5 is the message processor object. Reading it will only have two
outcomes, neither of which is particularly useful:
1) the message count decrements, and a valid message will be lost
2) an invalid message will be read (reportid == 0xff)
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Daniel Kurtz [Thu, 28 Jun 2012 13:08:03 +0000 (21:08 +0800)]
Input: atmel_mxt_ts - use client name for irq
The atmel_mxt_ts driver can support multiple devices simultaneously.
Use the i2c_client name instead of the driver name when requesting an
interrupt to make the different interrupts distinguishable in
/proc/interrupts and top.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Anton Blanchard [Wed, 27 Jun 2012 13:13:52 +0000 (13:13 +0000)]
powerpc: check_and_cede_processor() never cedes
Commit f948501b36c6 ("Make hard_irq_disable() actually hard-disable
interrupts") caused check_and_cede_processor to stop working.
->irq_happened will never be zero right after a hard_irq_disable
so the compiler removes the call to cede_processor completely.
The bug was introduced back in the lazy interrupt handling rework
of 3.4 but was hidden until recently because hard_irq_disable did
nothing.
This issue will eventually appear in 3.4 stable since the
hard_irq_disable fix is marked stable, so mark this one for stable
too.
Signed-off-by: Anton Blanchard <anton@samba.org> Cc: stable@vger.kernel.org Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Steven Rostedt [Mon, 4 Jun 2012 16:27:54 +0000 (16:27 +0000)]
powerpc/ftrace: Do not trace restore_interrupts()
As I was adding code that affects all archs, I started testing function
tracer against PPC64 and found that it currently locks up with 3.4
kernel. I figured it was due to tracing a function that shouldn't be, so
I went through the following process to bisect to find the culprit:
cat /debug/tracing/available_filter_functions > t
num=`wc -l t`
sed -ne "1,${num}p" t > t1
let num=num+1
sed -ne "${num},$p" t > t2
cat t1 > /debug/tracing/set_ftrace_filter
echo function /debug/tracing/current_tracer
<failed? bisect t1, if not bisect t2>
It finally came down to this function: restore_interrupts()
I'm not sure why this locks up the system. It just seems to prevent
scheduling from occurring. Interrupts seem to still work, as I can ping
the box. But all user processes freeze.
When restore_interrupts() is not traced, function tracing works fine.
Cc: stable@kernel.org Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Li Zhong [Thu, 7 Jun 2012 17:44:23 +0000 (17:44 +0000)]
powerpc: Fix Section mismatch warnings in prom_init.c
This patches tries to fix a couple of Section mismatch warnings like
following one:
WARNING: arch/powerpc/kernel/built-in.o(.text+0x2923c): Section mismatch
in reference from the function .prom_query_opal() to the
function .init.text:.call_prom()
The function .prom_query_opal() references
the function __init .call_prom().
This is often because .prom_query_opal lacks a __init
annotation or the annotation of .call_prom is wrong.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Tiejun Chen [Wed, 6 Jun 2012 20:56:43 +0000 (20:56 +0000)]
ppc64: fix missing to check all bits of _TIF_USER_WORK_MASK in preempt
In entry_64.S version of ret_from_except_lite, you'll notice that
in the !preempt case, after we've checked MSR_PR we test for any
TIF flag in _TIF_USER_WORK_MASK to decide whether to go to do_work
or not. However, in the preempt case, we do a convoluted trick to
test SIGPENDING only if PR was set and always test NEED_RESCHED ...
but we forget to test any other bit of _TIF_USER_WORK_MASK !!! So
that means that with preempt, we completely fail to test for things
like single step, syscall tracing, etc...
This should be fixed as the following path:
- Test PR. If not set, go to resume_kernel, else continue.
- If go resume_kernel, to do that original do_work.
- If else, then always test for _TIF_USER_WORK_MASK to decide to do
that original user_work, else restore directly.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Michael Neuling [Tue, 19 Jun 2012 20:01:45 +0000 (20:01 +0000)]
powerpc: Fix uninitialised error in numa.c
chroma_defconfig currently gives me this with gcc 4.6:
arch/powerpc/mm/numa.c:638:13: error: 'dm' may be used uninitialized in this function [-Werror=uninitialized]
It's a bogus warning/error since of_get_drconf_memory() only writes it
anyway.
Signed-off-by: Michael Neuling <mikey@neuling.org>
cc: <stable@kernel.org> [v3.3+] Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Michael Ellerman [Thu, 21 Jun 2012 17:50:27 +0000 (17:50 +0000)]
powerpc: Fix BPF_JIT code to link with multiple TOCs
If the kernel is big enough (eg. allyesconfig), the linker may need to
switch TOCs when calling from the BPF JIT code out to the external
helpers (skb_copy_bits() & bpf_internal_load_pointer_neg_helper()).
In order to do that we need to leave space after the bl for the linker
to insert a reload of our TOC pointer.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Linus Torvalds [Thu, 28 Jun 2012 19:38:51 +0000 (12:38 -0700)]
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon changes from Guenter Roeck:
"Just e-mail address updates"
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: Update my e-mail address
hwmon: (applesmc) correct email address for Jesper Juhl
Linus Torvalds [Thu, 28 Jun 2012 18:51:19 +0000 (11:51 -0700)]
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog fixes from Wim Van Sebroeck:
"This fixes:
- the WDIOC_GETSTATUS return value
- the unregister of all NMI events on exit
- the loading of the iTCO_wdt driver after the conversion to the
lpc_ich mfd model."
* git://www.linux-watchdog.org/linux-watchdog:
watchdog: core: fix WDIOC_GETSTATUS return value
watchdog: hpwdt: Unregister NMI events on exit.
watchdog: iTCO_wdt: add platform driver module alias
Linus Torvalds [Thu, 28 Jun 2012 18:43:45 +0000 (11:43 -0700)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull UDF fixes from Jan Kara:
"Make UDF more robust in presence of corrupted filesystem"
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
udf: Fortify loading of sparing table
udf: Avoid run away loop when partition table length is corrupted
udf: Use 'ret' instead of abusing 'i' in udf_load_logicalvol()
Linus Torvalds [Thu, 28 Jun 2012 18:41:43 +0000 (11:41 -0700)]
Merge tag 'upstream-3.5-rc5' of git://git.infradead.org/linux-ubifs
Pull ubi/ubifs fixes from Artem Bityutskiy:
"Fix the debugfs regression - we never enable it because incorrect
'IS_ENABLED()' macro usage: should be 'IS_ENABLED(CONFIG_DEBUG_FS)',
but we had 'IS_ENABLED(DEBUG_FS)'. Also fix incorrect assertion."
* tag 'upstream-3.5-rc5' of git://git.infradead.org/linux-ubifs:
UBI: correct usage of IS_ENABLED()
UBIFS: correct usage of IS_ENABLED()
UBIFS: fix assertion
Wim Van Sebroeck [Tue, 26 Jun 2012 18:07:21 +0000 (20:07 +0200)]
watchdog: core: fix WDIOC_GETSTATUS return value
In commit 7a87982420e5e126bfefeb42232d1fd92052794e we added
a wrapper for the WDIOC_GETSTATUS ioctl call. The code results
however in a different behaviour: it returns an error if the
driver doesn't support the status operation. This is not
according to the API that says that when we don't support
the status operation, that we just should return a 0 value.
Only when the device isn't there anymore, we should return an
error.