pandora-kernel.git
11 years agoMerge branches 'for-3.7/upstream-fixes', 'for-3.8/hidraw', 'for-3.8/i2c-hid', 'for...
Jiri Kosina [Wed, 12 Dec 2012 20:41:55 +0000 (21:41 +0100)]
Merge branches 'for-3.7/upstream-fixes', 'for-3.8/hidraw', 'for-3.8/i2c-hid', 'for-3.8/multitouch', 'for-3.8/roccat', 'for-3.8/sensors' and 'for-3.8/upstream' into for-linus

Conflicts:
drivers/hid/hid-core.c

11 years agoHID: i2c-hid: add mutex protecting open/close race
Benjamin Tissoires [Wed, 12 Dec 2012 17:00:02 +0000 (18:00 +0100)]
HID: i2c-hid: add mutex protecting open/close race

We should not enter close function while someone else is in open.
This mutex prevents this race.

There is also no need to override the ret value with -EIO in case of
a failure of i2c_hid_set_power.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoRevert "HID: sensors: add to special driver list"
Alexander Holler [Sun, 9 Dec 2012 01:12:24 +0000 (02:12 +0100)]
Revert "HID: sensors: add to special driver list"

Those IDs aren't necessary anymore.

This reverts commit c8147d9ea19bfe7d8e569351bc7239e118dd6997.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: sensors: autodetect USB HID sensor hubs
Alexander Holler [Sun, 9 Dec 2012 11:44:30 +0000 (12:44 +0100)]
HID: sensors: autodetect USB HID sensor hubs

It should not be necessary to add IDs for HID sensor hubs to lists in
hid-core.c and hid-sensor-hub.c. So instead of a whitelist, autodetect such USB
HID sensor hubs, based on a collection of type physical inside a useage page of
type sensor. If some sensor hubs stil must be usable as raw devices, a
blacklist might be created.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Acked-by: "Pandruvada, Srinivas" <srinivas.pandruvada@intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: hidp: fallback to input session properly if hid is blacklisted
Lamarque V. Souza [Thu, 6 Dec 2012 14:39:55 +0000 (12:39 -0200)]
HID: hidp: fallback to input session properly if hid is blacklisted

This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the
bluetooth mouse with id 0458:0058 [1].

The mouse in question supports both input and hid sessions, however it is
blacklisted in drivers/hid/hid-core.c so the input session is one that should
be used. Long ago (around kernel 3.0.0) some changes in the bluetooth
subsystem made the kernel do not fallback to input session when hid session is
not supported or blacklisted. This patch restore that behaviour by making the
kernel try the input session if hid_add_device returns ENODEV.

The patch exports hid_ignore() from hid-core.c so that it can be used in the
bluetooth subsystem.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=39882

Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>
Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix ret_count check
Jiri Kosina [Thu, 6 Dec 2012 09:59:28 +0000 (10:59 +0100)]
HID: i2c-hid: fix ret_count check

ret_count has to be at least 3, as we have to count the 2 bytes that are used
for the size of the reply. Without this, memcpy() might be called with zero or
negative count.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix i2c_hid_get_raw_report count mismatches
Benjamin Tissoires [Wed, 5 Dec 2012 14:02:56 +0000 (15:02 +0100)]
HID: i2c-hid: fix i2c_hid_get_raw_report count mismatches

The previous memcpy implementation relied on the size advertized by the
device. There were no guarantees that buf was big enough.

Some gymnastic is also required with the +2/-2 to take into account
the first 2 bytes of the returned buffer where the total returned
length is supplied by the device.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: remove extra .irq field in struct i2c_hid
Benjamin Tissoires [Wed, 5 Dec 2012 14:02:55 +0000 (15:02 +0100)]
HID: i2c-hid: remove extra .irq field in struct i2c_hid

There is no point in keeping the irq in i2c_hid as it's already
there in client.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: reorder allocation/free of buffers
Benjamin Tissoires [Wed, 5 Dec 2012 14:02:54 +0000 (15:02 +0100)]
HID: i2c-hid: reorder allocation/free of buffers

Simplifies i2c_hid_alloc_buffers tests, and makes this function
responsible of the assignment of ihid->bufsize.
The condition for the reallocation in i2c_hid_start is then simpler.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix memory corruption due to missing hid declaration
Benjamin Tissoires [Wed, 5 Dec 2012 14:02:53 +0000 (15:02 +0100)]
HID: i2c-hid: fix memory corruption due to missing hid declaration

HID descriptors contains 4 bytes of reserved field.
The previous implementation was overriding the next fields in struct i2c_hid.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: remove superfluous include
Jiri Kosina [Wed, 5 Dec 2012 10:29:08 +0000 (11:29 +0100)]
HID: i2c-hid: remove superfluous include

The pointless WARN_ON() has been removed from i2c_hid_remove(),
so we don't need bug.h any more.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: remove unneeded test in i2c_hid_remove
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:52 +0000 (16:27 +0100)]
HID: i2c-hid: remove unneeded test in i2c_hid_remove

ihid can not be null, so there are no reasons to test it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: i2c_hid_get_report may fail
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:50 +0000 (16:27 +0100)]
HID: i2c-hid: i2c_hid_get_report may fail

If i2c_hid_get_report fails, exit i2c_hid_init_report.
The printk log is already called by i2c_hid_get_report, so no need
to add some more printks.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: also call i2c_hid_free_buffers in i2c_hid_remove
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:54 +0000 (16:27 +0100)]
HID: i2c-hid: also call i2c_hid_free_buffers in i2c_hid_remove

In the case where the hid driver in charge of handling the hid part
of the device (hid-generic for instance) fails at probe, neither
i2c_hid_start nor i2c_hid_stop are called.
Thus, the buffers allocated in i2c_hid_probe are never freed.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix error messages
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:49 +0000 (16:27 +0100)]
HID: i2c-hid: fix error messages

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix return paths
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:48 +0000 (16:27 +0100)]
HID: i2c-hid: fix return paths

Forwards appropriate return values.
As noone use the error returned by i2c_hid_get_input, let's make it
returning void.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: remove unused static declarations
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:47 +0000 (16:27 +0100)]
HID: i2c-hid: remove unused static declarations

These definitions are not used here, but are defined by the specification.
Keeping some of them for documentation purposes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix i2c_hid_dbg macro
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:46 +0000 (16:27 +0100)]
HID: i2c-hid: fix i2c_hid_dbg macro

This avoids the problematic case:

if (condition)
i2c_hid_dbg(ihid, "Blah blah %d\n", i);
else
do_something_very_important();

