This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit call to gpiochip_irqchip_add().
The irqchip is instead added while adding the gpiochip.
Also move the IRQ initialization to the special .init_hw()
callback.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20200722101938.151265-1-linus.walleij@linaro.org
Change the handling of pin config flags from if/else to switch
statement to make the code more readable and cleaner.
Suggested-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Drew Fustini <drew@beagleboard.org>
Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200722120755.230741-1-drew@beagleboard.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add(). The irqchip is
instead added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Octavian Purdila <octavian.purdila@nxp.com>
Link: https://lore.kernel.org/r/20200722073426.38890-1-linus.walleij@linaro.org
* Move GPIO PMIC drivers to use IRQ chip template
* Introduce for_each_requested_gpio() and convert existing users
* Replace unsigned by unsigned int in few drivers
* Fix an issue in kernel doc that validator complains about
* Move to verbose debug level the IRQ status message in gpio-pch
The following is an automated git shortlog grouped by driver:
ARM/orion/gpio:
- Make use of for_each_requested_gpio()
crystalcove:
- Use irqchip template
- changed every 'unsigned' to 'unsigned int'
gpiolib:
- Introduce for_each_requested_gpio_in_range() macro
gpio-ml-ioh:
- Fix missing ':' in 'struct ioh_gpio_reg_data
ich:
- changed every 'unsigned' to 'unsigned int'
mvebu:
- Make use of for_each_requested_gpio()
pch:
- Add a blank line between declaration and code
- changed every 'unsigned' to 'unsigned int'
- Move IRQ status message to verbose debug level
pinctrl:
- at91: Make use of for_each_requested_gpio()
sch:
- Add a blank line between declaration and code
- changed every 'unsigned' to 'unsigned int'
wcove:
- Use irqchip template
xra1403:
- Make use of for_each_requested_gpio()
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAl8YPvwACgkQb7wzTHR8
rCgX6w/+MOk7PmVOHlYNrc7UiOnvVxpMbYRW/UpAXJ9r60FqnpeiwDh7Vqdonom5
TfQUfskHdKTQR1Ybo93HPJaKtxo601yu9PbV00pfB1uN9Nmj6pxQ+gXeFmV4Eov7
gKlqaKW2zIjF6Rrbs8Xa7O4UDnXLgIqKOguuGWyrHBywfkQKIz1i4/x0w/IOvyB6
ZM9n2iiEAysTGDOYsEvjKHAHgtruz+nQfqF5vWy6/6KBefuIUiHI6tbPXwkrhZ+x
xNsbkoyQvL95o0naDLfXoL8xZ9gxeQfr041405I96kZwtlOHsJSEule7fR39r4A6
4KKICJ0MwC03NyOaVpKeElffA1rfreZhNACFHEylcjauYrfEC84wXCSL0hOfa2Pe
7PBMlRMQmrO7MkBxlihsy0oUip+fDG+XoANnB/51dX62AEJTjNs8Adh4aI2adaXh
11bi9GjLxUJ+Myopf1wF5lWrDPRvXviEWFeMxPNAS/lJSWkCnAtm9UvZOPTgl4Ps
+vFs/oiORmsYUELcaVwnOsNsoLB+DOFHdH5K20H2n0fjch2th/n2Jph6lBcY6D9W
50pKighf/92gWMeOllTha0I/EOFNCBi57DnUsuiNkuZ7lQd0O05MAJ4GBsOmBuF8
sc4euGVU4mIvdn+bMNuN8c1vXJAWmPBfb1QiChXv9/BEVjZt0uI=
=txvs
-----END PGP SIGNATURE-----
Merge tag 'intel-gpio-v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into devel
intel-gpio for v5.9-1
* Move GPIO PMIC drivers to use IRQ chip template
* Introduce for_each_requested_gpio() and convert existing users
* Replace unsigned by unsigned int in few drivers
* Fix an issue in kernel doc that validator complains about
* Move to verbose debug level the IRQ status message in gpio-pch
The following is an automated git shortlog grouped by driver:
ARM/orion/gpio:
- Make use of for_each_requested_gpio()
crystalcove:
- Use irqchip template
- changed every 'unsigned' to 'unsigned int'
gpiolib:
- Introduce for_each_requested_gpio_in_range() macro
gpio-ml-ioh:
- Fix missing ':' in 'struct ioh_gpio_reg_data
ich:
- changed every 'unsigned' to 'unsigned int'
mvebu:
- Make use of for_each_requested_gpio()
pch:
- Add a blank line between declaration and code
- changed every 'unsigned' to 'unsigned int'
- Move IRQ status message to verbose debug level
pinctrl:
- at91: Make use of for_each_requested_gpio()
sch:
- Add a blank line between declaration and code
- changed every 'unsigned' to 'unsigned int'
wcove:
- Use irqchip template
xra1403:
- Make use of for_each_requested_gpio()
Added a lined between a declaration and other statements according to the
kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Changed 'unsigned' to 'unsigned int'.
This makes the code more uniform, and compliant with the kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Changed 'unsigned' to 'unsigned int'.
This makes the code more uniform, and compliant with the kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Cc: Bin Gao <bin.gao@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Changed 'unsigned' to 'unsigned int'.
This makes the code more uniform, and compliant with the kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Added a lined between a declaration and other statements according to the
kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Changed 'unsigned' to 'unsigned int'.
This makes the code more uniform, and compliant with the kernel coding style.
Signed-off-by: Abanoub Sameh <abanoubsameh@protonmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Adam Ford <aford173@gmail.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20200717144040.63253-1-linus.walleij@linaro.org
Modify omap_gpio_set_config() to handle pin config bias flags by calling
gpiochip_generic_config().
The pin group for the gpio line must have the corresponding pinconf
properties:
PIN_CONFIG_BIAS_PULL_UP requires "pinctrl-single,bias-pullup"
PIN_CONFIG_BIAS_PULL_DOWN requires "pinctrl-single,bias-pulldown"
This is necessary for pcs_pinconf_set() to find the requested bias
parameter in the PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map.
Signed-off-by: Drew Fustini <drew@beagleboard.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20200715213738.1640030-1-drew@beagleboard.org
Link: https://lore.kernel.org/r/20200717194043.1774643-1-drew@beagleboard.org
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Anders Darander <anders@chargestorm.se>
Cc: Roger Quadros <rogerq@ti.com>
Link: https://lore.kernel.org/r/20200717144835.68150-1-linus.walleij@linaro.org
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Cc: Nikolaus Voss <nv@vosn.de>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/20200716150502.195821-1-linus.walleij@linaro.org
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Roland Stigge <stigge@antcom.de>
Cc: Lars Poeschel <poeschel@lemonage.de>
Link: https://lore.kernel.org/r/20200716120318.127176-1-linus.walleij@linaro.org
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Alexandre TORGUE <alexandre.torgue@st.com>
Link: https://lore.kernel.org/r/20200716100638.112451-1-linus.walleij@linaro.org
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit calls to gpiochip_irqchip_add_nested() and
gpiochip_set_nested_irqchip(). The irqchip is instead
added while adding the gpiochip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20200716093459.76378-1-linus.walleij@linaro.org
Most other drivers fill out the gpio_irq_chip using a
struct gpio_irq_chip *girq helper variable for ease of
reading.
We also make a habit of explicitly assigning NULL and
zero to the parent IRQs when using ordinary IRQ handlers
in the driver, mostly for code readability and
maintenance.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Cc: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200716092835.69176-1-linus.walleij@linaro.org
This patch adds device tree bindings for the NXP PCA9570,
a 4-bit I2C GPO expander.
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20200630160934.1197066-1-mans0n@gorani.run
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
I noticed on Nexus 7 that after rebooting from downstream kernel to
upstream, the GPIO interrupt is triggering non-stop despite interrupts
being disabled for all of GPIOs. This happens because Nexus 7 uses a
soft-reboot, meaning that bootloader should take care of resetting
hardware, but the bootloader doesn't do it well. As a result, GPIO
interrupt may be left ON at a boot time. Let's mask all GPIO interrupts
at the driver's initialization time in order to resolve the issue.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-7-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This change addresses one of the GPIO-core TODOs for the MAX77620 driver
which requires modern drivers to use the irqchip template. Instead of
using the GPIO's irqchip-helpers for creating the IRQ domain, the
gpio_irq_chip structure is now filled by the driver itself and then
gpiochip_add_data() takes care of instantiating the IRQ domain for us.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-6-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
The platform_get_irq() returns a positive interrupt number on success and
negative error code on failure (zero shouldn't ever happen in practice, it
would produce a noisy warning). Hence let's return the error code directly
instead of overriding it with -ENODEV.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-5-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
The gpiochip_add_data() takes care of setting the of_node to the parent's
device of_node, hence there is no need to do it manually in the driver's
code. This patch corrects the parent's device pointer and removes the
unnecessary setting of the of_node.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-4-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
The requested interrupt is never released by the driver. Fix this by
using the resource-managed variant of request_threaded_irq().
Fixes: ab3dd9cc24 ("gpio: max77620: Fix interrupt handling")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: <stable@vger.kernel.org> # 5.5+
Link: https://lore.kernel.org/r/20200709171203.12950-3-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
The MAX77620_GPIO_NR enum value represents the total number of GPIOs,
let's use it instead of a raw value in order to improve the code's
readability a tad.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-2-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
- several improvements and minor tweaks to the GPIO character device code
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl8KyGQACgkQEacuoBRx
13L/IA/+PTpXnNNWZ7xu8elXRG5WV7+5QQM4TpNDmdac7CHYYej6B3iF60dtNtG3
pneS87GICkDhYaYjXKHkCX7OYzEHWrxY7E3avlUavsAMkyWTdzClkl+e+7ADaPsn
2n9UeeZ5p694m2w9vcamlEXRulHoR9j94pzZyDk6ps8Lsm9TGschasZzefeTJie/
oRo8SMx88BVmYB3a9bwZL6K92YdY3fIQaNZ/rMV56P0Vc57vW7ENWQBTVPMS6PAF
o/Kr2I0Zmdl+Z5TZWXaPtrry173y+DJ4XziCR0h6jHSPNDu1PIeC3zbKI5h/6d0B
nuFVarLmhD9wE8MOPP98WBqgOIqOgWfyIy5FNQSZ9YNe3G06XsvLkoPqEXB4oLwf
XoQpoC3de9tBc0TyEaqTFRgEn79ni0QAZP0W11CeGU57NKYfshZIBwRubIF+wp9J
MSH1zH0zrWqYcW7GN2r9wg2+Vm32XSu9z2HSfqtBeftPXyz9wjXiBcj9894c8n1q
l7CDDivTnu3s6V1gBHnGZWloCwTcKrnOEeonXZaDhmOOW2dcbifJ1LxSiBKzhi4T
W+L4fSrDxRRCVyzxgxijngufd61fj3KLc9aOLLJIdb7h4HnEDqtLOxB+g0IHlNpV
HLOI+4XoapjKxPz2iu3ZMoxhdX4ywgGmqDJQAtKVoG2IVDdYthw=
=HAhm
-----END PGP SIGNATURE-----
Merge tag 'gpio-updates-for-v5.9-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel
gpio updates for v5.9 - part 2
- several improvements and minor tweaks to the GPIO character device code
Fix bogus close warning that occurs when opening the character device
fails.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Fix bogus close warning that occurs when opening the character device
fails.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Fix bogus close warning that occurs when opening the character device
fails.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
The second line of the description for event_type is before the first.
Move it to after the first line.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Consolidate the cleanup of lineevents, currently duplicated in
lineevent_create and lineevent_release, into a helper function
lineevent_free.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Consolidate the cleanup of linehandles, currently duplicated in
linehandle_create and linehandle_release, into a helper function
linehandle_free.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Remove recalculation of offset from desc, where desc itself was calculated
from offset.
There is no benefit from the desc -> hwgpio conversion in this context.
The only implicit benefit of the offset -> desc -> hwgpio is
the range check in the offset -> desc, but where desc is required you
still get that, and where desc isn't required it is simpler to perform
the range check directly.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Merge separate usage of test_bit/set_bit into test_and_set_bit to remove
the possibility of a race between the test and set.
Similarly test_bit and clear_bit.
In the existing code it is possible for two threads to race past the
test_bit and then set or clear the watch bit, and neither return EBUSY.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Rename priv to cdev to improve readability.
The name "priv" indicates that the object is pointed to by
file->private_data, not what the object is actually is.
As it is always used to point to a struct gpio_chardev_data, renaming
it to cdev is more appropriate.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Replace usage of atomic_notifier_call_chain with
blocking_notifier_call_chain as the notifier function,
lineinfo_changed_notify, calls gpio_desc_to_lineinfo,
which calls pinctrl_gpio_can_use_line, which can sleep.
The chain isn't being called from an atomic context so the
the blocking notifier is a suitable substitute.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Remove pointless decrement of variable, and associated comment.
While i is used subsequently, it is re-initialized so this decrement
serves no purpose.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Rename numdescs to num_descs to be more consistent with the naming of
other counters and improve readability.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Rename 'filep' and 'filp' to 'file' to be consistent with other use
and improve readability.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Refactor the mapping from handle flags to desc flags into a helper
function.
The assign_bit is overkill where it is replacing the set_bit cases, as is
rechecking bits known to be clear in some circumstances, but the DRY
simplification more than makes up for any performance degradation,
especially as this is not a hot path.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Make indentation consistent with other use to improve readability.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Sort the includes of gpiolib-cdev.c to make it easier to identify if a
module is included and to avoid duplication.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Move gpiolib-sysfs function declarations into their own header.
These functions are in gpiolib-sysfs.c, and are only required by gpiolib.c,
and so should be in a module header, not gpiolib.h.
This brings gpiolib-sysfs into line with gpiolib-cdev, and is another step
towards removing the sysfs inferface.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Sparse cannot peer into other functions to see when and if locks are
acquired and released, thus it simply warns that a 'context imbalance'
is detected instead. Let's be kind to Sparse and let it know that
this behaviour is intentional.
drivers/gpio/gpio-mlxbf2.c:125:12: warning: context imbalance in 'mlxbf2_gpio_lock_acquire' - different lock contexts for basic block
drivers/gpio/gpio-mlxbf2.c:151:13: warning: context imbalance in 'mlxbf2_gpio_lock_release' - unexpected unlock
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Asmaa Mnebhi <asmaa@mellanox.com>
Cc: Asmaa Mnebhi <Asmaa@mellanox.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-11-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>