]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoMerge branch 'for-4.0/upstream-fixes' into for-next
Jiri Kosina [Tue, 17 Mar 2015 20:01:20 +0000 (21:01 +0100)]
Merge branch 'for-4.0/upstream-fixes' into for-next

9 years agoHID: wacom: check for wacom->shared before following the pointer
Benjamin Tissoires [Thu, 5 Mar 2015 22:36:35 +0000 (17:36 -0500)]
HID: wacom: check for wacom->shared before following the pointer

486b908 (HID: wacom: do not send pen events before touch is up/forced out)
introduces a kernel oops when plugging a tablet without touch.

wacom->shared is null for these devices so this leads to a null pointer
exception.

Change the condition to make it clear that what we need is wacom->shared
not NULL.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/wacom' into for-next
Jiri Kosina [Mon, 16 Mar 2015 19:19:43 +0000 (20:19 +0100)]
Merge branch 'for-4.1/wacom' into for-next

9 years agoHID: wacom: ask for a in-prox report when it was missed
Benjamin Tissoires [Thu, 5 Mar 2015 22:36:54 +0000 (17:36 -0500)]
HID: wacom: ask for a in-prox report when it was missed

If noone listens to the input device when a tool comes in proximity,
the tablet does not send the in-prox event when a client becomes available.
That means that no events will be sent until the tool is taken out of
proximity.

In this situation, ask for the report WACOM_REPORT_INTUOSREAD which will
read the corresponding feature and generate an in-prox event.
To make some generation of hardware working, we need to unset the
quirk NO_GET set by hid-core because the interfaces are seen as "boot
mouse".

We don't schedule this read in a worker while we are in an IO interrupt.
We know that usbhid will do it asynchronously. If this is triggered by
uhid, then this is obviously a client side bug :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/sensor-hub' into for-next
Jiri Kosina [Mon, 16 Mar 2015 15:25:49 +0000 (16:25 +0100)]
Merge branch 'for-4.1/sensor-hub' into for-next

9 years agoHID: hid-sensor-hub: Fix sparse warning
Srinivas Pandruvada [Thu, 26 Feb 2015 19:04:44 +0000 (11:04 -0800)]
HID: hid-sensor-hub: Fix sparse warning

Since I can't change the type of hid_set_field argument 3, using __force __s32 to remove
this warning.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/sensor-hub' into for-next
Jiri Kosina [Mon, 16 Mar 2015 15:22:16 +0000 (16:22 +0100)]
Merge branch 'for-4.1/sensor-hub' into for-next

9 years agoHID: hid-sensor-hub: fix attribute read for logical usage id
Srinivas Pandruvada [Thu, 26 Feb 2015 02:56:27 +0000 (18:56 -0800)]
HID: hid-sensor-hub: fix attribute read for logical usage id

For defining enumeration values like report or power status events, the
enumeration usage ids are enclosed in a logical collection.  In this case we
need to match logical usage id for pending read on this usage id. For example,
in the below field, when read is requested for 0319, the report will
contain one of the status usages like 850, 851 etc. In this case the raw
event will not match 0319. So when logical collection matches, then wake
up the pending thread.

      Physical(Sensor.OtherCustom)
      Logical(Sensor.0319)
      Application(Sensor.Sensor)
      Usage(6)
        Sensor.0850
        Sensor.0851
        Sensor.0852
        Sensor.0853
        Sensor.0854
        Sensor.0855
      Logical Minimum(1)
      Logical Maximum(5)
      Report Size(8)
      Report Count(1)
      Report Offset(24)
      Flags( Array Absolute )

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Mon, 16 Mar 2015 15:17:17 +0000 (16:17 +0100)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: plantronics: fix Kconfig default
Stefan Richter [Sun, 1 Feb 2015 19:42:04 +0000 (20:42 +0100)]
HID: plantronics: fix Kconfig default

This driver didn't exist until before v3.19.
Why would suddenly everybody want to build it?

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Mon, 16 Mar 2015 15:12:37 +0000 (16:12 +0100)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: pidff: support more than one concurrent effect
Jim Keir [Thu, 26 Feb 2015 09:14:03 +0000 (09:14 +0000)]
HID: pidff: support more than one concurrent effect

The PID driver (usbhid/hid-pidff.c) does not set the effect ID when
uploading an effect. The result is that the initial upload works but
subsequent uploads to modify effect parameters are all directed at the
last-created effect.

The targeted effect ID must be passed back to the device when effect
parameters are changed. This is done at the start of
"pidff_set_condition_report", "pidff_set_periodic_report" etc. based on
the value of "pidff->block_load[PID_EFFECT_
BLOCK_INDEX].value[0]".

This value is only ever set during pidff_request_effect_upload.
The result is stored in "pidff->pid_id[effect->id]" at the end of
pid_upload_effect, for later use. However, if an effect is modified and
re-sent then this identifier is not being copied back from
pidff->pid_id[effect->id] before sending the command to the device. The
fix is to do this at the start of pidff_upload_effect.

Signed-off-by: Jim Keir <jimkeir@oracledbadirect.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/kconfig-drop-expert-dependency' into for-next
Jiri Kosina [Mon, 16 Mar 2015 15:00:14 +0000 (16:00 +0100)]
Merge branch 'for-4.1/kconfig-drop-expert-dependency' into for-next

9 years agoHID: Stop hiding options with !EXPERT
Jean Delvare [Fri, 20 Feb 2015 16:33:33 +0000 (17:33 +0100)]
HID: Stop hiding options with !EXPERT

Many HID driver options are hidden unless EXPERT is set. While I
understand the idea of simplifying the kernel configuration for most
users, in practice I believe it adds more confusion than it helps.

One thing that worries me is that, in non-EXPERT mode, these drivers
will be either built-in or modular based on apparent magic. For
example, switching INPUT and HID from m to y will cause all these
drivers to be built into the kernel when they were previously built
as modules. Short of enabling EXPERT mode altogether, the user has no
control over that.

Generally I do not think tristate options should depend on !EXPERT.
Of these, 11 of 15 are currently in the hid subsystem.

The HID_LOGITECH option is even worse than the others. Sub-options
depend on it, and this causes menuconfig and friends to display the
option even though the user can't change its value. The help page for
HID_LOGITECH will not explain why the value can't be changed. It only
says, for example:

  Depends on: INPUT [=y] && HID [=y]

