public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Greg KH <gregkh@linuxfoundation.org>, Oliver Neukum <oneukum@suse.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 1/1] uapi: cdc.h: cleanly provide for more interfaces and countries
Date: Tue, 28 Oct 2025 15:34:40 +0100	[thread overview]
Message-ID: <16a3c8ef-dd3f-48c4-afcd-42ab4b14c429@suse.com> (raw)
In-Reply-To: <2025102858-doorframe-canola-e6c0@gregkh>

Hi,

On 28.10.25 14:32, Greg KH wrote:
> On Tue, Oct 28, 2025 at 01:32:22PM +0100, Oliver Neukum wrote:
>> The spec requires at least one interface respectively country.
>> It allows multiple ones. This needs to be clearly said in the UAPI.
>>
>> Signed-off-by: Oliver Neukum <oneukum@suse.com>
>> ---
>>   include/uapi/linux/usb/cdc.h | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
>> index 1924cf665448..5fcbce0be133 100644
>> --- a/include/uapi/linux/usb/cdc.h
>> +++ b/include/uapi/linux/usb/cdc.h
>> @@ -105,7 +105,7 @@ struct usb_cdc_union_desc {
>>   
>>   	__u8	bMasterInterface0;
>>   	__u8	bSlaveInterface0;
>> -	/* ... and there could be other slave interfaces */
>> +	__u8	bSlaveInterfaces[];
> 
> Can this be combined with bSlaveInterface0?  Feels odd to have 0 and
> then "more".

I am afraid the C language does not allow you to specify
that an array must have a minimum length other than zero.
In this case bSlaveInterface0 must be present.
I don't think using only an array would be the right choice.
> Also, what determines how many, the overall length?

bLength - 4 is the number of slave interfaces, which
must at least be 1.
We cannot use counted_by in UAPI, can we?

	Regards
		Oliver



  reply	other threads:[~2025-10-28 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 12:32 [PATCH 1/1] uapi: cdc.h: cleanly provide for more interfaces and countries Oliver Neukum
2025-10-28 13:32 ` Greg KH
2025-10-28 14:34   ` Oliver Neukum [this message]
2025-10-28 14:40     ` Greg KH
2025-10-28 16:43       ` Gustavo A. R. Silva

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=16a3c8ef-dd3f-48c4-afcd-42ab4b14c429@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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