Skip to content

Commit

Permalink
leds: renesas: use gpio_request_one
Browse files Browse the repository at this point in the history
Using gpio_request_one can make the code simpler because it can
set the direction and initial value in one shot.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
  • Loading branch information
Jingoo Han authored and Bryan Wu committed Nov 26, 2012
1 parent 31c3dc7 commit b0053aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/leds/leds-renesas-tpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ static void r_tpu_set_pin(struct r_tpu_priv *p, enum r_tpu_pin new_state,
if (p->pin_state == R_TPU_PIN_GPIO_FN)
gpio_free(cfg->pin_gpio_fn);

if (new_state == R_TPU_PIN_GPIO) {
gpio_request(cfg->pin_gpio, cfg->name);
gpio_direction_output(cfg->pin_gpio, !!brightness);
}
if (new_state == R_TPU_PIN_GPIO)
gpio_request_one(cfg->pin_gpio, GPIOF_DIR_OUT | !!brightness,
cfg->name);

if (new_state == R_TPU_PIN_GPIO_FN)
gpio_request(cfg->pin_gpio_fn, cfg->name);

Expand Down

0 comments on commit b0053aa

Please sign in to comment.