and that leaves the user puzzled about why the option is forced to y.
You might argue that this is a Kconfig bug, but that doesn't make it
less annoying for the user.

Even worse is that some of the sub-options of HID_LOGITECH select
INPUT_FF_MEMLESS, which in turn gets out of control for the user. So,
if you set INPUT=y and HID=y (something most general purpose
distributions would do these days, as both modules would get loaded on
a vast majority of systems otherwise), and you want support for
force-feedback game controllers, you can't have that as a module, it
has to be built-in, regardless of how rare these devices are.

Of course, all this madness goes away once EXPERT is enabled, but then
the rest of the kernel configuration becomes more complex, which
totally voids the original point.

For this reason, I would like all HID device tristate options to be
displayed regardless of EXPERT being set or not. We can let the
default settings still depend on EXPERT, that's not intrusive.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/huion-uclogic-merge' into for-next
Jiri Kosina [Mon, 16 Mar 2015 14:48:01 +0000 (15:48 +0100)]
Merge branch 'for-4.1/huion-uclogic-merge' into for-next

9 years agoHID: uclogic: make input_mapping independent of usb
Benjamin Tissoires [Sun, 15 Mar 2015 18:26:27 +0000 (14:26 -0400)]
HID: uclogic: make input_mapping independent of usb

No need to retrieve the USB handle in input_mapping() when we already
do that in probe. It also allows to use the quirk without having to
add the product ID matching.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Sun, 15 Mar 2015 14:11:41 +0000 (10:11 -0400)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: samples/hidraw: make it possible to select device
Pavel Machek [Sat, 14 Mar 2015 20:57:22 +0000 (21:57 +0100)]
HID: samples/hidraw: make it possible to select device

Makefile that can actually build the example, and allow selecting device to
work on.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.0/upstream-fixes' into for-next
Jiri Kosina [Sun, 15 Mar 2015 14:05:30 +0000 (10:05 -0400)]
Merge branch 'for-4.0/upstream-fixes' into for-next

9 years agoHID: tivo: enable all buttons on the TiVo Slide Pro remote
Forest Wilkinson [Fri, 13 Mar 2015 06:58:16 +0000 (23:58 -0700)]
HID: tivo: enable all buttons on the TiVo Slide Pro remote

The linux kernel has supported the TiVo Slide remote control for some time, but
does not recognize the USB ID of the newer Slide Pro. This patch adds the
missing data structures so the newer remote will be recognized by the driver,
thereby allowing the TiVo, LiveTV, and Thumbs Up/Down buttons to be
mapped with a hwdb file.

Signed-off-by: Forest Wilkinson <web11.forest@tibit.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/multitouch' into for-next
Jiri Kosina [Thu, 12 Mar 2015 04:05:26 +0000 (00:05 -0400)]
Merge branch 'for-4.1/multitouch' into for-next

9 years agoHID: multitouch: Add support for button type usage
Seth Forshee [Wed, 11 Mar 2015 22:26:41 +0000 (17:26 -0500)]
HID: multitouch: Add support for button type usage

According to [1], Windows Precision Touchpad devices must supply
a button type usage in the device capabilities feature report. A
value of 0 indicates that the device contains a depressible
button (i.e. it's a click-pad) whereas a value of 1 indicates
a non-depressible button. Add support for this usage and set
INPUT_PROP_BUTTONPAD on the touchpad input device whenever a
depressible button is present.

[1] https://msdn.microsoft.com/en-us/library/windows/hardware/dn467314(v=vs.85).aspx

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/wacom' into for-next
Jiri Kosina [Wed, 11 Mar 2015 17:51:59 +0000 (13:51 -0400)]
Merge branch 'for-4.1/wacom' into for-next

9 years agoHID: wacom: Add battery presence indicator to wireless tablets
Jason Gerecke [Wed, 11 Mar 2015 17:25:41 +0000 (10:25 -0700)]
HID: wacom: Add battery presence indicator to wireless tablets

Declare the POWER_SUPPLY_PROP_PRESENT property to provide userspace
with a way to determine if the battery on a wireless tablet is plugged
in. Although current wireless tablets do not explicitly report this
information, it can be inferred from other state information. In
particular, a battery is assumed to be present if any of the following
are true: a non-zero battery level reported, the battery is reported as
charging, or the tablet is operating wirelessly.

Note: The last condition above may not strictly hold for the Graphire
Wireless (it charges from a DC barrel jack instead of a USB port), but I
do not know what is reported in the no-battery condition.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.0/upstream-fixes' into for-next
Jiri Kosina [Wed, 11 Mar 2015 16:13:43 +0000 (12:13 -0400)]
Merge branch 'for-4.0/upstream-fixes' into for-next

9 years agoHID: add ALWAYS_POLL quirk for a Logitech 0xc007
oliver@neukum.org [Tue, 10 Mar 2015 15:36:22 +0000 (16:36 +0100)]
HID: add ALWAYS_POLL quirk for a Logitech 0xc007

This device disconnects every 60s without X

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/wacom' into for-next
Jiri Kosina [Wed, 11 Mar 2015 15:52:53 +0000 (11:52 -0400)]
Merge branch 'for-4.1/wacom' into for-next

Conflicts:
drivers/hid/wacom_wac.c

9 years agoHID: wacom: drop WACOM_PKGLEN_STATUS
Jiri Kosina [Wed, 11 Mar 2015 15:48:11 +0000 (11:48 -0400)]
HID: wacom: drop WACOM_PKGLEN_STATUS

The constant is not used (leftover from previous patch versions
that never got merged).

Reported-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Status packet provides 'charging', not 'powered' bit
Jason Gerecke [Fri, 6 Mar 2015 19:47:43 +0000 (11:47 -0800)]
HID: wacom: Status packet provides 'charging', not 'powered' bit

The status packet for tablets which can use a wireless module contains a
bit that is set if the battery is charging. This bit will be 0 if either
a battery is not present or if the battery has reached full charge. Note
that the charging circuit may continue to charge the battery for a short
time after reaching "100%".

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Report battery status for Intuos Pro and Intuos5
Jason Gerecke [Fri, 6 Mar 2015 19:47:42 +0000 (11:47 -0800)]
HID: wacom: Report battery status for Intuos Pro and Intuos5

Calls the wacom_status_irq function to report battery status for the
Intuos Pro and Intuos5 (in addition to the already-reporting Intuos
and last-generation Bamboo).

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Provide battery charge state to system over USB if available
Jason Gerecke [Fri, 6 Mar 2015 19:47:41 +0000 (11:47 -0800)]
HID: wacom: Provide battery charge state to system over USB if available

If a wireless adapter (which contains the charging circuitry) is
detected as being attached to the tablet then create a new battery
interface and update its status as data is reported. Also destroy the
battery if the adapter goes away.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Allow dynamic battery creation/destruction
Jason Gerecke [Fri, 6 Mar 2015 19:47:40 +0000 (11:47 -0800)]
HID: wacom: Allow dynamic battery creation/destruction

Tablets like the Intuos, Intuos Pro, and Bamboo have a connector for an
optional wireless module that can be connected on the fly. The presence
(or absence) of this module is indicated in a status report recieved
from the tablet. This patch adds a workqueue function that will create
or destroy a power_supply object at runtime to match the current state
of the WACOM_QUIRK_BATTERY flag.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Centralize updating of wacom_wac battery status
Jason Gerecke [Fri, 6 Mar 2015 19:47:39 +0000 (11:47 -0800)]
HID: wacom: Centralize updating of wacom_wac battery status

Has the 'wacom_notify_battery' function take on the job of detecting if
updating the power supply is necessary to remove multiple
nearly-identical 'if' blocks.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: Move handling of Intuos status packets to seperate function
Jason Gerecke [Fri, 6 Mar 2015 19:47:38 +0000 (11:47 -0800)]
HID: wacom: Move handling of Intuos status packets to seperate function

In addition to the touchswitch state for "Intuos", these packets are
also sent by the Intuos Pro, Intuos5, and last-generation Bamboo
tablets when using a wired connection. They contain, among other
things, information about the optional wireless module and battery
charge state (to be supported in subsuquent patches).

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/multitouch' into for-next
Jiri Kosina [Fri, 6 Mar 2015 21:55:30 +0000 (22:55 +0100)]
Merge branch 'for-4.1/multitouch' into for-next

9 years agoHID: multitouch: add support of clickpads
Benjamin Tissoires [Fri, 6 Mar 2015 16:14:42 +0000 (11:14 -0500)]
HID: multitouch: add support of clickpads

Touchpads that have only one button are called clickpads and should
be advertised as such by the kernel.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Wed, 4 Mar 2015 22:33:06 +0000 (23:33 +0100)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: map telephony usage page
Dmitry Torokhov [Wed, 4 Mar 2015 22:10:26 +0000 (14:10 -0800)]
HID: map telephony usage page

Currently HID code maps usages from telephony page into BTN_0, BTN_1, etc
keys which get interpreted by mousedev and userspace as left/right/middle
button clicks, which is not really helpful.

This change adds mappings for usages that have corresponding input event
definitions, and leaves the rest unmapped. This can be changed when
there are userspace consumers for more telephony usages.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/huion-uclogic-merge' into for-next
Jiri Kosina [Wed, 4 Mar 2015 16:33:34 +0000 (17:33 +0100)]
Merge branch 'for-4.1/huion-uclogic-merge' into for-next

9 years agoHID: Kconfig: add USB_HID dependency to UC-LOGIC
Benjamin Tissoires [Wed, 4 Mar 2015 16:24:55 +0000 (11:24 -0500)]
HID: Kconfig: add USB_HID dependency to UC-LOGIC

In commit 08177f4 (HID: uclogic: merge hid-huion driver in hid-uclogic)
HID_HUION depends explicitely on USB_HID because it contained quite some
USB-isms.

Now that hid-uclogic is the new home of Huion tablets, we need to also
add the dependency on USB_HID to this driver.

Reported-by: Jiri Kosina <jkosina@suse.cz>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/huion-uclogic-merge' into for-next
Jiri Kosina [Tue, 3 Mar 2015 20:33:22 +0000 (21:33 +0100)]
Merge branch 'for-4.1/huion-uclogic-merge' into for-next

9 years agoHID: uclogic: actually invert the in-range bit for huion tablets only
Benjamin Tissoires [Tue, 3 Mar 2015 17:44:05 +0000 (12:44 -0500)]
HID: uclogic: actually invert the in-range bit for huion tablets only

This hack is only needed for Huion tablets. It does not seem to have
any effect on the other tablets handled by this device right now, but
it's better to check for the product id sooner than discovering that
we have messed up one tablet later.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: uclogic: discard the extra Pen input node on Huion tablets
Benjamin Tissoires [Tue, 3 Mar 2015 17:44:04 +0000 (12:44 -0500)]
HID: uclogic: discard the extra Pen input node on Huion tablets

Some Huion tablets present 2 HID Pen interfaces. Only one is used, so
we can drop the unused one.

Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: uclogic: apply quirk NO_EMPTY_INPUT
Benjamin Tissoires [Tue, 3 Mar 2015 17:44:03 +0000 (12:44 -0500)]
HID: uclogic: apply quirk NO_EMPTY_INPUT

NO_EMPTY_INPUT is useful when MULTI_INPUT is set. It prevents to create
empty input nodes that user space does not know what to do with.

It does not seem to be required at the moment, this is just a preventive
patch. This check is only made during the plug of the device, so it does
not hurt to have it.

Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: uclogic: name the input nodes based on their tool
Benjamin Tissoires [Tue, 3 Mar 2015 17:44:02 +0000 (12:44 -0500)]
HID: uclogic: name the input nodes based on their tool

We append "Pen", "Pad", "Mouse", "Keyboard", "Consumer Control" or
"System Control" suffix to the appropriate input node to match what
the Wacom driver does and be more convenient for the user to know
which one is which.

Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: uclogic: merge hid-huion driver in hid-uclogic
Nikolai Kondrashov [Tue, 3 Mar 2015 17:44:01 +0000 (12:44 -0500)]
HID: uclogic: merge hid-huion driver in hid-uclogic

Merge the hid-huion driver into hid-uclogic as all the devices supported
by hid-huion are in fact UC-Logic devices.

Signed-off-by: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: uclogic: Set quirks from inside the driver
Benjamin Tissoires [Tue, 3 Mar 2015 17:44:00 +0000 (12:44 -0500)]
HID: uclogic: Set quirks from inside the driver

Based on a patch from: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>

Most of the tablets handled by hid-uclogic already use MULTI_INPUT.
For the ones which are not quirked in usbhid/hidquirks, they have a
custom report descriptor which contains only one report per HID
interface. For those tablets HID_QUIRK_MULTI_INPUT is transparent.

According to https://github.com/DIGImend/tablets, the only problematic
tablet currently handled by hid-uclogic is the TWHA60 v3. This tablet
presents different report descriptors from the ones currently quirked.
This is not a problem per se, given that this tablet is not supported
currently in this version (it needs the same command as a Huion to
start forwarding events).

Reviewed-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.0/upstream-fixes' into for-next
Jiri Kosina [Tue, 3 Mar 2015 12:01:42 +0000 (13:01 +0100)]
Merge branch 'for-4.0/upstream-fixes' into for-next

Conflicts:
drivers/hid/wacom_wac.c

9 years agoHID: wacom: rely on actual touch down count to decide touch_down
Ping Cheng [Fri, 20 Feb 2015 22:27:30 +0000 (14:27 -0800)]
HID: wacom: rely on actual touch down count to decide touch_down

touch_down is a flag to indicate if there are touches on tablet
or not. Since one set of touch events may be posted over more
than one data packet/touch frame, and pen may come in proximity
while touch events are partially sent, counting all touch events
for the set reflects the actual status of touch_down.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: do not send pen events before touch is up/forced out
Ping Cheng [Fri, 20 Feb 2015 22:25:58 +0000 (14:25 -0800)]
HID: wacom: do not send pen events before touch is up/forced out

If pen comes in proximity while touch is down, we force touch up
before sending pen events. Otherwise, there can be unfinished
touch events compete with pen events. This idea has been fully
implemented for Tablet PCs. But other tablets that support both
pen and touch are not fully considered.

Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/wacom' into for-next
Jiri Kosina [Fri, 27 Feb 2015 07:39:27 +0000 (08:39 +0100)]
Merge branch 'for-4.1/wacom' into for-next

9 years agoHID: wacom: add full support of the Wacom Bamboo PAD
Benjamin Tissoires [Thu, 26 Feb 2015 16:28:50 +0000 (11:28 -0500)]
HID: wacom: add full support of the Wacom Bamboo PAD

The stylus of this device works just fine out of the box.
The touch is seen by default as a mouse with relative events and some
gestures.
The wireless and the wired version have slightly different firmwares, but
the debug mode 2 on the feature 2 is common to the 2 devices. In this mode,
all the reports are emitted through the debug interface (pen, raw touch
and mouse emulation), so we have to re-route manually the events.

We keep the Pen interface as a HID_GENERIC one because it works, and only
parse the raw touches while discarding the mouse emulation & gestures.

Switching the default in raw mode allows us to have a consistent user
experience accross all the multitouch touchpads (and enable the touch part
of the devices).

Note that the buttons of this devices are reported through the touch
interface. There is no 'Pad' interface. It seemed more natural to have
the BTN_LEFT and BTN_RIGHT reported with the touch because they are
placed under the touch interface and it looks like they belong to the
touch part.

Tested-by: Josep Sanchez Ferreres <josep.sanchez.ferreres@est.fib.upc.edu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: wacom: store the hid_device pointers of the sibling devices
Benjamin Tissoires [Wed, 25 Feb 2015 16:43:39 +0000 (11:43 -0500)]
HID: wacom: store the hid_device pointers of the sibling devices

The Bamboo PAD in debug mode needs to re-route events from the debug
interface to the Pen interface. This can be easily done with
hid_input_report(), but that means that we need to keep a reference to
the various hid_devices.

There should be only one touch and one pen interface per physical tablet,
so there is no need to keep a list of hid-devices, plain pointers are
sufficient.

Tested-by: Josep Sanchez Ferreres <josep.sanchez.ferreres@est.fib.upc.edu>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Thu, 26 Feb 2015 23:38:01 +0000 (00:38 +0100)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: remove 2 unused usb.h includes
Benjamin Tissoires [Thu, 26 Feb 2015 18:39:48 +0000 (13:39 -0500)]
HID: remove 2 unused usb.h includes

These 2 are left over from the USB dependency cleaning, so there is
no need to keep them.

[jkosina@suse.cz: fix filename]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/rmi' into for-next
Jiri Kosina [Wed, 25 Feb 2015 14:46:26 +0000 (15:46 +0100)]
Merge branch 'for-4.1/rmi' into for-next

9 years agoHID: rmi: disable palm detect gesture when present
Andrew Duggan [Wed, 25 Feb 2015 01:36:50 +0000 (17:36 -0800)]
HID: rmi: disable palm detect gesture when present

A touchpad may have firmware based palm detection code enabled which
suppresses 2D data from being reported when the firmware believes a palm is
on the touchpad. This functionality is meant to be used in mouse mode without
a driver. When a driver is present, the driver can do a better job of
determining if a contact is a palm. If this gesture is enabled on a touchpad
operating in rmi mode then the firmware will not properly clear the palm detect
interrupt, causing the touchpad to interrupt indefinately. This patch disables
the palm detect gesture when the touchpad is operating in rmi mode.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: rmi: disable dribble packets on Synaptics touchpads
Andrew Duggan [Wed, 25 Feb 2015 01:36:49 +0000 (17:36 -0800)]
HID: rmi: disable dribble packets on Synaptics touchpads

When a finger is lifted from a Synaptics touchpad the firmware will continue
to interrupts for up to a second. These additional interrupts are know and
dribble interrupts. Since the data read from the touchpad does not change
the input subsystem only reports a single event. This makes the servicing of
dribble interrupts on Linux unnecessary. This patch simply disables dribble
interupts when configuring the touchpad.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: rmi: Add functions for writing to registers
Andrew Duggan [Wed, 25 Feb 2015 01:36:48 +0000 (17:36 -0800)]
HID: rmi: Add functions for writing to registers

Writing to registers is needed for setting configuration parameters.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/i2c-hid' into for-next
Jiri Kosina [Tue, 24 Feb 2015 20:00:16 +0000 (21:00 +0100)]
Merge branch 'for-4.1/i2c-hid' into for-next

Conflicts:
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
include/linux/hid-sensor-hub.h

9 years agoHID: i2c-hid: Add support for ACPI GPIO interrupts
Mika Westerberg [Mon, 23 Feb 2015 13:52:45 +0000 (15:52 +0200)]
HID: i2c-hid: Add support for ACPI GPIO interrupts

The HID over I2C specification allows to have the interrupt for a HID
device to be GPIO instead of directly connected to the IO-APIC.

Add support for this so that when the driver does not find proper interrupt
number from the I2C client structure we check if it has ACPI GpioInt()
resource listed in _CRS. If it is found we convert it to an interrupt
number and use it instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Tue, 24 Feb 2015 16:25:44 +0000 (08:25 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

Pull HID fixes from Jiri Kosina:

 - a few fixes to Sony driver (rmmod breakage, spinlock initialization),
   by Antonio Ospite, Frank Praznik and Jiri Kosina

 - fix for wMaxInputLength handling regression in i2c-hid, by Seth
   Forshee

 - IRQ safety spinlock fix in sensor hub driver, by Srinivas Pandruvada

 - IRQ level sensitivity fix to i2c-hid to be compliant with the spec,
   by Mika Westerberg

 - a couple device ID additions piggy-backing on top of that

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: microsoft: Add ID for NE7K wireless keyboard
  HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events
  HID: sony: fix uninitialized per-controller spinlock
  HID: sony: initialize sony_dev_list_lock properly
  HID: sony: Fix a WARNING shown when rmmod-ing the driver
  HID: sensor-hub: correct dyn_callback_lock IRQ-safe change
  HID: hid-sensor-hub: Correct documentation
  HID: saitek: add USB ID for older R.A.T. 7
  HID: i2c-hid: The interrupt should be level sensitive
  HID: wacom: Add missing ABS_MISC event and feature declaration for 27QHD

9 years agoMerge branch 'for-4.1/wacom' into for-next
Jiri Kosina [Tue, 24 Feb 2015 10:30:32 +0000 (11:30 +0100)]
Merge branch 'for-4.1/wacom' into for-next

9 years agoHID: wacom: Add support for I2C connected devices
Mika Westerberg [Mon, 23 Feb 2015 13:52:43 +0000 (15:52 +0200)]
HID: wacom: Add support for I2C connected devices

Lenovo Thinkpad 10 has wacom digitizer connected as a I2C-HID device. Add
generic support for this.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/upstream' into for-next
Jiri Kosina [Mon, 23 Feb 2015 15:17:45 +0000 (16:17 +0100)]
Merge branch 'for-4.1/upstream' into for-next

9 years agoHID: expose country code in sysfs
Olivier Gay [Tue, 17 Feb 2015 13:00:03 +0000 (14:00 +0100)]
HID: expose country code in sysfs

This commit exposes in sysfs the HID country code that is stored in the country
member of hid_device structure. It identifies the country code of localized
hardware.

For example some keyboards use it to exhibit the language of the key layout. It
helps the upper layer to identify the localized hardware and setup the correct
language to use.

For USB HID devices the country code comes for the HID descriptor and for
Bluetooth HID devices it is the HIDCountryCode attribute from the SDP database.

Signed-off-by: Olivier Gay <ogay@logitech.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: microsoft: Add ID for NE7K wireless keyboard
Jakub Sitnicki [Sat, 21 Feb 2015 19:51:08 +0000 (20:51 +0100)]
HID: microsoft: Add ID for NE7K wireless keyboard

Microsoft Natural Wireless Ergonomic Keyboard 7000 has special My
Favorites 1..5 keys which are handled through a vendor-defined usage
page (0xff05).

Apply MS_ERGONOMY quirks handling to USB PID 0x071d (Microsoft Microsoft
2.4GHz Transceiver V1.0) so that the My Favorites 1..5 keys are reported
as KEY_F14..18 events.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=52841
Signed-off-by: Jakub Sitnicki <jsitnicki@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branch 'for-4.1/sensor-hub' into for-next
Jiri Kosina [Mon, 23 Feb 2015 14:20:50 +0000 (15:20 +0100)]
Merge branch 'for-4.1/sensor-hub' into for-next

9 years agoHID: hid-sensor-hub: Enhance feature report set API
Srinivas Pandruvada [Thu, 19 Feb 2015 23:35:26 +0000 (15:35 -0800)]
HID: hid-sensor-hub: Enhance feature report set API

Current API only allows setting one offset in the field. This API
is extended to set multiple offsets in the field report.
Also update parameters in the users of this API.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: hid-sensor-hub: Enhance get feature report API
Srinivas Pandruvada [Thu, 19 Feb 2015 23:35:25 +0000 (15:35 -0800)]
HID: hid-sensor-hub: Enhance get feature report API

Some hid sensor feature report can contain more than one reports.
This API can now support receiving multiple values from the feature
report.
Also update the parameters in the users of this API.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: hid-sensor-hub: Extend API for async reads
Srinivas Pandruvada [Thu, 19 Feb 2015 23:33:56 +0000 (15:33 -0800)]
HID: hid-sensor-hub: Extend API for async reads

Add additional flag to read in async mode. In this mode the caller will get
reply via registered callback for capture_sample. Callbacks can be registered
using sensor_hub_register_callback function. The usage id parameter of the
capture_sample can be matched with the usage id of the requested attribute.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: hid-sensor-hub: Add support for application collection
Srinivas Pandruvada [Thu, 19 Feb 2015 23:31:26 +0000 (15:31 -0800)]
HID: hid-sensor-hub: Add support for application collection

Section 4.2.5 of HID Sensor hub specification allows two methods
defining sensor devices.
- Each sensor device by its own collection
- A top level application collection object, including multiple
sensors.
In the first method, each sensor can be in its own sensor application
collection without a physical collection.
In the second method there is a usage id for collection type, which
is defined as an application collection, with multiple physical
collections in it. It is possible to define fusion sensor with this
and may have its own handler. If there is a callback registered
for the collection type, then forward all reports for sensors in
its collection to this handler.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: hid-sensor-hub: Allow parallel synchronous reads
Srinivas Pandruvada [Thu, 19 Feb 2015 23:31:25 +0000 (15:31 -0800)]
HID: hid-sensor-hub: Allow parallel synchronous reads

Current implementation only allows one outstanding synchronous read.
This is a performance hit when user mode is requesting raw reads
of sensor attributes on multiple sensors together.
This change changes the mutex lock to per hid sensor hub device instead
of global lock. Although request to hid sensor hub is serialized, there
can be multiple outstanding read requests pending for responses via
hid reports.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: i2c-hid: Limit reads to wMaxInputLength bytes for input events
Seth Forshee [Fri, 20 Feb 2015 17:45:11 +0000 (11:45 -0600)]
HID: i2c-hid: Limit reads to wMaxInputLength bytes for input events

d1c7e29e8d27 (HID: i2c-hid: prevent buffer overflow in early IRQ)
changed hid_get_input() to read ihid->bufsize bytes, which can be
more than wMaxInputLength. This is the case with the Dell XPS 13
9343, and it is causing events to be missed. In some cases the
missed events are releases, which can cause the cursor to jump or
freeze, among other problems. Limit the number of bytes read to
min(wMaxInputLength, ihid->bufsize) to prevent such problems.

Fixes: d1c7e29e8d27 "HID: i2c-hid: prevent buffer overflow in early IRQ"
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoHID: sony: fix uninitialized per-controller spinlock
Frank Praznik [Mon, 23 Feb 2015 01:42:46 +0000 (20:42 -0500)]
HID: sony: fix uninitialized per-controller spinlock

Per-controller spinlock needs to be properly initialized during device probe.

[jkosina@suse.cz: massage changelog]
[jkosina@suse.cz: drop hunk that has already been applied by previous
 patch]
Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoMerge branches 'for-4.1/genius', 'for-4.1/logitech', 'for-4.1/rmi', 'for-4.1/sony...
Jiri Kosina [Mon, 23 Feb 2015 10:28:12 +0000 (11:28 +0100)]
Merge branches 'for-4.1/genius', 'for-4.1/logitech', 'for-4.1/rmi', 'for-4.1/sony' and 'for-4.1/wacom' into for-next

9 years agoHID: sony: initialize sony_dev_list_lock properly
Jiri Kosina [Mon, 23 Feb 2015 10:15:44 +0000 (11:15 +0100)]
HID: sony: initialize sony_dev_list_lock properly

sony_dev_list_lock spinlock (which was introduced in d2d782fccee ("HID: sony:
Prevent duplicate controller connections") is not being initialized properly.
Fix that.

Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
9 years agoLinux 4.0-rc1 v4.0-rc1
Linus Torvalds [Mon, 23 Feb 2015 02:21:14 +0000 (18:21 -0800)]
Linux 4.0-rc1

.. after extensive statistical analysis of my G+ polling, I've come to
the inescapable conclusion that internet polls are bad.

Big surprise.

But "Hurr durr I'ma sheep" trounced "I like online polls" by a 62-to-38%
margin, in a poll that people weren't even supposed to participate in.
Who can argue with solid numbers like that? 5,796 votes from people who
can't even follow the most basic directions?

In contrast, "v4.0" beat out "v3.20" by a slimmer margin of 56-to-44%,
but with a total of 29,110 votes right now.

Now, arguably, that vote spread is only about 3,200 votes, which is less
than the almost six thousand votes that the "please ignore" poll got, so
it could be considered noise.

But hey, I asked, so I'll honor the votes.

9 years agoMerge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
Linus Torvalds [Mon, 23 Feb 2015 02:05:13 +0000 (18:05 -0800)]
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 fixes from Ted Ts'o:
 "Ext4 bug fixes.

  We also reserved code points for encryption and read-only images (for
  which the implementation is mostly just the reserved code point for a
  read-only feature :-)"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: fix indirect punch hole corruption
  ext4: ignore journal checksum on remount; don't fail
  ext4: remove duplicate remount check for JOURNAL_CHECKSUM change
  ext4: fix mmap data corruption in nodelalloc mode when blocksize < pagesize
  ext4: support read-only images
  ext4: change to use setup_timer() instead of init_timer()
  ext4: reserve codepoints used by the ext4 encryption feature
  jbd2: complain about descriptor block checksum errors

9 years agoMerge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 23 Feb 2015 01:42:14 +0000 (17:42 -0800)]
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull more vfs updates from Al Viro:
 "Assorted stuff from this cycle.  The big ones here are multilayer
  overlayfs from Miklos and beginning of sorting ->d_inode accesses out
  from David"

* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (51 commits)
  autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
  procfs: fix race between symlink removals and traversals
  debugfs: leave freeing a symlink body until inode eviction
  Documentation/filesystems/Locking: ->get_sb() is long gone
  trylock_super(): replacement for grab_super_passive()
  fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
  Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
  VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
  SELinux: Use d_is_positive() rather than testing dentry->d_inode
  Smack: Use d_is_positive() rather than testing dentry->d_inode
  TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
  Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
  Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
  VFS: Split DCACHE_FILE_TYPE into regular and special types
  VFS: Add a fallthrough flag for marking virtual dentries
  VFS: Add a whiteout dentry type
  VFS: Introduce inode-getting helpers for layered/unioned fs environments
  Infiniband: Fix potential NULL d_inode dereference
  posix_acl: fix reference leaks in posix_acl_create
  autofs4: Wrong format for printing dentry
  ...

9 years agoMerge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 22 Feb 2015 17:57:16 +0000 (09:57 -0800)]
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm

Pull ARM fix from Russell King:
 "Just one fix this time around.  __iommu_alloc_buffer() can cause a
  BUG() if dma_alloc_coherent() is called with either __GFP_DMA32 or
  __GFP_HIGHMEM set.  The patch from Alexandre addresses this"

* 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  ARM: 8305/1: DMA: Fix kzalloc flags in __iommu_alloc_buffer()

9 years agoautofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
Al Viro [Sun, 22 Feb 2015 03:19:57 +0000 (22:19 -0500)]
autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation

X-Coverup: just ask spender
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoprocfs: fix race between symlink removals and traversals
Al Viro [Sun, 22 Feb 2015 03:16:11 +0000 (22:16 -0500)]
procfs: fix race between symlink removals and traversals

use_pde()/unuse_pde() in ->follow_link()/->put_link() resp.

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agodebugfs: leave freeing a symlink body until inode eviction
Al Viro [Sun, 22 Feb 2015 03:05:11 +0000 (22:05 -0500)]
debugfs: leave freeing a symlink body until inode eviction

As it is, we have debugfs_remove() racing with symlink traversals.
Supply ->evict_inode() and do freeing there - inode will remain
pinned until we are done with the symlink body.

And rip the idiocy with checking if dentry is positive right after
we'd verified debugfs_positive(), which is a stronger check...

Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoDocumentation/filesystems/Locking: ->get_sb() is long gone
Al Viro [Sat, 21 Feb 2015 09:59:02 +0000 (04:59 -0500)]
Documentation/filesystems/Locking: ->get_sb() is long gone

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agotrylock_super(): replacement for grab_super_passive()
Konstantin Khlebnikov [Thu, 19 Feb 2015 17:19:35 +0000 (20:19 +0300)]
trylock_super(): replacement for grab_super_passive()

I've noticed significant locking contention in memory reclaimer around
sb_lock inside grab_super_passive(). Grab_super_passive() is called from
two places: in icache/dcache shrinkers (function super_cache_scan) and
from writeback (function __writeback_inodes_wb). Both are required for
progress in memory allocator.

Grab_super_passive() acquires sb_lock to increment sb->s_count and check
sb->s_instances. It seems sb->s_umount locked for read is enough here:
super-block deactivation always runs under sb->s_umount locked for write.
Protecting super-block itself isn't a problem: in super_cache_scan() sb
is protected by shrinker_rwsem: it cannot be freed if its slab shrinkers
are still active. Inside writeback super-block comes from inode from bdi
writeback list under wb->list_lock.

This patch removes locking sb_lock and checks s_instances under s_umount:
generic_shutdown_super() unlinks it under sb->s_umount locked for write.
New variant is called trylock_super() and since it only locks semaphore,
callers must call up_read(&sb->s_umount) instead of drop_super(sb) when
they're done.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agofanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
David Howells [Thu, 29 Jan 2015 12:02:36 +0000 (12:02 +0000)]
fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions

Fanotify probably doesn't want to watch autodirs so make it use d_can_lookup()
rather than d_is_dir() when checking a dir watch and give an error on fake
directories.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoCachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
David Howells [Thu, 29 Jan 2015 12:02:36 +0000 (12:02 +0000)]
Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions

Fix up the following scripted S_ISDIR/S_ISREG/S_ISLNK conversions (or lack
thereof) in cachefiles:

 (1) Cachefiles mostly wants to use d_can_lookup() rather than d_is_dir() as
     it doesn't want to deal with automounts in its cache.

 (2) Coccinelle didn't find S_IS* expressions in ASSERT() statements in
     cachefiles.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoVFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
David Howells [Thu, 29 Jan 2015 12:02:35 +0000 (12:02 +0000)]
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)

Convert the following where appropriate:

 (1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).

 (2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).

 (3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry).  This is actually more
     complicated than it appears as some calls should be converted to
     d_can_lookup() instead.  The difference is whether the directory in
     question is a real dir with a ->lookup op or whether it's a fake dir with
     a ->d_automount op.

In some circumstances, we can subsume checks for dentry->d_inode not being
NULL into this, provided we the code isn't in a filesystem that expects
d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
use d_inode() rather than d_backing_inode() to get the inode pointer).

Note that the dentry type field may be set to something other than
DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
manages the fall-through from a negative dentry to a lower layer.  In such a
case, the dentry type of the negative union dentry is set to the same as the
type of the lower dentry.

However, if you know d_inode is not NULL at the call site, then you can use
the d_is_xxx() functions even in a filesystem.

There is one further complication: a 0,0 chardev dentry may be labelled
DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE.  Strictly, this was
intended for special directory entry types that don't have attached inodes.

The following perl+coccinelle script was used:

use strict;

my @callers;
open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
    die "Can't grep for S_ISDIR and co. callers";
@callers = <$fd>;
close($fd);
unless (@callers) {
    print "No matches\n";
    exit(0);
}

my @cocci = (
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISLNK(E->d_inode->i_mode)',
    '+ d_is_symlink(E)',
    '',
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISDIR(E->d_inode->i_mode)',
    '+ d_is_dir(E)',
    '',
    '@@',
    'expression E;',
    '@@',
    '',
    '- S_ISREG(E->d_inode->i_mode)',
    '+ d_is_reg(E)' );

my $coccifile = "tmp.sp.cocci";
open($fd, ">$coccifile") || die $coccifile;
print($fd "$_\n") || die $coccifile foreach (@cocci);
close($fd);

foreach my $file (@callers) {
    chomp $file;
    print "Processing ", $file, "\n";
    system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
die "spatch failed";
}

[AV: overlayfs parts skipped]

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoSELinux: Use d_is_positive() rather than testing dentry->d_inode
David Howells [Thu, 29 Jan 2015 12:02:33 +0000 (12:02 +0000)]
SELinux: Use d_is_positive() rather than testing dentry->d_inode

Use d_is_positive() rather than testing dentry->d_inode in SELinux to get rid
of direct references to d_inode outside of the VFS.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoSmack: Use d_is_positive() rather than testing dentry->d_inode
David Howells [Thu, 29 Jan 2015 12:02:32 +0000 (12:02 +0000)]
Smack: Use d_is_positive() rather than testing dentry->d_inode

Use d_is_positive() rather than testing dentry->d_inode in Smack to get rid of
direct references to d_inode outside of the VFS.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoTOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
David Howells [Thu, 29 Jan 2015 12:02:32 +0000 (12:02 +0000)]
TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()

Use d_is_dir() rather than d_inode and S_ISDIR().  Note that this will include
fake directories such as automount triggers.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoApparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
David Howells [Thu, 29 Jan 2015 12:02:31 +0000 (12:02 +0000)]
Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode

Use d_is_positive(dentry) or d_is_negative(dentry) rather than testing
dentry->d_inode as the dentry may cover another layer that has an inode when
the top layer doesn't or may hold a 0,0 chardev that's actually a whiteout.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoApparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
David Howells [Thu, 29 Jan 2015 12:02:31 +0000 (12:02 +0000)]
Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb

mediated_filesystem() should use dentry->d_sb not dentry->d_inode->i_sb and
should avoid file_inode() also since it is really dealing with the path.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoVFS: Split DCACHE_FILE_TYPE into regular and special types
David Howells [Thu, 29 Jan 2015 12:02:29 +0000 (12:02 +0000)]
VFS: Split DCACHE_FILE_TYPE into regular and special types

Split DCACHE_FILE_TYPE into DCACHE_REGULAR_TYPE (dentries representing regular
files) and DCACHE_SPECIAL_TYPE (representing blockdev, chardev, FIFO and
socket files).

d_is_reg() and d_is_special() are added to detect these subtypes and
d_is_file() is left as the union of the two.

This allows a number of places that use S_ISREG(dentry->d_inode->i_mode) to
use d_is_reg(dentry) instead.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoVFS: Add a fallthrough flag for marking virtual dentries
David Howells [Thu, 29 Jan 2015 12:02:28 +0000 (12:02 +0000)]
VFS: Add a fallthrough flag for marking virtual dentries

Add a DCACHE_FALLTHRU flag to indicate that, in a layered filesystem, this is
a virtual dentry that covers another one in a lower layer that should be used
instead.  This may be recorded on medium if directory integration is stored
there.

The flag can be set with d_set_fallthru() and tested with d_is_fallthru().