Which looks correct, however with the previous macro definition,
this expands to the unexpected:

if (condition) {
if (debug) \
dev_printk(KERN_DEBUG, &ihid->client->dev,
"Blah blah %d\n", i);
else
do_something_very_important();
}

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix checkpatch.pl warning
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:45 +0000 (16:27 +0100)]
HID: i2c-hid: fix checkpatch.pl warning

We should not initialize to 0 static declarations.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: enhance Kconfig
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:44 +0000 (16:27 +0100)]
HID: i2c-hid: enhance Kconfig

The "comment" part can never be displayed, so we can remove it.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: change I2C name
Benjamin Tissoires [Tue, 4 Dec 2012 15:27:42 +0000 (16:27 +0100)]
HID: i2c-hid: change I2C name

no I2C driver has "i2c" in its name. It makes more sense to call this
i2c driver "hid".

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: Add Apple wireless keyboard 2011 ANSI to special driver list
Ben Hutchings [Sun, 2 Dec 2012 14:38:23 +0000 (14:38 +0000)]
HID: Add Apple wireless keyboard 2011 ANSI to special driver list

Commit 0a97e1e9f9a6 ('HID: apple: Add Apple wireless keyboard 2011 ANSI PID')
did not update the special driver list in hid-core.c, so hid-generic may
still bind to this device.

Reported-by: Ari Pollak <ari@scvngr.com>
References: http://bugs.debian.org/694546
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: hid-input: factorize hid_input allocation
Benjamin Tissoires [Fri, 23 Nov 2012 15:31:24 +0000 (16:31 +0100)]
HID: hid-input: factorize hid_input allocation

This just refactors the allocation of hid_input.
No semantic changes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: hidraw: fix signaling SIGIO when hidraw reports an event
Andrew Duggan [Wed, 28 Nov 2012 03:02:27 +0000 (19:02 -0800)]
HID: hidraw: fix signaling SIGIO when hidraw reports an event

This patch fixes sending SIGIO from hidraw_report_event by creating a fasync
handler which adds the fasync entry.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: hiddev: fix nonblocking read semantics wrt EIO/ERESTARTSYS
Jiri Kosina [Tue, 27 Nov 2012 23:10:44 +0000 (00:10 +0100)]
HID: hiddev: fix nonblocking read semantics wrt EIO/ERESTARTSYS

When the file has been open in non-blocking mode, EIO or ERESTARTSYS
would never be returned even if they should (for example when device
has been unplugged, you want EIO and not EAGAIN to be returned).

Move the O_NONBLOCK check after other checks have been performed.

Base on similar patch done to hidraw by
Founder Fang <founder.fang@gmail.com>

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: add battery quirk for Apple 2009_ISO keyboard
Ortwin Glück [Sun, 25 Nov 2012 14:08:34 +0000 (15:08 +0100)]
HID: add battery quirk for Apple 2009_ISO keyboard

Support battery capacity on another Apple wireless keyboard.

Signed-off-by: Ortwin Glück <odi@odi.ch>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: add quirk for Freescale i.MX23 ROM recovery
Marek Vasut [Sat, 24 Nov 2012 05:15:57 +0000 (06:15 +0100)]
HID: add quirk for Freescale i.MX23 ROM recovery

The USB recovery mode present in i.MX23 ROM emulates USB HID.  It needs this
quirk to behave properly.

Even if the official branding of the chip is Freescale i.MX23, I named it
Sigmatel STMP3780 since that's what the chip really is and it even reports
itself as STMP3780.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: hidraw: fix nonblock read return EAGAIN after device removed
Founder Fang [Wed, 21 Nov 2012 07:20:31 +0000 (15:20 +0800)]
HID: hidraw: fix nonblock read return EAGAIN after device removed

When nonblock read the condition check (file->f_flags & O_NONBLOCK) always be
true, signal_pending and device exist checking never get a chance to run, so
the user mode code always get EAGAIN even if device removed. move nonblock mode
checking to the last can fix this problem.

Signed-off-by: Founder Fang <founder.fang@gmail.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: add support to novatec wireless mouse
Marco Biscaro [Thu, 22 Nov 2012 22:40:53 +0000 (20:40 -0200)]
HID: add support to novatec wireless mouse

This patch adds support to Novatec wireless mouse (device ID 0603:1602).
Fixes bug https://bugzilla.kernel.org/show_bug.cgi?id=47031

Signed-off-by: Marco Biscaro <marcobiscaro2112@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: fix memory leak during probe
Jiri Kosina [Tue, 20 Nov 2012 16:09:40 +0000 (17:09 +0100)]
HID: i2c-hid: fix memory leak during probe

In case we are returning from i2c_hid_probe() through the 'err' or
'err_mem_free' labels, there is noone freeing the buffers allocated by
i2c_hid_alloc_buffers().

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: sensor-hub: Remove pointless NULL check
Alan Cox [Tue, 20 Nov 2012 16:33:14 +0000 (16:33 +0000)]
HID: sensor-hub: Remove pointless NULL check

report cannot be NULL, fortunately as we use it before we check !

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: i2c-hid: introduce HID over i2c specification implementation
Benjamin Tissoires [Mon, 12 Nov 2012 14:42:59 +0000 (15:42 +0100)]
HID: i2c-hid: introduce HID over i2c specification implementation

Microsoft published the protocol specification of HID over i2c:
http://msdn.microsoft.com/en-us/library/windows/hardware/hh852380.aspx

This patch introduces an implementation of this protocol.

This implementation does not includes the ACPI part of the specification.
This will come when ACPI 5.0 devices enumeration will be available.

Once the ACPI part is done, OEM will not have to declare HID over I2C
devices in their platform specific driver.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: roccat: fix wrong attr size for koneplus tcu
Stefan Achatz [Sat, 17 Nov 2012 20:27:11 +0000 (21:27 +0100)]
HID: roccat: fix wrong attr size for koneplus tcu

