All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: warning: ???pci_find_device??? is deprecated
@ 2008-05-02 16:25 Matthew Wilcox
  2008-05-02 16:28 ` Julia Lawall
  2008-05-02 16:42 ` Ricardo Martins
  0 siblings, 2 replies; 3+ messages in thread
From: Matthew Wilcox @ 2008-05-02 16:25 UTC (permalink / raw)
  To: kernel-janitors

On Fri, May 02, 2008 at 05:19:40PM +0100, Ricardo Martins wrote:
> 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.

> 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.

-- 
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."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: warning: ???pci_find_device??? is deprecated
  2008-05-02 16:25 warning: ???pci_find_device??? is deprecated Matthew Wilcox
@ 2008-05-02 16:28 ` Julia Lawall
  2008-05-02 16:42 ` Ricardo Martins
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2008-05-02 16:28 UTC (permalink / raw)
  To: kernel-janitors

On Fri, 2 May 2008, Matthew Wilcox wrote:

> On Fri, May 02, 2008 at 05:19:40PM +0100, Ricardo Martins wrote:
> > 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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: warning: ???pci_find_device??? is deprecated
  2008-05-02 16:25 warning: ???pci_find_device??? is deprecated Matthew Wilcox
  2008-05-02 16:28 ` Julia Lawall
@ 2008-05-02 16:42 ` Ricardo Martins
  1 sibling, 0 replies; 3+ messages in thread
From: Ricardo Martins @ 2008-05-02 16:42 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

On Fri, 02 May 2008 18:28, Julia Lawall wrote:
> On Fri, 2 May 2008, Matthew Wilcox wrote:
> 
> > On Fri, May 02, 2008 at 05:19:40PM +0100, Ricardo Martins wrote:
> > > 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.
> 
> 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.

-- 
 Ricardo Martins  *  scarybox.net  *  GPG key: 0x1308F1B4

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-02 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 16:25 warning: ???pci_find_device??? is deprecated Matthew Wilcox
2008-05-02 16:28 ` Julia Lawall
2008-05-02 16:42 ` Ricardo Martins

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.