As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this ATM card
and could test it that would be great.
Hanna Linder
IBM Linux Technology Center
Signed-off-by: Hanna Linder <[email protected]>
---
diff -Nrup linux-2.6.9-rc4-mm1cln/drivers/atm/ambassador.c linux-2.6.9-rc4-mm1patch/drivers/atm/ambassador.c
--- linux-2.6.9-rc4-mm1cln/drivers/atm/ambassador.c 2004-10-12 14:15:10.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch/drivers/atm/ambassador.c 2004-10-13 13:50:30.070951672 -0700
@@ -2378,7 +2378,7 @@ static int __init amb_probe (void) {
devs = 0;
pci_dev = NULL;
- while ((pci_dev = pci_find_device
+ while ((pci_dev = pci_get_device
(PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_AMBASSADOR, pci_dev)
)) {
if (do_pci_device(pci_dev) == 0)
@@ -2387,7 +2387,7 @@ static int __init amb_probe (void) {
pci_dev = NULL;
- while ((pci_dev = pci_find_device
+ while ((pci_dev = pci_get_device
(PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_AMBASSADOR_BAD, pci_dev)
))
PRINTK (KERN_ERR, "skipped broken (PLX rev 2) card");
As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this ATM card
and could test it that would be great.
Hanna Linder
IBM Linux Technology Center
Signed-off-by: Hanna Linder <[email protected]>
---
diff -Nrup linux-2.6.9-rc4-mm1cln/drivers/atm/firestream.c linux-2.6.9-rc4-mm1patch2/drivers/atm/firestream.c
--- linux-2.6.9-rc4-mm1cln/drivers/atm/firestream.c 2004-10-12 14:15:10.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch2/drivers/atm/firestream.c 2004-10-13 13:51:35.570994152 -0700
@@ -2021,7 +2021,7 @@ int __init fs_detect(void)
func_enter ();
pci_dev = NULL;
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_FUJITSU_ME,
+ while ((pci_dev = pci_get_device(PCI_VENDOR_ID_FUJITSU_ME,
PCI_DEVICE_ID_FUJITSU_FS50,
pci_dev))) {
if (fs_register_and_init (pci_dev, &fs_pci_tbl[0]))
@@ -2029,7 +2029,7 @@ int __init fs_detect(void)
devs++;
}
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_FUJITSU_ME,
+ while ((pci_dev = pci_get_device(PCI_VENDOR_ID_FUJITSU_ME,
PCI_DEVICE_ID_FUJITSU_FS155,
pci_dev))) {
if (fs_register_and_init (pci_dev, FS_IS155))
As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this ATM card
and could test it that would be great.
Hanna Linder
IBM Linux Technology Center
Signed-off-by: Hanna Linder <[email protected]>
---
diff -Nrup linux-2.6.9-rc4-mm1cln/drivers/atm/zatm.c linux-2.6.9-rc4-mm1patch2/drivers/atm/zatm.c
--- linux-2.6.9-rc4-mm1cln/drivers/atm/zatm.c 2004-10-12 14:15:10.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch2/drivers/atm/zatm.c 2004-10-13 14:53:39.875813760 -0700
@@ -1591,7 +1591,7 @@ static int __init zatm_module_init(void)
struct pci_dev *pci_dev;
pci_dev = NULL;
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_ZEITNET,type ?
+ while ((pci_dev = pci_get_device(PCI_VENDOR_ID_ZEITNET,type ?
PCI_DEVICE_ID_ZEITNET_1225 : PCI_DEVICE_ID_ZEITNET_1221,
pci_dev))) {
if (pci_enable_device(pci_dev)) break;
As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this ATM card
and could test it that would be great.
Hanna Linder
IBM Linux Technology Center
Signed-off-by: Hanna Linder <[email protected]>
---
diff -Nrup linux-2.6.9-rc4-mm1cln/drivers/atm/fore200e.c linux-2.6.9-rc4-mm1patch3/drivers/atm/fore200e.c
--- linux-2.6.9-rc4-mm1cln/drivers/atm/fore200e.c 2004-10-12 14:15:10.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch3/drivers/atm/fore200e.c 2004-10-13 13:57:12.000000000 -0700
@@ -644,7 +644,7 @@ fore200e_pca_detect(const struct fore200
int count = index;
do {
- pci_dev = pci_find_device(PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, pci_dev);
+ pci_dev = pci_get_device(PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, pci_dev);
if (pci_dev == NULL)
return NULL;
} while (count--);
As pci_find_device is going away soon I have converted this file to use
pci_get_device instead. I have compile tested it. If anyone has this ATM card
and could test it that would be great.
Hanna Linder
IBM Linux Technology Center
Signed-off-by: Hanna Linder <[email protected]>
---
diff -Nrup linux-2.6.9-rc4-mm1cln/drivers/atm/horizon.c linux-2.6.9-rc4-mm1patch/drivers/atm/horizon.c
--- linux-2.6.9-rc4-mm1cln/drivers/atm/horizon.c 2004-10-12 14:15:10.000000000 -0700
+++ linux-2.6.9-rc4-mm1patch/drivers/atm/horizon.c 2004-10-13 14:52:43.218426992 -0700
@@ -2727,7 +2727,7 @@ static int __init hrz_probe (void) {
devs = 0;
pci_dev = NULL;
- while ((pci_dev = pci_find_device
+ while ((pci_dev = pci_get_device
(PCI_VENDOR_ID_MADGE, PCI_DEVICE_ID_MADGE_HORIZON, pci_dev)
)) {
hrz_dev * dev;
Hanna Linder <[email protected]> :
[...]
Too complicated.
Removal of dead code.
Signed-off-by: Francois Romieu <[email protected]>
diff -puN drivers/atm/firestream.c~firestream-10 drivers/atm/firestream.c
--- linux-2.6.9-rc3/drivers/atm/firestream.c~firestream-10 2004-10-14 00:28:36.000000000 +0200
+++ linux-2.6.9-rc3-fr/drivers/atm/firestream.c 2004-10-14 00:29:18.000000000 +0200
@@ -2012,66 +2012,6 @@ void __devexit firestream_remove_one (st
func_exit ();
}
-
-#if 0
-int __init fs_detect(void)
-{
- struct pci_dev *pci_dev;
- int devs = 0;
-
- func_enter ();
- pci_dev = NULL;
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_FUJITSU_ME,
- PCI_DEVICE_ID_FUJITSU_FS50,
- pci_dev))) {
- if (fs_register_and_init (pci_dev, &fs_pci_tbl[0]))
- break;
- devs++;
- }
-
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_FUJITSU_ME,
- PCI_DEVICE_ID_FUJITSU_FS155,
- pci_dev))) {
- if (fs_register_and_init (pci_dev, FS_IS155))
- break;
- devs++;
- }
- func_exit ();
- return devs;
-}
-#else
-
-#if 0
-int __init init_PCI (void)
-{ /* Begin init_PCI */
-
- int pci_count;
- printk ("init_PCI\n");
- /*
- memset (&firestream_driver, 0, sizeof (firestream_driver));
- firestream_driver.name = "firestream";
- firestream_driver.id_table = firestream_pci_tbl;
- firestream_driver.probe = fs_register_and_init;
- */
- pci_count = pci_register_driver (&firestream_driver);
-
- if (pci_count <= 0) {
- pci_unregister_driver (&firestream_driver);
- pci_count = 0;
- }
-
- return(pci_count);
-
-} /* End init_PCI */
-#endif
-#endif
-
-/*
-#ifdef MODULE
-#define firestream_init init_module
-#endif
-*/
-
static struct pci_device_id firestream_pci_tbl[] = {
{ PCI_VENDOR_ID_FUJITSU_ME, PCI_DEVICE_ID_FUJITSU_FS50,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, FS_IS50},
_
Hanna Linder <[email protected]> :
[...]
You will hate me but I had some code waiting for resurrection. :o)
Modern PCI device style module init.
Signed-off-by: Francois Romieu <[email protected]>
diff -puN drivers/atm/zatm.c~zatm-10 drivers/atm/zatm.c
--- linux-2.6.9-rc3/drivers/atm/zatm.c~zatm-10 2004-10-14 00:39:02.000000000 +0200
+++ linux-2.6.9-rc3-fr/drivers/atm/zatm.c 2004-10-14 00:47:56.000000000 +0200
@@ -46,6 +46,8 @@
* - OAM
*/
+#define ZATM_COPPER 1
+
#if 0
#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
#else
@@ -1577,51 +1579,77 @@ static const struct atmdev_ops ops = {
.change_qos = zatm_change_qos,
};
-static int __init zatm_module_init(void)
+static int __devinit zatm_init_one(struct pci_dev *pci_dev,
+ const struct pci_device_id *ent)
{
struct atm_dev *dev;
struct zatm_dev *zatm_dev;
- int devs,type;
+ int ret = -ENOMEM;
- zatm_dev = (struct zatm_dev *) kmalloc(sizeof(struct zatm_dev),
- GFP_KERNEL);
- if (!zatm_dev) return -ENOMEM;
- devs = 0;
- for (type = 0; type < 2; type++) {
- struct pci_dev *pci_dev;
-
- pci_dev = NULL;
- while ((pci_dev = pci_find_device(PCI_VENDOR_ID_ZEITNET,type ?
- PCI_DEVICE_ID_ZEITNET_1225 : PCI_DEVICE_ID_ZEITNET_1221,
- pci_dev))) {
- if (pci_enable_device(pci_dev)) break;
- dev = atm_dev_register(DEV_LABEL,&ops,-1,NULL);
- if (!dev) break;
- zatm_dev->pci_dev = pci_dev;
- dev->dev_data = zatm_dev;
- zatm_dev->copper = type;
- if (zatm_init(dev) || zatm_start(dev)) {
- atm_dev_deregister(dev);
- break;
- }
- zatm_dev->more = zatm_boards;
- zatm_boards = dev;
- devs++;
- zatm_dev = (struct zatm_dev *) kmalloc(sizeof(struct
- zatm_dev),GFP_KERNEL);
- if (!zatm_dev) {
- printk(KERN_EMERG "zatm.c: memory shortage\n");
- goto out;
- }
- }
- }
+ zatm_dev = (struct zatm_dev *) kmalloc(sizeof(*zatm_dev), GFP_KERNEL);
+ if (!zatm_dev) {
+ printk(KERN_EMERG "%s: memory shortage\n", DEV_LABEL);
+ goto out;
+ }
+
+ dev = atm_dev_register(DEV_LABEL, &ops, -1, NULL);
+ if (!dev)
+ goto out_free;
+
+ ret = pci_enable_device(pci_dev);
+ if (ret < 0)
+ goto out_deregister;
+
+ ret = pci_request_regions(pci_dev, DEV_LABEL);
+ if (ret < 0)
+ goto out_disable;
+
+ zatm_dev->pci_dev = pci_dev;
+ ZATM_DEV(dev) = zatm_dev;
+ zatm_dev->copper = (int)ent->driver_data;
+ if ((ret = zatm_init(dev)) || (ret = zatm_start(dev)))
+ goto out_release;
+
+ pci_set_drvdata(pci_dev, dev);
+ zatm_dev->more = zatm_boards;
+ zatm_boards = dev;
+ ret = 0;
out:
- kfree(zatm_dev);
+ return ret;
- return 0;
+out_release:
+ pci_release_regions(pci_dev);
+out_disable:
+ pci_disable_device(pci_dev);
+out_deregister:
+ atm_dev_deregister(dev);
+out_free:
+ kfree(zatm_dev);
+ goto out;
}
+
MODULE_LICENSE("GPL");
-module_init(zatm_module_init);
+static struct pci_device_id zatm_pci_tbl[] __devinitdata = {
+ { PCI_VENDOR_ID_ZEITNET, PCI_DEVICE_ID_ZEITNET_1221,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, ZATM_COPPER },
+ { PCI_VENDOR_ID_ZEITNET, PCI_DEVICE_ID_ZEITNET_1225,
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+ { 0, }
+};
+MODULE_DEVICE_TABLE(pci, zatm_pci_tbl);
+
+static struct pci_driver zatm_driver = {
+ .name = DEV_LABEL,
+ .id_table = zatm_pci_tbl,
+ .probe = zatm_init_one,
+};
+
+static int __init zatm_init_module(void)
+{
+ return pci_module_init(&zatm_driver);
+}
+
+module_init(zatm_init_module);
/* module_exit not defined so not unloadable */
_
--On Thursday, October 14, 2004 12:53:04 AM +0200 Francois Romieu <[email protected]> wrote:
> Hanna Linder <[email protected]> :
> [...]
>
> You will hate me but I had some code waiting for resurrection. :o)
Not at all. I have no attachment to this code whatsoever. Your solution
looks very clean.
Thanks.
Hanna
On Wed, Oct 13, 2004 at 03:18:30PM -0700, Hanna Linder wrote:
>
>
> As pci_find_device is going away soon I have converted this file to use
> pci_get_device instead. I have compile tested it. If anyone has this ATM card
> and could test it that would be great.
Again this driver should be converted to pci_driver. What you did didn't
plug the hotplug races anyway.
i have to concur. these need to be fixed the right way. i can only
test the fore200e changes though. the other drivers see somewhat
limited use so that is a mistake is made during conversion it isnt
critical.
In message <[email protected]>,Hanna Linder writ
es:
>
>
>As pci_find_device is going away soon I have converted this file to use
>pci_get_device instead. I have compile tested it. If anyone has this ATM card
>and could test it that would be great.