[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200711132018.22995.david-b@pacbell.net>
Date: Tue, 13 Nov 2007 20:18:22 -0800
From: David Brownell <david-b@...bell.net>
To: "eric miao" <eric.y.miao@...il.com>
Cc: "Linux Kernel list" <linux-kernel@...r.kernel.org>,
"Felipe Balbi" <felipebalbi@...rs.sourceforge.net>,
"Bill Gatliff" <bgat@...lgatliff.com>,
"Haavard Skinnemoen" <hskinnemoen@...el.com>,
"Andrew Victor" <andrew@...people.com>,
"Tony Lindgren" <tony@...mide.com>,
"Jean Delvare" <khali@...ux-fr.org>,
"Kevin Hilman" <khilman@...sta.com>,
"Paul Mundt" <lethal@...ux-sh.org>,
"Ben Dooks" <ben@...nity.fluff.org>
Subject: Re: [patch/rfc 1/4] GPIO implementation framework
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.
> +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.
>
> - 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.
- Dave
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists