Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2018-02-09 Thread Bin Liu
On Fri, Feb 09, 2018 at 08:51:03PM +0100, Greg KH wrote:
> On Fri, Feb 09, 2018 at 01:23:43PM -0600, Bin Liu wrote:
> > From: Petr Cvek 
> > 
> > commit c8cd751060b149997b9de53a494fb1490ded72c5 upstream.
> > 
> > Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
> > methods") caused a stringification of an undefined macro argument "aname",
> > so three UVC parameters (streaming_interval, streaming_maxpacket and
> > streaming_maxburst) were named "aname".
> > 
> > Add the definition of "aname" to the main macro and name the filenames as
> > originaly intended.
> > 
> > Signed-off-by: Petr Cvek 
> > Signed-off-by: Felipe Balbi 
> > Signed-off-by: Bin Liu 
> > ---
> >  drivers/usb/gadget/function/uvc_configfs.c | 16 
> >  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> What stable kernel(s) do you want this applied to?

The commit 76e0da34c7ce which causes the regression is introduced in
v4.4, so I would think this patch have to be applied down to v4.4.

FYI, I tested this patch on v4.4 and v4.9.

Thanks,
-Bin.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2018-02-09 Thread Greg KH
On Fri, Feb 09, 2018 at 01:23:43PM -0600, Bin Liu wrote:
> From: Petr Cvek 
> 
> commit c8cd751060b149997b9de53a494fb1490ded72c5 upstream.
> 
> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
> methods") caused a stringification of an undefined macro argument "aname",
> so three UVC parameters (streaming_interval, streaming_maxpacket and
> streaming_maxburst) were named "aname".
> 
> Add the definition of "aname" to the main macro and name the filenames as
> originaly intended.
> 
> Signed-off-by: Petr Cvek 
> Signed-off-by: Felipe Balbi 
> Signed-off-by: Bin Liu 
> ---
>  drivers/usb/gadget/function/uvc_configfs.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

What stable kernel(s) do you want this applied to?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: uvc: Missing files for configfs interface

2018-02-09 Thread Bin Liu
From: Petr Cvek 

commit c8cd751060b149997b9de53a494fb1490ded72c5 upstream.

Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
methods") caused a stringification of an undefined macro argument "aname",
so three UVC parameters (streaming_interval, streaming_maxpacket and
streaming_maxburst) were named "aname".

Add the definition of "aname" to the main macro and name the filenames as
originaly intended.

Signed-off-by: Petr Cvek 
Signed-off-by: Felipe Balbi 
Signed-off-by: Bin Liu 
---
 drivers/usb/gadget/function/uvc_configfs.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index ad8c9b05572d..01656f1c6d65 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2202,7 +2202,7 @@ static struct configfs_item_operations uvc_item_ops = {
.release= uvc_attr_release,
 };
 
-#define UVCG_OPTS_ATTR(cname, conv, str2u, uxx, vnoc, limit)   \
+#define UVCG_OPTS_ATTR(cname, aname, conv, str2u, uxx, vnoc, limit)\
 static ssize_t f_uvc_opts_##cname##_show(  \
struct config_item *item, char *page)   \
 {  \
@@ -2245,16 +2245,16 @@ end:
\
return ret; \
 }  \
\
-UVC_ATTR(f_uvc_opts_, cname, aname)
+UVC_ATTR(f_uvc_opts_, cname, cname)
 
 #define identity_conv(x) (x)
 
