07 Mar, 2014

1 commit


28 Feb, 2014

2 commits


26 Oct, 2013

1 commit

  • now the leds-gpio driver will create every child led node without
    checking the status is disabled or not.

    for example, if we have a led node like d3, and its status is disabled:
    leds {
    d3 {
    label = "d3";
    gpios = ;
    status = "disabled";
    };
    };

    we except the d3 should not be created. And the gpios should not be
    request as well.

    But current driver will create d3 and request its gpio.

    This patch fix this by using for_each_available_child_of_node() and
    of_get_available_child_count() to enumerate all child nodes. So the
    disabled node will be inavailable.

    Signed-off-by: Josh Wu
    Signed-off-by: Bryan Wu

    Josh Wu
     

23 Oct, 2013

1 commit


27 Aug, 2013

1 commit


21 Jun, 2013

2 commits

  • Since commit ab78029 (drivers/pinctrl: grab default handles from device core)
    we can rely on device core for handling pinctrl, so remove
    devm_pinctrl_get_select_default() from the driver.

    Reported-by: Stephen Warren
    Signed-off-by: Fabio Estevam
    Signed-off-by: Bryan Wu

    Fabio Estevam
     
  • The driver core clears the driver data to NULL after device_release
    or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d
    (device-core: Ensure drvdata = NULL when no driver is bound).
    Thus, it is not needed to manually clear the device driver data to NULL.

    Signed-off-by: Jingoo Han
    Signed-off-by: Bryan Wu

    Jingoo Han
     

22 May, 2013

