From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Raag Jadav <raag.jadav@intel.com>,
jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com,
lakshmi.sowjanya.d@intel.com, linux-pwm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/3] pwm: dwc: use to_pci_dev() helper
Date: Sun, 28 Jan 2024 17:55:00 +0100 [thread overview]
Message-ID: <q5mde3tak2mpqnkphue7vdez33l4bh2urjqryljzzpvz556yjw@2gmnudzle3my> (raw)
In-Reply-To: <ZbZo2A3qU9RIz568@smile.fi.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]
Hello,
On Sun, Jan 28, 2024 at 04:46:48PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 22, 2024 at 08:32:38AM +0530, Raag Jadav wrote:
> > Use to_pci_dev() helper to get pci device reference.
>
> PCI
>
> ...
>
> > static int dwc_pwm_suspend(struct device *dev)
> > {
> > - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
> > + struct pci_dev *pdev = to_pci_dev(dev);
> > struct dwc_pwm *dwc = pci_get_drvdata(pdev);
> > int i;
> >
> > @@ -120,7 +120,7 @@ static int dwc_pwm_suspend(struct device *dev)
> >
> > static int dwc_pwm_resume(struct device *dev)
> > {
> > - struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
> > + struct pci_dev *pdev = to_pci_dev(dev);
> > struct dwc_pwm *dwc = pci_get_drvdata(pdev);
> > int i;
>
> I don't see how pdev is being used. That said, why dev_get_drvdata() is not
> suffice?
I would even consider using dev_get_drvdata() a nice cleanup given that
pci_get_drvdata() works because dwc_pwm_alloc() called dev_set_drvdata()
(and not pci_set_drvdata()).
Not so long ago (i.e. before commit a357d1493f0c ("pwm: dwc: Move memory
allocation to own function")) the dwc driver was pci only and used
pci_set_drvdata(). Then the upside of first converting the struct device
to a struct pci_dev was not to hard code knowledge about the
implementation of pci_[gs]et_drvdata().
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-01-28 16:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 3:02 [PATCH v1 0/3] DesignWare PWM improvements Raag Jadav
2024-01-22 3:02 ` [PATCH v1 1/3] pwm: dwc: Add 16 channel support for Intel Elkhart Lake Raag Jadav
2024-01-28 14:53 ` Andy Shevchenko
2024-01-30 10:30 ` Raag Jadav
2024-02-01 11:26 ` Andy Shevchenko
2024-02-02 4:02 ` Raag Jadav
2024-02-07 11:48 ` Raag Jadav
2024-02-07 13:11 ` Jarkko Nikula
2024-01-22 3:02 ` [PATCH v1 2/3] pwm: dwc: simplify error handling Raag Jadav
2024-01-28 14:48 ` Andy Shevchenko
2024-01-28 16:58 ` Uwe Kleine-König
2024-02-01 11:22 ` Andy Shevchenko
2024-01-30 8:31 ` Raag Jadav
2024-02-01 11:24 ` Andy Shevchenko
2024-01-22 3:02 ` [PATCH v1 3/3] pwm: dwc: use to_pci_dev() helper Raag Jadav
2024-01-28 14:46 ` Andy Shevchenko
2024-01-28 16:55 ` Uwe Kleine-König [this message]
2024-01-31 6:54 ` Raag Jadav
2024-01-24 9:45 ` [PATCH v1 0/3] DesignWare PWM improvements Jarkko Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=q5mde3tak2mpqnkphue7vdez33l4bh2urjqryljzzpvz556yjw@2gmnudzle3my \
--to=u.kleine-koenig@pengutronix.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lakshmi.sowjanya.d@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=raag.jadav@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).