-UVCG_OPTS_ATTR(streaming_interval, identity_conv, kstrtou8, u8, identity_conv,
-  16);
-UVCG_OPTS_ATTR(streaming_maxpacket, le16_to_cpu, kstrtou16, u16, le16_to_cpu,
-  3072);
-UVCG_OPTS_ATTR(streaming_maxburst, identity_conv, kstrtou8, u8, identity_conv,
-  15);
+UVCG_OPTS_ATTR(streaming_interval, streaming_interval, identity_conv,
+  kstrtou8, u8, identity_conv, 16);
+UVCG_OPTS_ATTR(streaming_maxpacket, streaming_maxpacket, le16_to_cpu,
+  kstrtou16, u16, le16_to_cpu, 3072);
+UVCG_OPTS_ATTR(streaming_maxburst, streaming_maxburst, identity_conv,
+  kstrtou8, u8, identity_conv, 15);
 
 #undef identity_conv
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-31 Thread Petr Cvek
Dne 31.3.2017 v 11:01 Laurent Pinchart napsal(a):
> Hi Felipe and Petr,
> 
> On Tuesday 28 Mar 2017 16:48:46 Felipe Balbi wrote:
>> Petr Cvek  writes:
>>> Dne 7.3.2017 v 06:58 Laurent Pinchart napsal(a):
 On Tuesday 07 Mar 2017 00:57:20 Petr Cvek wrote:
> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
> methods") caused a stringification of an undefined macro argument
> "aname", so three UVC parameters (streaming_interval,
> streaming_maxpacket and streaming_maxburst) were named "aname".
>
> Add the definition of "aname" to the main macro and name the filenames
> as originaly intended.

 Why don't you just

 - UVC_ATTR(f_uvc_opts_, cname, aname)
 + UVC_ATTR(f_uvc_opts_, cname, cname)

 in the definition of the UVCG_OPTS_ATTR() macro ?
>>>
>>> Hi,
>>>
>>> In a fact I did it for my first testing version. But then I realized
>>> two things. First one is that someone may want to rename these three
>>> files (now or in the future). The second one is that this bug was
>>> caused by original author, who probably assumed the UVCG_OPTS_ATTR
>>> macro had "aname" argument as others UVCG_* macros and didn't check. I
>>> assumed that too and only after I saw three "aname" files with the
>>> same path I realized where is the problem.
>>>
>>> So it's more like a human error prone type of a code. But if you think
>>> "cname" is enough I can send PATCH v2.
> 
> I think it would be, otherwise we end up passing the same argument twice, 
> which seems a bit useless to me. If we ever need to rename those files we can 
> always change the code later.

... or if the variables, which need to be renamed (and userapi filenames to be 
kept).

> 
> It's no big deal, but I have a preference for my proposal.
> 

Any way I've sent your suggested version, you can choose whichever you like ;-).

cheers,
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-31 Thread Laurent Pinchart
Hi Felipe and Petr,

On Tuesday 28 Mar 2017 16:48:46 Felipe Balbi wrote:
> Petr Cvek  writes:
> > Dne 7.3.2017 v 06:58 Laurent Pinchart napsal(a):
> >> On Tuesday 07 Mar 2017 00:57:20 Petr Cvek wrote:
> >>> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
> >>> methods") caused a stringification of an undefined macro argument
> >>> "aname", so three UVC parameters (streaming_interval,
> >>> streaming_maxpacket and streaming_maxburst) were named "aname".
> >>> 
> >>> Add the definition of "aname" to the main macro and name the filenames
> >>> as originaly intended.
> >> 
> >> Why don't you just
> >> 
> >> - UVC_ATTR(f_uvc_opts_, cname, aname)
> >> + UVC_ATTR(f_uvc_opts_, cname, cname)
> >> 
> >> in the definition of the UVCG_OPTS_ATTR() macro ?
> > 
> > Hi,
> > 
> > In a fact I did it for my first testing version. But then I realized
> > two things. First one is that someone may want to rename these three
> > files (now or in the future). The second one is that this bug was
> > caused by original author, who probably assumed the UVCG_OPTS_ATTR
> > macro had "aname" argument as others UVCG_* macros and didn't check. I
> > assumed that too and only after I saw three "aname" files with the
> > same path I realized where is the problem.
> > 
> > So it's more like a human error prone type of a code. But if you think
> > "cname" is enough I can send PATCH v2.

I think it would be, otherwise we end up passing the same argument twice, 
which seems a bit useless to me. If we ever need to rename those files we can 
always change the code later.

It's no big deal, but I have a preference for my proposal.

> Laurent, any comments?

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-28 Thread Felipe Balbi

Hi,

Petr Cvek  writes:
> Dne 7.3.2017 v 06:58 Laurent Pinchart napsal(a):
>> Hi Petr,
>> 
>> Thank you for the patch.
>> 
>> On Tuesday 07 Mar 2017 00:57:20 Petr Cvek wrote:
>>> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
>>> methods") caused a stringification of an undefined macro argument "aname",
>>> so three UVC parameters (streaming_interval, streaming_maxpacket and
>>> streaming_maxburst) were named "aname".
>>>
>>> Add the definition of "aname" to the main macro and name the filenames as
>>> originaly intended.
>> 
>> Why don't you just 
>> 
>> - UVC_ATTR(f_uvc_opts_, cname, aname)
>> + UVC_ATTR(f_uvc_opts_, cname, cname)
>> 
>> in the definition of the UVCG_OPTS_ATTR() macro ?
>
> Hi,
>
> In a fact I did it for my first testing version. But then I realized
> two things. First one is that someone may want to rename these three
> files (now or in the future). The second one is that this bug was
> caused by original author, who probably assumed the UVCG_OPTS_ATTR
> macro had "aname" argument as others UVCG_* macros and didn't check. I
> assumed that too and only after I saw three "aname" files with the
> same path I realized where is the problem.
>
> So it's more like a human error prone type of a code. But if you think
> "cname" is enough I can send PATCH v2.

Laurent, any comments?

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-07 Thread Petr Cvek
Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
methods") caused a stringification of an undefined macro argument "aname",
so three UVC parameters (streaming_interval, streaming_maxpacket and
streaming_maxburst) were named "aname".

Add the definition of "aname" to the main macro and name the filenames as
originaly intended.

Signed-off-by: Petr Cvek 
---
 drivers/usb/gadget/function/uvc_configfs.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
b/drivers/usb/gadget/function/uvc_configfs.c
index 4e037d2a7a60..3a36b2e85788 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -2125,7 +2125,7 @@ static struct configfs_item_operations uvc_item_ops = {
.release= uvc_attr_release,
 };
 
-#define UVCG_OPTS_ATTR(cname, conv, str2u, uxx, vnoc, limit)   \
+#define UVCG_OPTS_ATTR(cname, aname, conv, str2u, uxx, vnoc, limit)\
 static ssize_t f_uvc_opts_##cname##_show(  \