1 commit

  • This reverts commit a99d76f (leds: leds-gpio: use gpio_request_one)
    and commit 2d7c22f (leds: leds-gpio: set devm_gpio_request_one()
    flags param correctly) which was a fix of the first one.

    The conversion to devm_gpio_request in commit e3b1d44c (leds:
    leds-gpio: use devm_gpio_request_one) is not reverted.

    The problem is that gpio_cansleep() and gpio_get_value_cansleep()
    calls can crash if the gpio is not first reserved. Incidentally this
    same bug existed earlier and was fixed similarly in commit d95cbe61
    (leds: Fix potential leds-gpio oops). But the OOPS is real. It happens
    when GPIOs are provided by module which is not yet loaded.

    So this fixes the following BUG during my ALIX boot (3.9.2-vanilla):

    BUG: unable to handle kernel NULL pointer dereference at 0000004c
    IP: [] __gpio_cansleep+0xe/0x1a
    *pde = 00000000
    Oops: 0000 [#1] SMP
    Modules linked in: leds_gpio(+) via_rhine mii cs5535_mfd mfd_core
    geode_rng rng_core geode_aes isofs nls_utf8 nls_cp437 vfat fat
    ata_generic pata_amd pata_cs5536 pata_acpi libata ehci_pci ehci_hcd
    ohci_hcd usb_storage usbcore usb_common sd_mod scsi_mod squashfs loop
    Pid: 881, comm: modprobe Not tainted 3.9.2 #1-Alpine
    EIP: 0060:[] EFLAGS: 00010282 CPU: 0
    EIP is at __gpio_cansleep+0xe/0x1a
    EAX: 00000000 EBX: cf364018 ECX: c132b8b9 EDX: 00000000
    ESI: c13993a4 EDI: c1399370 EBP: cded9dbc ESP: cded9dbc
    DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    CR0: 8005003b CR2: 0000004c CR3: 0f0c4000 CR4: 00000090
    DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    DR6: ffff0ff0 DR7: 00000400
    Process modprobe (pid: 881, ti=cded8000 task=cf094aa0 task.ti=cded8000)
    Stack:
    cded9de0 d09471cb 00000000 c1399260 cf364014 00000000 c1399260 c1399254
    d0949014 cded9df4 c118cd59 c1399260 d0949014 d0949014 cded9e08 c118ba47
    c1399260 d0949014 c1399294 cded9e1c c118bb75 cded9e24 d0949014 00000000
    Call Trace:
    [] gpio_led_probe+0xba/0x203 [leds_gpio]
    [] platform_drv_probe+0x26/0x48
    [] driver_probe_device+0x75/0x15c
    [] __driver_attach+0x47/0x63
    [] bus_for_each_dev+0x3c/0x66
    [] driver_attach+0x14/0x16
    [] ? driver_probe_device+0x15c/0x15c
    [] bus_add_driver+0xbd/0x1bc
    [] ? 0xd08b3fff
    [] ? 0xd08b3fff
    [] driver_register+0x74/0xec
    [] ? 0xd08b3fff
    [] platform_driver_register+0x38/0x3a
    [] gpio_led_driver_init+0xd/0x1000 [leds_gpio]
    [] do_one_initcall+0x6b/0x10f
    [] ? 0xd08b3fff
    [] load_module+0x1631/0x1907
    [] ? insert_vmalloc_vmlist+0x14/0x43
    [] ? __vmalloc_node_range+0x13e/0x15f
    [] sys_init_module+0x62/0x77
    [] syscall_call+0x7/0xb
    EIP: [] __gpio_cansleep+0xe/0x1a SS:ESP 0068:cded9dbc
    CR2: 000000000000004c
    ---[ end trace 5308fb20d2514822 ]---

    Signed-off-by: Timo Teräs
    Cc: Sachin Kamat
    Cc: Raphael Assenat
    Cc: Trent Piepho
    Cc: Javier Martinez Canillas
    Cc: Arnaud Patard
    Cc: Ezequiel Garcia
    Acked-by: Jingoo Han
    Signed-off-by: Bryan Wu

    Timo Teräs
     

03 Jan, 2013

1 commit

  • commit a99d76f leds: leds-gpio: use gpio_request_one

    changed the leds-gpio driver to use gpio_request_one() instead
    of gpio_request() + gpio_direction_output()

    Unfortunately, it also made a semantic change that breaks the
    leds-gpio driver.

    The gpio_request_one() flags parameter was set to:

    GPIOF_DIR_OUT | (led_dat->active_low ^ state)

    Since GPIOF_DIR_OUT is 0, the final flags value will just be the
    XOR'ed value of led_dat->active_low and state.

    This value were used to distinguish between HIGH/LOW output initial
    level and call gpio_direction_output() accordingly.

    With this new semantic gpio_request_one() will take the flags value
    of 1 as a configuration of input direction (GPIOF_DIR_IN) and will
    call gpio_direction_input() instead of gpio_direction_output().

    int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
    {
    ..
    if (flags & GPIOF_DIR_IN)
    err = gpio_direction_input(gpio);
    else
    err = gpio_direction_output(gpio,
    (flags & GPIOF_INIT_HIGH) ? 1 : 0);
    ..
    }

    The right semantic is to evaluate led_dat->active_low ^ state and
    set the output initial level explicitly.

    Signed-off-by: Javier Martinez Canillas
    Reported-by: Arnaud Patard
    Tested-by: Ezequiel Garcia
    Signed-off-by: Bryan Wu

    Javier Martinez Canillas
     

16 Dec, 2012

1 commit

  • Pull LED subsystem update from Bryan Wu.

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (47 commits)
    leds: leds-lp5521: return an error code on error in probe()
    leds: leds-clevo-mail: Use pr_* instead of printks
    leds: leds-rb532: Fix checkpatch errors
    leds: led-triggers: Fix checkpatch warnings
    leds: ledtrig-backlight: Fix checkpatch error
    leds: leds-wrap: Use instead of
    leds: leds-wm8350: Use dev_err instead of printk
    leds: leds-pwm: Fix checkpatch warning
    leds: leds-pca955x: Use dev_info instead of printk
    leds: leds-net48xx: Use linux/io.h instead of asm/io.h
    leds: leds-lt3593: Fix checkpatch warnings
    leds: leds-gpio: Use dev_info instead of printk
    leds: leds-da903x: Fix checkpatch error and warnings
    leds: leds-bd2802: Fix checkpatch warnings
    leds: leds-adp5520: Fix checkpatch warnings
    leds: led-class: Fix checkpatch warning
    leds: leds-ns2: use devm_gpio_request_one
    leds: leds-lt3593: use devm_gpio_request_one
    leds: leds-gpio: use devm_gpio_request_one
    leds: lp3944: Fix return value
    ...

    Linus Torvalds
     

29 Nov, 2012

3 commits


28 Nov, 2012

2 commits


27 Nov, 2012

2 commits


11 Sep, 2012

4 commits


24 Jul, 2012

1 commit


24 Mar, 2012

1 commit


11 Jan, 2012

1 commit

  • Factor out some boilerplate code for platform driver registration into
    module_platform_driver.

    Signed-off-by: Axel Lin
    Acked-by: Haojian Zhuang [led-88pm860x.c]
    Acked-by: Mark Brown
    Cc: Richard Purdie
    Cc: Michael Hennerich
    Cc: Mike Rapoport
    Cc: Guennadi Liakhovetski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     

07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

01 Nov, 2011

2 commits

  • I get the following warning:

    ------------[ cut here ]------------
    WARNING: at drivers/gpio/gpiolib.c:1559 __gpio_get_value+0x90/0x98()
    Modules linked in:
    Call Trace:
    [] dump_stack+0x8/0x34
    [] warn_slowpath_common+0x78/0xa0
    [] __gpio_get_value+0x90/0x98
    [] create_gpio_led+0xdc/0x194
    [] gpio_led_probe+0x290/0x36c
    [] driver_probe_device+0x78/0x1b0
    [] __driver_attach+0xc0/0xc8
    [] bus_for_each_dev+0x64/0xb0
    [] bus_add_driver+0x1c8/0x2a8
    [] driver_register+0x90/0x180
    [] do_one_initcall+0x38/0x160

    ---[ end trace ee38723fbefcd65c ]---

    My GPIOs are on an I2C port expander, so we must use the *_cansleep()
    variant of the GPIO functions. This is was not being done in
    create_gpio_led().

    We can change gpio_get_value() to gpio_get_value_cansleep() because it is
    only called from the platform_driver probe function, which is a context
    where we can sleep.

    Only tested on my gpio_cansleep() system, but it seems safe for all
    systems.

    Signed-off-by: David Daney
    Cc: Richard Purdie
    Acked-by: Trent Piepho
    Cc: Grant Likely
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Daney
     
  • A pending cleanup will mean that module.h won't be implicitly
    everywhere anymore. Make sure the modular drivers in the leds
    dir are actually calling out for explicitly in advance.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

04 Jun, 2011

1 commit


28 Feb, 2011

1 commit


12 Nov, 2010

1 commit


06 Aug, 2010

1 commit

  • of_device is just an alias for platform_device, so remove it entirely. Also
    replace to_of_device() with to_platform_device() and update comment blocks.

    This patch was initially generated from the following semantic patch, and then
    edited by hand to pick up the bits that coccinelle didn't catch.

    @@
    @@
    -struct of_device
    +struct platform_device

    Signed-off-by: Grant Likely
    Reviewed-by: David S. Miller

    Grant Likely
     

28 May, 2010

1 commit


26 May, 2010

1 commit

  • The leds-gpio blink_set() callback follows the same prototype as the
    main leds subsystem blink_set() one.

    The problem is that to stop blink, normally, a leds driver does it
    in the brightness_set() callback when asked to set a new fixed value.

    However, with leds-gpio, the platform has no hook to do so, as this
    later callback results in a standard GPIO manipulation.

    This changes the leds-gpio specific callback to take a new argument
    that indicates whether the LED should be blinking or not and in what
    state it should be set if not. We also update the dns323 platform
    which seems to be the only user of this so far.

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Richard Purdie

    Benjamin Herrenschmidt
     

22 May, 2010

1 commit

  • .name, .match_table and .owner are duplicated in both of_platform_driver
    and device_driver. This patch is a removes the extra copies from struct
    of_platform_driver and converts all users to the device_driver members.

    This patch is a pretty mechanical change. The usage model doesn't change
    and if any drivers have been missed, or if anything has been fixed up
    incorrectly, then it will fail with a compile time error, and the fixup
    will be trivial. This patch looks big and scary because it touches so
    many files, but it should be pretty safe.

    Signed-off-by: Grant Likely
    Acked-by: Sean MacLennan

    Grant Likely
     

19 May, 2010

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

17 Mar, 2010

1 commit

  • The driver wrongly sets default state for LEDs that don't specify
    default-state property.

    Currently the driver handles default state this way:

    memset(&led, 0, sizeof(led));
    for_each_child_of_node(np, child) {
    state = of_get_property(child, "default-state", NULL);
    if (state) {
    if (!strcmp(state, "keep"))
    led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
    ...
    }
    ret = create_gpio_led(&led, ...);
    }

    Which means that all LEDs that do not specify default-state will inherit
    the last value of the default-state property, which is wrong.

    This patch fixes the issue by moving LED's template initialization into
    the loop body.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Andrew Morton
    Signed-off-by: Richard Purdie

    Anton Vorontsov
     

16 Nov, 2009

1 commit


07 Sep, 2009

1 commit