From: Maxim Uvarov <muvarov@ru.mvista.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] SMbus i2c-i801 ioports request.
Date: Fri, 21 Dec 2007 14:06:56 +0000 [thread overview]
Message-ID: <20071221140656.12179.42116.stgit@localhost.localdomain> (raw)
Seems it was not on lkml mail list.
MPCBL0040 target has buggy DC752HRA bios with wrong length of SMBus region
(SMBL field). That makes acpi pnp code reserve incorrect region. i2c-801
driver fails on requesting ioport region because half of this region is
alredy held by acpi pnp and regions lengths are not match. This patch
requests each ioport separately so it doesn't matter now if ioport is
reserved by acpi pnp or not.
This patch makes extra records in /proc/ioport. One record per ioport = 20
lines. In case with DC752HRA bios we can request ioports on 2 commands and
we will have only 2 lines in /proc/ioport. But this solution is more
universal.
Signed-off-by: Maxim Uvarov <muvarov@ru.mvista.com>
Signed-off-by: Maxim Uvarov <muvarov@ru.mvista.com>
---
drivers/i2c/busses/i2c-i801.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index ac27e5f..6bb9a70 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -554,6 +554,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
{
unsigned char temp;
int err;
+ int idx;
I801_dev = dev;
switch (dev->device) {
@@ -588,12 +589,15 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
goto exit;
}
- err = pci_request_region(dev, SMBBAR, i801_driver.name);
- if (err) {
- dev_err(&dev->dev, "Failed to request SMBus region "
- "0x%lx-0x%Lx\n", i801_smba,
- (unsigned long long)pci_resource_end(dev, SMBBAR));
- goto exit;
+ for (idx = 0; idx < pci_resource_len(dev, SMBBAR); idx++) {
+ if (!request_region(i801_smba + idx, 1, i801_driver.name)) {
+ while (idx--)
+ release_region(i801_smba + idx, 1);
+ dev_err(&dev->dev, "Failed to request SMBus region "
+ "0x%lx-0x%Lx\n", i801_smba,
+ (unsigned long long)pci_resource_end(dev, SMBBAR));
+ goto exit;
+ }
}
pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
@@ -623,7 +627,8 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
return 0;
exit_release:
- pci_release_region(dev, SMBBAR);
+ for (idx = 0; idx < pci_resource_len(dev, SMBBAR); idx++)
+ release_region(i801_smba + idx, 1);
exit:
return err;
}
reply other threads:[~2007-12-21 11:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20071221140656.12179.42116.stgit@localhost.localdomain \
--to=muvarov@ru.mvista.com \
--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