[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <480920BB.9010506@keyaccess.nl>
Date: Sat, 19 Apr 2008 00:29:15 +0200
From: Rene Herman <rene.herman@...access.nl>
To: Bjorn Helgaas <bjorn.helgaas@...com>
CC: Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, Adam Belay <ambx1@....rr.com>,
Li Shaohua <shaohua.li@...el.com>,
Matthieu Castet <castet.matthieu@...e.fr>,
Thomas Renninger <trenn@...e.de>,
Jaroslav Kysela <perex@...ex.cz>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [patch 22/53] PNP: factor pnp_init_resource_table() and pnp_clean_resource_table()
On 18-04-08 22:50, Bjorn Helgaas wrote:
> Move the common part of pnp_init_resource_table() and
> pnp_clean_resource_table() into a new pnp_init_resource().
> This reduces a little code duplication and will be
> useful later to initialize an individual resource.
This can't be right, can it? :
> +void pnp_init_resource(struct resource *res)
> +{
> + unsigned long type;
> +
> + type = res->flags & (IORESOURCE_IO | IORESOURCE_MEM |
> + IORESOURCE_IRQ | IORESOURCE_DMA);
> +
> + res->name = NULL;
> + res->flags = type | IORESOURCE_AUTO | IORESOURCE_UNSET;
> + if (type == IORESOURCE_IRQ || type == IORESOURCE_DMA) {
> + res->start = -1;
> + res->end = -1;
> + } else {
> + res->start = 0;
> + res->end = 0;
> + }
> +}
This depends on the type already being set in res->flags, yet:
> /**
> * pnp_init_resources - Resets a resource table to default values.
> * @table: pointer to the desired resource table
> @@ -209,34 +227,14 @@
> struct pnp_resource_table *table = &dev->res;
> int idx;
>
> - for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
> - table->irq_resource[idx].name = NULL;
> - table->irq_resource[idx].start = -1;
> - table->irq_resource[idx].end = -1;
> - table->irq_resource[idx].flags =
> - IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
> - }
> - for (idx = 0; idx < PNP_MAX_DMA; idx++) {
> - table->dma_resource[idx].name = NULL;
> - table->dma_resource[idx].start = -1;
> - table->dma_resource[idx].end = -1;
> - table->dma_resource[idx].flags =
> - IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
> - }
> - for (idx = 0; idx < PNP_MAX_PORT; idx++) {
> - table->port_resource[idx].name = NULL;
> - table->port_resource[idx].start = 0;
> - table->port_resource[idx].end = 0;
> - table->port_resource[idx].flags =
> - IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
> - }
> - for (idx = 0; idx < PNP_MAX_MEM; idx++) {
> - table->mem_resource[idx].name = NULL;
> - table->mem_resource[idx].start = 0;
> - table->mem_resource[idx].end = 0;
> - table->mem_resource[idx].flags =
> - IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
> - }
> + for (idx = 0; idx < PNP_MAX_IRQ; idx++)
> + pnp_init_resource(&table->irq_resource[idx]);
> + for (idx = 0; idx < PNP_MAX_DMA; idx++)
> + pnp_init_resource(&table->dma_resource[idx]);
> + for (idx = 0; idx < PNP_MAX_PORT; idx++)
> + pnp_init_resource(&table->port_resource[idx]);
> + for (idx = 0; idx < PNP_MAX_MEM; idx++)
> + pnp_init_resource(&table->mem_resource[idx]);
> }
... it's not being set.
Rene.
--
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