kernel_optimize_test/drivers/leds
Javier Martinez Canillas 2d7c22f67d leds: leds-gpio: set devm_gpio_request_one() flags param correctly
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 <javier.martinez@collabora.co.uk>
Reported-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
2013-01-02 17:58:41 -08:00
..
dell-led.c
Kconfig
led-class.c
led-core.c
led-triggers.c
leds-88pm860x.c
leds-adp5520.c
leds-asic3.c
leds-atmel-pwm.c
leds-bd2802.c
leds-blinkm.c
leds-clevo-mail.c
leds-cobalt-qube.c
leds-cobalt-raq.c
leds-da903x.c
leds-da9052.c
leds-dac124s085.c
leds-fsg.c
leds-gpio-register.c
leds-gpio.c leds: leds-gpio: set devm_gpio_request_one() flags param correctly 2013-01-02 17:58:41 -08:00
leds-hp6xx.c
leds-lm355x.c
leds-lm3530.c
leds-lm3533.c
leds-lm3642.c
leds-locomo.c
leds-lp3944.c
leds-lp5521.c
leds-lp5523.c
leds-lp8788.c
leds-lt3593.c
leds-max8997.c
leds-mc13783.c
leds-net48xx.c
leds-netxbig.c
leds-ns2.c
leds-ot200.c
leds-pca955x.c
leds-pca9532.c
leds-pca9633.c
leds-pwm.c
leds-rb532.c
leds-regulator.c
leds-renesas-tpu.c
leds-s3c24xx.c
leds-ss4200.c
leds-sunfire.c
leds-tca6507.c
leds-wm831x-status.c
leds-wm8350.c
leds-wrap.c
leds.h
ledtrig-backlight.c
ledtrig-cpu.c
ledtrig-default-on.c
ledtrig-gpio.c
ledtrig-heartbeat.c
ledtrig-ide-disk.c
ledtrig-oneshot.c
ledtrig-timer.c
ledtrig-transient.c
Makefile