From: David Brownell <david-b@pacbell.net>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jeff Garzik <jeff@garzik.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg KH <greg@kroah.com>
Subject: Re: [patch 2.6.24-rc1] resource_len() utility function
Date: Thu, 25 Oct 2007 09:31:11 -0700 [thread overview]
Message-ID: <200710250931.11636.david-b@pacbell.net> (raw)
In-Reply-To: <20071025132939.3fd010f9@the-village.bc.nu>
On Thursday 25 October 2007, Alan Cox wrote:
> > So you'd suggest having search utilities (as with platform_bus)
> > returning resource indices not resources?
>
> That seems a bad idea to me
I'm assuming you mean they should continue to work like they
do today: return the resource. Your pseudocode below shows
an iomap utility taking a resource.
> > Thing is, BARs are usually well defined, but when folk glue
> > resources together they use whatever order is convenient on
> > that particular platform. And different platforms can have
> > different numbers and types of resources, etc.
>
> Far better I think that pci_ functions that take BAR values end up as
> wrappers of the form
>
> pci_iomap(pdev, bar)
> return dev_iomap_resource(&pdev->resource[bar]);
Sure, for PCI ... where the meaning of BARs is a fixed part of the
hardware spec, and it's not uncommon to skip a few.
But as I noted, that notion doesn't apply cleanly outside PCI;
indexes aren't necessarily portable between systems. So any
such interface should discourage their use.
One issue with a dev_iomap() is that only memory resources
really need mapping ... but *all* of them need claiming.
(Modulo the detail that the iomap morphs i/o addresses too.)
The $SUBJECT function is a (minor) simplification for both
the mapping and claiming steps.
I think I'd rather see a dev_resource_claim() which combines
the request_{,mem_}region() semantics with mapping ... that
way drivers could save code, not just unify the two types
of register addressing.
- Dave
next prev parent reply other threads:[~2007-10-25 16:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-25 1:20 [patch 2.6.24-rc1] resource_len() utility function David Brownell
2007-10-25 1:44 ` Alan Cox
2007-10-25 2:08 ` Jeff Garzik
2007-10-25 2:47 ` David Brownell
2007-10-25 3:46 ` Jeff Garzik
2007-10-25 4:38 ` David Brownell
2007-10-25 12:29 ` Alan Cox
2007-10-25 16:31 ` David Brownell [this message]
2007-10-25 2:39 ` David Brownell
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=200710250931.11636.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox