dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: airlied@redhat.com, emil.l.velikov@gmail.com, kraxel@redhat.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 04/13] drm/ast: Managed release of I2C adapter
Date: Thu, 30 Jul 2020 11:23:19 +0200	[thread overview]
Message-ID: <abebcb6c-8765-1996-6e44-f384e5d7c281@suse.de> (raw)
In-Reply-To: <20200728180649.GD1114934@ravnborg.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 3382 bytes --]

Hi

Am 28.07.20 um 20:06 schrieb Sam Ravnborg:
> On Tue, Jul 28, 2020 at 09:44:16AM +0200, Thomas Zimmermann wrote:
>> Managed releases of the device's I2C adapter simplify the connector's
>> release.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>  drivers/gpu/drm/ast/ast_mode.c | 21 ++++++++++-----------
>>  1 file changed, 10 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
>> index f421a60d8a96..27eb49bd12b3 100644
>> --- a/drivers/gpu/drm/ast/ast_mode.c
>> +++ b/drivers/gpu/drm/ast/ast_mode.c
>> @@ -39,6 +39,7 @@
>>  #include <drm/drm_fourcc.h>
>>  #include <drm/drm_gem_framebuffer_helper.h>
>>  #include <drm/drm_gem_vram_helper.h>
>> +#include <drm/drm_managed.h>
>>  #include <drm/drm_plane_helper.h>
>>  #include <drm/drm_probe_helper.h>
>>  #include <drm/drm_simple_kms_helper.h>
>> @@ -591,6 +592,14 @@ static void ast_i2c_setsda(void *i2c_priv, int data)
>>  	}
>>  }
>>  
>> +static void ast_i2c_release(struct drm_device *dev, void *data)
>> +{
>> +	struct ast_i2c_chan *i2c = data;
>> +
>> +	i2c_del_adapter(&i2c->adapter);
>> +	i2c->dev = NULL; /* clear to signal absence of I2C support */
>> +}
>> +
>>  static int ast_i2c_init(struct ast_i2c_chan *i2c, struct drm_device *dev)
>>  {
>>  	int ret;
>> @@ -618,7 +627,7 @@ static int ast_i2c_init(struct ast_i2c_chan *i2c, struct drm_device *dev)
>>  
>>  	i2c->dev = dev; /* signals presence of I2C support */
>>  
>> -	return 0;
>> +	return drmm_add_action_or_reset(dev, ast_i2c_release, i2c);
>>  }
>>  
>>  static bool ast_i2c_is_initialized(struct ast_i2c_chan *i2c)
>> @@ -626,14 +635,6 @@ static bool ast_i2c_is_initialized(struct ast_i2c_chan *i2c)
>>  	return !!i2c->dev;
>>  }
>>  
>> -static void ast_i2c_fini(struct ast_i2c_chan *i2c)
>> -{
>> -	if (!ast_i2c_is_initialized(i2c))
>> -		return;
>> -	i2c_del_adapter(&i2c->adapter);
>> -	i2c->dev = NULL; /* clear to signal absence of I2C support */
>> -}
> The intro of ast_i2c_fini() and then removal again confuses me a little.
> But end result looks simple so I guess thats what counts.

The intention was to separate _fini from _destroy and make the patch
series more readable. But looking at it now, this idea did not really
work. I guess, I'll drop _fini.

Best regards
Thomas

> 
> 	Sam
> 
>> -
>>  /*
>>   * Primary plane
>>   */
>> @@ -1139,8 +1140,6 @@ static enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
>>  
>>  static void ast_connector_destroy(struct drm_connector *connector)
>>  {
>> -	struct ast_connector *ast_connector = to_ast_connector(connector);
>> -	ast_i2c_fini(&ast_connector->i2c);
>>  	drm_connector_cleanup(connector);
>>  	kfree(connector);
>>  }
>> -- 
>> 2.27.0
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 

-- 
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.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 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

  reply	other threads:[~2020-07-30  9:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28  7:44 [PATCH 00/13] drm/ast: Convert to managed initialization Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 01/13] drm/ast: Move I2C code within ast_mode.c Thomas Zimmermann
2020-07-28 18:04   ` Sam Ravnborg
2020-07-30  9:18     ` Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 02/13] drm/ast: Test if I2C support has been initialized Thomas Zimmermann
2020-07-28 17:38   ` Sam Ravnborg
2020-07-28  7:44 ` [PATCH 03/13] drm/ast: Embed I2C fields in struct ast_connector Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 04/13] drm/ast: Managed release of I2C adapter Thomas Zimmermann
2020-07-28  9:23   ` daniel
2020-07-28  9:33     ` Thomas Zimmermann
2020-07-30  9:19     ` Thomas Zimmermann
2020-07-28 18:06   ` Sam Ravnborg
2020-07-30  9:23     ` Thomas Zimmermann [this message]
2020-07-28  7:44 ` [PATCH 05/13] drm/ast: Embed CRTC and connector in struct ast_private Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 06/13] drm/ast: Separate DRM driver from PCI code Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 07/13] drm/ast: Replace driver load/unload functions with device create/destroy Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 08/13] drm/ast: Replace struct_drm_device.dev_private with to_ast_private() Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 09/13] drm/ast: Don't use ast->dev if dev is available Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 10/13] drm/ast: Embed struct drm_device in struct ast_private Thomas Zimmermann
2020-07-28  7:44 ` [PATCH 11/13] drm/ast: Managed release of ast firmware Thomas Zimmermann
2020-07-28  9:17   ` daniel
2020-07-28  9:32     ` Thomas Zimmermann
2020-07-28  9:34       ` daniel
2020-07-28  7:44 ` [PATCH 12/13] drm/ast: Manage release of firmware backup memory Thomas Zimmermann
2020-07-28  9:18   ` daniel
2020-07-28  7:44 ` [PATCH 13/13] drm/ast: Managed device release Thomas Zimmermann
2020-07-28 18:10 ` [PATCH 00/13] drm/ast: Convert to managed initialization Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abebcb6c-8765-1996-6e44-f384e5d7c281@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).