More thorough testing revealed a typo in last koneplus cleanups.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Fri, 16 Nov 2012 15:58:20 +0000 (07:58 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jikos/hid

Pull HID fix from Jiri Kosina:
 "This has a build fix for architectures where memcmp() is macro, from
  Jiri Slaby"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: microsoft: do not use compound literal - fix build

11 years agoMerge tag 'usb-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Fri, 16 Nov 2012 15:47:18 +0000 (07:47 -0800)]
Merge tag 'usb-3.7-rc5' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes from Greg Kroah-Hartman:
 "Here are some USB fixes for the 3.7 tree.

  Nothing huge here, just a number of tiny bugfixes resolving issues
  that have been found, and two reverts of patches that were found to
  have caused problems.

  All of these have been in linux-next already.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'usb-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  Revert "USB/host: Cleanup unneccessary irq disable code"
  USB: option: add Alcatel X220/X500D USB IDs
  USB: option: add Novatel E362 and Dell Wireless 5800 USB IDs
  USB: keyspan: fix typo causing GPF on open
  USB: fix build with XEN and EARLY_PRINTK_DBGP enabled but USB_SUPPORT disabled
  USB: usb_wwan: fix bulk-urb allocation
  usb: otg: Fix build errors if USB_MUSB_OMAP2PLUS is selected as module
  usb: musb: ux500: fix 'musbid' undeclared error in ux500_remove()
  Revert "usb: musb: use DMA mode 1 whenever possible"

11 years agoMerge tag 'tty-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Fri, 16 Nov 2012 15:46:38 +0000 (07:46 -0800)]
Merge tag 'tty-3.7-rc5' of git://git./linux/kernel/git/gregkh/tty

Pull TTY fixes from Greg Kroah-Hartman:
 "Here are two TTY driver fixes for 3.7-rc5.

  They resolve a bug in the hvc driver that has been reported, and fix a
  problem with the list of device ids in the max310x serial driver.

  Both have been in linux-next for a while.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'tty-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: serial: max310x: Add terminating entry for spi_device_id table
  TTY: hvc_console, fix port reference count going to zero prematurely

11 years agoMerge tag 'staging-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Fri, 16 Nov 2012 15:46:04 +0000 (07:46 -0800)]
Merge tag 'staging-3.7-rc5' of git://git./linux/kernel/git/gregkh/staging

Pull staging tree fix from Greg Kroah-Hartman:
 "Here is a single patch, a revert of an android driver patch, that
  resolves a bug that has been reported in the Android alarm driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'staging-3.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  Revert "Staging: Android alarm: IOCTL command encoding fix"

11 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Linus Torvalds [Fri, 16 Nov 2012 15:39:30 +0000 (07:39 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/s390/linux

Pull s390 patches from Martin Schwidefsky:
 "Some more bug fixes and a config change.

  The signal bug is nasty, if the clock_gettime vdso function is
  interrupted by a signal while in access-register-mode we end up with
  an endless signal loop until the signal stack is full.  The config
  change is for aligned struct pages, gives us 8% improvement with
  hackbench."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/3215: fix tty close handling
  s390/mm: have 16 byte aligned struct pages
  s390/gup: fix access_ok() usage in __get_user_pages_fast()
  s390/gup: add missing TASK_SIZE check to get_user_pages_fast()
  s390/topology: fix core id vs physical package id mix-up
  s390/signal: set correct address space control

11 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Fri, 16 Nov 2012 15:32:32 +0000 (07:32 -0800)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "All pretty normal: one TTM oops fix, one radeon, a few intel and a
  vmwgfx fix."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/ttm: remove unneeded preempt_disable/enable
  ttm: Clear the ttm page allocated from high memory zone correctly
  vmwgfx: return an -EFAULT if copy_to_user() fails
  drm/radeon: fix logic error in atombios_encoders.c
  drm/i915: do not ignore eDP bpc settings from vbt
  drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures
  drm/i915/crt: fix DPMS standby and suspend mode handling

11 years agoMerge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux
Linus Torvalds [Fri, 16 Nov 2012 15:19:45 +0000 (07:19 -0800)]
Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux

Pull another clk layer fix from Michael Turquette:
 "GCC 4.7 users get compilation errors from unnecessary use of inline in
  clk-provider.h.  This pull request fixes the regression by removing
  inline usage from those function declarations."

* tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux:
  clk: remove inline usage from clk-provider.h

11 years agoHID: hiddev: Remove redundant check on unsigned variable
Tushar Behera [Fri, 16 Nov 2012 06:50:43 +0000 (12:20 +0530)]
HID: hiddev: Remove redundant check on unsigned variable

No need to check whether unsigned variable is less than 0.

CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-usb@vger.kernel.org
CC: linux-input@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoMerge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel...
Dave Airlie [Fri, 16 Nov 2012 00:00:43 +0000 (10:00 +1000)]
Merge branch 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes

Daniel writes:
Just a few small things to fix regressions, somehow all patches from Jani:
- Fix dpms confusion about which platforms support intermediate modes on
  vga.
- Revert the "ignore vbt for eDP bpc" patch, it breaks machines. This will
  annoy mbp retina owners again, but windows machines seem to _really_
  depend upon this. We can try to quirk the mbp retinas again in 3.8 and
  backport the patch.
- Fix connector leaks when the sdvo setup failed, resulted in an OOPS
  later on when trying to probe that connector (with it's encoder kfree'd
  already).

* 'drm-intel-fixes' of git://people.freedesktop.org/~danvet/drm-intel:
  drm/i915: do not ignore eDP bpc settings from vbt
  drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures
  drm/i915/crt: fix DPMS standby and suspend mode handling

11 years agoMerge branch 'drm-fixes-3.7' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 16 Nov 2012 00:00:24 +0000 (10:00 +1000)]
Merge branch 'drm-fixes-3.7' of git://people.freedesktop.org/~agd5f/linux into drm-fixes

Just a single radeon fix from Alex.

* 'drm-fixes-3.7' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: fix logic error in atombios_encoders.c

11 years agodrm/ttm: remove unneeded preempt_disable/enable
Akinobu Mita [Fri, 9 Nov 2012 12:10:43 +0000 (12:10 +0000)]
drm/ttm: remove unneeded preempt_disable/enable

It is unnecessary to disable preemption explicitly while calling
copy_highpage().  Because copy_highpage() will do it again through
kmap_atomic/kunmap_atomic.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agottm: Clear the ttm page allocated from high memory zone correctly
Zhao Yakui [Tue, 13 Nov 2012 18:31:55 +0000 (18:31 +0000)]
ttm: Clear the ttm page allocated from high memory zone correctly

The TTM page can be allocated from high memory. In such case it is
wrong to use the page_address(page) as the virtual address for the high memory
page.

bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50241

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agovmwgfx: return an -EFAULT if copy_to_user() fails
Dan Carpenter [Mon, 12 Nov 2012 11:07:24 +0000 (11:07 +0000)]
vmwgfx: return an -EFAULT if copy_to_user() fails

copy_to_user() returns the number of bytes remaining to be copied, but
we want to return a negative error code here.  I fixed a couple of these
last year, but I missed this one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoclk: remove inline usage from clk-provider.h
Igor Mazanov [Thu, 15 Nov 2012 17:07:00 +0000 (21:07 +0400)]
clk: remove inline usage from clk-provider.h

Users of GCC 4.7 have reported compiler errors due to having inline
applied to function declarations in clk-provider.h.  The definitions
exist in drivers/clk/clk.c.  An example error:

In file included from arch/arm/mach-omap2/clockdomain.c:25:0:
arch/arm/mach-omap2/clockdomain.c: In function ‘clkdm_clk_disable’:
include/linux/clk-provider.h:338:12: error: inlining failed in call to always_inline ‘__clk_get_enable_count’: function body not available
arch/arm/mach-omap2/clockdomain.c:1001:28: error: called from here
make[1]: *** [arch/arm/mach-omap2/clockdomain.o] Error 1
make: *** [arch/arm/mach-omap2] Error 2

This patch removes the use of inline from include/linux/clk-provider.h
but keeps the function definitions in drivers/clk/clk.c as inlined since
they are one-liners.

Signed-off-by: Igor Mazanov <i.mazanov@gmail.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
[mturquette@linaro.org: improved subject, added changelog]

11 years agoMerge tag 'for-linus' of git://github.com/gxt/linux
Linus Torvalds [Thu, 15 Nov 2012 19:34:45 +0000 (11:34 -0800)]
Merge tag 'for-linus' of git://github.com/gxt/linux

Pull unicore32 update from Guan Xuetao.

* tag 'for-linus' of git://github.com/gxt/linux:
  arch/unicore32: remove CONFIG_EXPERIMENTAL
  unicore32: switch to generic sys_execve()
  unicore32: switch to generic kernel_thread()/kernel_execve()
  unicore32: Use Kbuild infrastructure for kvm_para.h
  UAPI: (Scripted) Disintegrate arch/unicore32/include/asm
  UniCore32-bugfix: Remove definitions in asm/bug.h to solve difference between native and cross compiler
  UniCore32-bugfix: fix mismatch return value of __xchg_bad_pointer
  UniCore32 bugfix: add missed CONFIG_ZONE_DMA
  unicore32/mm/fault.c: Port OOM changes to do_pf

11 years agoMerge tag 'upstream-3.7-rc6' of git://git.infradead.org/linux-ubifs
Linus Torvalds [Thu, 15 Nov 2012 19:28:43 +0000 (11:28 -0800)]
Merge tag 'upstream-3.7-rc6' of git://git.infradead.org/linux-ubifs

Pull UBIFS fixes from Artem Bityutskiy:
 "Two patches which fix a problem reported by several people in the
  past, but only fixed now because no one gave enough material for
  debugging.

  Anyway, these fix the problem that sometimes after a power cut the
  file-system is not mountable with the following symptom:

grab_empty_leb: could not find an empty LEB

  The fixes make the file-system mountable again."

* tag 'upstream-3.7-rc6' of git://git.infradead.org/linux-ubifs:
  UBIFS: fix mounting problems after power cuts
  UBIFS: introduce categorized lprops counter

11 years agoMerge tag 'for-v3.7-fixes' of git://git.infradead.org/users/cbou/linux-pstore
Linus Torvalds [Thu, 15 Nov 2012 19:27:53 +0000 (11:27 -0800)]
Merge tag 'for-v3.7-fixes' of git://git.infradead.org/users/cbou/linux-pstore

Pull pstore fix from Anton Vorontsov:
 "A small fixup for the persistent storage subsystem.  The bug can
  prevent kernel booting on a APEI-enabled machines w/ PSTORE_CONSOLE=y
  (this is N by default, though)."

* tag 'for-v3.7-fixes' of git://git.infradead.org/users/cbou/linux-pstore:
  pstore: Fix NULL pointer dereference in console writes

11 years agoMerge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
Linus Torvalds [Thu, 15 Nov 2012 19:25:39 +0000 (11:25 -0800)]
Merge branch 'i2c-for-linus' of git://git./linux/kernel/git/jdelvare/staging

Pill i2c fixes from Jean Delvare.

Well, "fixes"..  The biggest patch here is actually Jan marking Wolfram
Sang as the main i2c subsystem maintainer, with Jan staying on as the PC
controller maintainer.

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-mux-pinctrl: Fix probe error path
  MAINTAINERS: i2c: 7 years, this is it

11 years agoMerge tag 'regulator-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Linus Torvalds [Thu, 15 Nov 2012 19:22:03 +0000 (11:22 -0800)]
Merge tag 'regulator-3.7' of git://git./linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A few fixes for teardown issues that will be rarely seen, plus a fix
  for a silly bug in regulator_is_supported_voltage() which shows how
  often the answer to the question should be false.

  The supported voltage commit is very new as I just edited to add a Cc
  to stable, the code itself has been in -next."

* tag 'regulator-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: fix voltage check in regulator_is_supported_voltage()
  regulator: core: Avoid deadlock when regulator_register fails
  Regulator: core: Unregister when gpio request fails.

11 years agoMerge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Linus Torvalds [Thu, 15 Nov 2012 19:21:28 +0000 (11:21 -0800)]
Merge tag 'sound-3.7' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "The only large LOC is seen in WM5102 driver, just writing a bunch of
  register updates, but the actual code change is small.  Other than
  that, all small fixes suitable for rc6."

* tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Fix mutex deadlock at disconnection
  ALSA: fm801: precedence bug in snd_fm801_tea575x_get_pins()
  ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()
  ALSA: hda - Add a missing quirk entry for iMac 9,1
  ASoC: core: Double control update err for snd_soc_put_volsw_sx
  ASoC: dapm: Use card_list during DAPM shutdown
  ASoC: cs42l52: fix the return value of cs42l52_set_fmt()
  ASoC: bells: Correct type in sub speaker DAI name for WM5102
  ASoC: wm8978: pll incorrectly configured when codec is master
  ASoC: mxs-saif: Fix channel swap for 24-bit format
  ASoC: bells: Select WM1250-EV1 Springbank audio I/O module
  ASoC: bells: Add missing select of WM0010
  ASoC: mxs-saif: Add MODULE_ALIAS
  ASoC: wm5102: Write register value corrections after SYSCLK is enabled

11 years agos390/3215: fix tty close handling
Heiko Carstens [Thu, 15 Nov 2012 08:22:40 +0000 (09:22 +0100)]
s390/3215: fix tty close handling

The 3215 console always has the RAW3215_FIXED flag set, which causes
raw3215_shutdown() not to wait for outstanding I/O requests if an attached
tty gets closed.
The flag however can be simply removed, so we can guarantee that all requests
belonging to the tty have been processed when the tty is closed.

However the tasklet that belongs to the 3215 device may be scheduled even if
there is no tty attached anymore, since we have a race between console and tty
processing.
Thefore unconditional tty_wakekup() in raw3215_wakeup() can cause the following
NULL pointer dereference:

3.465368 Unable to handle kernel pointer dereference at virtual kernel address (null)
3.465448 Oops: 0004 #1 SMP
3.465454 Modules linked in:
3.465459 CPU: 1 Not tainted 3.6.0 #1
3.465462 Process swapper/1 (pid: 0, task: 000000003ffa4428, ksp: 000000003ffb7ce0)
3.465466 Krnl PSW : 0404100180000000 0000000000162f86 (__wake_up+0x46/0xb8)
3.465480            R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
         Krnl GPRS: fffffffffffffffe 0000000000000000 0000000000000160 0000000000000001
3.465492            0000000000000001 0000000000000004 0000000000000004 000000000096b490
3.465499            0000000000000001 0000000000000100 0000000000000001 0000000000000001
3.465506            070000003fc87d60 0000000000000160 000000003fc87d68 000000003fc87d00
3.465526 Krnl Code: 0000000000162f76e3c0f0a80004      lg      %r12,168(%r15)
                    0000000000162f7c58000370          l       %r0,880
                   #0000000000162f80c007ffffffff00    xilf    %r0,4294967295
                   >0000000000162f86ba102000          cs      %r1,%r0,0(%r2)
                    0000000000162f8a: 1211              ltr     %r1,%r1
                    0000000000162f8ca774002f          brc     7,162fea
                    0000000000162f90b904002d          lgr     %r2,%r13
                    0000000000162f94b904003a          lgr     %r3,%r10
3.465597 Call Trace:
3.465599 (<0400000000000000> 0x400000000000000)
3.465602  <000000000048c77e> raw3215_wakeup+0x2e/0x40
3.465607  <0000000000134d66> tasklet_action+0x96/0x168
3.465612  <000000000013423c> __do_softirq+0xd8/0x21c
3.465615  <0000000000134678> irq_exit+0xa8/0xac
3.465617  <000000000046c232> do_IRQ+0x182/0x248
3.465621  <00000000005c8296> io_return+0x0/0x8
3.465625  <00000000005c7cac> vtime_stop_cpu+0x4c/0xb8
3.465629 (<0000000000194e06> tick_nohz_idle_enter+0x4e/0x74)
3.465633  <0000000000104760> cpu_idle+0x170/0x184
3.465636  <00000000005b5182> smp_start_secondary+0xd6/0xe0
3.465641  <00000000005c86be> restart_int_handler+0x56/0x6c
3.465643  <0000000000000000> 0x0
3.465645 Last Breaking-Event-Address:
3.465647  <0000000000403136> tty_wakeup+0x46/0x98
3.465652
3.465654 Kernel panic - not syncing: Fatal exception in interrupt
01: HCPGIR450W CP entered; disabled wait PSW 00020001 80000000 00000000 0010F63C

The easiest solution is simply to check if tty is NULL in the tasklet.
If it is NULL nothing is to do (no tty attached), otherwise tty_wakeup()
can be called, since we hold a reference to the tty.
This is not nice... but it is a small patch and it works.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
11 years agodrm/radeon: fix logic error in atombios_encoders.c
Alex Deucher [Wed, 14 Nov 2012 14:10:39 +0000 (09:10 -0500)]
drm/radeon: fix logic error in atombios_encoders.c

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=50431

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoHID: usbhid: add quirk HID_QUIRK_NOGET to TPV optical touchscreen
Benjamin Tissoires [Wed, 14 Nov 2012 16:53:56 +0000 (17:53 +0100)]
HID: usbhid: add quirk HID_QUIRK_NOGET to TPV optical touchscreen

Without this, the device is blocked in dmesg at:
hid-multitouch 0003:25AA:8883.000X: usb_submit_urb(ctrl) failed: -1
hid-multitouch 0003:25AA:8883.000X: timeout initializing reports

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: fix Win 8 protocol
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:25 +0000 (16:59 +0100)]
HID: multitouch: fix Win 8 protocol

The Win 8 protocol specify the fact that each valid touch must be reported
within a frame until it is released.
We can therefore use the always_valid quirk and dismiss reports when we see
duplicate contacts ID.

We recognize Win8 certified devices from their vendor feature 0xff0000c5
where Microsoft put a signed blob in the report to check if the device
passed the certification.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: support for hovering devices
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:24 +0000 (16:59 +0100)]
HID: multitouch: support for hovering devices

