mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Peter Rosin <peda@axentia.se>
Cc: linux-kernel@vger.kernel.org,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v4 01/14] drm/atomic: export drm_atomic_replace_property_blob
Date: Tue, 11 Jul 2017 10:01:36 +0200	[thread overview]
Message-ID: <20170711080136.7ywol2i272oq2mkk@phenom.ffwll.local> (raw)
In-Reply-To: <1499343648-29695-2-git-send-email-peda@axentia.se>

On Thu, Jul 06, 2017 at 02:20:35PM +0200, Peter Rosin wrote:
> While at it, add some words in the kernel-doc about the 'replaced' arg and
> remove a faulty kernel-doc comment on the return value.
> 
> Also remove a redundant return statement.
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  drivers/gpu/drm/drm_atomic.c | 17 +++++++++--------
>  include/drm/drm_atomic.h     |  4 ++++
>  2 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 09ca662..b7d9696 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -414,13 +414,15 @@ EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
>   * @new_blob: the new blob to replace with
>   * @replaced: whether the blob has been replaced
>   *
> - * RETURNS:
> - * Zero on success, error code on failure
> + * Note that you are required to initialize @replaced to false before the
> + * call, since it is only set to true when the blob property is changed and
> + * not set to false when the property is not changed. This enables a series
> + * of calls to be made where you are interested in if any property is
> + * replaced, but not care so much about exactly which of them was replaced.
>   */
> -static void
> -drm_atomic_replace_property_blob(struct drm_property_blob **blob,
> -				 struct drm_property_blob *new_blob,
> -				 bool *replaced)
> +void drm_atomic_replace_property_blob(struct drm_property_blob **blob,
> +				      struct drm_property_blob *new_blob,
> +				      bool *replaced)

Yes I know I'm super-annoying, but this function now feels misplaced. It
has nothing to do with atomic, it just replaces a pointer to a blob with
anther pointer. I think it'd be much better if we move this function to
drm_property.c, and rename it to drm_property_replace_blob.

Second, instead of typing a huge paragraph explaining how replaced works,
I think the better option would be to drop that parameter and instead
return a boolean indicating whether the blob was replaced or not.

That's a bit more work, but imo functions which are exported need to pass
a higher barrier wrt api polish.

Thanks, Daniel

>  {
>  	struct drm_property_blob *old_blob = *blob;
>  
> @@ -432,9 +434,8 @@ drm_atomic_replace_property_blob(struct drm_property_blob **blob,
>  		drm_property_blob_get(new_blob);
>  	*blob = new_blob;
>  	*replaced = true;
> -
> -	return;
>  }
> +EXPORT_SYMBOL(drm_atomic_replace_property_blob);
>  
>  static int
>  drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index dcc8e0c..8b32ea5 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -321,6 +321,10 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
>  		struct drm_connector_state *state, struct drm_property *property,
>  		uint64_t val);
>  
> +void drm_atomic_replace_property_blob(struct drm_property_blob **blob,
> +				      struct drm_property_blob *new_blob,
> +				      bool *replaced);
> +
>  void * __must_check
>  drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
>  			      void *obj,
> -- 
> 2.1.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2017-07-11  8:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 12:20 [PATCH v4 00/14] improve the fb_setcmap helper Peter Rosin
2017-07-06 12:20 ` [PATCH v4 01/14] drm/atomic: export drm_atomic_replace_property_blob Peter Rosin
2017-07-11  8:01   ` Daniel Vetter [this message]
2017-07-11 12:06     ` Peter Rosin
2017-07-06 12:20 ` [PATCH v4 02/14] drm/atomic-helper: update lut props directly in ..._legacy_gamma_set Peter Rosin
2017-07-11  8:02   ` Daniel Vetter
2017-07-11 13:08     ` Peter Rosin
2017-07-06 12:20 ` [PATCH v4 03/14] drm/fb-helper: separate the fb_setcmap helper into atomic and legacy paths Peter Rosin
2017-07-11  8:10   ` Daniel Vetter
2017-07-11 12:12     ` Peter Rosin
2017-07-12  7:03       ` Daniel Vetter
2017-07-12  7:47         ` Peter Rosin
2017-07-13 12:42           ` Daniel Vetter
2017-07-06 12:20 ` [PATCH v4 04/14] drm: amd: remove dead code and pointless local lut storage Peter Rosin
2017-07-06 12:20 ` [PATCH v4 05/14] drm: armada: remove dead empty functions Peter Rosin
2017-07-06 12:20 ` [PATCH v4 06/14] drm: ast: remove dead code and pointless local lut storage Peter Rosin
2017-07-06 12:20 ` [PATCH v4 07/14] drm: cirrus: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 08/14] drm: gma500: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 09/14] drm: i915: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 10/14] drm: mgag200: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 11/14] drm: nouveau: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 12/14] drm: radeon: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 13/14] drm: stm: " Peter Rosin
2017-07-06 12:20 ` [PATCH v4 14/14] drm: remove unused and redundant callbacks Peter Rosin
2017-07-11  8:13   ` Daniel Vetter
2017-07-11 12:13     ` Peter Rosin

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=20170711080136.7ywol2i272oq2mkk@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=boris.brezillon@free-electrons.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    /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

all inboxes | Powered by JetHome®