Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
Date: Thu, 25 Jan 2018 08:41:44 -0200	[thread overview]
Message-ID: <20180125084116.6eec66e0@vela.lan> (raw)
In-Reply-To: <20180125003430.18558-1-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

Em Thu, 25 Jan 2018 01:34:30 +0100
Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> escreveu:

> A recent change to the media_entity_to_video_device() macro breaks some
> use-cases for the macro due to a symbol collision. Before the change
> this worked:
> 
>     vdev = media_entity_to_video_device(link->sink->entity);
> 
> While after the change it results in a compiler error "error: 'struct
> video_device' has no member named 'link'; did you mean 'lock'?". While
> the following still works after the change.
> 
>     struct media_entity *entity = link->sink->entity;
>     vdev = media_entity_to_video_device(entity);
> 
> Fix the collision by renaming the macro argument to 'media_entity'.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>  include/media/v4l2-dev.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Hi Mauro,
> 
> As the offending commit is not yet upstream and I'm not sure if the 
> commit ids in the media-tree are stable. If they are please attach the 
> following fixes tag.

They are. 

> 
> Fixes: 69b925c5fc36d8f1 ("media: v4l2-dev.h: add kernel-doc to two macros")
> 
> Regards,
> // Niklas
> 
> diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
> index 267fd2bed17bd3c1..f0fc1ebda47244b3 100644
> --- a/include/media/v4l2-dev.h
> +++ b/include/media/v4l2-dev.h
> @@ -298,10 +298,10 @@ struct video_device
>   * media_entity_to_video_device - Returns a &struct video_device from
>   *	the &struct media_entity embedded on it.
>   *
> - * @entity: pointer to &struct media_entity
> + * @media_entity: pointer to &struct media_entity
>   */
> -#define media_entity_to_video_device(entity) \
> -	container_of(entity, struct video_device, entity)
> +#define media_entity_to_video_device(media_entity) \
> +	container_of(media_entity, struct video_device, entity)

Instead, the best would be to use __entity (or __media_entity).
That would very likely prevent future conflicts.

>  
>  /**
>   * to_video_device - Returns a &struct video_device from the




Cheers,
Mauro

      parent reply	other threads:[~2018-01-25 10:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  0:34 [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device() Niklas Söderlund
2018-01-25  7:59 ` Geert Uytterhoeven
2018-01-25 10:19   ` Sakari Ailus
2018-01-25 10:41 ` Mauro Carvalho Chehab [this message]

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=20180125084116.6eec66e0@vela.lan \
    --to=mchehab@s-opensource.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.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