Input: wistron_btns - add FS AMILO Pro 8210 support

This adds Fujitsu-Siemens AMILO Pro 8210 support to wistron_btns driver.

Functions are very similar to already supported AMILO Pro 3505, but 8210
has WIFI led.

Such functionality is needed to enable WiFi under Linux on 8210 when it
cold boots with hardware rfkill enabled, without booting another operating
system or running custom utility that calls appropriate BIOS function.

Signed-off-by: Jakub Bogusz <qboosh@pld-linux.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: gtco - fix usb_dev leak

There is usb_get_dev() in gtco_probe(), but there is no usb_put_dev()
anywhere in the driver.

As pointed out by Dmitry Torokhov:
The lifetime of gtco structure is already directly tied to lifetime of
usb_dev: when destroying usb_dev driver core will call remove() function
of currently bound driver (in our case gtco) which will destroy gtco
memory. Taking additional reference is not needed here.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - fix spelling errors

Fixed a few spelling errors.

Signed-off-by: Luis Ortega <luiorpe1@upv.es>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - fix lines exceeding 80 columns

Fixed lines exceeding 80 characters long wherever possible,
as per the coding style.

Signed-off-by: Luis Ortega <luiorpe1@upv.es>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - remove unnecessary payload data checks

The function zforce_read_packet() reads 2 values (bytes) of payload
header, validates them and then proceeds to read the payload body.
The function stores all these in a u8 buffer.

The PAYLOAD_LENGTH check seems to be trying to detect an overflow error.
However, since we are just reading a u8 value from the buffer, these
checks are unnecessary and we should simply compare against zero.

Signed-off-by: Luis Ortega <luiorpe1@upv.es>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> - bq Cervantes (imx6sl)
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - reduce stack memory allocated to frames

A frame is a u8 array with the following structure:
[PAYLOAD_HEADER, PAYLOAD_LENGTH, ...PAYLOAD_BODY...]

PAYLOAD_BODY can be at most 255 bytes long, as it's size is represented
by PAYLOAD_LENGTH. Therefore we can reduce the stack memory allocated to
payload_buffer[] roughly by half, from 512 to 257 bytes.

Signed-off-by: Luis Ortega <luiorpe1@upv.es>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> - bq Cervantes (imx6sl)
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - use internal pdata pointer instead of dev_get_platdata

Devicetree support will be creating its own platfprm data structure that
is not attached to the device. Let's use the internal pointer to the
pdata instead of re-fetching it with dev_get_platdata().

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: zforce - add devicetree support

This makes the zforce driver usable on devicetree-based platforms too.

Signed-off-by: Heiko Stuebner <heiko.stuebner@bqreaders.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: uinput - breaks by goto out in uinput_ioctl_handler

The current implementation prevents us to add variable-length ioctl.
Use a bunch of gotos instead of break to allow us to do so.

No functional changes.

Signed-off-by: Benjamin Tisssoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
gpio: document how to make combined GPIO+irqchip drivers

Write a few words on how GPIO drivers supplying an irqchip should
be written.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: pl061: proper error messages

This makes the PL061 driver print proper error messages
when probe fails, and also tell us when the chip is finally
registered.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: pl061: lock IRQs when starting them

This uses the new API for tagging GPIO lines as in use by
IRQs. This enforces a few semantic checks on how the underlying
GPIO line is used.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: pl061: refactor type setting

Refactor this function so that I can understand it, do one
big read/modify/write operation and have the bitmask in a
variable instead of recalculating it every time it's needed.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: pl061: remove confusing naming

Drop the " gpio" suffix after the pl061 irq_chip name:
this is only confusing: an irqchip name should be a single,
short, simple string that looks nice in /proc/interrupts.

Drop the nameing of each individual IRQ to "pl061" - I
think this naming function is for naming the IRQ line,
not for boilerplating them all with the name of the
parent controller, which is already known from the
.name field of the irq_chip.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: intel-mid: comments cleanup

This is a simple cleanup on gpio-intel-mid.c's header comments.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: bcm281xx: Fix parameter name for GPIO_CONTROL macro

The GPIO_CONTROL macro returns the control register offset when given a
GPIO number.

Update the argument name in the macro to reflect that it takes in a
GPIO number and not a bank.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: bcm281xx: Centralize register locking

Rather than unlock/re-lock for every write access, unlock a GPIO when
it is requested and re-lock it when it is freed. As a result, the GPIO
helper functions no longer have to deal with unlocking and re-locking
the register.

In addition, only unlock a specific GPIO rather than unlocking the
entire GPIO bank as before.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: gpiolib-of: Use PTR_ERR_OR_ZERO

PTR_RET is deprecated. Use PTR_ERR_OR_ZERO instead. While at it
also include missing err.h header.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: bcm281xx: Use "unsigned gpio" consistently throughout the code

This patch removes some inconsistencies caused by the use of "int gpio"
in some parts of the code and "unsigned gpio" in others.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio: generic: Add label to platform data

When registering more than one platform device, it is
useful to set the gpio chip label in the platform data.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>