* [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
@ 2018-01-25 0:34 Niklas Söderlund
2018-01-25 7:59 ` Geert Uytterhoeven
2018-01-25 10:41 ` Mauro Carvalho Chehab
0 siblings, 2 replies; 4+ messages in thread
From: Niklas Söderlund @ 2018-01-25 0:34 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media
Cc: linux-renesas-soc, Niklas Söderlund
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.
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)
/**
* to_video_device - Returns a &struct video_device from the
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
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
1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-01-25 7:59 UTC (permalink / raw)
To: Niklas Söderlund
Cc: Mauro Carvalho Chehab, Linux Media Mailing List, Linux-Renesas
Hi Niklas,
On Thu, Jan 25, 2018 at 1:34 AM, Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> 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'.
Thanks!
Given there also exists a "struct media_entity", using "_media_entity" seems
safe to me.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
2018-01-25 7:59 ` Geert Uytterhoeven
@ 2018-01-25 10:19 ` Sakari Ailus
0 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2018-01-25 10:19 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Niklas Söderlund, Mauro Carvalho Chehab,
Linux Media Mailing List, Linux-Renesas
Hi guys,
On Thu, Jan 25, 2018 at 08:59:35AM +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Thu, Jan 25, 2018 at 1:34 AM, Niklas S�derlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > 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'.
>
> Thanks!
> Given there also exists a "struct media_entity", using "_media_entity" seems
> safe to me.
That doesn't matter, does it? As long as the macro argument is used as a
field name of a struct. I.e. "__entity" would be fine, as well as "e". I'd
vote for __entity. :-)
In any case,
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] v4l2-dev.h: fix symbol collision in media_entity_to_video_device()
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:41 ` Mauro Carvalho Chehab
1 sibling, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2018-01-25 10:41 UTC (permalink / raw)
To: Niklas Söderlund; +Cc: linux-media, linux-renesas-soc
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-25 10:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox