aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-max732x.c
AgeCommit message (Collapse)AuthorFilesLines
2015-08-26gpio: max732x: Fix error handling in probe()Nicholas Krause1-3/+8
This fixes error handling in the function max732x_probe by checking if the calls to the function max732x_readb fail by returning a error code. Signed-off-by: Nicholas Krause <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-07-16gpio: max732x: Add missing dev reference to gpiochipMarek Vasut1-0/+1
In case the gpiochip doesn't have the .dev field set, as is the case in here, it is not possible to reference this device in DT as a GPIO controller. A good example of this problem is that gpio-leds can not be used when connected to this chip, the gpio-leds driver bails out with -EPROBE_DEFER. Fix this problem by setting the .dev field of the gpio_chip to the parent i2c device. Signed-off-by: Marek Vasut <[email protected]> Cc: Alexandre Courbot <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Mans Rullgard <[email protected]> Cc: Olaf Mandel <[email protected]> Cc: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-05-06gpio: max732x: Fix irq-events handlerSemen Protsenko1-1/+1
MAX732X clears all pending interrupts on I2C read (when interrupts register is being read). Driver doesn't need to send any ACKs when interrupt was handled. So replace handle_edge_irq() with handle_simple_irq(). Using handle_edge_irq() (w/o .irq_ack callback set) may lead to NULL pointer dereference in some cases. E.g. this was observed on hibernation process: Unable to handle kernel NULL pointer dereference at virtual address 0 Backtrace: (handle_edge_irq) from (resend_irqs) (resend_irqs) from (tasklet_action) (tasklet_action) from (__do_softirq) (__do_softirq) from (run_ksoftirqd) (run_ksoftirqd) from (smpboot_thread_fn) (smpboot_thread_fn) from (kthread) (kthread) from (ret_from_fork) Signed-off-by: Semen Protsenko <[email protected]> Reviewed-by: Grygorii Strashko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-05-06gpio: max732x: Add IRQF_SHARED to irq flagsSemen Protsenko1-6/+4
It's possible that multiple MAX732X can be hooked up to the same interrupt line with the processor. So add IRQF_SHARED in requesting irq. Signed-off-by: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-05-04gpio: max732x: Propagate wake-up setting to parent irq controllerSemen Protsenko1-0/+9
Set .irq_set_wake callback to prevent possible issues on wake-up. This patch was inspired by this commit: b80eef95beb04760629822fa130aeed54cdfafca Signed-off-by: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-03-02gpio: max732x: convert to GPIOLIB_IRQCHIPLinus Walleij1-92/+42
Take a sweep to bring the irq support for the MAX732x expanders into the gpiolib core to cut down on duplicated code. Only compile tested! I need some feedback from people using this expander with interrupts to tell me if things go right or wrong when I do this. Cc: Semen Protsenko <[email protected]> Cc: Mans Rullgard <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-02-03gpio: max732x: use an inline function for container castLinus Walleij1-15/+10
Cast the struct gpio_chip into a max732x_chip using an inline macro and move the assignment to the variable declaration to save lines and simplify things. Cc: Semen Protsenko <[email protected]> Acked-by: Mans Rullgard <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-01-30gpio: max732x: add set_multiple functionMans Rullgard1-3/+25
This adds a set_multiple function to the MAX732x GPIO driver, allowing for performance gains when using gpiod_set_array(). Signed-off-by: Mans Rullgard <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-01-15gpio: max732x: Fix possible deadlockSemen Protsenko1-1/+11
This patch was derived from next one: "gpio: fix pca953x set_type 'scheduling while atomic' bug". After adding entry that consumes max732x GPIO as interrupt line to dts file, deadlock appears somewhere in max732x probe function. Deadlock caught by lockdep (from kernel log): <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< cut here >>>>>>>>>>>>>>>>>>>>>>>>>>> [ 0.473419] ====================================================== [ 0.473419] [ INFO: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected ] [ 0.473449] 3.x.xx-xxxxx-xxxxxxxx-dirty #2 Tainted: G W [ 0.473449] ------------------------------------------------------ [ 0.473449] swapper/0/1 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: [ 0.473449] (&lock->wait_lock){+.+...}, at: [<c072e350>] rt_mutex_trylock+0xc/0x74 [ 0.473480] [ 0.473480] and this task is already holding: [ 0.473510] (&chip->lock){......}, at: [<c0314514>] max732x_gpio_set_value+0x2c/0xa4 [ 0.473541] which would create a new lock dependency: [ 0.473541] (&chip->lock){......} -> (&lock->wait_lock){+.+...} ... [ 0.474273] *** DEADLOCK *** [ 0.474273] [ 0.474273] 5 locks held by swapper/0/1: [ 0.474273] #0: (&__lockdep_no_validate__){......}, at: [<c03b2328>] __driver_attach+0x48/0x98 [ 0.474304] #1: (&__lockdep_no_validate__){......}, at: [<c03b2338>] __driver_attach+0x58/0x98 [ 0.474334] #2: (&chip->irq_lock){+.+...}, at: [<c0313e3c>] max732x_irq_bus_lock+0x14/0x20 [ 0.474365] #3: (&irq_desc_lock_class){-.....}, at: [<c00a65a4>] __irq_get_desc_lock+0x48/0x88 [ 0.474365] #4: (&chip->lock){......}, at: [<c0314514>] max732x_gpio <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< cut here >>>>>>>>>>>>>>>>>>>>>>>>>>> Signed-off-by: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-01-15gpio: max732x: Rewrite IRQ code to use irq_domain APISemen Protsenko1-35/+65
Signed-off-by: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2015-01-15gpio: max732x: Add device tree supportSemen Protsenko1-11/+51
Signed-off-by: Semen Protsenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2014-07-22gpio: remove all usage of gpio_remove retval in driver/gpioabdoulaye berthe1-6/+1
Signed-off-by: abdoulaye berthe <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2014-03-12gpio: max732x: Fix possible NULL pointer dereference on i2c_new_dummy errorKrzysztof Kozlowski1-0/+7
In max732x_probe() driver allocates dummy I2C device (if number of ports is greater than 8) with i2c_new_dummy() but it does not check the return value of this call. In case of error (i2c_new_device(): memory allocation failure or I2C address cannot be used) this function returns NULL which is later dereferenced by i2c_smbus_read_byte() (called from max732x_readb()). Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2014-03-12gpio: max732x: Fix I2C dummy device resource leak on probe failureKrzysztof Kozlowski1-0/+2
In max732x_probe() driver allocates dummy I2C device (if number of ports is greater than 8) however it is not unregistered if probe fails later. Fix the leak by unregistering dummy I2C device if it was allocated. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2013-12-04gpio/pinctrl: make gpio_chip members typed booleanLinus Walleij1-1/+1
This switches the two members of struct gpio_chip that were defined as unsigned foo:1 to bool, because that is indeed what they are. Switch all users in the gpio and pinctrl subsystems to assign these values with true/false instead of 0/1. The users outside these subsystems will survive since true/false is 1/0, atleast we set some kind of more strict typing example. Signed-off-by: Linus Walleij <[email protected]>
2013-08-16gpio: use dev_get_platdata()Jingoo Han1-4/+4
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2013-03-27gpio: max732x: use devm_kzalloc()Jingoo Han1-3/+2
Use devm_kzalloc() to make cleanup paths simpler. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2012-11-28gpio: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: Grant Likely <[email protected]> Acked-by: Linus Walleij <[email protected]> Cc: Peter Tyser <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-28gpio: remove use of __devinitBill Pemberton1-2/+2
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: Grant Likely <[email protected]> Cc: Peter Tyser <[email protected]> Cc: Santosh Shilimkar <[email protected]> Cc: Kevin Hilman <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-28gpio: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: Grant Likely <[email protected]> Cc: Peter Tyser <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2011-06-06gpio: reorganize driversGrant Likely1-0/+714
Sort the gpio makefile and enforce the naming convention gpio-*.c for gpio drivers. v2: cleaned up filenames in Kconfig and comment blocks v3: fixup use of BASIC_MMIO to GENERIC_GPIO for mxc Signed-off-by: Grant Likely <[email protected]>