Win8 devices supporting hovering must provides InRange HID field.
The information that the finger is here but is not touching the surface
is sent to the user space through ABS_MT_DISTANCE as required by the
multitouch protocol.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: add MT_QUIRK_IGNORE_DUPLICATES
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:23 +0000 (16:59 +0100)]
HID: multitouch: add MT_QUIRK_IGNORE_DUPLICATES

This quirk allows a device to reuse a contact id when sending garbage
inactive contacts at the end of a report.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoInput: mt: add input_mt_is_used
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:22 +0000 (16:59 +0100)]
Input: mt: add input_mt_is_used

This patch extracts the test (slot->frame == mt->frame) so that it can
be used in third party drivers.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoInput: introduce EV_MSC Timestamp
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:21 +0000 (16:59 +0100)]
Input: introduce EV_MSC Timestamp

Some devices provides the actual timestamp (hid_dg_scan_time in win8 ones)
computed by the hardware itself. This value is global to the frame and is
not specific to the multitouch protocol.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: move ALWAYS_VALID quirk check
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:20 +0000 (16:59 +0100)]
HID: multitouch: move ALWAYS_VALID quirk check

Win 8 device specification changed the requirements for the hid usages
of the multitouch devices. Now InRange is optional and must be only
used when the device supports hovering.

