public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eli Billauer <eli.billauer@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Zheyu Ma <zheyuma97@gmail.com>,
	arnd@arndb.de,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] char: xillybus: Check endpoint type before allocing
Date: Tue, 24 May 2022 15:23:32 +0300	[thread overview]
Message-ID: <628CCE44.6020007@gmail.com> (raw)
In-Reply-To: <YovBOwJs/A/5Ua7I@kroah.com>

On 23/05/22 20:15, Greg KH wrote:
>> Rather, it works like this: The driver uses the EP 1 IN and OUT endpoints to
>> >  query the device for a data structure, which contains information on the
>> >  device's communication channels. The driver sets up device files
>> >  accordingly, and it also gets informed on which bulk OUT endpoints are
>> >  present.
>> >  
>> >  For what it's worth, I think it's fairly safe to assume that if a device
>> >  returns a legal data structure (which passes a CRC test), it's a XillyUSB
>> >  device.
>>      
> Why?  You still need to verify that the requested endpoints match up
> with what the device really has.
>    
OK. So to summarize:

EP 1 IN and EP 1 OUT are always present in XillyUSB devices.

On top of these, there might be additional bulk OUT endpoints. The 
driver resolves which ones in setup_channels(), by scanning a data blob 
it has received from the device. This takes place in the for-loop inside 
this function. When (out_desc & 0x80) is true for a given @i in the 
loop, the device has a bulk OUT endpoint with address i+2 (e.g. if this 
condition is met for i==2, the device has a bulk OUT EP 4).

So it seems like setup_channels() would be the right place to make this 
check, since it's called during the device's probe.

I guess it would likewise make sense to check for EP 1 IN and OUT in 
xillyusb_setup_base_eps().

Thanks,
    Eli




  reply	other threads:[~2022-05-24 12:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14  7:14 [PATCH] char: xillybus: Check endpoint type properly Zheyu Ma
2022-05-14  7:18 ` Greg KH
2022-05-14 11:48   ` [PATCH v2] char: xillybus: Check endpoint type before allocing Zheyu Ma
2022-05-14 12:52     ` Eli Billauer
2022-05-14 13:24       ` Greg KH
2022-05-14 13:32     ` Greg KH
2022-05-20  3:32       ` Zheyu Ma
2022-05-20  5:41         ` Greg KH
2022-05-22  5:06           ` Zheyu Ma
2022-05-23 16:06             ` Greg KH
2022-05-23 17:05               ` Eli Billauer
2022-05-23 17:15                 ` Greg KH
2022-05-24 12:23                   ` Eli Billauer [this message]
2022-05-26 12:02                     ` Zheyu Ma

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=628CCE44.6020007@gmail.com \
    --to=eli.billauer@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zheyuma97@gmail.com \
    /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