diff mbox series

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

Message ID 313a3cb44e81f067deb9ec03d7e0d13ff6e461b0.1722263308.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 July 29, 2024, 2:30 p.m. UTC
We have a helper for converting pci device to i915 device, use it.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gustavo Sousa Aug. 1, 2024, 5:03 p.m. UTC | #1
Quoting Jani Nikula (2024-07-29 11:30:05-03:00)
>We have a helper for converting pci device to i915 device, use it.

Any reason why i915_inject_probe_failure(pci_get_drvdata(pdev)) was not
converted in i915_pci_probe()?

--
Gustavo Sousa

>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>---
> drivers/gpu/drm/i915/i915_pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
>index ce4dfd65fafa..b2e1fd22520b 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;
> 
>@@ -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
>
Gustavo Sousa Aug. 1, 2024, 5:27 p.m. UTC | #2
Quoting Gustavo Sousa (2024-08-01 14:03:33-03:00)
>Quoting Jani Nikula (2024-07-29 11:30:05-03:00)
>>We have a helper for converting pci device to i915 device, use it.
>
>Any reason why i915_inject_probe_failure(pci_get_drvdata(pdev)) was not
>converted in i915_pci_probe()?

Hm... And after the next patch, that pci_get_drvdata(pdev) call seems to
be wrong (although it would work because of drm being at offset 0).

--
Gustavo Sousa

>
>--
>Gustavo Sousa
>
>>
>>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>---
>> drivers/gpu/drm/i915/i915_pci.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
>>index ce4dfd65fafa..b2e1fd22520b 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;
>> 
>>@@ -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
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index ce4dfd65fafa..b2e1fd22520b 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;
 
@@ -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);
 }