1. 05 Jan, 2016 7 commits
    • Linus Walleij's avatar
      gpio: generic: factor into gpio_chip struct · 0f4630f3
      Linus Walleij authored
      The separate struct bgpio_chip has been a pain to handle, both
      by being confusingly similar in name to struct gpio_chip and
      for being contained inside a struct so that struct gpio_chip
      is contained in a struct contained in a struct, making several
      steps of dereferencing necessary.
      
      Make things simpler: include the fields directly into
      <linux/gpio/driver.h>, #ifdef:ed for CONFIG_GENERIC_GPIO, and
      get rid of the <linux/basic_mmio_gpio.h> altogether. Prefix
      some of the member variables with bgpio_* and add proper
      kerneldoc while we're at it.
      
      Modify all users to handle the change and use a struct
      gpio_chip directly. And while we're at it: replace all
      container_of() dereferencing by gpiochip_get_data() and
      registering the gpio_chip with gpiochip_add_data().
      
      Cc: arm@kernel.org
      Cc: Alexander Shiyan <shc_work@mail.ru>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <kernel@pengutronix.de>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: Alexandre Courbot <gnurou@gmail.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-omap@vger.kernel.org
      Cc: linux-samsung-soc@vger.kernel.org
      Cc: bcm-kernel-feedback-list@broadcom.com
      Acked-by: default avatarGregory Fong <gregory.0xf0@gmail.com>
      Acked-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
      Acked-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Acked-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      0f4630f3
    • Linus Walleij's avatar
      gpio: of: provide optional of_mm_gpiochip_add_data() function · 3208b0f0
      Linus Walleij authored
      In the same spirit as we add an optional void *data argument
      to the gpiochip_add_data() call, we need this also for
      of_mm_gpiochip_add().
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      3208b0f0
    • Linus Walleij's avatar
      gpio: add a data pointer to gpio_chip · b08ea35a
      Linus Walleij authored
      This adds a void * pointer to gpio_chip so that driver can
      assign and retrieve some states. This is done to get rid of
      container_of() calls for gpio_chips embedded inside state
      containers, so we can remove the need to have the gpio_chip
      or later (planned) struct gpio_device be dynamically allocated
      at registration time, so that its struct device can be properly
      reference counted and not bound to its parent device (e.g.
      a platform_device) but instead live on after unregistration
      if it is opened by e.g. a char device or sysfs.
      
      The data is added with the new function gpiochip_add_data()
      and for compatibility we add static inline wrapper function
      gpiochip_add() that will call gpiochip_add_data() with
      NULL as argument. The latter will be removed once we have
      exorcised gpiochip_add() from the kernel.
      
      gpiochip_get_data() is added as a static inline accessor
      for drivers to quickly get their data out.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      b08ea35a
    • Dan Carpenter's avatar
      gpio: pxa: checking IS_ERR() instead of NULL · 41d107ad
      Dan Carpenter authored
      irq_domain_add_legacy() returns NULL on error, it doesn't return error
      pointers.
      
      Fixes: 384ca3c6 ('gpio: pxa: change the interrupt management')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      41d107ad
    • Linus Walleij's avatar
      gpio: generic: fix signedness bug found by cppcheck · 4b63739e
      Linus Walleij authored
      cppcheck reports this:
      
      (style) int result is returned as long value. If the return
      value is long to avoid loss of information, then you have
      loss of information.
      
      This can be fixed with (1UL << pin) but that is the same
      as using <linux/bitops.h> that already use 1UL so take
      this approach.
      Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      4b63739e
    • Linus Walleij's avatar
      fbdev: via-gpio: Be sure to clamp return value · 13e676be
      Linus Walleij authored
      As we want gpio_chip .get() calls to be able to return negative
      error codes and propagate to drivers, we need to go over all
      drivers and make sure their return values are clamped to [0,1].
      We do this by using the ret = !!(val) design pattern.
      
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Acked-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      13e676be
    • Linus Walleij's avatar
      pinctrl: qcom: fix up errorpath · 33203f5b
      Linus Walleij authored
      This fixes up:
      commit 464231fb
      "pinctrl: ssbi-gpio: Be sure to clamp return value"
      commit b9164f04
      "gpio: ssbi-mpp: Be sure to clamp return value"
      as I managed to screw up some of the logic when clamping
      the return values.
      
      Cc: Björn Andersson <bjorn@kryo.se>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      33203f5b
  2. 04 Jan, 2016 1 commit
    • Arnd Bergmann's avatar
      gpiolib: always initialize *flags from of_get_named_gpio_flags · 427e0dc5
      Arnd Bergmann authored
      The of_get_named_gpio_flags() function does nothing other than returning
      an error when CONFIG_OF_GPIO is disabled, but that causes spurious
      warnings about possible use of uninitialized variables in any code that
      does not check the of_get_named_gpio_flags() return value before trying
      to use the flags:
      
      drivers/input/misc/rotary_encoder.c: In function 'rotary_encoder_probe':
      drivers/input/misc/rotary_encoder.c:223:28: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
      drivers/power/bq24735-charger.c: In function 'bq24735_charger_probe':
      drivers/power/bq24735-charger.c:227:12: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
      drivers/power/sbs-battery.c: In function 'sbs_probe':
      drivers/power/sbs-battery.c:782:17: warning: 'gpio_flags' may be used uninitialized in this function [-Wmaybe-uninitialized]
      
      This changes the behavior of the inline helper to set the flags to zero
      when OF_GPIO is disabled, to avoid the warnings. In all cases I've
      encountered, we don't actually get to the place that uses the flags
      if CONFIG_OF is disabled because we won't enter the DT parser code.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      427e0dc5
  3. 27 Dec, 2015 1 commit
  4. 26 Dec, 2015 31 commits