- 01 8月, 2017 1 次提交
-
-
由 Bartosz Golaszewski 提交于
The previous fix for filtering out of unwatched events was not entirely correct. Instead of skipping the events we don't want, they are now interpreted as events with opposing edge. In order to fix it: always read the GPIO line value on interrupt and only emit the event if it corresponds with the event type we requested. Cc: stable@vger.kernel.org Fixes: ad537b82 ("gpiolib: fix filtering out unwanted events") Signed-off-by: NBartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 29 6月, 2017 1 次提交
-
-
由 Bartosz Golaszewski 提交于
GPIOEVENT_REQUEST_BOTH_EDGES is not a single flag, but a binary OR of GPIOEVENT_REQUEST_RISING_EDGE and GPIOEVENT_REQUEST_FALLING_EDGE. The expression 'le->eflags & GPIOEVENT_REQUEST_BOTH_EDGES' we'll get evaluated to true even if only one event type was requested. Fix it by checking both RISING & FALLING flags explicitly. Cc: stable@vger.kernel.org Fixes: 61f922db ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: NBartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 31 5月, 2017 1 次提交
-
-
由 Arnd Bergmann 提交于
This was left behind by a cleanup patch: drivers/gpio/gpiolib.c: In function 'gpiochip_irqchip_init_valid_mask': drivers/gpio/gpiolib.c:1474:6: error: unused variable 'i' [-Werror=unused-variable] Fixes: 923a654c ("gpiolib: Re-use bitmap_fill() instead of open coded loop") Reported-by: Nkbuild test robot <fengguang.wu@intel.com> Reported-by: NStephen Rothwell <sfr@canb.auug.org.au> Reported-by: NColin King <colin.king@canonical.com> Signed-off-by: NArnd Bergmann <arnd@arndb.de> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 29 5月, 2017 4 次提交
-
-
由 Andy Shevchenko 提交于
Re-use bitmap_fill() instead of open coded loop for setting an area of bits in a bitmap. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
This allows ACPI GPIO code to modify flags based on ACPI GpioIo() / GpioInt() resources. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: NJarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
This is preparatory patch for enabling GPIO ACPI to configure a pin accordingly. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: NJarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Charles Keepax 提交于
Add new flags to allow users to specify that they are not concerned with the status of GPIOs whilst in a sleep/low power state. Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: NRob Herring <robh@kernel.org> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 22 5月, 2017 1 次提交
-
-
由 Anatolij Gustschin 提交于
For hot-pluggable devices adding GPIOs dynamically we need to assemble and add the gpio lookup tables at probe time in modules, so that requesting these GPIOs in attached drivers can work. Export lookup table functions for modules. Signed-off-by: NAnatolij Gustschin <agust@denx.de> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 13 4月, 2017 1 次提交
-
-
由 Thierry Reding 提交于
Interrupt numbers are never negative, zero serves as the special invalid value. Signed-off-by: NThierry Reding <treding@nvidia.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 07 4月, 2017 1 次提交
-
-
由 Laxman Dewangan 提交于
Currently, the GPIO interface is said to Open Drain if it is Single Ended and active LOW. Similarly, it is said as Open Source if it is Single Ended and active HIGH. The active HIGH/LOW is used in the interface for setting the pin state to HIGH or LOW when enabling/disabling the interface. In Open Drain interface, pin is set to HIGH by putting pin in high impedance and LOW by driving to the LOW. In Open Source interface, pin is set to HIGH by driving pin to HIGH and set to LOW by putting pin in high impedance. With above, the Open Drain/Source is unrelated to the active LOW/HIGH in interface. There is interface where the enable/disable of interface is ether active LOW or HIGH but it is Open Drain type. Hence decouple the Open Drain with Single Ended + Active LOW and Open Source with Single Ended + Active HIGH. Adding different flag for the Open Drain/Open Source which is valid only when Single ended flag is enabled. Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 21 3月, 2017 1 次提交
-
-
由 Logan Gunthorpe 提交于
Replace the open coded registration of the cdev and dev with the new device_add_cdev() helper. The helper replaces a common pattern by taking the proper reference against the parent device and adding both the cdev and the device. Signed-off-by: NLogan Gunthorpe <logang@deltatee.com> Reviewed-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 17 3月, 2017 1 次提交
-
-
由 Andy Shevchenko 提交于
It's unusual to have error checking like (ret <= 0) in cases when counting GPIO resources. In case when it's mandatory we propagate the error (-ENOENT), otherwise we don't use the result. This makes consistent behaviour across all possible variants called in gpiod_count(). Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 14 3月, 2017 1 次提交
-
-
由 Andy Shevchenko 提交于
Remove extra 'l' in "successfull". Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 05 2月, 2017 1 次提交
-
-
由 Boris Brezillon 提交于
devm_fwnode_get_gpiod_from_child() currently allows GPIO users to request a GPIO that is defined in a child fwnode instead of directly in the device fwnode. Extend this API by adding the devm_fwnode_get_index_gpiod_from_child() helper which does the same except you can also specify an index in case the 'xx-gpios' property describe several GPIOs. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 31 1月, 2017 1 次提交
-
-
由 Christophe JAILLET 提交于
"if (!x) WARN_ON(x)" can never trigger. Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 26 1月, 2017 3 次提交
-
-
由 Mika Westerberg 提交于
Currently we already have two pin configuration related callbacks available for GPIO chips .set_single_ended() and .set_debounce(). In future we expect to have even more, which does not scale well if we need to add yet another callback to the GPIO chip structure for each possible configuration parameter. Better solution is to reuse what we already have available in the generic pinconf. To support this, we introduce a new .set_config() callback for GPIO chips. The callback takes a single packed pin configuration value as parameter. This can then be extended easily beyond what is currently supported by just adding new types to the generic pinconf enum. If the GPIO driver is backed up by a pinctrl driver the GPIO driver can just assign gpiochip_generic_config() (introduced in this patch) to .set_config and that will take care configuration requests are directed to the pinctrl driver. We then convert the existing drivers over .set_config() and finally remove the .set_single_ended() and .set_debounce() callbacks. Suggested-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Alexander Stein 提交于
Currently all users of fwnode_get_named_gpiod() have no way to specify a label for the GPIO. So GPIOs listed in debugfs are shown with label "?". With this change a proper label is used. Also adjust all users so they can pass a label, properly retrieved from device tree properties. Signed-off-by: NAlexander Stein <alexander.stein@systec-electronic.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: NJacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: NBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Acked-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
Make fwnode_get_named_gpiod() consistent with the rest of gpiod_get() like API, i.e. configure GPIO pin immediately after request. Besides obvious clean up it will help to configure pins based on firmware provided resources. Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 19 1月, 2017 1 次提交
-
-
由 Linus Walleij 提交于
The helper function for adding a GPIO chip compiles in a lockdep key for debugging, the same key is needed for nested chips as well. The macro construction is unreadable, replace this with two static inlines instead. The _gpiochip_irqchip_add prefixed function is not helpful, rename it with gpiochip_irqchip_add_key() that tell us what the function is actually doing. Fixes: d245b3f9 ("gpio: simplify adding threaded interrupts") Cc: Roger Quadros <rogerq@ti.com> Reported-by: NClemens Gruber <clemens.gruber@pqgruber.com> Reported-by: NRoger Quadros <rogerq@ti.com> Reported-by: NGrygorii Strashko <grygorii.strashko@ti.com> Tested-by: NClemens Gruber <clemens.gruber@pqgruber.com> Tested-by: NGrygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 11 1月, 2017 2 次提交
-
-
由 Stephen Boyd 提交于
container_of() does pointer math on the pointer that's passed in. If it were to return a NULL pointer the value passed in would need to be perfectly offset from 0 to make that so. Remove these checks because they don't make sense. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Andy Shevchenko 提交于
The macro for_each_set_bit() effectively looks up to the next set bit in array of bits. Instead of open coding that switch to for_each_set_bit() in gpio_chip_set_multiple(). While here, make gpio_chip_set_multiple() non-destructive against its parameters. We are safe since all callers, i.e. gpiod_set_array_value_complex(), handle that already. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 30 12月, 2016 1 次提交
-
-
由 Geert Uytterhoeven 提交于
When removing a gpiochip that uses GPIO hogging (e.g. by unloading the chip's DT overlay), a warning is printed: gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED This happens because gpiochip_free_hogs() is called after the gdev->chip pointer is reset to NULL. Hence __gpiod_free() cannot determine the chip in use, and cannot clear flags nor call the optional chip-specific .free() callback. Move the call to gpiochip_free_hogs() up to fix this. Cc: stable@vger.kernel.org Fixes: ff2b1359 ("gpio: make the gpiochip a real device") Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 07 12月, 2016 1 次提交
-
-
由 Lars-Peter Clausen 提交于
The GPIO chardev is used for management tasks (allocating line and event handles) and does neither support read() nor write() operations. Hence it does not make much sense to allow seek operations. Currently the chardev uses noop_llseek() for its seek implementation. This function does not move the pointer and simply returns the current position (always 0 for the GPIO chardev). noop_llseek() is primarily meant for devices that can not support seek, but where there might be a user that depends on the seek() operation succeeding. For newly added devices that can not support seek operations it is recommended to use no_llseek(), which will return an error. For more information see commit 6038f373 ("llseek: automatically add .llseek fop"). Unfortunately this was overlooked when the GPIO chardev ABI was introduced. But it is highly unlikely that since then userspace applications have appeared that rely on being able to perform non-failing seek operations on a GPIO chardev file descriptor. So it should be safe to change from noop_llseel() to no_seek(). Also use nonseekable_open() in the chardev open() callback to clear the FMODE_SEEK, FMODE_PREAD and FMODE_PWRITE flags from the file. Neither of these should be set on a file that does not support seek operations. Cc: stable@vger.kernel.org Fixes: 3c702e99 ("gpio: add a userspace chardev ABI for GPIOs") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 25 11月, 2016 1 次提交
-
-
由 Linus Walleij 提交于
This tries to simplify the use of CONFIG_GPIOLIB_IRQCHIP when using threaded interrupts: add a new call gpiochip_irqchip_add_nested() to indicate that we're dealing with a nested rather than a chained irqchip, then create a separate gpiochip_set_nested_irqchip() to mirror the gpiochip_set_chained_irqchip() call to connect the parent and child interrupts. In the nested case gpiochip_set_nested_irqchip() does nothing more than call irq_set_parent() on each valid child interrupt, which has little semantic effect in the kernel, but this is probably still formally correct. Update all drivers using nested interrupts to use gpiochip_irqchip_add_nested() so we can now see clearly which these users are. The DLN2 driver can drop its specific hack with .irq_not_threaded as we now recognize whether a chip is threaded or not from its use of gpiochip_irqchip_add_nested() signature rather than from inspecting .can_sleep. We rename the .irq_parent to .irq_chained_parent since this parent IRQ is only really kept around for the chained interrupt handlers. Cc: Lars Poeschel <poeschel@lemonage.de> Cc: Octavian Purdila <octavian.purdila@intel.com> Cc: Daniel Baluta <daniel.baluta@intel.com> Cc: Bin Gao <bin.gao@linux.intel.com> Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com> Cc: Semen Protsenko <semen.protsenko@globallogic.com> Cc: Alexander Stein <alexander.stein@systec-electronic.com> Cc: Phil Reid <preid@electromag.com.au> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 15 11月, 2016 3 次提交
-
-
由 Linus Walleij 提交于
When a GPIO line is marked as used for an interrupt, it is helpful to set the label to "interrupt" so we know what is going on when inspecting the lines. If a GPIO is already properly named by gpiod_get*() we don't need to do this. It only happens when a line is used from the irqchip side of a GPIO driver without communicating with the GPIO side, such as when gpiochip is used as interrupt provider in the device tree. If the line is still marked as used by "interrupt" when we unmark it as used by an interrupt, also remove this label from the descriptor. Also shape up the code around unmarking IRQ lines. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Linus Walleij 提交于
I saw weird values != [0,1] being passed down to drivers in their .set_direction_output() callbacks. Go over the gpiolib and make sure to hammer it to [0,1] before hitting the driver to avoid undesired side effects. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Linus Walleij 提交于
When locking a GPIO line as IRQ, we go to lengths to double-check that the line is really set as input before marking it as used for IRQ. This is not good on GPIO chips that can sleep, because this function is called in IRQ-safe context. Just skip this if it can't be checked quickly. Currently this happens on sleeping expanders such as STMPE or TC3589x: BUG: scheduling while atomic: swapper/1/0x00000002 Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.9.0-rc1+ #38 Hardware name: Nomadik STn8815 [<c000f2e0>] (unwind_backtrace) from [<c000d244>] (show_stack+0x10/0x14) [<c000d244>] (show_stack) from [<c0037b78>] (__schedule_bug+0x54/0x80) [<c0037b78>] (__schedule_bug) from [<c042df14>] (__schedule+0x3a0/0x460) [<c042df14>] (__schedule) from [<c042e028>] (schedule+0x54/0xb8) (...) This patch fixes that problem and relies on the direction read from the chip when it was added. Cc: stable@vger.kernel.org Fixes: 9c10280d ("gpio: flush direction status in gpiochip_lock_as_irq()") Cc: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 01 11月, 2016 1 次提交
-
-
由 Lars-Peter Clausen 提交于
When allocating a new line handle or event a file is allocated that it is associated to. The file is attached to a file descriptor of the current process and the file descriptor is returned to userspace using copy_to_user(). If this copy operation fails the line handle or event allocation is aborted, all acquired resources are freed and an error is returned. But the file struct is not freed and left attached to the userspace application and even though the file descriptor number was not copied it is trivial to guess. If a userspace application performs a IOCTL on such a left over file descriptor it will trigger a use-after-free and if the file descriptor is closed (latest when the application exits) a double-free is triggered. anon_inode_getfd() performs 3 tasks, allocate a file struct, allocate a file descriptor for the current process and install the file struct in the file descriptor. As soon as the file struct is installed in the file descriptor it is accessible by userspace (even if the IOCTL itself hasn't completed yet), this means uninstalling the fd on the error path is not an option, since userspace might already got a reference to the file. Instead anon_inode_getfd() needs to be broken into its individual steps. The allocation of the file struct and file descriptor is done first, then the copy_to_user() is executed and only if it succeeds the file is installed. Since the file struct is reference counted it can not be just freed, but its reference needs to be dropped, which will also call the release() callback, which will free the state attached to the file. So in this case the normal error cleanup path should not be taken. Cc: stable@vger.kernel.org Fixes: d932cd49 ("gpio: free handles in fringe cases") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 21 10月, 2016 8 次提交
-
-
由 Lars-Peter Clausen 提交于
The GPIO_GET_LINEEVENT_IOCTL currently ignores unknown or undefined linehandle and lineevent flags. From a backwards and forwards compatibility viewpoint it is highly desirable to reject unknown flags though. On one hand an application that is using newer flags and is running on an older kernel has no way to detect if the new flags were handled correctly if they are silently discarded. On the other hand an application that (accidentally) passes undefined flags will run fine on an older kernel, but may break on a newer kernel when these flags get defined. Ensure that requests that have undefined flags set are rejected with an error, rather than silently discarding the undefined flags. Cc: stable@vger.kernel.org Fixes: 61f922db ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The GPIO_GET_LINEHANDLE_IOCTL currently ignores unknown or undefined linehandle flags. From a backwards and forwards compatibility viewpoint it is highly desirable to reject unknown flags though. On one hand an application that is using newer flags and is running on an older kernel has no way to detect if the new flags were handled correctly if they are silently discarded. On the other hand an application that (accidentally) passes undefined flags will run fine on an older kernel, but may break on a newer kernel when these flags get defined. Ensure that requests that have undefined flags set are rejected with an error, rather than silently discarding the undefined flags. Cc: stable@vger.kernel.org Fixes: d7c51b47 ("gpio: userspace ABI for reading/writing GPIO lines") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The GPIOHANDLE_GET_LINE_VALUES_IOCTL handler allocates a gpiohandle_data struct on the stack and then passes it to copy_to_user(). But depending on the number of requested line handles the struct is only partially initialized. This exposes the previous, potentially sensitive, stack content to the issuing userspace application. To avoid this make sure that the struct is fully initialized. Cc: stable@vger.kernel.org Fixes: d7c51b47 ("gpio: userspace ABI for reading/writing GPIO lines") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The line offset that is used as an index into the descs array is provided by userspace and might go beyond the bounds of the array. If that happens undefined behavior will occur. Make sure that the offset is within the bounds of the desc array and reject any requests that specify a value outside of it. Cc: stable@vger.kernel.org Fixes: 61f922db ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The GPIOHANDLE_GET_LINE_VALUES_IOCTL handler allocates a gpiohandle_data struct on the stack and then passes it to copy_to_user(). But only the first element of the values array in the struct is set, which leaves the struct partially initialized. This exposes the previous, potentially sensitive, stack content to the issuing userspace application. To avoid this make sure that the struct is fully initialized. Cc: stable@vger.kernel.org Fixes: 61f922db ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The line offset that is used as an index into the descs array is provided by userspace and might go beyond the bounds of the array. If that happens undefined behavior will occur. Make sure that the offset is within the bounds of the desc array and reject any requests that specify a value outside of it. Cc: stable@vger.kernel.org Fixes: d7c51b47 ("gpio: userspace ABI for reading/writing GPIO lines") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The GPIO_GET_CHIPINFO_IOCTL handler allocates a gpiochip_info struct on the stack and then passes it to copy_to_user(). But depending on the length of the GPIO chip name and label the struct is only partially initialized. This exposes the previous, potentially sensitive, stack content to the issuing userspace application. To avoid this make sure that the struct is fully initialized. Cc: stable@vger.kernel.org Fixes: 521a2ad6 ("gpio: add userspace ABI for GPIO line information") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
由 Lars-Peter Clausen 提交于
The current line offset validation is off by one. Depending on the data stored behind the descs array this can either cause undefined behavior or disclose arbitrary, potentially sensitive, memory to the issuing userspace application. Make sure that offset is within the bounds of the desc array. Cc: stable@vger.kernel.org Fixes: 521a2ad6 ("gpio: add userspace ABI for GPIO line information") Signed-off-by: NLars-Peter Clausen <lars@metafoo.de> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 04 10月, 2016 1 次提交
-
-
由 Linus Walleij 提交于
The generic GPIO library directly implement code for acpi_find_gpio() which is only used with CONFIG_ACPI. This was probably done because OF did the same thing, but I removed that so remove this too. Rename the internal acpi_find_gpio() in gpiolib-acpi.c to acpi_populate_gpio_lookup() which seems to be more appropriate anyway so as to avoid a namespace clash with the same function. Make the stub return -ENOENT rather than -ENOSYS (as that is for syscalls!). For some reason the sunxi pin control driver was including the private gpiolib header, it works just fine without it so remove that oneliner. Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 03 10月, 2016 1 次提交
-
-
由 Linus Walleij 提交于
The generic GPIO library directly implement code for of_find_gpio() which is only used with CONFIG_OF and causes compilation problems on archs that do not even have stubs for OF functions, especially on UM that does not implement any IO remap functions. Move the function to gpiolib-of.c, implement a static inline stub in gpiolib.h returning PTR_ERR(-ENOENT) if CONFIG_OF_GPIO is not set and be done with it. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 23 9月, 2016 1 次提交
-
-
由 Mika Westerberg 提交于
When using GPIO irqchip helpers to setup irqchip for a gpiolib based driver, it is not possible to select which GPIOs to add to the IRQ domain. Instead it just adds all GPIOs which is not always desired. For example there might be GPIOs that for some reason cannot generated normal interrupts at all. To support this we add a flag irq_need_valid_mask to struct gpio_chip. When this flag is set the core allocates irq_valid_mask that holds one bit for each GPIO the chip has. By default all bits are set but drivers can manipulate this using set_bit() and clear_bit() accordingly. Then when gpiochip_irqchip_add() is called, this mask is checked and all GPIOs with bit is set are added to the IRQ domain created for the GPIO chip. Suggested-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-
- 13 9月, 2016 1 次提交
-
-
由 Mika Westerberg 提交于
Follow DT and forbid default trigger if the GPIO irqchip device is enumerated from ACPI. Triggering for these devices will be configured automatically from ACPI interrupt resources provided by the BIOS. Suggested-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
-