All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Venkatesh Pallipadi <venki@google.com>,
	Vojtech Pavlik <vojtech@suse.cz>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: [PATCH v2 2/4] hpet: pass physical address, not entire hpet_data, to hpet_is_known()
Date: Thu, 18 Mar 2010 11:59:35 -0600	[thread overview]
Message-ID: <20100318175935.15143.96345.stgit@bob.kio> (raw)
In-Reply-To: <20100318175852.15143.2124.stgit@bob.kio>


No functional change; hpet_is_known() only needs the physical address,
so supplying that instead of the whole struct hpet_data makes the callers
a little simpler.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
---

 drivers/char/hpet.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)


diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 5cb05ed..d132fef 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -662,12 +662,12 @@ static const struct file_operations hpet_fops = {
 	.mmap = hpet_mmap,
 };
 
-static int hpet_is_known(struct hpet_data *hdp)
+static int hpet_is_known(unsigned long phys_address)
 {
 	struct hpets *hpetp;
 
 	for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
-		if (hpetp->hp_hpet_phys == hdp->hd_phys_address)
+		if (hpetp->hp_hpet_phys == phys_address)
 			return 1;
 
 	return 0;
@@ -788,7 +788,7 @@ int hpet_alloc(struct hpet_data *hdp)
 	 * If platform dependent code has allocated the hpet that
 	 * ACPI has also reported, then we catch it here.
 	 */
-	if (hpet_is_known(hdp)) {
+	if (hpet_is_known(hdp->hd_phys_address)) {
 		printk(KERN_DEBUG "%s: duplicate HPET ignored\n",
 			__func__);
 		return 0;
@@ -909,12 +909,7 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	memset(&data, 0, sizeof(data));
 
 	mem = pnp_get_resource(dev, IORESOURCE_MEM, 0);
-	if (!mem)
-		return -ENODEV;
-
-	data.hd_phys_address = mem->start;
-
-	if (hpet_is_known(&data))
+	if (!mem || hpet_is_known(mem->start))
 		return -ENODEV;
 
 	i = 0;
@@ -926,6 +921,7 @@ static int hpet_pnp_add(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
 	if (!data.hd_nirqs)
 		return -ENODEV;
 
+	data.hd_phys_address = mem->start;
 	data.hd_address = ioremap(mem->start, resource_size(mem));
 
 	return hpet_alloc(&data);

  parent reply	other threads:[~2010-03-18 17:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18 17:59 [PATCH v2 0/4] hpet: convert from ACPI to PNP driver Bjorn Helgaas
2010-03-18 17:59 ` [PATCH v2 1/4] " Bjorn Helgaas
2010-03-18 19:26   ` Venkatesh Pallipadi
2010-03-18 19:26     ` Venkatesh Pallipadi
2010-03-18 17:59 ` Bjorn Helgaas [this message]
2010-03-18 19:25   ` [PATCH v2 2/4] hpet: pass physical address, not entire hpet_data, to hpet_is_known() Venkatesh Pallipadi
2010-03-18 19:25     ` Venkatesh Pallipadi
2010-03-18 17:59 ` [PATCH v2 3/4] hpet: clean up io mapping when hpet_alloc() fails Bjorn Helgaas
2010-03-18 19:25   ` Venkatesh Pallipadi
2010-03-18 19:25     ` Venkatesh Pallipadi
2010-03-18 17:59 ` [PATCH v2 4/4] MAINTAINERS: remove obsolete HPET ACPI entry Bjorn Helgaas
2010-03-19  8:28 ` [PATCH v2 0/4] hpet: convert from ACPI to PNP driver Clemens Ladisch
2010-03-19 15:58   ` Bjorn Helgaas

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=20100318175935.15143.96345.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=clemens@ladisch.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=venki@google.com \
    --cc=vojtech@suse.cz \
    /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.