This ensures that the quirk ALWAYS_VALID is taken into account and
also ensures its precedence over the other VALID* quirks.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: support T and C for win8 devices
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:19 +0000 (16:59 +0100)]
HID: multitouch: support T and C for win8 devices

Win8 input specification clarifies the X and Y sent by devices.
It distincts the position where the user wants to Touch (T) from
the center of the ellipsoide (C). This patch enable supports for this
distinction in hid-multitouch.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: get maxcontacts also from logical_max value
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:18 +0000 (16:59 +0100)]
HID: multitouch: get maxcontacts also from logical_max value

Win8 devices are required to present the feature "Maximum Contact Number".
Fortunately all win7 devices I've seen presents this feature.
If the current value is 0, then, the driver can get the actual supported
contact count by refering to the logical_max.
This win8 specification ensures that logical_max may not be above 250.
This also allows us to detect when devices like irtouch or stantum reports
an obviously wrong value of 255.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: multitouch: support arrays for the split of the touches in a report
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:17 +0000 (16:59 +0100)]
HID: multitouch: support arrays for the split of the touches in a report

Win8 certification introduced the ability to transmit two X and two Y per
touch. The specification precises that it must be used in an array.

This test guarantees that we split the touches on the last element
in this array.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: add usage_index in struct hid_usage.
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:16 +0000 (16:59 +0100)]
HID: add usage_index in struct hid_usage.

