Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@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 15:54:00 +0300	[thread overview]
Message-ID: <20260507125400.GC1938994@killaraus.ideasonboard.com> (raw)
In-Reply-To: <afyJk_qcsuTt8gxf@zed>

On Thu, May 07, 2026 at 02:48:23PM +0200, Jacopo Mondi wrote:
> 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 :)

We could probably drop the "currently, it does nothing" part. It's true,
but not relevant. The function was added because we thought we will at
some point have to perform cleanup tasks, and patching lots of drivers
to add cleanup calls then would be error-prone.

> >   */
> > -#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:54 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
2026-05-07 12:54     ` Laurent Pinchart [this message]
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=20260507125400.GC1938994@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=jacopo.mondi@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