From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, arnd@arndb.de,
linux-pci@vger.kernel.org, bhelgaas@google.com
Subject: Re: [RESEND PATCH 2/3] PCI: ARM: add support for generic PCI host controller
Date: Fri, 2 May 2014 11:23:18 -0600 [thread overview]
Message-ID: <20140502172317.GC3179@obsidianresearch.com> (raw)
In-Reply-To: <1399048876-11862-3-git-send-email-will.deacon@arm.com>
On Fri, May 02, 2014 at 05:41:15PM +0100, Will Deacon wrote:
> + bus_range = &pci->cfg.bus_range;
> + for (busn = bus_range->start; busn <= bus_range->end; ++busn) {
> + u32 idx = busn - bus_range->start;
> + u32 sz = 1 << pci->cfg.ops->bus_shift;
> +
> + pci->cfg.win[idx] = devm_ioremap(dev,
> + pci->cfg.res.start + busn * sz,
> + sz);
Why map each bus individually? Both CAM and ECAM define consecutive
busses consecutively in the address space, and I though ioremap was OK
with unaligned stuff?
> +out_unmap_cfg:
> + while (busn-- > bus_range->start)
> + devm_iounmap(dev, pci->cfg.win[busn - bus_range->start]);
Is there a reason to explicitly clean up devm resources? I guess it is
because this is in setup not probe?
It seems strange to me for a driver to do this sort of work in a setup
function, typically probe acquires as much stuff as it can, that way
defered probe can work properly.
Looking at pci-mvebu, 'setup' is only populating the resource list, I
would suggest the same split for this driver.
> +out_release_res:
> + release_child_resources(&iomem_resource);
> + release_child_resources(&ioport_resource);
This looks really off to me, doesn't this free all resources in the
system?
This isn't enough?:
> + list_for_each_entry(win, &sys->resources, list)
> + devm_kfree(dev, win->res);
> + pci_free_resource_list(&sys->resources);
At worst, I would guess 'release_child_resources(win->res);' in the
loop. But since no bus scan has been done, is there any chance of
child resources at this point?
Regards,
Jason
WARNING: multiple messages have this Message-ID (diff)
From: jgunthorpe@obsidianresearch.com (Jason Gunthorpe)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH 2/3] PCI: ARM: add support for generic PCI host controller
Date: Fri, 2 May 2014 11:23:18 -0600 [thread overview]
Message-ID: <20140502172317.GC3179@obsidianresearch.com> (raw)
In-Reply-To: <1399048876-11862-3-git-send-email-will.deacon@arm.com>
On Fri, May 02, 2014 at 05:41:15PM +0100, Will Deacon wrote:
> + bus_range = &pci->cfg.bus_range;
> + for (busn = bus_range->start; busn <= bus_range->end; ++busn) {
> + u32 idx = busn - bus_range->start;
> + u32 sz = 1 << pci->cfg.ops->bus_shift;
> +
> + pci->cfg.win[idx] = devm_ioremap(dev,
> + pci->cfg.res.start + busn * sz,
> + sz);
Why map each bus individually? Both CAM and ECAM define consecutive
busses consecutively in the address space, and I though ioremap was OK
with unaligned stuff?
> +out_unmap_cfg:
> + while (busn-- > bus_range->start)
> + devm_iounmap(dev, pci->cfg.win[busn - bus_range->start]);
Is there a reason to explicitly clean up devm resources? I guess it is
because this is in setup not probe?
It seems strange to me for a driver to do this sort of work in a setup
function, typically probe acquires as much stuff as it can, that way
defered probe can work properly.
Looking at pci-mvebu, 'setup' is only populating the resource list, I
would suggest the same split for this driver.
> +out_release_res:
> + release_child_resources(&iomem_resource);
> + release_child_resources(&ioport_resource);
This looks really off to me, doesn't this free all resources in the
system?
This isn't enough?:
> + list_for_each_entry(win, &sys->resources, list)
> + devm_kfree(dev, win->res);
> + pci_free_resource_list(&sys->resources);
At worst, I would guess 'release_child_resources(win->res);' in the
loop. But since no bus scan has been done, is there any chance of
child resources at this point?
Regards,
Jason
next prev parent reply other threads:[~2014-05-02 17:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-02 16:41 [RESEND PATCH 0/3] Support for Generic PCI Host Controller Will Deacon
2014-05-02 16:41 ` Will Deacon
2014-05-02 16:41 ` [RESEND PATCH 1/3] ARM: mach-virt: allow PCI support to be selected Will Deacon
2014-05-02 16:41 ` Will Deacon
2014-05-02 18:11 ` Arnd Bergmann
2014-05-02 18:11 ` Arnd Bergmann
2014-05-02 18:21 ` Will Deacon
2014-05-02 18:21 ` Will Deacon
2014-05-02 16:41 ` [RESEND PATCH 2/3] PCI: ARM: add support for generic PCI host controller Will Deacon
2014-05-02 16:41 ` Will Deacon
2014-05-02 17:23 ` Jason Gunthorpe [this message]
2014-05-02 17:23 ` Jason Gunthorpe
2014-05-02 18:25 ` Arnd Bergmann
2014-05-02 18:25 ` Arnd Bergmann
2014-05-02 18:44 ` Will Deacon
2014-05-02 18:44 ` Will Deacon
2014-05-02 19:03 ` Jason Gunthorpe
2014-05-02 19:03 ` Jason Gunthorpe
2014-05-02 19:29 ` Arnd Bergmann
2014-05-02 19:29 ` Arnd Bergmann
2014-05-06 18:38 ` Will Deacon
2014-05-06 18:38 ` Will Deacon
2014-05-06 19:11 ` Arnd Bergmann
2014-05-06 19:11 ` Arnd Bergmann
2014-05-07 9:18 ` Will Deacon
2014-05-07 9:18 ` Will Deacon
2014-05-06 16:05 ` Will Deacon
2014-05-06 16:05 ` Will Deacon
2014-05-02 16:41 ` [RESEND PATCH 3/3] MAINTAINERS: add entry for generic PCI host controller driver Will Deacon
2014-05-02 16:41 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140502172317.GC3179@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.