* [PATCH] usb: video: fix descriptor structures macros @ 2021-01-28 8:12 Sylvain Pelissier 2021-01-28 8:22 ` Greg KH 0 siblings, 1 reply; 6+ messages in thread From: Sylvain Pelissier @ 2021-01-28 8:12 UTC (permalink / raw) Cc: laurent.pinchart, kopiga.rasiah, linux-usb, Sylvain Pelissier The macros defining structures for descriptors use token pasting incorrectly. For example, the macro UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named uvc_extension_unit_descriptor_p_2 which should be uvc_extension_unit_descriptor_1_2 instead. Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> --- include/uapi/linux/usb/video.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h index d854cb19c42c..1eb982df87a0 100644 --- a/include/uapi/linux/usb/video.h +++ b/include/uapi/linux/usb/video.h @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ - uvc_extension_unit_descriptor_##p_##n + uvc_extension_unit_descriptor_##p##_##n #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ - uvc_input_header_descriptor_##n_##p + uvc_input_header_descriptor_##n##_##p #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ - uvc_output_header_descriptor_##n_##p + uvc_output_header_descriptor_##n##_##p #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: video: fix descriptor structures macros 2021-01-28 8:12 [PATCH] usb: video: fix descriptor structures macros Sylvain Pelissier @ 2021-01-28 8:22 ` Greg KH 2021-01-28 17:17 ` Sylvain Pelissier 0 siblings, 1 reply; 6+ messages in thread From: Greg KH @ 2021-01-28 8:22 UTC (permalink / raw) To: Sylvain Pelissier; +Cc: laurent.pinchart, kopiga.rasiah, linux-usb On Thu, Jan 28, 2021 at 09:12:59AM +0100, Sylvain Pelissier wrote: > The macros defining structures for descriptors use token > pasting incorrectly. For example, the macro > UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named > uvc_extension_unit_descriptor_p_2 which should be > uvc_extension_unit_descriptor_1_2 instead. > > Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> > --- > include/uapi/linux/usb/video.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h > index d854cb19c42c..1eb982df87a0 100644 > --- a/include/uapi/linux/usb/video.h > +++ b/include/uapi/linux/usb/video.h > @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { > #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) > > #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > - uvc_extension_unit_descriptor_##p_##n > + uvc_extension_unit_descriptor_##p##_##n > > #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ > @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { > #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) > > #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > - uvc_input_header_descriptor_##n_##p > + uvc_input_header_descriptor_##n##_##p > > #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ > @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { > #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) > > #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > - uvc_output_header_descriptor_##n_##p > + uvc_output_header_descriptor_##n##_##p > > #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ > -- > 2.25.1 > And no one noticed this? If not, then why do we have these defines at all, as obviously they are not used :) thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: video: fix descriptor structures macros 2021-01-28 8:22 ` Greg KH @ 2021-01-28 17:17 ` Sylvain Pelissier 2021-02-09 16:16 ` Sylvain Pelissier 0 siblings, 1 reply; 6+ messages in thread From: Sylvain Pelissier @ 2021-01-28 17:17 UTC (permalink / raw) To: Greg KH; +Cc: laurent.pinchart, kopiga.rasiah, linux-usb On Thu, 28 Jan 2021 at 09:22, Greg KH <gregkh@linuxfoundation.org> wrote: > > On Thu, Jan 28, 2021 at 09:12:59AM +0100, Sylvain Pelissier wrote: > > The macros defining structures for descriptors use token > > pasting incorrectly. For example, the macro > > UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named > > uvc_extension_unit_descriptor_p_2 which should be > > uvc_extension_unit_descriptor_1_2 instead. > > > > Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> > > --- > > include/uapi/linux/usb/video.h | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h > > index d854cb19c42c..1eb982df87a0 100644 > > --- a/include/uapi/linux/usb/video.h > > +++ b/include/uapi/linux/usb/video.h > > @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { > > #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) > > > > #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > - uvc_extension_unit_descriptor_##p_##n > > + uvc_extension_unit_descriptor_##p##_##n > > > > #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ > > @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { > > #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) > > > > #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > - uvc_input_header_descriptor_##n_##p > > + uvc_input_header_descriptor_##n##_##p > > > > #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ > > @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { > > #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) > > > > #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > - uvc_output_header_descriptor_##n_##p > > + uvc_output_header_descriptor_##n##_##p > > > > #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ > > -- > > 2.25.1 > > > > And no one noticed this? If not, then why do we have these defines at > all, as obviously they are not used :) The problem is not detected if you have descriptors with the second argument different each time since the structure name will change. It is maybe why it was not noticed. Nevertheless, the extension unit, the input header and the output header descriptors are part of the USB video class specification and are often used by devices. We have detected the problem while implementing a usb gadget having such descriptors. > > thanks, > > greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: video: fix descriptor structures macros 2021-01-28 17:17 ` Sylvain Pelissier @ 2021-02-09 16:16 ` Sylvain Pelissier 2021-02-11 12:48 ` Greg KH 0 siblings, 1 reply; 6+ messages in thread From: Sylvain Pelissier @ 2021-02-09 16:16 UTC (permalink / raw) To: Greg KH; +Cc: kopiga.rasiah, linux-usb, laurent.pinchart On Thu, 28 Jan 2021 at 18:17, Sylvain Pelissier <sylvain.pelissier@gmail.com> wrote: > > On Thu, 28 Jan 2021 at 09:22, Greg KH <gregkh@linuxfoundation.org> wrote: > > > > On Thu, Jan 28, 2021 at 09:12:59AM +0100, Sylvain Pelissier wrote: > > > The macros defining structures for descriptors use token > > > pasting incorrectly. For example, the macro > > > UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named > > > uvc_extension_unit_descriptor_p_2 which should be > > > uvc_extension_unit_descriptor_1_2 instead. > > > > > > Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> > > > --- > > > include/uapi/linux/usb/video.h | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h > > > index d854cb19c42c..1eb982df87a0 100644 > > > --- a/include/uapi/linux/usb/video.h > > > +++ b/include/uapi/linux/usb/video.h > > > @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { > > > #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) > > > > > > #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > - uvc_extension_unit_descriptor_##p_##n > > > + uvc_extension_unit_descriptor_##p##_##n > > > > > > #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ > > > @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { > > > #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) > > > > > > #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > - uvc_input_header_descriptor_##n_##p > > > + uvc_input_header_descriptor_##n##_##p > > > > > > #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ > > > @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { > > > #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) > > > > > > #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > - uvc_output_header_descriptor_##n_##p > > > + uvc_output_header_descriptor_##n##_##p > > > > > > #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ > > > -- > > > 2.25.1 > > > > > > > And no one noticed this? If not, then why do we have these defines at > > all, as obviously they are not used :) > > The problem is not detected if you have descriptors with the second > argument different each time since the structure name will change. It > is maybe why it was not noticed. Nevertheless, the extension unit, the > input header and the output header descriptors are part of the USB > video class specification and are often used by devices. We have > detected the problem while implementing a usb gadget having such > descriptors. > Hi, Do I need to change something for this patch ? Thanks, Sylvain > > > > thanks, > > > > greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] usb: video: fix descriptor structures macros 2021-02-09 16:16 ` Sylvain Pelissier @ 2021-02-11 12:48 ` Greg KH [not found] ` <CAOkUe-D2vCFiCp6qqvTTxgi5it+W2rEeXzf3-zu4rji7Cc106w@mail.gmail.com> 0 siblings, 1 reply; 6+ messages in thread From: Greg KH @ 2021-02-11 12:48 UTC (permalink / raw) To: Sylvain Pelissier; +Cc: kopiga.rasiah, linux-usb, laurent.pinchart On Tue, Feb 09, 2021 at 05:16:45PM +0100, Sylvain Pelissier wrote: > On Thu, 28 Jan 2021 at 18:17, Sylvain Pelissier > <sylvain.pelissier@gmail.com> wrote: > > > > On Thu, 28 Jan 2021 at 09:22, Greg KH <gregkh@linuxfoundation.org> wrote: > > > > > > On Thu, Jan 28, 2021 at 09:12:59AM +0100, Sylvain Pelissier wrote: > > > > The macros defining structures for descriptors use token > > > > pasting incorrectly. For example, the macro > > > > UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named > > > > uvc_extension_unit_descriptor_p_2 which should be > > > > uvc_extension_unit_descriptor_1_2 instead. > > > > > > > > Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> > > > > --- > > > > include/uapi/linux/usb/video.h | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h > > > > index d854cb19c42c..1eb982df87a0 100644 > > > > --- a/include/uapi/linux/usb/video.h > > > > +++ b/include/uapi/linux/usb/video.h > > > > @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { > > > > #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) > > > > > > > > #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > > - uvc_extension_unit_descriptor_##p_##n > > > > + uvc_extension_unit_descriptor_##p##_##n > > > > > > > > #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > > struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ > > > > @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { > > > > #define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p)) > > > > > > > > #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > > - uvc_input_header_descriptor_##n_##p > > > > + uvc_input_header_descriptor_##n##_##p > > > > > > > > #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > > struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ > > > > @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { > > > > #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p)) > > > > > > > > #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > > - uvc_output_header_descriptor_##n_##p > > > > + uvc_output_header_descriptor_##n##_##p > > > > > > > > #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > > struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ > > > > -- > > > > 2.25.1 > > > > > > > > > > And no one noticed this? If not, then why do we have these defines at > > > all, as obviously they are not used :) > > > > The problem is not detected if you have descriptors with the second > > argument different each time since the structure name will change. It > > is maybe why it was not noticed. Nevertheless, the extension unit, the > > input header and the output header descriptors are part of the USB > > video class specification and are often used by devices. We have > > detected the problem while implementing a usb gadget having such > > descriptors. > > > Hi, > Do I need to change something for this patch ? I need an ack from the v4l maintainers before I can take it... ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAOkUe-D2vCFiCp6qqvTTxgi5it+W2rEeXzf3-zu4rji7Cc106w@mail.gmail.com>]
* Re: [PATCH] usb: video: fix descriptor structures macros [not found] ` <CAOkUe-D2vCFiCp6qqvTTxgi5it+W2rEeXzf3-zu4rji7Cc106w@mail.gmail.com> @ 2021-02-11 13:04 ` Greg KH 0 siblings, 0 replies; 6+ messages in thread From: Greg KH @ 2021-02-11 13:04 UTC (permalink / raw) To: Sylvain Pelissier; +Cc: kopiga.rasiah, linux-usb, laurent.pinchart On Thu, Feb 11, 2021 at 01:55:21PM +0100, Sylvain Pelissier wrote: > Le jeu. 11 févr. 2021 à 13:48, Greg KH <gregkh@linuxfoundation.org> a > écrit : > > > On Tue, Feb 09, 2021 at 05:16:45PM +0100, Sylvain Pelissier wrote: > > > On Thu, 28 Jan 2021 at 18:17, Sylvain Pelissier > > > <sylvain.pelissier@gmail.com> wrote: > > > > > > > > On Thu, 28 Jan 2021 at 09:22, Greg KH <gregkh@linuxfoundation.org> > > wrote: > > > > > > > > > > On Thu, Jan 28, 2021 at 09:12:59AM +0100, Sylvain Pelissier wrote: > > > > > > The macros defining structures for descriptors use token > > > > > > pasting incorrectly. For example, the macro > > > > > > UVC_EXTENSION_UNIT_DESCRIPTOR(1, 2) defines a structure named > > > > > > uvc_extension_unit_descriptor_p_2 which should be > > > > > > uvc_extension_unit_descriptor_1_2 instead. > > > > > > > > > > > > Signed-off-by: Sylvain Pelissier <sylvain.pelissier@gmail.com> > > > > > > --- > > > > > > include/uapi/linux/usb/video.h | 6 +++--- > > > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > > > > > diff --git a/include/uapi/linux/usb/video.h > > b/include/uapi/linux/usb/video.h > > > > > > index d854cb19c42c..1eb982df87a0 100644 > > > > > > --- a/include/uapi/linux/usb/video.h > > > > > > +++ b/include/uapi/linux/usb/video.h > > > > > > @@ -324,7 +324,7 @@ struct uvc_extension_unit_descriptor { > > > > > > #define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n)) > > > > > > > > > > > > #define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > > > > - uvc_extension_unit_descriptor_##p_##n > > > > > > + uvc_extension_unit_descriptor_##p##_##n > > > > > > > > > > > > #define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \ > > > > > > struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \ > > > > > > @@ -371,7 +371,7 @@ struct uvc_input_header_descriptor { > > > > > > #define UVC_DT_INPUT_HEADER_SIZE(n, p) > > (13+(n*p)) > > > > > > > > > > > > #define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > > > > - uvc_input_header_descriptor_##n_##p > > > > > > + uvc_input_header_descriptor_##n##_##p > > > > > > > > > > > > #define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \ > > > > > > struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \ > > > > > > @@ -406,7 +406,7 @@ struct uvc_output_header_descriptor { > > > > > > #define UVC_DT_OUTPUT_HEADER_SIZE(n, p) > > (9+(n*p)) > > > > > > > > > > > > #define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > > > > - uvc_output_header_descriptor_##n_##p > > > > > > + uvc_output_header_descriptor_##n##_##p > > > > > > > > > > > > #define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \ > > > > > > struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \ > > > > > > -- > > > > > > 2.25.1 > > > > > > > > > > > > > > > > And no one noticed this? If not, then why do we have these defines > > at > > > > > all, as obviously they are not used :) > > > > > > > > The problem is not detected if you have descriptors with the second > > > > argument different each time since the structure name will change. It > > > > is maybe why it was not noticed. Nevertheless, the extension unit, the > > > > input header and the output header descriptors are part of the USB > > > > video class specification and are often used by devices. We have > > > > detected the problem while implementing a usb gadget having such > > > > descriptors. > > > > > > > Hi, > > > Do I need to change something for this patch ? > > > > I need an ack from the v4l maintainers before I can take it... > > > > Do I need to add someone in cc in particular? I think Laurent is the proper one here as he's the maintainer for the usb v4l driver, right? thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-02-11 13:08 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-28 8:12 [PATCH] usb: video: fix descriptor structures macros Sylvain Pelissier 2021-01-28 8:22 ` Greg KH 2021-01-28 17:17 ` Sylvain Pelissier 2021-02-09 16:16 ` Sylvain Pelissier 2021-02-11 12:48 ` Greg KH [not found] ` <CAOkUe-D2vCFiCp6qqvTTxgi5it+W2rEeXzf3-zu4rji7Cc106w@mail.gmail.com> 2021-02-11 13:04 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).