linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: ISST: Use dev_get_drvdata
@ 2019-07-24 12:23 Chuhong Yuan
  2019-07-25 18:00 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-07-24 12:23 UTC (permalink / raw)
  Cc: Srinivas Pandruvada, Darren Hart, Andy Shevchenko,
	platform-driver-x86, linux-kernel, Chuhong Yuan

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/platform/x86/intel_speed_select_if/isst_if_mmio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
index f7266a115a08..ad8c7c0df4d9 100644
--- a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
+++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
@@ -132,11 +132,9 @@ static void isst_if_remove(struct pci_dev *pdev)
 
 static int __maybe_unused isst_if_suspend(struct device *device)
 {
-	struct pci_dev *pdev = to_pci_dev(device);
-	struct isst_if_device *punit_dev;
+	struct isst_if_device *punit_dev = dev_get_drvdata(device);
 	int i;
 
-	punit_dev = pci_get_drvdata(pdev);
 	for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
 		punit_dev->range_0[i] = readl(punit_dev->punit_mmio +
 						mmio_range[0].beg + 4 * i);
@@ -149,11 +147,9 @@ static int __maybe_unused isst_if_suspend(struct device *device)
 
 static int __maybe_unused isst_if_resume(struct device *device)
 {
-	struct pci_dev *pdev = to_pci_dev(device);
-	struct isst_if_device *punit_dev;
+	struct isst_if_device *punit_dev = dev_get_drvdata(device);
 	int i;
 
-	punit_dev = pci_get_drvdata(pdev);
 	for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
 		writel(punit_dev->range_0[i], punit_dev->punit_mmio +
 						mmio_range[0].beg + 4 * i);
-- 
2.20.1


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

* Re: [PATCH] platform/x86: ISST: Use dev_get_drvdata
  2019-07-24 12:23 [PATCH] platform/x86: ISST: Use dev_get_drvdata Chuhong Yuan
@ 2019-07-25 18:00 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2019-07-25 18:00 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Srinivas Pandruvada, Darren Hart, Andy Shevchenko,
	Platform Driver, Linux Kernel Mailing List

On Wed, Jul 24, 2019 at 3:23 PM Chuhong Yuan <hslester96@gmail.com> wrote:
>
> Instead of using to_pci_dev + pci_get_drvdata,
> use dev_get_drvdata to make code simpler.
>

Pushed to my review and testing queue, thanks!

> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
>  drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> index f7266a115a08..ad8c7c0df4d9 100644
> --- a/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> +++ b/drivers/platform/x86/intel_speed_select_if/isst_if_mmio.c
> @@ -132,11 +132,9 @@ static void isst_if_remove(struct pci_dev *pdev)
>
>  static int __maybe_unused isst_if_suspend(struct device *device)
>  {
> -       struct pci_dev *pdev = to_pci_dev(device);
> -       struct isst_if_device *punit_dev;
> +       struct isst_if_device *punit_dev = dev_get_drvdata(device);
>         int i;
>
> -       punit_dev = pci_get_drvdata(pdev);
>         for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
>                 punit_dev->range_0[i] = readl(punit_dev->punit_mmio +
>                                                 mmio_range[0].beg + 4 * i);
> @@ -149,11 +147,9 @@ static int __maybe_unused isst_if_suspend(struct device *device)
>
>  static int __maybe_unused isst_if_resume(struct device *device)
>  {
> -       struct pci_dev *pdev = to_pci_dev(device);
> -       struct isst_if_device *punit_dev;
> +       struct isst_if_device *punit_dev = dev_get_drvdata(device);
>         int i;
>
> -       punit_dev = pci_get_drvdata(pdev);
>         for (i = 0; i < ARRAY_SIZE(punit_dev->range_0); ++i)
>                 writel(punit_dev->range_0[i], punit_dev->punit_mmio +
>                                                 mmio_range[0].beg + 4 * i);
> --
> 2.20.1
>


-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2019-07-25 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-24 12:23 [PATCH] platform/x86: ISST: Use dev_get_drvdata Chuhong Yuan
2019-07-25 18:00 ` Andy Shevchenko

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 NNTP newsgroup(s).