Currently, there is no way to know the index of the current field
in the .input_mapping and .event callbacks  when this field is inside
an array of HID fields.
This patch adds this index to the struct hid_usage so that this
information is available to input_mapping and event callbacks.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: fix unit exponent parsing
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:15 +0000 (16:59 +0100)]
HID: fix unit exponent parsing

HID spec details special values for the HID field unit exponent.
Basically, the range [0x8..0xf] correspond to [-8..-1], so this is
a standard two's complement on a half-byte.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: round return value of hidinput_calc_abs_res
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:14 +0000 (16:59 +0100)]
HID: round return value of hidinput_calc_abs_res

hidinput_calc_abs_res should return the closest int in the division
instead of the floor.
On a device with a logical_max of 3008 and a physical_max of 255mm,
previous implementation gave a resolution of 11 instead of 12.
With 11, user-space computes a physical size of 273.5mm and the
round_closest results gives 250.6mm.
The old implementation introduced an error of 2cm in this example.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agoHID: export hidinput_calc_abs_res
Benjamin Tissoires [Wed, 14 Nov 2012 15:59:13 +0000 (16:59 +0100)]
HID: export hidinput_calc_abs_res

Exporting the function allows us to calculate the resolution in third
party drivers like hid-multitouch.
This patch also complete the function with additional valid axes.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
11 years agopstore: Fix NULL pointer dereference in console writes
Colin Ian King [Wed, 14 Nov 2012 11:49:53 +0000 (11:49 +0000)]
pstore: Fix NULL pointer dereference in console writes

Passing a NULL id causes a NULL pointer deference in writers such as
erst_writer and efi_pstore_write because they expect to update this id.
Pass a dummy id instead.

This avoids a cascade of oopses caused when the initial
pstore_console_write passes a null which in turn causes writes to the
console causing further oopses in subsequent pstore_console_write calls.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: stable@vger.kernel.org
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
11 years agoMerge remote-tracking branches 'regulator/fix/gpio', 'regulator/fix/put' and 'regulat...
Mark Brown [Thu, 15 Nov 2012 02:16:02 +0000 (11:16 +0900)]
Merge remote-tracking branches 'regulator/fix/gpio', 'regulator/fix/put' and 'regulator/fix/supp-volt' into tmp

11 years agoregulator: fix voltage check in regulator_is_supported_voltage()
Marek Szyprowski [Tue, 13 Nov 2012 08:48:51 +0000 (09:48 +0100)]
regulator: fix voltage check in regulator_is_supported_voltage()

regulator_is_supported_voltage() should return true only if the voltage
of fixed/constant regulator is between min_uV and max_uV.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
11 years agotty: serial: max310x: Add terminating entry for spi_device_id table
Axel Lin [Sun, 4 Nov 2012 15:34:18 +0000 (23:34 +0800)]
tty: serial: max310x: Add terminating entry for spi_device_id table

The spi_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Linus Torvalds [Wed, 14 Nov 2012 21:46:40 +0000 (13:46 -0800)]
Merge branch 'release' of git://git./linux/kernel/git/lenb/linux

Pull power tools fixes from Len Brown:
 "A pair of power tools patches -- a 3.7 regression fix plus a bug fix."

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: graceful fail on garbage input
  tools/power turbostat: Repair Segmentation fault when using -i option

11 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Wed, 14 Nov 2012 21:45:23 +0000 (13:45 -0800)]
Merge branch 'upstream' of git://git.linux-mips.org/ralf/upstream-linus

Pull MIPS update from Ralf Baechle:
 "To avoid unnecessary risk and work the preemption fixes are combined
  with some preparatory work that isn't strictly required.  So it's
  really just 3 fixes:

   - Get is_compat_task() to do the right thing while simplifying it.
     The unnecessary complexity hid a rarely striking bug which could be
     triggered by ext3/ext4 under certain circumstances.
   - Resolve a preemption issue in the irqflags.h functions for kernels
     built to support pre-MIPS32 / pre-MIPS64 Release 2 processors.
   - Fix the interrupt number of the MIPS Malta's CBUS UART."

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
  MIPS: Malta: Fix interupt number of CBUS UART.
  MIPS: Make irqflags.h functions preempt-safe for non-mipsr2 cpus
  MIPS: Remove irqflags.h dependency from bitops.h
  MIPS: bitops.h: Change use of 'unsigned short' to 'int'
  MIPS: compat: Delete now unused TIF_32BIT.
  MIPS: compat: Implement is_compat_task() by testing for 32-bit address space.
  MIPS: compat: Fix use of TIF_32BIT_ADDR vs _TIF_32BIT_ADDR

11 years agoMerge branch 'for-3.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
Linus Torvalds [Wed, 14 Nov 2012 21:44:04 +0000 (13:44 -0800)]
Merge branch 'for-3.7-fixes' of git://git./linux/kernel/git/tj/cgroup

Pull cgroup fixes from Tejun Heo:
 "This contains two fix patches for device_cgroup.  One fixes a
  regression introduced earlier in 3.7 cycle where device_cgroup could
  try to dereference the NULL parent of the root cgroup.  The other one
  is RCU usage fix."

* 'for-3.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  device_cgroup: fix RCU usage
  device_cgroup: fix unchecked cgroup parent usage

11 years agoTTY: hvc_console, fix port reference count going to zero prematurely
Paul Mackerras [Wed, 14 Nov 2012 08:15:47 +0000 (19:15 +1100)]
TTY: hvc_console, fix port reference count going to zero prematurely

Commit bdb498c20040 "TTY: hvc_console, add tty install" took the port
refcounting out of hvc_open()/hvc_close(), but failed to remove the
kref_put() and tty_kref_put() calls in hvc_hangup() that were there to
remove the extra references that hvc_open() had taken.

