13 Sep, 2016

1 commit

  • These structures are only used to copy into other structures, so declare
    them as const.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct gpio_chip i@p = { ... };

    @ok@
    identifier r.i;
    expression e;
    position p;
    @@
    e = i@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    struct gpio_chip e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct gpio_chip i = { ... };
    //

    Signed-off-by: Julia Lawall
    Acked-by: Joachim Eastwood
    Signed-off-by: Linus Walleij

    Julia Lawall
     

23 Feb, 2016

1 commit


18 Jan, 2016

1 commit

  • Pull GPIO updates from Linus Walleij:
    "Here is the bulk of GPIO changes for v4.5.

    Notably there are big refactorings mostly by myself, aimed at getting
    the gpio_chip into a shape that makes me believe I can proceed to
    preserve state for a proper userspace ABI (character device) that has
    already been proposed once, but resulted in the feedback that I need
    to go back and restructure stuff. So I've been restructuring stuff.
    On the way I ran into brokenness (return code from the get_value()
    callback) and had to fix it. Also, refactored generic GPIO to be
    simpler.

    Some of that is still waiting to trickle down from the subsystems all
    over the kernel that provide random gpio_chips, I've touched every
    single GPIO driver in the kernel now, oh man I didn't know I was
    responsible for so much...

    Apart from that we're churning along as usual.

    I took some effort to test and retest so it should merge nicely and we
    shook out a couple of bugs in -next.

    Infrastructural changes:

    - In struct gpio_chip, rename the .dev node to .parent to better
    reflect the fact that this is not the GPIO struct device
    abstraction. We will add that soon so this would be totallt
    confusing.

    - It was noted that the driver .get_value() callbacks was sometimes
    reporting negative -ERR values to the gpiolib core, expecting them
    to be propagated to consumer gpiod_get_value() and gpio_get_value()
    calls. This was not happening, so as there was a mess of drivers
    returning negative errors and some returning "anything else than
    zero" to indicate that a line was active. As some would have bit
    31 set to indicate "line active" it clashed with negative error
    codes. This is fixed by the largeish series clamping values in all
    drivers with !!value to [0,1] and then augmenting the code to
    propagate error codes to consumers. (Includes some ACKed patches
    in other subsystems.)

    - Add a void *data pointer to struct gpio_chip. The container_of()
    design pattern is indeed very nice, but we want to reform the
    struct gpio_chip to be a non-volative, stateless business, and keep
    states internal to the gpiolib to be able to hold on to the state
    when adding a proper userspace ABI (character device) further down
    the road. To achieve this, drivers need a handle at the internal
    state that is not dependent on their struct gpio_chip() so we add
    gpiochip_add_data() and gpiochip_get_data() following the pattern
    of many other subsystems. All the "use gpiochip data pointer"
    patches transforms drivers to this scheme.

    - The Generic GPIO chip header has been merged into the general
    header, and the custom header for that
    removed. Instead of having a separate mm_gpio_chip struct for
    these generic drivers, merge that into struct gpio_chip,
    simplifying the code and removing the need for separate and
    confusing includes.

    Misc improvements:

    - Stabilize the way GPIOs are looked up from the ACPI legacy
    specification.

    - Incremental driver features for PXA, PCA953X, Lantiq (patches from
    the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48

    New drivers:

    - Add a GPIO chip to the ALSA SoC AC97 driver.

    - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir,
    but the branch is merged here too to account for infrastructural
    changes).

    - The sx150x driver now supports the sx1502"

    * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits)
    gpio: generic: make bgpio_pdata always visible
    gpiolib: fix chip order in gpio list
    gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs()
    gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs()
    gpio: brcmstb: Allow building driver for BMIPS_GENERIC
    gpio: brcmstb: Set endian flags for big-endian MIPS
    gpio: moxart: fix build regression
    gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
    leds: pca9532: use gpiochip data pointer
    leds: tca6507: use gpiochip data pointer
    hid: cp2112: use gpiochip data pointer
    bcma: gpio: use gpiochip data pointer
    avr32: gpio: use gpiochip data pointer
    video: fbdev: via: use gpiochip data pointer
    gpio: pch: Optimize pch_gpio_get()
    Revert "pinctrl: lantiq: Implement gpio_chip.to_irq"
    pinctrl: nsp-gpio: use gpiochip data pointer
    pinctrl: vt8500-wmt: use gpiochip data pointer
    pinctrl: exynos5440: use gpiochip data pointer
    pinctrl: at91-pio4: use gpiochip data pointer
    ...

    Linus Torvalds
     

11 Jan, 2016

1 commit


05 Jan, 2016

1 commit


19 Nov, 2015

