Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358769
b: refs/heads/master
c: 362432a
h: refs/heads/master
i:
  358767: b24c169
v: v3
  • Loading branch information
Grant Likely committed Feb 11, 2013
1 parent 15bb232 commit 431d654
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 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: 6c0b4e6c85d085bd92966bc2b8da73e2d7f35929
refs/heads/master: 362432aed5e5b497a8cf7b20c268ba71df93c045
12 changes: 9 additions & 3 deletions trunk/drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2053,29 +2053,35 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)

static void *gpiolib_seq_start(struct seq_file *s, loff_t *pos)
{
unsigned long flags;
struct gpio_chip *chip = NULL;
loff_t index = *pos;

/* REVISIT this isn't locked against gpio_chip removal ... */

s->private = "";

spin_lock_irqsave(&gpio_lock, flags);
list_for_each_entry(chip, &gpio_chips, list)
if (index-- == 0)
if (index-- == 0) {
spin_unlock_irqrestore(&gpio_lock, flags);
return chip;
}
spin_unlock_irqrestore(&gpio_lock, flags);

return NULL;
}

static void *gpiolib_seq_next(struct seq_file *s, void *v, loff_t *pos)
{
unsigned long flags;
struct gpio_chip *chip = v;
void *ret = NULL;

spin_lock_irqsave(&gpio_lock, flags);
if (list_is_last(&chip->list, &gpio_chips))
ret = NULL;
else
ret = list_entry(chip->list.next, struct gpio_chip, list);
spin_unlock_irqrestore(&gpio_lock, flags);

s->private = "\n";
++*pos;
Expand Down

0 comments on commit 431d654

Please sign in to comment.