Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139636
b: refs/heads/master
c: 926b663
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Silverstone authored and Linus Torvalds committed Apr 3, 2009
1 parent 89d3505 commit 057bb97
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f30281f4f7c2a0efcfeddad12277dfdada8f08a7
refs/heads/master: 926b663ce8215ba448960e1ff6e58b67a2c3b99b
7 changes: 6 additions & 1 deletion trunk/drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
unsigned long flags;
struct gpio_desc *desc;
int status = -EINVAL;
char *ioname = NULL;

/* can't export until sysfs is available ... */
if (!gpio_class.p) {
Expand All @@ -461,11 +462,14 @@ int gpio_export(unsigned gpio, bool direction_may_change)
}
spin_unlock_irqrestore(&gpio_lock, flags);

if (desc->chip->names && desc->chip->names[gpio - desc->chip->base])
ioname = desc->chip->names[gpio - desc->chip->base];

if (status == 0) {
struct device *dev;

dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
desc, "gpio%d", gpio);
desc, ioname ? ioname : "gpio%d", gpio);
if (dev) {
if (direction_may_change)
status = sysfs_create_group(&dev->kobj,
Expand Down Expand Up @@ -513,6 +517,7 @@ void gpio_unexport(unsigned gpio)
mutex_lock(&sysfs_lock);

desc = &gpio_desc[gpio];

if (test_bit(FLAG_EXPORT, &desc->flags)) {
struct device *dev = NULL;

Expand Down
5 changes: 5 additions & 0 deletions trunk/include/asm-generic/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ struct module;
* handled is (base + ngpio - 1).
* @can_sleep: flag must be set iff get()/set() methods sleep, as they
* must while accessing GPIO expander chips over I2C or SPI
* @names: if set, must be an array of strings to use as alternative
* names for the GPIOs in this chip. Any entry in the array
* may be NULL if there is no alias for the GPIO, however the
* array must be @ngpio entries long.
*
* A gpio_chip can help platforms abstract various sources of GPIOs so
* they can all be accessed through a common programing interface.
Expand Down Expand Up @@ -92,6 +96,7 @@ struct gpio_chip {
struct gpio_chip *chip);
int base;
u16 ngpio;
char **names;
unsigned can_sleep:1;
unsigned exported:1;
};
Expand Down

0 comments on commit 057bb97

Please sign in to comment.