aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/gpio.c
AgeCommit message (Collapse)Author
2017-02-22Merge tag 'staging-4.11-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging/iio driver updates from Greg KH: "Here is the big staging and iio driver patchsets for 4.11-rc1. We almost broke even this time around, with only a few thousand lines added overall, as we removed the old and obsolete i4l code, but added some new drivers for the RPi platform, as well as adding some new IIO drivers. All of these have been in linux-next for a while with no reported issues" * tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (669 commits) Staging: vc04_services: Fix the "space prohibited" code style errors Staging: vc04_services: Fix the "wrong indent" code style errors staging: octeon: Use net_device_stats from struct net_device Staging: rtl8192u: ieee80211: ieee80211.h - style fix Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix Staging: rtl8192u: ieee80211: rtl819x_BAProc.c - style fix Staging: rtl8192u: ieee80211: ieee80211_module.c - style fix Staging: rtl8192u: ieee80211: rtl819x_TSProc.c - style fix Staging: rtl8192u: r8192U.h - style fix Staging: rtl8192u: r8192U_core.c - style fix Staging: rtl8192u: r819xU_cmdpkt.c - style fix staging: rtl8192u: blank lines aren't necessary before a close brace '}' staging: rtl8192u: Adding space after enum and struct definition staging: rtl8192u: Adding space after struct definition Staging: ks7010: Add required and preferred spaces around operators Staging: ks7010: ks*: Remove redundant blank lines Staging: ks7010: ks*: Add missing blank lines after declarations staging: visorbus, replace init_timer with setup_timer staging: vt6656: rxtx.c Removed multiple dereferencing staging: vt6656: Alignment match open parenthesis ...
2017-02-12staging: greybus: fix "line over 80 characters" coding style issuesGioh Kim
This patch fixes only obvious lines. There are still more issues. Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-26pinctrl / gpio: Introduce .set_config() callback for GPIO chipsMika 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: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-01-16staging: greybus: fix checkpatch unsigned warningsRoman Sommer
Fix checkpatch warnings for parameter type unsigned in greybus. Note that this patch does not fix all checkpatch warnings for the affected files. Signed-off-by: Christian Bewermeyer <christian.bewermeyer@fau.de> Signed-off-by: Roman Sommer <roman.sommer@fau.de> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-17Staging: greybus: gpio: Use gbphy_dev->dev instead of bundle->devViresh Kumar
Some of the print messages are using the incorrect device pointer, fix them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27drivers/staging/greybus: gpio.c - Fixed a checkpatch generated warningChase Metzger
Removed braces for single line if statement. Signed-off-by: Chase Metzger <chasemetzger15@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-19staging: greybus: gpio: remove KERNEL_VERSION checksGreg Kroah-Hartman
No need to support older kernel versions in the Greybus GPIO driver, so remove the checks as needed, we can now rely on all of the correct GPIO core apis being present. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-09-05greybus: gpio: create irqdomain before registering gpio controllerViresh Kumar
If a gpio line is getting used for an irq, gpio core will create /proc/irq/X/gpiolib/ directory for it. This directory gets removed while the gpio controller is unregistered. In case of greybus, gb_gpio_irqchip_add() creates an irqdomain and creates irq mappings for the gpio lines. Currently they are added after registering the gpio controller and removed before the gpio controller is removed. On the removal path, while the core tries to remove the irq directory (/proc/irq/X), it finds that the irq is still getting used and a "gpiolib" directory is present within it and so it gives this warning: Steps to reproduce: $ cd /sys/class/gpio $ echo X > export $ echo both > gpioX/edge $ echo <interface-number> > /sys/bus/greybus/devices/1-svc/intf_eject [ 139.171436] ------------[ cut here ]------------ [ 139.171468] WARNING: at /home/vireshk/all/work/repos/ara/arche/kernel/arche/fs/proc/generic.c:552 remove_proc_entry+0x154/0x188() [ 139.171476] remove_proc_entry: removing non-empty directory 'irq/683', leaking at least 'gpiolib' [ 139.171589] Modules linked in: gb_vibrator(O) gb_usb(O) gb_uart(O) gb_spi(O) gb_sdio(O) gb_raw(O) gb_pwm(O) gb_power_supply(O) gb_loopback(O) gb_log(O) gb_light(O) gb_i2c(O) gb_hid(O) gb_gpio(O) gb_gbphy(O) gb_firmware(O) gb_spilib(O) gb_es2(O) gb_camera(O) gb_bootrom(O) gb_audio_module(O) gb_audio_manager(O) gb_audio_codec(O) gb_audio_gb(O) gb_audio_apbridgea(O) gb_arche(O) greybus(O) [ 139.171605] CPU: 1 PID: 280 Comm: kworker/u16:4 Tainted: G W O 3.10.83-g9771b10cbeed #107 [ 139.171652] Workqueue: greybus1:svc gb_svc_intf_set_power_mode [greybus] [ 139.171657] Call trace: [ 139.171677] [<ffffffc000207b40>] dump_backtrace+0x0/0x268 [ 139.171689] [<ffffffc000207db8>] show_stack+0x10/0x1c [ 139.171707] [<ffffffc000ccad78>] dump_stack+0x1c/0x28 [ 139.171723] [<ffffffc00021f9dc>] warn_slowpath_common+0x74/0x9c [ 139.171735] [<ffffffc00021fa60>] warn_slowpath_fmt+0x5c/0x80 [ 139.171747] [<ffffffc00035fa38>] remove_proc_entry+0x150/0x188 [ 139.171763] [<ffffffc00027464c>] unregister_irq_proc+0xb4/0xdc [ 139.171779] [<ffffffc00026e3f4>] free_desc+0x2c/0x70 [ 139.171791] [<ffffffc00026e48c>] irq_free_descs+0x54/0x9c [ 139.171802] [<ffffffc000273448>] irq_dispose_mapping+0x54/0x64 [ 139.171814] [<ffffffbffc0621e8>] 0xffffffbffc0621e8 [ 139.171825] [<ffffffbffc05e01c>] 0xffffffbffc05e01c [ 139.171843] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4 [ 139.171854] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38 [ 139.171867] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148 [ 139.171878] [<ffffffc0005d1cb0>] device_del+0x108/0x16c [ 139.171888] [<ffffffc0005d1d64>] device_unregister+0x50/0x68 [ 139.171901] [<ffffffbffc05e2bc>] gb_gbphy_deregister_driver+0xf0/0x4ec [gb_gbphy] [ 139.171924] [<ffffffbffc0014c4>] greybus_disabled+0x14c4/0x1760 [greybus] [ 139.171936] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4 [ 139.171948] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38 [ 139.171959] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148 [ 139.171969] [<ffffffc0005d1cb0>] device_del+0x108/0x16c [ 139.171992] [<ffffffbffc004cec>] gb_bundle_destroy+0x7c/0x1b0 [greybus] [ 139.172017] [<ffffffbffc004074>] gb_interface_disable+0xb4/0x178 [greybus] [ 139.172040] [<ffffffbffc002ae4>] gb_module_del+0x5c/0xf8 [greybus] [ 139.172063] [<ffffffbffc008418>] gb_svc_intf_set_power_mode+0xea0/0xfe8 [greybus] [ 139.172078] [<ffffffc00023888c>] process_one_work+0x268/0x3c8 [ 139.172089] [<ffffffc000239a64>] worker_thread+0x204/0x358 [ 139.172108] [<ffffffc00023f43c>] kthread+0xb8/0xc4 [ 139.172114] ---[ end trace 6fa3314e8c6157ca ]--- Also note that registering the gpio controller before creating irqdomain is incorrect as well and may lead to kernel panic, as a gpio may get requested as an interrupt source right after the controller is registered, and the greybus gpio driver wouldn't be fully ready by then. This patch changes the sequence in both probe() and remove() to fix it. Fixes: 426e88a47d39 ("greybus: gpio: add interrupt handling support") Reported-by: David Hsu <davidhsu@google.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-14greybus: gpio: Add runtime_pm suppourtAxel Haslam
Add runtime pm support for the gpio driver. Since there is no remote wakeup support, the module will not suspend as long as a gpio is requested. Maybe an optimization could be made, to allow suspend if all the requested gpios are in output mode, since the bridge should maintain the state of the gpio during suspend. Testing Done: using the test board, let the gpbrige enter standby and request a gpio. Signed-off-by: Axel Haslam <haslam_axel@projectara.com> Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
2016-06-10greybus: Remove extra blank linesViresh Kumar
This patch removes few blank lines across the repository at places where two blank lines were present together or when a blank line is present at the start or end of a routine. Note that this doesn't remove most of them from greybus_protocols.h as they were added on purpose. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-31greybus: gbphy: Remove protocol specific version handlingViresh Kumar
We should be using the generic version handling at bundle level, instead of at protocol level for bridged PHY devices as well. The bundle version handling is already in place, though it is *not* used today as we haven't bumped the version of control protocol yet. Remove protocol specific handling for bridged PHY devices. Tested on EVT 1.5 with gpbridge-test module. No nuttx changes are required with this. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-19greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhereSandeep Patil
The 'gpbridge' name didn't relaly reflect what the bus is; which is a bus for bridged-phy devices. So, rename all instances of 'gpbridge' to more appropriate 'gbphy' Testing Done: Build and boot tested. 'lsgb' will stop displaying 'GPBridge' devices until I change the library to reflect this change. Signed-off-by: Sandeep Patil <patil_sandeep@projectara.com> Suggested-by: Greg Kroah-Hartman <gregkh@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14greybus: gpio: Create separate moduleViresh Kumar
Create separate module for gpio gpbridge driver. Tested on EVT 1.5 by inserting GP test module, all the devices were enumerated correctly. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-05greybus: GPIO: convert to a gpbridge driverGreg Kroah-Hartman
This converts the GPIO driver to be a gpbridge driver, moving it away from the "legacy" interface. Testing Done: Tested on gbsim. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> [vaibhav.hiremath@linaro.org: 1.Changed code to retain init/exit fns of drivers. 2.Exit path fix. 3. Fixed review comments] Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-22greybus: convert drivers to use connection->private set/getGreg Kroah-Hartman
This converts all drivers to use the gb_connection_get_data() and gb_connection_set_data() functions to make it a bit more explicit as to what is going on. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-03greybus: gpbridge.h: move protocol init/exit prototypesGreg Kroah-Hartman
Create gpbridge.h for the gpbridge-specific function prototypes, the rest of the greybus drivers don't care about them. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2016-02-24greybus: gpio: handle api changes for 4.5 kernel releaseGreg Kroah-Hartman
In kernel version 4.5, struct gpio_chip renamed the field 'dev' to 'parent' so handle this properly. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-24greybus: gpio: use bundle device for error messagesGreg Kroah-Hartman
Use the bundle device directly in gpio error messages instead of the gpio device, as they are the same pointer. This will make future gpio api changes much easier to handle. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-15greybus: gpio: use the bundle struct device instead of the connectorGreg Kroah-Hartman
We are removing struct device from the gb_connection structure in the near future. The gb_bundle structure's struct device should be used as a replacement. This patch moves the gpio driver to use the bundle pointer instead of the connection pointer. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org>
2015-10-14greybus: gpio: handle set_irq_flags api changeJohan Hovold
The ARM-specific set_irq_flags helper has been removed in 4.3. Instead of doing conditional compilation on the kernel version to avoid build breakages, simply use the genirq interface directly. Suggested-by: Rob Herring <rob.herring@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-01greybus: gpio: fix generic_handle_irq_desc api changeRui Miguel Silva
The generic_handle_irq_desc api only have changed in 4.3.0, so check against the correct version, if not will break builds for 4.2.x. Fixes: e7895cfc476 ("gpio: handle api change in generic_handle_irq_desc()") Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-30greybus: gpio: handle api change in generic_handle_irq_desc()Greg Kroah-Hartman
generic_handle_irq_desc changed the api in the 4.2 kernel, so fix up the gpio driver to handle this properly to keep it working. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11greybus: gpio: Drop get_version supportViresh Kumar
This is done from a common place now, no need to replicate it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-10greybus: gpio: Use (already defined) major/minor macrosViresh Kumar
We already have macros for these, use them instead of writing fixed values. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-10greybus: gpio: Print expected/actual payload size on mismatchViresh Kumar
Print (expected-payload-size actual-payload-size), when the size doesn't match for requests received by the module. This gives more details required for debugging the issue. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-01greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()Viresh Kumar
This macro is also required by core protocols like control and svc, and hence the 'gpbridge' name doesn't fit anymore. Lets call this macro gb_builtin_protocol_driver(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-28greybus: gpio: add irq-type definesJohan Hovold
Add Greybus GPIO IRQ-type defines rather than rely on the current Linux implementation. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: fix interrupt protocolJohan Hovold
The current interrupt implementation uses the simple irq-flow handler, which means that the interrupt subsystem makes no irq-chip callbacks when handling an interrupt. Specifically, no end-of-interrupt message is sent when the threaded handler has run. This means that we may currently re-enable an interrupt before it has been serviced (i.e. the irq-event operation may complete before the threaded handler has run). The simple flow handler also silently drops a second interrupt arriving while a handler is running. This means that we may lose a second edge interrupt with the current firmware. Switch to a new one-shot interrupt protocol, where the primary handler (firmware) always masks and acks an interrupt before sending an event to the AP. The AP is responsible for unmasking the interrupt when it has been handled. By having the firmware ack an edge interrupt before sending the event, a second edge interrupt will no longer get lost. This one-shot protocol can be implemented in the kernel by using the level irq-flow handler, one-shot interrupts with threaded handlers and bus-lock synchronisation for slow buses. Note that the same flow handler is used for both edge and level interrupts. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: fix atomic sleep when using interruptsJohan Hovold
The irq-chip callbacks are made in atomic context where we must not do any synchronous greybus operations. Fix the current gpio-interrupt implementation by using the bus-lock functionality provided by the irq subsystem. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: rename irq mask and unmask callbacksJohan Hovold
Rename irq mask and unmask functions to match the callback names. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: use irq-domain lookupsJohan Hovold
Use irq_find_mapping directly rather than go through the legacy gpio interface. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: don't call irq-flow handler directlyJohan Hovold
Use generic_handle_irq_desc rather than call a hardcoded irq-flow handler directly. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: remove unused irq-ack operationJohan Hovold
Remove unused irq-ack operation, which has never been called and does not make sense for message-signalled interrupts over slow buses. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-26greybus: gpio: fix debugfs outputJohan Hovold
Fix debugfs output by removing the unimplemented, custom dbg_show callback. The default implementation is perfectly sufficient. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-23greybus: include "gpbridge.h" from "greybus.h"Alex Elder
Avoid the need for all the source files to include "gpbridge.h" by just having "greybus.h" include it. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-20greybus: Use gb_gpbridge_protocol_init()Viresh Kumar
Start using gb_gpbridge_protocol_init() in gpbridge drivers. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-20greybus: gpio: fix tab/space mistakeViresh Kumar
Spaces were present in place of tab. Fix that. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-10greybus: Move briged phy structure definitions into gpbridge.hJohn Stultz
In order to facilitate re-use of the gpio, i2c, pwm and i2s structures, split them out of independent files and add them into a shared gpbridge.h This will be a prereq to sharing these headers w/ gbsim. Cc: Alex Elder <alex.elder@linaro.org> Cc: Greg Kroah-Hartman <gregkh@google.com> CC: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-03-30greybus: operation: refactor response handlingJohan Hovold
Send response to incoming requests from the operation request handler rather than in every protocol request_recv callback. This simplifies request_recv error handling and allows for further code reuse. Note that if we ever get protocols that need to hold off sending responses we could implement this by letting them return a special value (after acquiring the necessary operation references) to suppress the response from being sent by greybus core. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: gpio: fix missing response on request errorsJohan Hovold
Send response also to incoming requests that cannot be fulfilled. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: gpio: fix null-deref on unexpected irq requestsJohan Hovold
Fix null-pointer dereference on failure to look up irq due to missing error handling. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: gpio: fix null-deref on short irq requestsJohan Hovold
Make sure to verify the length of incoming requests before trying to parse the request buffer, which can even be NULL on empty requests. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: add error messages to callbacks not propagating errorsJohan Hovold
Add error messages on failures to deactivate, set and get operation handlers as any errors would not be detected by the upper layers (either because the callbacks are declared void or expected to return a boolean value). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: refuse to set value of input pinsJohan Hovold
Add warning and refuse to set output value for pin configured as input, as the result of such an operation is undefined. Remove incorrect todo-comment suggesting that the driver could implicitly switch direction as part of the call. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: clean up line-state allocationJohan Hovold
Clean up allocation of line-state array. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: use dev_err and dev_warnJohan Hovold
Use the more informative dev_err and dev_warn for messages, and make the messages more uniform. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: fix error handlingJohan Hovold
Make sure to propagate any errors detected up the call chain. This specifically means that we will detect failed connection init, something which is now handled more gracefully by greybus core. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: make gb_gpio_controller pointer naming consistentJohan Hovold
Rename all struct gb_gpio_controller-pointer variables "ggc" for consistency and readability reason. This also fixes a bunch of lines that exceeded the 80 columns limit. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: remove unnecessary explicit castJohan Hovold
Remove unnecessary explicit cast of line value. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: gpio: remove overly defensive argument verificationJohan Hovold
Remove overly defensive argument verification in gpio-chip callbacks. We should trust gpiolib to get this right (or we would not even get any callback) just like the other gpio drivers do. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>