lkml.org 
[lkml]   [2019]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] media: pci: Use dev_get_drvdata where possible
On Wed, Jul 24, 2019 at 09:23:41AM +0800, Chuhong Yuan wrote:
> On Tue, Jul 23, 2019 at 10:39 PM Cao, Bingbu <bingbu.cao@intel.com> wrote:
> >
> >
> >
> > ________________________
> > BRs,
> > Bingbu Cao
> >
> >
> > -----Original Message-----
> > From: Chuhong Yuan <hslester96@gmail.com>
> > Sent: Tuesday, July 23, 2019 7:50 PM
> > Cc: Zhi, Yong <yong.zhi@intel.com>; Sakari Ailus <sakari.ailus@linux.intel.com>; Cao, Bingbu <bingbu.cao@intel.com>; Mauro Carvalho Chehab <mchehab@kernel.org>; Akihiro Tsukada <tskd08@gmail.com>; linux-media@vger.kernel.org; linux-kernel@vger.kernel.org; Chuhong Yuan <hslester96@gmail.com>
> > Subject: [PATCH] media: pci: Use dev_get_drvdata where possible
> >
> > Instead of using to_pci_dev + pci_get_drvdata, use dev_get_drvdata to make code simpler.
> >
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> > drivers/media/pci/intel/ipu3/ipu3-cio2.c | 3 +--
> > drivers/media/pci/pt1/pt1.c | 6 ++----
> > drivers/media/pci/pt3/pt3.c | 6 ++----
> > 3 files changed, 5 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > index c1d133e17e4b..50a34bcd4d14 100644
> > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > @@ -2000,8 +2000,7 @@ static int __maybe_unused cio2_suspend(struct device *dev)
> >
> > static int __maybe_unused cio2_resume(struct device *dev) {
> > - struct pci_dev *pci_dev = to_pci_dev(dev);
> > - struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
> > + struct cio2_device *cio2 = dev_get_drvdata(dev);
> >
> > Thanks for your patch.
> > I think using pci_get_drvdata() here mainly make a pair with the pci_set_drvdata() in probe.
>
> Thanks for your reply.
> I will change pci_set_drvdata() to dev_set_drvdata() in the next
> version to keep their consistency.

Sorry guys; I like this one better. These pci_*() functions are just
wrappers around the dev_*() equivalents; you can use the one you like at
any given occasion. In this case the pci prefixed one is more convenient.

--
Kind regards,

Sakari Ailus
sakari.ailus@linux.intel.com

\
 
 \ /
  Last update: 2019-07-25 11:17    [W:0.050 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site