From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: "David S. Miller" <davem@davemloft.net>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6 IrDA] Fix via_ircc pci init code
Date: Wed, 8 Dec 2004 17:51:34 -0800 [thread overview]
Message-ID: <20041209015134.GB2298@bougret.hpl.hp.com> (raw)
ir260_via_pci_hack.diff :
~~~~~~~~~~~~~~~~~~~~~~~
<Bugfix suggested by Arkadiusz Miskiewicz>
o [CORRECT] Try to fix the worse abuse of the pci init code in via_ircc
Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com>
diff -u -p linux/drivers/net/irda/via-ircc.d2.c linux/drivers/net/irda/via-ircc.c
--- linux/drivers/net/irda/via-ircc.d2.c Wed Dec 8 16:13:03 2004
+++ linux/drivers/net/irda/via-ircc.c Wed Dec 8 16:39:43 2004
@@ -75,6 +75,9 @@ static int dongle_id = 0; /* default: pr
/* We can't guess the type of connected dongle, user *must* supply it. */
MODULE_PARM(dongle_id, "i");
+/* FIXME : we should not need this, because instances should be automatically
+ * managed by the PCI layer. Especially that we seem to only be using the
+ * first entry. Jean II */
/* Max 4 instances for now */
static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
@@ -153,11 +156,9 @@ static int __init via_ircc_init(void)
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
rc = pci_register_driver(&via_driver);
- if (rc < 1) {
+ if (rc < 0) {
IRDA_DEBUG(0, "%s(): error rc = %d, returning -ENODEV...\n",
__FUNCTION__, rc);
- if (rc == 0)
- pci_unregister_driver (&via_driver);
return -ENODEV;
}
return 0;
@@ -288,15 +289,27 @@ static void __exit via_remove_one (struc
{
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+ /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
+ * to get our driver instance and call directly via_ircc_close().
+ * See vlsi_ir for details...
+ * Jean II */
via_ircc_clean();
+ /* FIXME : This should be in via_ircc_close(), because here we may
+ * theoritically disable still configured devices :-( - Jean II */
+ pci_disable_device(pdev);
}
static void __exit via_ircc_cleanup(void)
{
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
+ /* FIXME : This should be redundant, as pci_unregister_driver()
+ * should call via_remove_one() on each device.
+ * Jean II */
via_ircc_clean();
+
+ /* Cleanup all instances of the driver */
pci_unregister_driver (&via_driver);
}
@@ -323,6 +336,10 @@ static __devinit int via_ircc_open(int i
self->netdev = dev;
spin_lock_init(&self->lock);
+ /* FIXME : We should store our driver instance in the PCI layer,
+ * using pci_set_drvdata(), not in this array.
+ * See vlsi_ir for details... - Jean II */
+ /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */
/* Need to store self somewhere */
dev_self[i] = self;
self->index = i;
reply other threads:[~2004-12-09 1:53 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=20041209015134.GB2298@bougret.hpl.hp.com \
--to=jt@bougret.hpl.hp.com \
--cc=davem@davemloft.net \
--cc=jt@hpl.hp.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
all inboxes | Powered by JetHome®