[5/6] drm/xen: Use drm_dev_unregister()

Submitted by Noralf Trønnes on Feb. 3, 2019, 3:41 p.m.

Details

Message ID 20190203154200.61479-6-noralf@tronnes.org
State New
Headers show
Series "drm/drv: Remove drm_dev_unplug()" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Noralf Trønnes Feb. 3, 2019, 3:41 p.m.
drm_dev_unplug() has been stripped down and is going away. Open code its
2 remaining function calls.

Also remove the drm_dev_is_unplugged() check since this can't be true
before drm_dev_unregister() is called which happens after the check.

Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/xen/xen_drm_front.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
index 3e78a832d7f9..5c5eb24c6342 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -576,12 +576,9 @@  static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)
 	if (!dev)
 		return;
 
-	/* Nothing to do if device is already unplugged */
-	if (drm_dev_is_unplugged(dev))
-		return;
-
 	drm_kms_helper_poll_fini(dev);
-	drm_dev_unplug(dev);
+	drm_dev_unregister(dev);
+	drm_dev_put(dev);
 
 	front_info->drm_info = NULL;
 

Comments

On 2/3/19 5:41 PM, Noralf Trønnes wrote:
> drm_dev_unplug() has been stripped down and is going away. Open code its

> 2 remaining function calls.

>

> Also remove the drm_dev_is_unplugged() check since this can't be true

> before drm_dev_unregister() is called which happens after the check.

>

> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

> ---

>   drivers/gpu/drm/xen/xen_drm_front.c | 7 ++-----

>   1 file changed, 2 insertions(+), 5 deletions(-)

>

> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c

> index 3e78a832d7f9..5c5eb24c6342 100644

> --- a/drivers/gpu/drm/xen/xen_drm_front.c

> +++ b/drivers/gpu/drm/xen/xen_drm_front.c

> @@ -576,12 +576,9 @@ static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)

>   	if (!dev)

>   		return;

>   

> -	/* Nothing to do if device is already unplugged */

> -	if (drm_dev_is_unplugged(dev))

> -		return;

xen_drm_drv_fini is called when the backend changes its state [1],
so I just use the check above to prevent possible race conditions here,
e.g. do not allow to run unregister code if it is already in progress
So, I think we should keep this and probably just add a comment why it is
here
> -

>   	drm_kms_helper_poll_fini(dev);

> -	drm_dev_unplug(dev);

> +	drm_dev_unregister(dev);

> +	drm_dev_put(dev);

>   

>   	front_info->drm_info = NULL;

>   

[1] https://elixir.bootlin.com/linux/v5.0-rc5/ident/displback_disconnect
Den 04.02.2019 11.42, skrev Oleksandr Andrushchenko:
> On 2/3/19 5:41 PM, Noralf Trønnes wrote:
>> drm_dev_unplug() has been stripped down and is going away. Open code its
>> 2 remaining function calls.
>>
>> Also remove the drm_dev_is_unplugged() check since this can't be true
>> before drm_dev_unregister() is called which happens after the check.
>>
>> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
>> ---
>>   drivers/gpu/drm/xen/xen_drm_front.c | 7 ++-----
>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
>> index 3e78a832d7f9..5c5eb24c6342 100644
>> --- a/drivers/gpu/drm/xen/xen_drm_front.c
>> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
>> @@ -576,12 +576,9 @@ static void xen_drm_drv_fini(struct xen_drm_front_info *front_info)
>>   	if (!dev)
>>   		return;
>>   
>> -	/* Nothing to do if device is already unplugged */
>> -	if (drm_dev_is_unplugged(dev))
>> -		return;
> xen_drm_drv_fini is called when the backend changes its state [1],
> so I just use the check above to prevent possible race conditions here,
> e.g. do not allow to run unregister code if it is already in progress
> So, I think we should keep this and probably just add a comment why it is
> here

Ok, it's just me not reading the code closely enough. I'll put it back
in the next version.

Noralf.

>> -
>>   	drm_kms_helper_poll_fini(dev);
>> -	drm_dev_unplug(dev);
>> +	drm_dev_unregister(dev);
>> +	drm_dev_put(dev);
>>   
>>   	front_info->drm_info = NULL;
>>   
> [1] https://elixir.bootlin.com/linux/v5.0-rc5/ident/displback_disconnect
>