Skip to contentSkip to conversation

warning: ???pci_find_device??? is deprecated

DISCUSSION Matthew Wilcox 3 participants 3 messages May 2, 2008 Kernel janitors

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines · Ricardo Martins

There are 14 drivers in drivers/isdn/hisax/ still using calls to pci_find_device() instead of the pci_get_device(). From what I gather, a simple sed 's|pci_find_device|pci_get_device|' is enough to fix this, since both functions use the same input and give the same output. Is this correct?

It's never correct. If it were that easy (a) there wouldn't be a rename in the first place and (b) it would have been done with a shell-script already.

pci_get_device increments a refcount on the pci_dev. pci_find_device does not. Your patch must include calls to pci_dev_put() *when appropriate*. Note, for example, that pci_get_device decrements the refcount on the device passed in.

Quoted 3 lines

Also, since there are 14 drivers with only those 1-line changes, should each driver have its own patch or could I send a single patch covering all of them?

It's not going to be a 1-line patch, so one per driver.

Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
#1 lore raw
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · Ricardo Martins

There are 14 drivers in drivers/isdn/hisax/ still using calls to pci_find_device() instead of the pci_get_device(). From what I gather, a simple sed 's|pci_find_device|pci_get_device|' is enough to fix this, since both functions use the same input and give the same output. Is this correct?

Quoted 8 lines

It's never correct. If it were that easy (a) there wouldn't be a rename in the first place and (b) it would have been done with a shell-script already.

pci_get_device increments a refcount on the pci_dev. pci_find_device does not. Your patch must include calls to pci_dev_put() *when appropriate*. Note, for example, that pci_get_device decrements the refcount on the device passed in.

I looked at this briefly at one point. To my recollection, many of the files that use pci_find_device store the result in a global variable. So one would have to think carefully about the useful lifetime of the value of that variable to know where to put the puts.

julia

#2 lore raw
In reply to Matthew Wilcox
Quoted 18 lines · Julia Lawall
Quoted 7 lines · Matthew Wilcox
Quoted 5 lines · Ricardo Martins

There are 14 drivers in drivers/isdn/hisax/ still using calls to pci_find_device() instead of the pci_get_device(). From what I gather, a simple sed 's|pci_find_device|pci_get_device|' is enough to fix this, since both functions use the same input and give the same output. Is this correct?

Quoted 8 lines

It's never correct. If it were that easy (a) there wouldn't be a rename in the first place and (b) it would have been done with a shell-script already.

pci_get_device increments a refcount on the pci_dev. pci_find_device does not. Your patch must include calls to pci_dev_put() *when appropriate*. Note, for example, that pci_get_device decrements the refcount on the device passed in.

Quoted 6 lines

I looked at this briefly at one point. To my recollection, many of the files that use pci_find_device store the result in a global variable. So one would have to think carefully about the useful lifetime of the value of that variable to know where to put the puts.

julia

I see. Thank you both for shedding some light on this.

Signature · 1 line
 Ricardo Martins  *  scarybox.net  *  GPG key: 0x1308F1B4