dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/hisilicon: Remove redundant null check
@ 2020-10-30  9:27 Tian Tao
  2020-11-02  8:32 ` Thomas Zimmermann
  0 siblings, 1 reply; 5+ messages in thread
From: Tian Tao @ 2020-10-30  9:27 UTC (permalink / raw)
  To: airlied, daniel, tzimmermann, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel

drm_irq_uninstall can handle the case where dev->irq_enable is false,
so Remove redundant null check.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 0c1b40d..b71589b1 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
 
 	drm_atomic_helper_shutdown(dev);
 
-	if (dev->irq_enabled)
-		drm_irq_uninstall(dev);
-
+	drm_irq_uninstall(dev);
 	pci_disable_msi(dev->pdev);
+
 	hibmc_kms_fini(priv);
 	hibmc_mm_fini(priv);
 	dev->dev_private = NULL;
+
 	return 0;
 }
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/hisilicon: Remove redundant null check
  2020-10-30  9:27 [PATCH] drm/hisilicon: Remove redundant null check Tian Tao
@ 2020-11-02  8:32 ` Thomas Zimmermann
  2020-11-02  8:46   ` tiantao (H)
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Zimmermann @ 2020-11-02  8:32 UTC (permalink / raw)
  To: Tian Tao, airlied, daniel, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel


[-- Attachment #1.1.1.1: Type: text/plain, Size: 1456 bytes --]

Hi

Am 30.10.20 um 10:27 schrieb Tian Tao:
> drm_irq_uninstall can handle the case where dev->irq_enable is false,
> so Remove redundant null check.
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index 0c1b40d..b71589b1 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
>  
>  	drm_atomic_helper_shutdown(dev);
>  
> -	if (dev->irq_enabled)
> -		drm_irq_uninstall(dev);
> -
> +	drm_irq_uninstall(dev);

Removing this check would at least result in an error, [1] so rather
leave it in for now.

Instead, we could discuss if drm_irq_install() should become a managed
interface.

Best regards
Thomas

[1]
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L201

>  	pci_disable_msi(dev->pdev);
> +
>  	hibmc_kms_fini(priv);
>  	hibmc_mm_fini(priv);
>  	dev->dev_private = NULL;
> +
>  	return 0;
>  }
>  
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #1.1.1.2: OpenPGP_0x680DC11D530B7A23.asc --]
[-- Type: application/pgp-keys, Size: 4259 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/hisilicon: Remove redundant null check
  2020-11-02  8:32 ` Thomas Zimmermann
@ 2020-11-02  8:46   ` tiantao (H)
  2020-11-02  9:03     ` Thomas Zimmermann
  0 siblings, 1 reply; 5+ messages in thread
From: tiantao (H) @ 2020-11-02  8:46 UTC (permalink / raw)
  To: Thomas Zimmermann, Tian Tao, airlied, daniel, kraxel,
	alexander.deucher, tglx, dri-devel, xinliang.liu, linux-kernel



在 2020/11/2 16:32, Thomas Zimmermann 写道:
> Hi
> 
> Am 30.10.20 um 10:27 schrieb Tian Tao:
>> drm_irq_uninstall can handle the case where dev->irq_enable is false,
>> so Remove redundant null check.
>>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> ---
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> index 0c1b40d..b71589b1 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> @@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
>>   
>>   	drm_atomic_helper_shutdown(dev);
>>   
>> -	if (dev->irq_enabled)
>> -		drm_irq_uninstall(dev);
>> -
>> +	drm_irq_uninstall(dev);
> 
> Removing this check would at least result in an error, [1] so rather
> leave it in for now.
> 
Now there seems to be no driver to check the return value of 
drm_irq_uninstall
> Instead, we could discuss if drm_irq_install() should become a managed
> interface.

Codes like the following
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 09d6e9e..572357c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
         bool irq_enabled;
         int i;

+       if(!dev->irq_enabled || !dev)
+               return 0;

