diff mbox series

[v2,04/10] drm/i915: use pdev_to_i915() instead of pci_get_drvdata() directly

Message ID 2a6172500e94055f6bf1ab288d8736a53c72cda8.1723129920.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/xe & drm/i915: drvdata usage changes | expand

Commit Message

Jani Nikula Aug. 8, 2024, 3:15 p.m. UTC
We have a helper for converting pci device to i915 device, use it.

v2: Also convert i915_pci_probe() (Gustavo)

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Gustavo Sousa Aug. 9, 2024, 12:54 p.m. UTC | #1
Quoting Jani Nikula (2024-08-08 12:15:49-03:00)
>We have a helper for converting pci device to i915 device, use it.
>
>v2: Also convert i915_pci_probe() (Gustavo)
>
>Cc: Gustavo Sousa <gustavo.sousa@intel.com>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>

>---
> drivers/gpu/drm/i915/i915_pci.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
>index ce4dfd65fafa..94c89ca2ef30 100644
>--- a/drivers/gpu/drm/i915/i915_pci.c
>+++ b/drivers/gpu/drm/i915/i915_pci.c
>@@ -880,7 +880,7 @@ static void i915_pci_remove(struct pci_dev *pdev)
> {
>         struct drm_i915_private *i915;
> 
>-        i915 = pci_get_drvdata(pdev);
>+        i915 = pdev_to_i915(pdev);
>         if (!i915) /* driver load aborted, nothing to cleanup */
>                 return;
> 
>@@ -1003,7 +1003,7 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>         if (err)
>                 return err;
> 
>-        if (i915_inject_probe_failure(pci_get_drvdata(pdev))) {
>+        if (i915_inject_probe_failure(pdev_to_i915(pdev))) {
>                 i915_pci_remove(pdev);
>                 return -ENODEV;
>         }
>@@ -1025,7 +1025,7 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> 
> static void i915_pci_shutdown(struct pci_dev *pdev)
> {
>-        struct drm_i915_private *i915 = pci_get_drvdata(pdev);
>+        struct drm_i915_private *i915 = pdev_to_i915(pdev);
> 
>         i915_driver_shutdown(i915);
> }
>-- 
>2.39.2
>
Andi Shyti Aug. 12, 2024, 5:15 p.m. UTC | #2
Hi Jani,

On Thu, Aug 08, 2024 at 06:15:49PM +0300, Jani Nikula wrote:
> We have a helper for converting pci device to i915 device, use it.
> 
> v2: Also convert i915_pci_probe() (Gustavo)
> 
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index ce4dfd65fafa..94c89ca2ef30 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -880,7 +880,7 @@  static void i915_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_i915_private *i915;
 
-	i915 = pci_get_drvdata(pdev);
+	i915 = pdev_to_i915(pdev);
 	if (!i915) /* driver load aborted, nothing to cleanup */
 		return;
 
@@ -1003,7 +1003,7 @@  static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (err)
 		return err;
 
-	if (i915_inject_probe_failure(pci_get_drvdata(pdev))) {
+	if (i915_inject_probe_failure(pdev_to_i915(pdev))) {
 		i915_pci_remove(pdev);
 		return -ENODEV;
 	}
@@ -1025,7 +1025,7 @@  static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 static void i915_pci_shutdown(struct pci_dev *pdev)
 {
-	struct drm_i915_private *i915 = pci_get_drvdata(pdev);
+	struct drm_i915_private *i915 = pdev_to_i915(pdev);
 
 	i915_driver_shutdown(i915);
 }