Linux Media Controller development
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: [PATCH 2/2] media: mc-entity: Drop ifdef for media_entity_cleanup definition
Date: Thu, 7 May 2026 14:48:23 +0200	[thread overview]
Message-ID: <afyJk_qcsuTt8gxf@zed> (raw)
In-Reply-To: <20260506165438.1767378-2-laurent.pinchart@ideasonboard.com>

Hi Laurent

On Wed, May 06, 2026 at 07:54:38PM +0300, Laurent Pinchart wrote:
> The media_entity_cleanup() function is defined in media-entity.h as a
> static inline no-op when CONFIG_MEDIA_CONTROLLER is enabled, and as a
> no-op macro otherwise. This complexity is unneeded. Use a static inline
> function in all cases.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/media/media-entity.h | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 904f61c14dc1..d9b72cd87d52 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -729,11 +729,9 @@ int media_entity_pads_init(struct media_entity *entity, u16 num_pads,
>   * zeroed but that has not been initialized with media_entity_pads_init() is
>   * valid and is a no-op.

I wonder if the documentation really applies

 * Calling media_entity_cleanup() on a media_entity whose memory has been
 * zeroed but that has not been initialized with media_entity_pad_init() is
 * valid and is a no-op.

But a few lines above it says

 * This function must be called during the cleanup phase after unregistering
 * the entity (currently, it does nothing).

Not that the documentation is wrong, but if the functions is a nop, of
course it is valid to call it on non initialized entities :)

>   */
> -#if IS_ENABLED(CONFIG_MEDIA_CONTROLLER)
> -static inline void media_entity_cleanup(struct media_entity *entity) {}
> -#else
> -#define media_entity_cleanup(entity) do { } while (false)
> -#endif
> +static inline void media_entity_cleanup(struct media_entity *entity)
> +{
> +}

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

>
>  /**
>   * media_get_pad_index() - retrieves a pad index from an entity
> --
> Regards,
>
> Laurent Pinchart
>
>

  reply	other threads:[~2026-05-07 12:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 16:54 [PATCH 1/2] media: mc-entity: Fix documentation typo in function name Laurent Pinchart
2026-05-06 16:54 ` [PATCH 2/2] media: mc-entity: Drop ifdef for media_entity_cleanup definition Laurent Pinchart
2026-05-07 12:48   ` Jacopo Mondi [this message]
2026-05-07 12:54     ` Laurent Pinchart
2026-05-07 12:46 ` [PATCH 1/2] media: mc-entity: Fix documentation typo in function name Jacopo Mondi
2026-05-08 16:10 ` Frank Li
2026-05-08 20:07   ` Laurent Pinchart

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=afyJk_qcsuTt8gxf@zed \
    --to=jacopo.mondi@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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