dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: daniel@ffwll.ch
Cc: emil.l.velikov@gmail.com, dri-devel@lists.freedesktop.org,
	kraxel@redhat.com, airlied@redhat.com, sam@ravnborg.org
Subject: Re: [PATCH 11/13] drm/ast: Managed release of ast firmware
Date: Tue, 28 Jul 2020 11:34:09 +0200	[thread overview]
Message-ID: <20200728093409.GF6419@phenom.ffwll.local> (raw)
In-Reply-To: <9105824f-2d8c-e234-510b-e2da7d7d1ace@suse.de>

On Tue, Jul 28, 2020 at 11:32:04AM +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 28.07.20 um 11:17 schrieb daniel@ffwll.ch:
> > On Tue, Jul 28, 2020 at 09:44:23AM +0200, Thomas Zimmermann wrote:
> >> The ast driver loads firmware for the DP501 display encoder. The
> >> patch replaces the removal code with a managed release function.
> >>
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > 
> > Hm a devm_request_firmware which does exactly this would be nice I think.
> > Maybe as a follow-up refactor?
> 
> There are so many ideas for follow-up patches wrt. devres and drmres, we
> should add a todo item to collect them. Especially, devres is much more
> over head in terms of reviews and kernel building/testing tha tit makes
> sense to collect ideas and address them in larger chunks.

Yeah maybe a section with wanted devres functions in todo.rst makes sense.
For devres it depends which subsystem you're dealing with I guess, and how
much they want to see before it lands.
-Daniel

> 
> Best regards
> Thomas
> 
> > -Daniel
> > 
> >> ---
> >>  drivers/gpu/drm/ast/ast_dp501.c | 23 ++++++++++++++---------
> >>  drivers/gpu/drm/ast/ast_drv.h   |  1 -
> >>  drivers/gpu/drm/ast/ast_main.c  |  3 ---
> >>  3 files changed, 14 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c
> >> index 4b85a504825a..88121c0e0d05 100644
> >> --- a/drivers/gpu/drm/ast/ast_dp501.c
> >> +++ b/drivers/gpu/drm/ast/ast_dp501.c
> >> @@ -8,11 +8,24 @@
> >>  
> >>  MODULE_FIRMWARE("ast_dp501_fw.bin");
> >>  
> >> +static void ast_release_firmware(void *data)
> >> +{
> >> +	struct ast_private *ast = data;
> >> +
> >> +	release_firmware(ast->dp501_fw);
> >> +	ast->dp501_fw = NULL;
> >> +}
> >> +
> >>  static int ast_load_dp501_microcode(struct drm_device *dev)
> >>  {
> >>  	struct ast_private *ast = to_ast_private(dev);
> >> +	int ret;
> >> +
> >> +	ret = request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev);
> >> +	if (ret)
> >> +		return ret;
> >>  
> >> -	return request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev);
> >> +	return devm_add_action_or_reset(dev->dev, ast_release_firmware, ast);
> >>  }
> >>  
> >>  static void send_ack(struct ast_private *ast)
> >> @@ -435,11 +448,3 @@ void ast_init_3rdtx(struct drm_device *dev)
> >>  		}
> >>  	}
> >>  }
> >> -
> >> -void ast_release_firmware(struct drm_device *dev)
> >> -{
> >> -	struct ast_private *ast = to_ast_private(dev);
> >> -
> >> -	release_firmware(ast->dp501_fw);
> >> -	ast->dp501_fw = NULL;
> >> -}
> >> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> >> index 86c9a7ac712b..02908d005b99 100644
> >> --- a/drivers/gpu/drm/ast/ast_drv.h
> >> +++ b/drivers/gpu/drm/ast/ast_drv.h
> >> @@ -312,7 +312,6 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
> >>  bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata);
> >>  u8 ast_get_dp501_max_clk(struct drm_device *dev);
> >>  void ast_init_3rdtx(struct drm_device *dev);
> >> -void ast_release_firmware(struct drm_device *dev);
> >>  
> >>  /* ast_cursor.c */
> >>  int ast_cursor_init(struct ast_private *ast);
> >> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> >> index 792fb7f616ec..e3b7748335a3 100644
> >> --- a/drivers/gpu/drm/ast/ast_main.c
> >> +++ b/drivers/gpu/drm/ast/ast_main.c
> >> @@ -442,11 +442,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv,
> >>  
> >>  void ast_device_destroy(struct ast_private *ast)
> >>  {
> >> -	struct drm_device *dev = &ast->base;
> >> -
> >>  	/* enable standard VGA decode */
> >>  	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
> >>  
> >> -	ast_release_firmware(dev);
> >>  	kfree(ast->dp501_fw_addr);
> >>  }
> >> -- 
> >> 2.27.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
> 




-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-07-28  9:34 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
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 [this message]
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=20200728093409.GF6419@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --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).