1 commit

  • The name .dev in a struct is normally reserved for a struct device
    that is let us say a superclass to the thing described by the struct.
    struct gpio_chip stands out by confusingly using a struct device *dev
    to point to the parent device (such as a platform_device) that
    represents the hardware. As we want to give gpio_chip:s real devices,
    this is not working. We need to rename this member to parent.

    This was done by two coccinelle scripts, I guess it is possible to
    combine them into one, but I don't know such stuff. They look like
    this:

    @@
    struct gpio_chip *var;
    @@
    -var->dev
    +var->parent

    and:

    @@
    struct gpio_chip var;
    @@
    -var.dev
    +var.parent

    and:

    @@
    struct bgpio_chip *var;
    @@
    -var->gc.dev
    +var->gc.parent

    Plus a few instances of bgpio that I couldn't figure out how
    to teach Coccinelle to rewrite.

    This patch hits all over the place, but I *strongly* prefer this
    solution to any piecemal approaches that just exercise patch
    mechanics all over the place. It mainly hits drivers/gpio and
    drivers/pinctrl which is my own backyard anyway.

    Cc: Haavard Skinnemoen
    Cc: Rafał Miłecki
    Cc: Richard Purdie
    Cc: Mauro Carvalho Chehab
    Cc: Alek Du
    Cc: Jaroslav Kysela
    Cc: Takashi Iwai
    Acked-by: Dmitry Torokhov
    Acked-by: Greg Kroah-Hartman
    Acked-by: Lee Jones
    Acked-by: Jiri Kosina
    Acked-by: Hans-Christian Egtvedt
    Acked-by: Jacek Anaszewski
    Signed-off-by: Linus Walleij

    Linus Walleij
     

02 Oct, 2015

1 commit


18 Apr, 2015

1 commit

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for the v4.1 development cycle:

    - A new GPIO hogging mechanism has been added. This can be used on
    boards that want to drive some GPIO line high, low, or set it as
    input on boot and then never touch it again. For some embedded
    systems this is bliss and simplifies things to a great extent.

    - Some API cleanup and closure: gpiod_get_array() and
    gpiod_put_array() has been added to get and put GPIOs in bulk as
    was possible with the non-descriptor API.

    - Encapsulate cross-calls to the pin control subsystem in
    . Now this should be the only header any GPIO
    driver needs to include or something is wrong. Cleanups
    restricting drivers to this include are welcomed if tested.

    - Sort the GPIO Kconfig and split it into submenus, as it was
    becoming and unstructured, illogical and unnavigatable mess. I
    hope this is easier to follow. Menus that require a certain
    subsystem like I2C can now be hidden nicely for example, still
    working on others.

    - New drivers:

    - New driver for the Altera Soft GPIO.

    - The F7188x driver now handles the F71869 and F71869A variants.

    - The MIPS Loongson driver has been moved to drivers/gpio for
    consolidation and cleanup.

    - Cleanups:

    - The MAX732x is converted to use the GPIOLIB_IRQCHIP
    infrastructure.

    - The PCF857x is converted to use the GPIOLIB_IRQCHIP
    infrastructure.

    - Radical cleanup of the OMAP driver.

    - Misc:

    - Enable the DWAPB GPIO for all architectures. This is a "hard
    IP" block from Synopsys which has started to turn up in so
    diverse architectures as X86 Quark, ARC and a slew of ARM
    systems. So even though it's not an expander, it's generic
    enough to be available for all.

    - We add a mock GPIO on Crystalcove PMIC after a long discussion
    with Daniel Vetter et al, tracing back to the shootout at the
    kernel summit where DRM drivers and sub-componentization was
    discussed. In this case a mock GPIO is assumed to be the best
    compromise gaining some reuse of infrastructure without making
    DRM drivers overly complex at the same time. Let's see"

    * tag 'gpio-v4.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (62 commits)
    Revert "gpio: sch: use uapi/linux/pci_ids.h directly"
    gpio: dwapb: remove dependencies
    gpio: dwapb: enable for ARC
    gpio: removing kfree remove functionality
    gpio: mvebu: Fix mask/unmask managment per irq chip type
    gpio: split GPIO drivers in submenus
    gpio: move MFD GPIO drivers under their own comment
    gpio: move BCM Kona Kconfig option
    gpio: arrange SPI Kconfig symbols alphabetically
    gpio: arrange PCI GPIO controllers alphabetically
    gpio: arrange I2C Kconfig symbols alphabetically
    gpio: arrange Kconfig symbols alphabetically
    gpio: ich: Implement get_direction function
    gpio: use (!foo) instead of (foo == NULL)
    gpio: arizona: drop owner assignment from platform_drivers
    gpio: max7300: remove 'ret' variable
    gpio: use devm_kzalloc
    gpio: sch: use uapi/linux/pci_ids.h directly
    gpio: x-gene: fix devm_ioremap_resource() check
    gpio: loongson: Add Loongson-3A/3B GPIO driver support
    ...

    Linus Torvalds
     

08 Apr, 2015

2 commits


26 Feb, 2015

1 commit


22 Jul, 2014

1 commit


04 Dec, 2013

1 commit

  • 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

    Linus Walleij
     

02 Oct, 2013

1 commit


21 Sep, 2013

1 commit


16 Aug, 2013

1 commit


29 Nov, 2012

3 commits

  • CONFIG_HOTPLUG is going away as an option so __devexit is no
    longer needed.

    Signed-off-by: Bill Pemberton
    Cc: Grant Likely
    Acked-by: Linus Walleij
    Cc: Peter Tyser
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devinit is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Grant Likely
    Cc: Peter Tyser
    Cc: Santosh Shilimkar
    Cc: Kevin Hilman
    Acked-by: Linus Walleij
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     
  • CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
    needed.

    Signed-off-by: Bill Pemberton
    Cc: Grant Likely
    Cc: Peter Tyser
    Acked-by: Linus Walleij
    Acked-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Bill Pemberton
     

18 Jul, 2012

1 commit