Skip to content

Commit

Permalink
Fix sysfs exported gpio name (example "gpio254")
Browse files Browse the repository at this point in the history
Accoding to Documentation/gpio.txt GPIO signals have paths like /sys/class/gpio/gpio42/ (for GPIO linux-sunxi#42).
Existing version break compatability with program where used this interface. For example avrdude (avr programmer, module linuxgpio) work ok with this change (tested).
  • Loading branch information
krayushkin committed Oct 11, 2013
1 parent 9ee9fc5 commit 7b33e78
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/gpio/gpio-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ static int sunxi_gpio_request(struct gpio_chip *chip, unsigned offset)
if ((offset > chip->ngpio - 1) || (offset < 0))
return -EINVAL;

/* Set sysfs exported gpio name (example "gpio254_ph20") */
sprintf((char *)(chip->names[offset]), "gpio%d_p%c%d",
offset+chip->base,
'a'+sgpio->data[offset].info.port-1,
sgpio->data[offset].info.port_num);
/* Set sysfs exported gpio name (example "gpio254") */
sprintf((char *)(chip->names[offset]), "gpio%d",
offset+chip->base);

sgpio->data[offset].gpio_handler = gpio_request_ex("gpio_para",
sgpio->data[offset].pin_name);
Expand Down

0 comments on commit 7b33e78

Please sign in to comment.