Original-author: Valerie Aurora <vaurora@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoVFS: Add a whiteout dentry type
David Howells [Thu, 29 Jan 2015 12:02:27 +0000 (12:02 +0000)]
VFS: Add a whiteout dentry type

Add DCACHE_WHITEOUT_TYPE and provide a d_is_whiteout() accessor function.  A
d_is_miss() accessor is also added for ordinary cache misses and
d_is_negative() is modified to indicate either an ordinary miss or an enforced
miss (whiteout).

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoVFS: Introduce inode-getting helpers for layered/unioned fs environments
David Howells [Thu, 29 Jan 2015 12:02:27 +0000 (12:02 +0000)]
VFS: Introduce inode-getting helpers for layered/unioned fs environments

Introduce some function for getting the inode (and also the dentry) in an
environment where layered/unioned filesystems are in operation.

The problem is that we have places where we need *both* the union dentry and
the lower source or workspace inode or dentry available, but we can only have
a handle on one of them.  Therefore we need to derive the handle to the other
from that.

The idea is to introduce an extra field in struct dentry that allows the union
dentry to refer to and pin the lower dentry.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 years agoMerge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Linus Torvalds [Sun, 22 Feb 2015 03:41:38 +0000 (19:41 -0800)]
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:
 "This is the main pull request for MIPS:

   - a number of fixes that didn't make the 3.19 release.

   - a number of cleanups.

   - preliminary support for Cavium's Octeon 3 SOCs which feature up to
     48 MIPS64 R3 cores with FPU and hardware virtualization.

   - support for MIPS R6 processors.

     Revision 6 of the MIPS architecture is a major revision of the MIPS
     architecture which does away with many of original sins of the
     architecture such as branch delay slots.  This and other changes in
     R6 require major changes throughout the entire MIPS core
     architecture code and make up for the lion share of this pull
     request.

   - finally some preparatory work for eXtendend Physical Address
     support, which allows support of up to 40 bit of physical address
     space on 32 bit processors"

     [ Ahh, MIPS can't leave the PAE brain damage alone.  It's like
       every CPU architect has to make that mistake, but pee in the snow
       by changing the TLA.  But whether it's called PAE, LPAE or XPA,
       it's horrid crud   - Linus ]

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (114 commits)
  MIPS: sead3: Corrected get_c0_perfcount_int
  MIPS: mm: Remove dead macro definitions
  MIPS: OCTEON: irq: add CIB and other fixes
  MIPS: OCTEON: Don't do acknowledge operations for level triggered irqs.
  MIPS: OCTEON: More OCTEONIII support
  MIPS: OCTEON: Remove setting of processor specific CVMCTL icache bits.
  MIPS: OCTEON: Core-15169 Workaround and general CVMSEG cleanup.
  MIPS: OCTEON: Update octeon-model.h code for new SoCs.
  MIPS: OCTEON: Implement DCache errata workaround for all CN6XXX
  MIPS: OCTEON: Add little-endian support to asm/octeon/octeon.h
  MIPS: OCTEON: Implement the core-16057 workaround
  MIPS: OCTEON: Delete unused COP2 saving code
  MIPS: OCTEON: Use correct instruction to read 64-bit COP0 register
  MIPS: OCTEON: Save and restore CP2 SHA3 state
  MIPS: OCTEON: Fix FP context save.
  MIPS: OCTEON: Save/Restore wider multiply registers in OCTEON III CPUs
  MIPS: boot: Provide more uImage options
  MIPS: Remove unneeded #ifdef __KERNEL__ from asm/processor.h
  MIPS: ip22-gio: Remove legacy suspend/resume support
  mips: pci: Add ifdef around pci_proc_domain
  ...

9 years agoMerge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
Linus Torvalds [Sun, 22 Feb 2015 03:21:54 +0000 (19:21 -0800)]
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Arnd Bergmann:
 "A few fixes that came in too late to make it into the first set of
  pull requests but would still be nice to have in -rc1.

  The majority of these are trivial build fixes for bugs that I found
  myself using randconfig testing, and a set of two patches from Uwe to
  mark DT strings as 'const' where appropriate, to resolve inconsistent
  section attributes"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  ARM: make of_device_ids const
  ARM: make arrays containing machine compatible strings const
  ARM: mm: Remove Kconfig symbol CACHE_PL310
  ARM: rockchip: force built-in regulator support for PM
  ARM: mvebu: build armada375-smp code conditionally
  ARM: sti: always enable RESET_CONTROLLER
  ARM: rockchip: make rockchip_suspend_init conditional
  ARM: ixp4xx: fix {in,out}s{bwl} data types
  ARM: prima2: do not select SMP_ON_UP
  ARM: at91: fix pm declarations
  ARM: davinci: multi-soc kernels require AUTO_ZRELADDR
  ARM: davinci: davinci_cfg_reg cannot be init
  ARM: BCM: put back ARCH_MULTI_V7 dependency for mobile
  ARM: vexpress: use ARM_CPU_SUSPEND if needed
  ARM: dts: add I2C device nodes for Broadcom Cygnus
  ARM: dts: BCM63xx: fix L2 cache properties