> 
> Best regards
> Thomas
> 
> [1]
> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L201
> 
>>   	pci_disable_msi(dev->pdev);
>> +
>>   	hibmc_kms_fini(priv);
>>   	hibmc_mm_fini(priv);
>>   	dev->dev_private = NULL;
>> +
>>   	return 0;
>>   }
>>   
>>
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/hisilicon: Remove redundant null check
  2020-11-02  8:46   ` tiantao (H)
@ 2020-11-02  9:03     ` Thomas Zimmermann
  2020-11-02  9:06       ` tiantao (H)
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Zimmermann @ 2020-11-02  9:03 UTC (permalink / raw)
  To: tiantao (H),
	Tian Tao, airlied, daniel, kraxel, alexander.deucher, tglx,
	dri-devel, xinliang.liu, linux-kernel


[-- Attachment #1.1.1.1: Type: text/plain, Size: 2580 bytes --]

Hi

Am 02.11.20 um 09:46 schrieb tiantao (H):
> 
> 
> 在 2020/11/2 16:32, Thomas Zimmermann 写道:
>> Hi
>>
>> Am 30.10.20 um 10:27 schrieb Tian Tao:
>>> drm_irq_uninstall can handle the case where dev->irq_enable is false,
>>> so Remove redundant null check.
>>>
>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>> ---
>>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> index 0c1b40d..b71589b1 100644
>>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>> @@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
>>>         drm_atomic_helper_shutdown(dev);
>>>   -    if (dev->irq_enabled)
>>> -        drm_irq_uninstall(dev);
>>> -
>>> +    drm_irq_uninstall(dev);
>>
>> Removing this check would at least result in an error, [1] so rather
>> leave it in for now.
>>
> Now there seems to be no driver to check the return value of
> drm_irq_uninstall

True. No clean-up code should ever fail. But currently, it's not handled
by drm_irq_uninstall().

A better fix would be to have drm_irq_uninstall() return early with a
warning if IRQs are disabled. And for most drivers, a managed version of
drm_irq_install() would be useful.

Best regards
Thomas

>> Instead, we could discuss if drm_irq_install() should become a managed
>> interface.
> 
> Codes like the following
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 09d6e9e..572357c 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
>         bool irq_enabled;
>         int i;
> 
> +       if(!dev->irq_enabled || !dev)
> +               return 0;
> 
>>
>> Best regards
>> Thomas
>>
>> [1]
>> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L201
>>
>>
>>>       pci_disable_msi(dev->pdev);
>>> +
>>>       hibmc_kms_fini(priv);
>>>       hibmc_mm_fini(priv);
>>>       dev->dev_private = NULL;
>>> +
>>>       return 0;
>>>   }
>>>  
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

[-- Attachment #1.1.1.2: OpenPGP_0x680DC11D530B7A23.asc --]
[-- Type: application/pgp-keys, Size: 4259 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/hisilicon: Remove redundant null check
  2020-11-02  9:03     ` Thomas Zimmermann
@ 2020-11-02  9:06       ` tiantao (H)
  0 siblings, 0 replies; 5+ messages in thread
From: tiantao (H) @ 2020-11-02  9:06 UTC (permalink / raw)
  To: Thomas Zimmermann, Tian Tao, airlied, daniel, kraxel,
	alexander.deucher, tglx, dri-devel, xinliang.liu, linux-kernel



在 2020/11/2 17:03, Thomas Zimmermann 写道:
> Hi
> 
> Am 02.11.20 um 09:46 schrieb tiantao (H):
>>
>>
>> 在 2020/11/2 16:32, Thomas Zimmermann 写道:
>>> Hi
>>>
>>> Am 30.10.20 um 10:27 schrieb Tian Tao:
>>>> drm_irq_uninstall can handle the case where dev->irq_enable is false,
>>>> so Remove redundant null check.
>>>>
>>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>>> ---
>>>>    drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +++---
>>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> index 0c1b40d..b71589b1 100644
>>>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>>>> @@ -246,13 +246,13 @@ static int hibmc_unload(struct drm_device *dev)
>>>>          drm_atomic_helper_shutdown(dev);
>>>>    -    if (dev->irq_enabled)
>>>> -        drm_irq_uninstall(dev);
>>>> -
>>>> +    drm_irq_uninstall(dev);
>>>
>>> Removing this check would at least result in an error, [1] so rather
>>> leave it in for now.
>>>
>> Now there seems to be no driver to check the return value of
>> drm_irq_uninstall
> 
> True. No clean-up code should ever fail. But currently, it's not handled
> by drm_irq_uninstall().
> 
> A better fix would be to have drm_irq_uninstall() return early with a
> warning if IRQs are disabled. And for most drivers, a managed version of
> drm_irq_install() would be useful.
> 
Codes like the following
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 09d6e9e..572357c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
         bool irq_enabled;
         int i;

+       if(!dev->irq_enabled || !dev)
+               return 0;
> Best regards
> Thomas
> 
>>> Instead, we could discuss if drm_irq_install() should become a managed
>>> interface.
>>
>> Codes like the following
>> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
>> index 09d6e9e..572357c 100644
>> --- a/drivers/gpu/drm/drm_irq.c
>> +++ b/drivers/gpu/drm/drm_irq.c
>> @@ -172,6 +172,9 @@ int drm_irq_uninstall(struct drm_device *dev)
>>          bool irq_enabled;
>>          int i;
>>
>> +       if(!dev->irq_enabled || !dev)
>> +               return 0;
>>
>>>
>>> Best regards
>>> Thomas
>>>
>>> [1]
>>> https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/drm_irq.c#L201
>>>
>>>
>>>>        pci_disable_msi(dev->pdev);
>>>> +
>>>>        hibmc_kms_fini(priv);
>>>>        hibmc_mm_fini(priv);
>>>>        dev->dev_private = NULL;
>>>> +
>>>>        return 0;
>>>>    }
>>>>   
>>>
>>
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-11-02 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  9:27 [PATCH] drm/hisilicon: Remove redundant null check Tian Tao
2020-11-02  8:32 ` Thomas Zimmermann
2020-11-02  8:46   ` tiantao (H)
2020-11-02  9:03     ` Thomas Zimmermann
2020-11-02  9:06       ` tiantao (H)

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).