From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] pnp: add PNP resource range checking function
Date: Tue, 21 Apr 2009 09:55:30 -0600 [thread overview]
Message-ID: <200904210955.32105.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <20090414155505.0c2b619f@hobbes>
On Tuesday 14 April 2009 04:55:05 pm Jesse Barnes wrote:
> On Tue, 14 Apr 2009 16:53:11 -0600
> Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
>
> > On Tuesday 14 April 2009 01:46:18 pm Jesse Barnes wrote:
> > > This patch adds a new export from the ACPI PNP core,
> > > is_acpi_pnp_reserved, which is intended for use by drivers to check
> > > whether a given range is already reserved (and therefore likely
> > > safe to use) or not (indicating that new resource space should
> > > probably be allocated).
> >
> > This doesn't really need to be ACPI-specific, does it? And can't
> > you use the pre-parsed resources in pnp_dev->resources? And wouldn't
> > you just look at all resources for all PNP devices, not just the
> > PNP0C01/2 ones?
> >
> > Sorry I don't have time to code up an example right now; maybe next
> > week, though, if you remind me :-)
>
> Sure, that all sounds reasonable... I'll try to remind you. :)
Here's the sort of thing I was thinking (untested).
---
drivers/pnp/resource.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index f604061..6665562 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -638,6 +638,23 @@ int pnp_possible_config(struct pnp_dev *dev, int type, resource_size_t start,
}
EXPORT_SYMBOL(pnp_possible_config);
+int pnp_range_reserved(resource_size_t start, resource_size_t end)
+{
+ struct pnp_dev *dev;
+ struct pnp_resource *pnp_res;
+ resource_size_t *dev_start, *dev_end;
+
+ pnp_for_each_dev(dev) {
+ list_for_each_entry(pnp_res, &dev->resources, list) {
+ dev_start = &pnp_res->res.start;
+ dev_end = &pnp_res->res.end;
+ if (ranged_conflict(&start, &end, dev_start, dev_end))
+ return 1;
+ }
+ }
+ return 0;
+}
+
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
{
prev parent reply other threads:[~2009-04-21 15:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 19:46 [PATCH] pnp: add PNP resource range checking function Jesse Barnes
2009-04-14 19:48 ` [PATCH] i915: enable MCHBAR if needed Jesse Barnes
2009-04-14 22:53 ` [PATCH] pnp: add PNP resource range checking function Bjorn Helgaas
2009-04-14 22:55 ` Jesse Barnes
2009-04-21 15:55 ` Bjorn Helgaas [this message]
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=200904210955.32105.bjorn.helgaas@hp.com \
--to=bjorn.helgaas@hp.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@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