Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307685
b: refs/heads/master
c: 09d71ff
h: refs/heads/master
i:
  307683: b5c9b62
v: v3
  • Loading branch information
Mark Brown authored and Grant Likely committed May 18, 2012
1 parent 4d14f96 commit d4a7942
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb1567f7ad0032ba7b02b878e352f191d53dc228
refs/heads/master: 09d71ff19404b3957fab6de942fb8026ccfd8524
29 changes: 29 additions & 0 deletions trunk/drivers/gpio/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,35 @@ int devm_gpio_request(struct device *dev, unsigned gpio, const char *label)
}
EXPORT_SYMBOL(devm_gpio_request);

/**
* devm_gpio_request_one - request a single GPIO with initial setup
* @dev: device to request for
* @gpio: the GPIO number
* @flags: GPIO configuration as specified by GPIOF_*
* @label: a literal description string of this GPIO
*/
int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label)
{
unsigned *dr;
int rc;

dr = devres_alloc(devm_gpio_release, sizeof(unsigned), GFP_KERNEL);
if (!dr)
return -ENOMEM;

rc = gpio_request_one(gpio, flags, label);
if (rc) {
devres_free(dr);
return rc;
}

*dr = gpio;
devres_add(dev, dr);

return 0;
}

/**
* devm_gpio_free - free an interrupt
* @dev: device to free gpio for
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/asm-generic/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ extern void gpio_free_array(const struct gpio *array, size_t num);

/* bindings for managed devices that want to request gpios */
int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label);
void devm_gpio_free(struct device *dev, unsigned int gpio);

#ifdef CONFIG_GPIO_SYSFS
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ static inline int gpio_request_one(unsigned gpio,
return -ENOSYS;
}

static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
unsigned long flags, const char *label)
{
return -ENOSYS;
}

static inline int gpio_request_array(const struct gpio *array, size_t num)
{
return -ENOSYS;
Expand Down

0 comments on commit d4a7942

Please sign in to comment.