The result was that doing a vhangup() when the current terminal was
a hvc_console, then closing the current terminal, would end up calling
destroy_hvc_struct() and making the port disappear entirely.  This
meant that Fedora 17 systems would boot up but then not display the
login prompt on the console, and attempts to open /dev/hvc0 would
give a "No such device" error.

This fixes it by removing the extra kref_put() and tty_kref_put() calls.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoALSA: usb-audio: Fix mutex deadlock at disconnection
Takashi Iwai [Tue, 13 Nov 2012 10:22:48 +0000 (11:22 +0100)]
ALSA: usb-audio: Fix mutex deadlock at disconnection

The recent change for USB-audio disconnection race fixes introduced a
mutex deadlock again.  There is a circular dependency between
chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
device is opened during the disconnection operation:

A. snd_usb_audio_disconnect() ->
     card.c::register_mutex ->
       chip->shutdown_rwsem (write) ->
         snd_card_disconnect() ->
           pcm.c::register_mutex ->
             pcm->open_mutex

B. snd_pcm_open() ->
     pcm->open_mutex ->
       snd_usb_pcm_open() ->
         chip->shutdown_rwsem (read)

Since the chip->shutdown_rwsem protection in the case A is required
only for turning on the chip->shutdown flag and it doesn't have to be
taken for the whole operation, we can reduce its window in
snd_usb_audio_disconnect().

Reported-by: Jiri Slaby <jslaby@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoregulator: core: Avoid deadlock when regulator_register fails
Charles Keepax [Wed, 14 Nov 2012 09:39:31 +0000 (09:39 +0000)]
regulator: core: Avoid deadlock when regulator_register fails

When regulator_register fails and exits through the scrub path the
regulator_put function was called whilst holding the
regulator_list_mutex, causing deadlock.

This patch adds a private version of the regulator_put function which
can be safely called whilst holding the mutex, replacing the
aforementioned call.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 years agoALSA: fm801: precedence bug in snd_fm801_tea575x_get_pins()
Dan Carpenter [Wed, 14 Nov 2012 08:23:54 +0000 (11:23 +0300)]
ALSA: fm801: precedence bug in snd_fm801_tea575x_get_pins()

There is a precedence bug because | has higher precedence than ?:.  This
code was cut and pasted and I fixed a similar bug a few days ago.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoi2c-mux-pinctrl: Fix probe error path
Guenter Roeck [Tue, 13 Nov 2012 21:27:19 +0000 (22:27 +0100)]
i2c-mux-pinctrl: Fix probe error path

When allocating the memory for i2c busses, the code checked the wrong
variable and thus never detected if there was a memory error.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org
Signed-off-by: Jean Delvare <khali@linux-fr.org>
11 years agoMAINTAINERS: i2c: 7 years, this is it
Jean Delvare [Tue, 13 Nov 2012 21:27:19 +0000 (22:27 +0100)]
MAINTAINERS: i2c: 7 years, this is it

I have been maintaining the i2c subsystem for 7 years now, it's about
time to let someone else take over. Just before I leave, I would like
to thank several individuals who made this possible at all:

* Greg Kroah-Hartman, for his faith in my potential subsystem
  maintainer skills. Greg, I hope I met your expectations.
* Late David Brownell, for helping me convert the i2c subsystem to the
  standard device driver model. Rest in peace David, we're missing you.
* Ben Dooks, for stepping in when I asked for someone to take care of
  the huge flow of new i2c adapter drivers for embedded systems.
* Wolfram Sang, for joining the crew when it became clear that there
  was more review work than Ben and myself could deal with.

I hope I did not forget anyone, please forgive me if I did.

Another big thank is due to Wolfram again, who quickly proposed to
take over as the main i2c subsystem maintainer. This will allow for a
smooth and fast transition.

Note that I will keep maintaining all I2C/SMBus controller drivers for
PC systems as well as a few others. I am hereby updating MAINTAINERS
accordingly. I'll also keep maintaining user-space i2c-tools.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
11 years agoRevert "Staging: Android alarm: IOCTL command encoding fix"
Colin Cross [Thu, 8 Nov 2012 02:21:51 +0000 (18:21 -0800)]
Revert "Staging: Android alarm: IOCTL command encoding fix"

Commit 6bd4a5d96c08dc2380f8053b1bd4f879f55cd3c9 changed the
ANDROID_ALARM_GET_TIME ioctls from IOW to IOR.  While technically
correct, the _IOC_DIR bits are ignored by alarm_ioctl, so the
commit breaks a userspace ABI used by all existing Android devices
for a purely cosmetic reason.  Revert it.

Cc: stable <stable@vger.kernel.org>
Cc: Dae S. Kim <dae@velatum.com>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoRevert "USB/host: Cleanup unneccessary irq disable code"
Greg Kroah-Hartman [Tue, 13 Nov 2012 18:52:52 +0000 (10:52 -0800)]
Revert "USB/host: Cleanup unneccessary irq disable code"

This reverts commit 73d4066055e0e2830533041f4b91df8e6e5976ff.

Martin Steigerwald reported that this change caused a hard lockup when
using USB if threadirqs are enabled.  Thomas pointed out that this patch
is incorrect, and can cause problems.  So revert it to get the
previously working functionality back.

Reported-by: Martin Steigerwald <Martin@lichtvoll.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Chuansheng Liu <chuansheng.liu@intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: option: add Alcatel X220/X500D USB IDs
Dan Williams [Thu, 8 Nov 2012 17:56:53 +0000 (11:56 -0600)]
USB: option: add Alcatel X220/X500D USB IDs

Signed-off-by: Dan Williams <dcbw@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: option: add Novatel E362 and Dell Wireless 5800 USB IDs
Dan Williams [Thu, 8 Nov 2012 17:56:42 +0000 (11:56 -0600)]
USB: option: add Novatel E362 and Dell Wireless 5800 USB IDs

The Dell 5800 appears to be a simple rebrand of the Novatel E362.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoUSB: keyspan: fix typo causing GPF on open
Bjørn Mork [Sat, 10 Nov 2012 09:13:42 +0000 (10:13 +0100)]
USB: keyspan: fix typo causing GPF on open

Commit f79b2d0f (USB: keyspan: fix NULL-pointer dereferences and
memory leaks) had a small typo which made the driver use wrong
offsets when mapping serial port private data.  This results in
in a GPF when the port is opened.

Reported-by: Richard <richjunk@pacbell.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMIPS: Malta: Fix interupt number of CBUS UART.
Ralf Baechle [Tue, 13 Nov 2012 09:41:50 +0000 (10:41 +0100)]
MIPS: Malta: Fix interupt number of CBUS UART.

