drivers/char/ip2/ip2main.c : change pci_find_device by
Subsystems (2)
PATCH 1/1 drivers/char/ip2/ip2main.c : change pci_find_device by
From: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter, so unload could be done.
---
drivers/char/ip2/ip2main.c +2 -1
@@ -594,7 +594,7 @@ ip2_loadmain(int *iop, int *irqp, unsign#ifdef CONFIG_PCI {struct pci_dev *pci_dev_i =NULL ; - pci_dev_i =pci_find_device (PCI_VENDOR_ID_COMPUTONE , + pci_dev_i =pci_get_device (PCI_VENDOR_ID_COMPUTONE ,PCI_DEVICE_ID_COMPUTONE_IP2EX , pci_dev_i);if (pci_dev_i !=NULL ) {unsigned int addr;
@@ -622,6 +622,7 @@ ip2_loadmain(int *iop, int *irqp, unsign// pci_irq = 0; // } ip2config.irq[i] = pci_dev_i->irq; +pci_dev_put (pci_dev_i); }else {// ann error ip2config.addr[i] =0 ;if (status ==PCIBIOS_DEVICE_NOT_FOUND ) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
PATCH 1/1 drivers/char/ip2/ip2main.c : change pci_find_device by
From: trem <[email protected]>
This patch simply change pci_find_device by pci_get_device, because pci_find_device is deprecated. pci_dev_put has been added to decrement the counter, so unload could be done. I've added a pci_dev_put(pci_dev_i) before the break to avoid mising a device.
---
drivers/char/ip2/ip2main.c +3 -1
@@ -594,7 +594,7 @@ ip2_loadmain(int *iop, int *irqp, unsign#ifdef CONFIG_PCI {struct pci_dev *pci_dev_i =NULL ; - pci_dev_i =pci_find_device (PCI_VENDOR_ID_COMPUTONE , + pci_dev_i =pci_get_device (PCI_VENDOR_ID_COMPUTONE ,PCI_DEVICE_ID_COMPUTONE_IP2EX , pci_dev_i);if (pci_dev_i !=NULL ) {unsigned int addr;
@@ -602,6 +602,7 @@ ip2_loadmain(int *iop, int *irqp, unsignif (pci_enable_device (pci_dev_i)) {printk (KERN_ERR "IP2: can't enable PCI device at %s\n" ,pci_name (pci_dev_i)); +pci_dev_put (pci_dev_i);break ; } ip2config.type[i] =PCI ;
@@ -622,6 +623,7 @@ ip2_loadmain(int *iop, int *irqp, unsign// pci_irq = 0; // } ip2config.irq[i] = pci_dev_i->irq; +pci_dev_put (pci_dev_i); }else {// ann error ip2config.addr[i] =0 ;if (status ==PCIBIOS_DEVICE_NOT_FOUND ) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/char/ip2/ip2main.c : change pci_find_device
In reply to tremQuoted 6 lines · trem
From: trem <[email protected]>
This patch simply change
pci_find_devicebypci_get_device, becausepci_find_deviceis deprecated.pci_dev_puthas been added to decrement the counter, so unload could be done. I've added apci_dev_put(pci_dev_i)before the break to avoid mising a device.
No, you are decrementing a reference while still holding a pointer to it. That's a bug.
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Re: [KJ] [PATCH] drivers/char/ip2/ip2main.c : change pci_find_device
In reply to tremQuoted 24 lines · trem
From: trem <[email protected]>
This patch simply change
pci_find_devicebypci_get_device, becausepci_find_deviceis deprecated.pci_dev_puthas been added to decrement the counter, so unload could be done.Signed-off-by trem <[email protected]>---
drivers/char/ip2/ip2main.c +1
-1@@ -594,7 +594,7 @@ ip2_loadmain(int *iop, int *irqp, unsign#ifdef CONFIG_PCI {struct pci_dev *pci_dev_i =NULL ; - pci_dev_i =pci_find_device (PCI_VENDOR_ID_COMPUTONE , + pci_dev_i =pci_get_device (PCI_VENDOR_ID_COMPUTONE ,PCI_DEVICE_ID_COMPUTONE_IP2EX , pci_dev_i);if (pci_dev_i !=NULL ) {unsigned int addr;
drivers/char/ip2/ip2main.c ip2_loadmain(int *iop, int *irqp, unsign · line 625
Quoted 4 lines
drivers/char/ip2/ip2main.c +1
-0@@ -622,6 +622,7 @@ ip2_loadmain(int *iop, int *irqp, unsign// pci_irq = 0; // } ip2config.irq[i] = pci_dev_i->irq; +pci_dev_put (pci_dev_i);
Nope, you saved a reference and yet just released it. Not acceptable.
Please note that making these changes is very difficult. Numerous people have tried it in the past and generally just given up. See the archives for details on how to get it correct, and to keep from doing the same things that others did.
thanks,
greg k-h
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors