[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAErSpo5AnsmfQs4oa3P7AQyPTJ+YqCVVh5p2L=bmDY=A+BO9PQ@mail.gmail.com>
Date: Mon, 30 Apr 2012 17:29:01 -0600
From: Bjorn Helgaas <bhelgaas@...gle.com>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Jesse Barnes <jbarnes@...tuousgeek.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Tony Luck <tony.luck@...el.com>,
David Miller <davem@...emloft.net>, x86 <x86@...nel.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org
Subject: Re: [PATCH -v11 05/30] PCI: Add busn_res operation functions
On Sun, Mar 18, 2012 at 11:42 PM, Yinghai Lu <yinghai@...nel.org> wrote:
> Will use them insert/update busn res in pci_bus struct.
>
> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
> ---
> drivers/pci/probe.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/pci.h | 3 +++
> 2 files changed, 53 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index d30948d..9235b16 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1679,6 +1679,56 @@ err_out:
> return NULL;
> }
>
> +void pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max)
> +{
> + struct resource *res = &b->busn_res;
> + struct resource *parent_res;
> + int ret;
> +
> + res->start = bus;
> + res->end = bus_max;
> + res->flags = IORESOURCE_BUS;
> +
> + /* no parent for root bus' busn_res */
> + if (!pci_is_root_bus(b)) {
> + parent_res = &b->parent->busn_res;
> +
> + ret = insert_resource(parent_res, res);
> +
> + dev_printk(KERN_DEBUG, &b->dev,
> + "busn_res: %pR %s inserted under %pR\n",
> + res, ret ? "can not be" : "is", parent_res);
> + } else
> + dev_printk(KERN_DEBUG, &b->dev,
> + "busn_res: %pR for root bus\n",
> + res);
> +}
> +
> +void pci_bus_update_busn_res_end(struct pci_bus *b, int bus_max)
> +{
> + struct resource *res = &b->busn_res;
> + struct resource old_res = *res;
> +
> + res->end = bus_max;
I've mentioned before that I'm not comfortable with updating the
struct resource after it's been inserted into the tree. If you want
to do an in-place update, I think you need to add a new interface in
kernel/resource.c so it can make sure the resource tree remains
consistent.
--
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