The CBUS UART's interrupt number was wrong conflicting with the interrupt
being tied to the Intel PIIX4.  Since the PIIX4's interrupt is registered
before the CBUS UART which is not being used on most systems this would
not be noticed.

Attempts to open the ttyS2 CBUS UART would result in:

genirq: Flags mismatch irq 18. 00000000 (serial) vs. 00010000 (XT-PIC cascade)
serial_link_irq_chain: request failed: -16 for irq: 18

Qemu was written to match the kernel so will need to be fixed also.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
11 years agodrm/i915: do not ignore eDP bpc settings from vbt
Jani Nikula [Mon, 12 Nov 2012 12:33:44 +0000 (14:33 +0200)]
drm/i915: do not ignore eDP bpc settings from vbt

There are laptops out there that need the eDP bpc from VBT. This is
effectively a revert of

commit 4344b813f105a19f793f1fd93ad775b784648b95
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Aug 10 11:10:20 2012 +0200

    drm/i915: ignore eDP bpc settings from vbt

but putting the VBT check after the EDID check to see them both in dmesg if
this clamps more than the EDID. We have enough history with bpc clamping to
warrant the extra debug info.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47641
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56401
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
11 years agos390/mm: have 16 byte aligned struct pages
Heiko Carstens [Thu, 8 Nov 2012 13:18:47 +0000 (14:18 +0100)]
s390/mm: have 16 byte aligned struct pages

Select HAVE_ALIGNED_STRUCT_PAGE on s390, so that the slub allocator can make
use of compare and swap double for lockless updates. This increases the size
of struct page to 64 bytes (instead of 56 bytes), however the performance gain
justifies the increased size:

- now excactly four struct pages fit into a single cache line; the
  case that accessing a struct page causes two cache line loads
  does not exist anymore.
- calculating the offset of a struct page within the memmap array
  is only a simple shift instead of a more expensive multiplication.

A "hackbench 200 process 200" run on a 32 cpu system did show an 8% runtime
improvement.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
11 years agos390/gup: fix access_ok() usage in __get_user_pages_fast()
Heiko Carstens [Mon, 22 Oct 2012 13:58:26 +0000 (15:58 +0200)]
s390/gup: fix access_ok() usage in __get_user_pages_fast()

access_ok() returns always "true" on s390. Therefore all access_ok()
invocations are rather pointless.
However when walking page tables we need to make sure that everything
is within bounds of the ASCE limit of the task's address space.
So remove the access_ok() call and add the same check we have in
get_user_pages_fast().

Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
11 years agos390/gup: add missing TASK_SIZE check to get_user_pages_fast()
Heiko Carstens [Mon, 22 Oct 2012 13:49:02 +0000 (15:49 +0200)]
s390/gup: add missing TASK_SIZE check to get_user_pages_fast()

When walking page tables we need to make sure that everything
is within bounds of the ASCE limit of the task's address space.
Otherwise we might calculate e.g. a pud pointer which is not
within a pud and dereference it.
So check against TASK_SIZE (which is the ASCE limit) before
walking page tables.

Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
11 years agoALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()
Dan Carpenter [Tue, 13 Nov 2012 07:44:54 +0000 (10:44 +0300)]
ALSA: es1968: precedence bug in snd_es1968_tea575x_get_pins()

I don't think this works as intended.  '|' higher precedence than ?: so
the bitwize OR "0 | (val & STR_MOST)" is a no-op.

I have re-written it to be more clear.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
11 years agoMerge tag 'asoc-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Tue, 13 Nov 2012 06:48:07 +0000 (07:48 +0100)]
Merge tag 'asoc-3.7' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v3.7

A few small fixes plus a large but simple change for WM5102 which writes
out a bunch of register updates to the device when we enable the clock
as recommended following chip evaluation.

11 years agoMerge branches 'fix/arizona', 'fix/core', 'fix/cs42l52', 'fix/mxs', 'fix/samsung...
Mark Brown [Tue, 13 Nov 2012 06:13:29 +0000 (15:13 +0900)]
Merge branches 'fix/arizona', 'fix/core', 'fix/cs42l52', 'fix/mxs', 'fix/samsung' and 'fix/wm8978' of git://git./linux/kernel/git/broonie/sound into tmp

11 years agoMerge git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Tue, 13 Nov 2012 01:37:53 +0000 (17:37 -0800)]
Merge git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fix from Marcelo Tosatti:
 "A correction for user triggerable oops"

* git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: x86: invalid opcode oops on SET_SREGS with OSXSAVE bit set (CVE-2012-4461)

11 years agoMerge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux
Linus Torvalds [Tue, 13 Nov 2012 01:05:53 +0000 (17:05 -0800)]
Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux

Pull ux500 clk fixes from Mike Turquette:
 "Missing clkdev entries are causing regressions on the U8500 platform.
  This pull request contains those missing clkdev entries which are
  needed to boot that platform."

* tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux:
  clk: ux500: Register slimbus clock lookups for u8500
  clk: ux500: Update rtc clock lookup for u8500
  clk: ux500: Register msp clock lookups for u8500
  clk: ux500: Register ssp clock lookups for u8500
  clk: ux500: Register i2c clock lookups for u8500

11 years agoMerge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Linus Torvalds [Tue, 13 Nov 2012 01:04:57 +0000 (17:04 -0800)]
Merge branch 'rc-fixes' of git://git./linux/kernel/git/mmarek/kbuild

Pull menuconfig portability fix from Michal Marek:
 "Here is a fix for v3.7 that makes menuconfig compile again on systems
  whose C library is lacking CIRCLEQ_* macros.  I thought I sent it
  earlier, but apparently I did not."

* 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  menuconfig: Replace CIRCLEQ by list_head-style lists.

11 years agoMerge branch 'fixes-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/coolone...
Linus Torvalds [Tue, 13 Nov 2012 01:03:28 +0000 (17:03 -0800)]
Merge branch 'fixes-for-3.7' of git://git./linux/kernel/git/cooloney/linux-leds

Pull LED fix from Bryan Wu.

* 'fixes-for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
  ledtrig-cpu: kill useless mutex to fix sleep in atomic context

11 years agoMerge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Tue, 13 Nov 2012 01:02:21 +0000 (17:02 -0800)]
Merge branch 'core-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull futex fix from Thomas Gleixner:
 "Single fix for a long standing futex race when taking over a futex
  whose owner died.  You can end up with two owners, which violates
  quite some rules."

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  futex: Handle futex_pi OWNER_DIED take over correctly