mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] habanalabs: Use dev_get_drvdata
@ 2019-07-23 12:46 Chuhong Yuan
  2019-07-23 18:24 ` Oded Gabbay
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-07-23 12:46 UTC (permalink / raw)
  Cc: Oded Gabbay, Arnd Bergmann, Greg Kroah-Hartman, 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>
---
Changes in v2:
  - Split v1 into different subsystems

 drivers/misc/habanalabs/habanalabs_drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/habanalabs/habanalabs_drv.c b/drivers/misc/habanalabs/habanalabs_drv.c
index 6f6dbe93f1df..678f61646ca9 100644
--- a/drivers/misc/habanalabs/habanalabs_drv.c
+++ b/drivers/misc/habanalabs/habanalabs_drv.c
@@ -295,8 +295,7 @@ void destroy_hdev(struct hl_device *hdev)
 
 static int hl_pmops_suspend(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct hl_device *hdev = pci_get_drvdata(pdev);
+	struct hl_device *hdev = dev_get_drvdata(dev);
 
 	pr_debug("Going to suspend PCI device\n");
 
@@ -310,8 +309,7 @@ static int hl_pmops_suspend(struct device *dev)
 
 static int hl_pmops_resume(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct hl_device *hdev = pci_get_drvdata(pdev);
+	struct hl_device *hdev = dev_get_drvdata(dev);
 
 	pr_debug("Going to resume PCI device\n");
 
-- 
2.20.1


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

* Re: [PATCH v2] habanalabs: Use dev_get_drvdata
  2019-07-23 12:46 [PATCH v2] habanalabs: Use dev_get_drvdata Chuhong Yuan
@ 2019-07-23 18:24 ` Oded Gabbay
  0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2019-07-23 18:24 UTC (permalink / raw)
  To: Chuhong Yuan
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Linux-Kernel@Vger. Kernel. Org

On Tue, Jul 23, 2019 at 3:46 PM Chuhong Yuan <hslester96@gmail.com> wrote:
>
> 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>
> ---
> Changes in v2:
>   - Split v1 into different subsystems
>
>  drivers/misc/habanalabs/habanalabs_drv.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/habanalabs/habanalabs_drv.c b/drivers/misc/habanalabs/habanalabs_drv.c
> index 6f6dbe93f1df..678f61646ca9 100644
> --- a/drivers/misc/habanalabs/habanalabs_drv.c
> +++ b/drivers/misc/habanalabs/habanalabs_drv.c
> @@ -295,8 +295,7 @@ void destroy_hdev(struct hl_device *hdev)
>
>  static int hl_pmops_suspend(struct device *dev)
>  {
> -       struct pci_dev *pdev = to_pci_dev(dev);
> -       struct hl_device *hdev = pci_get_drvdata(pdev);
> +       struct hl_device *hdev = dev_get_drvdata(dev);
>
>         pr_debug("Going to suspend PCI device\n");
>
> @@ -310,8 +309,7 @@ static int hl_pmops_suspend(struct device *dev)
>
>  static int hl_pmops_resume(struct device *dev)
>  {
> -       struct pci_dev *pdev = to_pci_dev(dev);
> -       struct hl_device *hdev = pci_get_drvdata(pdev);
> +       struct hl_device *hdev = dev_get_drvdata(dev);
>
>         pr_debug("Going to resume PCI device\n");
>
> --
> 2.20.1
>

This patch is:
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
And pushed to -next

Thanks,
Oded

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 12:46 [PATCH v2] habanalabs: Use dev_get_drvdata Chuhong Yuan
2019-07-23 18:24 ` Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®