On Nov 14, 2007 12:18 PM, David Brownell <[email protected]> wrote:
> On Tuesday 13 November 2007, eric miao wrote:
> > Here comes the point of "struct gpio_desc"
> >
> > Subject: [PATCH 3/5] use a per GPIO "struct gpio_desc" and chain
> > "gpio_chip" to a list
>
> I see what it does, but don't see the "why" ... surely
> you can come up with a one sentence description of why
> this would be better?
>
> And I'd been so glad to *get rid of* that list, too.
I'll be happy too.
>
>
> > +struct gpio_desc {
> > + struct gpio_chip *chip;
> > +};
> > +
>
> > -/* gpio_lock protects modification to the table of chips and to
> > - * gpio_chip->requested. If a gpio is requested, its gpio_chip
> > - * is not removable.
> > - */
>
> But it still protects data. Don't remove documentation for
> what locks protect ... update it! Otherwise someonels going
> to come by and make a change which breaks the locking model.
> Usually in some subtle (hard-to-debug) way.
I'd prefer to name it "gpio_desc_lock" instead, which is self-explanatory
and thus requires no comment at all
>
> >
> > - for (id = 0; id < ARRAY_SIZE(chips); id++) {
> > - chip = chips[id];
> > - if (!chip)
> > - continue;
> > -
> > + list_for_each_entry(chip, &gpio_chip_list, node) {
> > seq_printf(s, "%sGPIOs %d-%d, %s%s:\n",
> > started ? "\n" : "",
> > chip->base, chip->base + chip->ngpio - 1,
>
> Note that this now produces the debug info in a relatively
> random order ... ordered by registration rather than anything
> useful, and hence awkward to read.
>
> It'd be better if you just scanned your new gpio_desc[]
> table in numeric order, and start a new section whenever
> you find a new gpio_chip.
>
> That'd get rid of that otherwise-useless list, too.
>
absolutely, you get the same feeling of mine and since this is for illustration
purpose only, I don't want more patches to fix this...
> - Dave
>
--
Cheers
- eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]