From: Andrey Panin <pazke@orbita1.ru>
To: arjanv@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] i82092 PCMCIA driver cleanup
Date: Wed, 13 Mar 2002 15:29:33 +0300 [thread overview]
Message-ID: <20020313122933.GA291@pazke.ipt> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 395 bytes --]
Hi,
attached patch contains some minor changes to i82092.c PCMCIA driver:
- MODULE_DEVICE_TABLE() added;
- request_region() and pci_enable_device() return value checks added;
- some printk() cleanups.
Untested, but compiles and looks correct.
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #1.2: patch-i82092-3 --]
[-- Type: text/plain, Size: 3270 bytes --]
diff -urN -X /usr/share/dontdiff linux.vanilla/drivers/pcmcia/i82092.c linux/drivers/pcmcia/i82092.c
--- linux.vanilla/drivers/pcmcia/i82092.c Tue Dec 4 12:44:22 2001
+++ linux/drivers/pcmcia/i82092.c Fri Mar 8 23:25:11 2002
@@ -37,6 +37,7 @@
},
{}
};
+MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids);
static struct pci_driver i82092aa_pci_drv = {
name: "i82092aa",
@@ -91,42 +92,41 @@
static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
unsigned char configbyte;
- int i;
+ int i, ret;
enter("i82092aa_pci_probe");
- if (pci_enable_device(dev))
- return -EIO;
+ if ((ret = pci_enable_device(dev)))
+ return ret;
pci_read_config_byte(dev, 0x40, &configbyte); /* PCI Configuration Control */
switch(configbyte&6) {
case 0:
- printk(KERN_INFO "i82092aa: configured as a 2 socket device.\n");
socket_count = 2;
break;
case 2:
- printk(KERN_INFO "i82092aa: configured as a 1 socket device.\n");
socket_count = 1;
break;
case 4:
case 6:
- printk(KERN_INFO "i82092aa: configured as a 4 socket device.\n");
socket_count = 4;
break;
default:
printk(KERN_ERR "i82092aa: Oops, you did something we didn't think of.\n");
- return -EIO;
- break;
+ ret = -EIO;
+ goto err_out_disable;
+ }
+ printk(KERN_INFO "i82092aa: configured as a %d socket device.\n", socket_count);
+
+ if (request_region(pci_resource_start(dev, 0), 2, "i82092aa")) {
+ ret = -EBUSY;
+ goto err_out_disable;
}
for (i = 0;i<socket_count;i++) {
sockets[i].card_state = 1; /* 1 = present but empty */
- sockets[i].io_base = (dev->resource[0].start & ~1);
- if (sockets[i].io_base > 0)
- request_region(sockets[i].io_base, 2, "i82092aa");
-
-
+ sockets[i].io_base = pci_resource_start(dev, 0);
sockets[i].cap.features |= SS_CAP_PCCARD;
sockets[i].cap.map_size = 0x1000;
sockets[i].cap.irq_mask = 0;
@@ -144,20 +144,28 @@
configbyte = 0xFF; /* bitmask, one bit per event, 1 = PCI interrupt, 0 = ISA interrupt */
pci_write_config_byte(dev, 0x50, configbyte); /* PCI Interrupt Routing Register */
-
/* Register the interrupt handler */
dprintk(KERN_DEBUG "Requesting interrupt %i \n",dev->irq);
- if (request_irq(dev->irq, i82092aa_interrupt, SA_SHIRQ, "i82092aa", i82092aa_interrupt)) {
+ if ((ret = request_irq(dev->irq, i82092aa_interrupt, SA_SHIRQ, "i82092aa", i82092aa_interrupt))) {
printk(KERN_ERR "i82092aa: Failed to register IRQ %d, aborting\n", dev->irq);
- return -EIO;
+ goto err_out_free_res;
}
-
- if (register_ss_entry(socket_count, &i82092aa_operations) != 0)
- printk(KERN_NOTICE "i82092aa: register_ss_entry() failed\n");
+ if ((ret = register_ss_entry(socket_count, &i82092aa_operations) != 0)) {
+ printk(KERN_ERR "i82092aa: register_ss_entry() failed\n");
+ goto err_out_free_irq;
+ }
leave("i82092aa_pci_probe");
return 0;
+
+err_out_free_irq:
+ free_irq(dev->irq, i82092aa_interrupt);
+err_out_free_res:
+ release_region(pci_resource_start(dev, 0), 2);
+err_out_disable:
+ pci_disable_device(dev);
+ return ret;
}
static void __exit i82092aa_pci_remove(struct pci_dev *dev)
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
reply other threads:[~2002-03-13 12:25 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=20020313122933.GA291@pazke.ipt \
--to=pazke@orbita1.ru \
--cc=arjanv@redhat.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