Skip to contentSkip to conversation

drivers/isdn/hisax/telespci.c: fix warning

PATCH In review Michael Borisov 2 participants 6 messages Jul 27, 2008 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/14 drivers/isdn/hisax/telespci.c: fix warning

Probably now it is correct ?
This patch fixes the following compile warning:

drivers/isdn/hisax/telespci.c: In function ‘setup_telespci’:
drivers/isdn/hisax/telespci.c:303: warning: ‘pci_find_device’ is deprecated (declared at include/linux/pci.h:535)

---

(quoted diff) +0 -0

b/drivers/isdn/hisax/telespci.c
index 28b08de..1142f35 100644

drivers/isdn/hisax/telespci.c +0 -1
@@ -300,7 +300,9 @@ setup_telespci(struct IsdnCard *card)
 	if (cs->typ != ISDN_CTYPE_TELESPCI)
 		return (0);
 
-	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN,

PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
+ dev_tel = pci_get_device (PCI_VENDOR_ID_ZORAN,
PCI_DEVICE_ID_ZORAN_36120, NULL);
+ if (dev_tel) {
+ pci_dev_put(dev_tel);
if (pci_enable_device(dev_tel))
return(0);
cs->irq = dev_tel->irq;

#1 lore raw
Quoted 1 line · Michael Borisov

Probably now it is correct ?

Please explain why.

julia

Quoted 32 lines

This patch fixes the following compile warning:

drivers/isdn/hisax/telespci.c: In function ÿÿsetup_telespciÿÿ:
drivers/isdn/hisax/telespci.c:303: warning: ÿÿpci_find_deviceÿÿ is deprecated (declared at include/linux/pci.h:535)

---

drivers/isdn/hisax/telespci.c +3 -1
index 28b08de..1142f35 100644
@@ -300,7 +300,9 @@ setup_telespci(struct IsdnCard *card)
 	if (cs->typ != ISDN_CTYPE_TELESPCI)
 		return (0);
 
-	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN,
 PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
+	dev_tel = pci_get_device (PCI_VENDOR_ID_ZORAN,
 PCI_DEVICE_ID_ZORAN_36120, NULL);
+	if (dev_tel) {
+		pci_dev_put(dev_tel);
 		if (pci_enable_device(dev_tel))
drivers/isdn/hisax/telespci.c +0 -1
 			return(0);
 		cs->irq = dev_tel->irq;
 
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Michael Borisov
Quoted 8 lines · Michael Borisov
Quoted 4 lines
Quoted 2 lines

Probably now it is correct ?

Please explain why.

Because added pci_dev_put() and not used assignment in if condition. Right ?

The question is whether this is the right time to do pci_dev_put() for that value and whether someone will do pci_dev_put(), if needed, for the new value.

julia

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Michael Borisov

Some points that I did not pick up on the first time:

1. You have changed the semantics by putting NULL as the last argument of pci_get_device. The last argument of pci_find_device is the one from which to start searching for the result. With NULL as the last argument, it starts the search from the beginning of the list.

2. By immediately dropping the reference count, you have at best preserved the behavior of pci_find_device, in which the object is not protected from being freed, and at worst caused the object to be freed immediately, if no one else has increased its reference count.

julia

Quoted 33 lines · Michael Borisov

Probably now it is correct ?
This patch fixes the following compile warning:

drivers/isdn/hisax/telespci.c: In function ÿÿsetup_telespciÿÿ:
drivers/isdn/hisax/telespci.c:303: warning: ÿÿpci_find_deviceÿÿ is deprecated (declared at include/linux/pci.h:535)

---

drivers/isdn/hisax/telespci.c +3 -1
index 28b08de..1142f35 100644
@@ -300,7 +300,9 @@ setup_telespci(struct IsdnCard *card)
 	if (cs->typ != ISDN_CTYPE_TELESPCI)
 		return (0);
 
-	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN,
 PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
+	dev_tel = pci_get_device (PCI_VENDOR_ID_ZORAN,
 PCI_DEVICE_ID_ZORAN_36120, NULL);
+	if (dev_tel) {
+		pci_dev_put(dev_tel);
 		if (pci_enable_device(dev_tel))
drivers/isdn/hisax/telespci.c +0 -1
 			return(0);
 		cs->irq = dev_tel->irq;
 
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Michael Borisov

---

(quoted diff) +0 -0

b/drivers/isdn/hisax/telespci.c
index 28b08de..2ebcbc9 100644

drivers/isdn/hisax/telespci.c +0 -1
@@ -300,7 +300,9 @@ setup_telespci(struct IsdnCard *card)
 	if (cs->typ != ISDN_CTYPE_TELESPCI)
 		return (0);
 
-	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN,

PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
+ dev_tel = pci_get_device (PCI_VENDOR_ID_ZORAN,
PCI_DEVICE_ID_ZORAN_36120, dev_tel);
+ if (dev_tel) {
+ pci_dev_put(dev_tel);
if (pci_enable_device(dev_tel))
return(0);
cs->irq = dev_tel->irq;