struct config_item *item, char *page)   \
 {  \
@@ -2172,12 +2172,12 @@ UVC_ATTR(f_uvc_opts_, cname, aname)
 
 #define identity_conv(x) (x)
 
-UVCG_OPTS_ATTR(streaming_interval, identity_conv, kstrtou8, u8, identity_conv,
-  16);
-UVCG_OPTS_ATTR(streaming_maxpacket, le16_to_cpu, kstrtou16, u16, le16_to_cpu,
-  3072);
-UVCG_OPTS_ATTR(streaming_maxburst, identity_conv, kstrtou8, u8, identity_conv,
-  15);
+UVCG_OPTS_ATTR(streaming_interval, streaming_interval, identity_conv,
+  kstrtou8, u8, identity_conv, 16);
+UVCG_OPTS_ATTR(streaming_maxpacket, streaming_maxpacket, le16_to_cpu,
+  kstrtou16, u16, le16_to_cpu, 3072);
+UVCG_OPTS_ATTR(streaming_maxburst, streaming_maxburst, identity_conv,
+  kstrtou8, u8, identity_conv, 15);
 
 #undef identity_conv
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-06 Thread Laurent Pinchart
Hi Petr,

Thank you for the patch.

On Tuesday 07 Mar 2017 00:57:20 Petr Cvek wrote:
> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
> methods") caused a stringification of an undefined macro argument "aname",
> so three UVC parameters (streaming_interval, streaming_maxpacket and
> streaming_maxburst) were named "aname".
> 
> Add the definition of "aname" to the main macro and name the filenames as
> originaly intended.

Why don't you just 

- UVC_ATTR(f_uvc_opts_, cname, aname)
+ UVC_ATTR(f_uvc_opts_, cname, cname)

in the definition of the UVCG_OPTS_ATTR() macro ?

> Signed-off-by: Petr Cvek 
> ---
>  drivers/usb/gadget/function/uvc_configfs.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c
> b/drivers/usb/gadget/function/uvc_configfs.c index
> 4e037d2a7a60..3a36b2e85788 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -2125,7 +2125,7 @@ static struct configfs_item_operations uvc_item_ops =
> { .release= uvc_attr_release,
>  };
> 
> -#define UVCG_OPTS_ATTR(cname, conv, str2u, uxx, vnoc, limit) \
> +#define UVCG_OPTS_ATTR(cname, aname, conv, str2u, uxx, vnoc, limit)  \
>  static ssize_t f_uvc_opts_##cname##_show(\
>   struct config_item *item, char *page)   \
>  {\
> @@ -2172,12 +2172,12 @@ UVC_ATTR(f_uvc_opts_, cname, aname)
> 
>  #define identity_conv(x) (x)
> 
> -UVCG_OPTS_ATTR(streaming_interval, identity_conv, kstrtou8, u8,
> identity_conv, - 16);
> -UVCG_OPTS_ATTR(streaming_maxpacket, le16_to_cpu, kstrtou16, u16,
> le16_to_cpu, -   3072);
> -UVCG_OPTS_ATTR(streaming_maxburst, identity_conv, kstrtou8, u8,
> identity_conv, - 15);
> +UVCG_OPTS_ATTR(streaming_interval, streaming_interval, identity_conv,
> +kstrtou8, u8, identity_conv, 16);
> +UVCG_OPTS_ATTR(streaming_maxpacket, streaming_maxpacket, le16_to_cpu,
> +kstrtou16, u16, le16_to_cpu, 3072);
> +UVCG_OPTS_ATTR(streaming_maxburst, streaming_maxburst, identity_conv,
> +kstrtou8, u8, identity_conv, 15);
> 
>  #undef identity_conv

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] usb: gadget: uvc: Missing files for configfs interface

2017-03-06 Thread Petr Cvek
Dne 7.3.2017 v 06:58 Laurent Pinchart napsal(a):
> Hi Petr,
> 
> Thank you for the patch.
> 
> On Tuesday 07 Mar 2017 00:57:20 Petr Cvek wrote:
>> Commit 76e0da34c7ce ("usb-gadget/uvc: use per-attribute show and store
>> methods") caused a stringification of an undefined macro argument "aname",
>> so three UVC parameters (streaming_interval, streaming_maxpacket and
>> streaming_maxburst) were named "aname".
>>
>> Add the definition of "aname" to the main macro and name the filenames as
>> originaly intended.
> 
> Why don't you just 
> 
> - UVC_ATTR(f_uvc_opts_, cname, aname)
> + UVC_ATTR(f_uvc_opts_, cname, cname)
> 
> in the definition of the UVCG_OPTS_ATTR() macro ?

Hi,

In a fact I did it for my first testing version. But then I realized two 
things. First one is that someone may want to rename these three files (now or 
in the future). The second one is that this bug was caused by original author, 
who probably assumed the UVCG_OPTS_ATTR macro had "aname" argument as others 
UVCG_* macros and didn't check. I assumed that too and only after I saw three 
"aname" files with the same path I realized where is the problem.

So it's more like a human error prone type of a code. But if you think "cname" 
is enough I can send PATCH v2.

Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html