public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rix <tom@bumblecow.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] USB Consolidate descriptor definitions
Date: Wed, 14 Oct 2009 06:14:55 -0500	[thread overview]
Message-ID: <4AD5B2AF.70503@bumblecow.com> (raw)
In-Reply-To: <3efb10970910121208x77a2c1b2obc7fdd4ae7ab142c@mail.gmail.com>

Remy Bohmer wrote:
> Hi Tom,
> 
> Sorry for not responding to this series very fast, because I wanted to
> look into it carefully.
> Below my comments on this patch
> 
> 2009/9/28 Tom Rix <Tom.Rix@windriver.com>:
>> The header files usb.h and usbdescriptors.h have the same or
>> similarly named structure definitions for
>>
>> usb_device_descriptor
>> usb_string_descriptor
>> usb_endpoint_descriptor
>> usb_config_descriptor vs usb_configuration_descriptor
>> usb_interface_descriptor
>>
>> There should only be one definition of these structures.
> 
> True, I agree with that.
> 
>> Some of these structures are element-wise duplicates,
>> one has unused elements that can be reduced to a duplicate,
>> and some of the the structures have additional elements.
>>
>> These are the element-wise duplicates in usb.h
>>
>> usb_device_descriptor
>> usb_string_descriptor
>>
>> For these, the usb.h definition will be removed.
>>
>> This definition in usb.h has extra unused elements
> 
> Can these be merged to one global structure?
> 

No.
The size of the structure is kept in 'bLength' field.
Have bLength = sizeof(struct bla_descriptor)
is the right way to go.

>> usb_endpoint_descriptor
>>
>>        unsigned char   bRefresh
>>        unsigned char   bSynchAddress;
>>
>> The definition of usb_endpoint_descriptor in usb.h will
>> be removed.
>>
>> These definitions in usb.h have extra elements at the end of
>> the usb 2.0 specified descriptor:
>>
>> usb_config_descriptor
>> usb_interface_descriptor
>>
>> These structures will have their name shorted by removing the
>> '_descriptor' suffix.
>>
>> So
>>
>> usb_config_descriptor -> usb_config
>> usb_interface_descriptor -> usb_interface
>>
>> The common descriptor elements are now defined by the macros
>>
>> USB_CONFIG_DESCRIPTOR_DEFINITION
>> USB_INTERFACE_DESCRIPTOR_DEFINITION
> 
> Personally I do not like the macros for these kind of definitions, I
> would prefer a solution by nesting the structures.
> What do you think?

I have an early version of this patch that does use nested structures.
After looking at the added '.desc.' that caused a good number of
changes in the c files,  I went with the macro approach.   It seemed like
the lesser of the evils as the changes seemed smaller and were limited
to the h files.  What I really wanted to do was to use nameless
structures but had a problem getting them to work with gcc.

I do not mind reverting to the '.desc.' solution.
I will resend the patches when I have had a chance to test them.

Thanks
Tom


> 
> Kind regards,
> 
> Remy
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 
> 

  reply	other threads:[~2009-10-14 11:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-28 16:37 [U-Boot] V2 of OMAP3 USB device Support Tom Rix
2009-09-28 16:37 ` [U-Boot] [PATCH 1/8] USB Consolidate descriptor definitions Tom Rix
2009-09-28 16:37   ` [U-Boot] [PATCH 2/8] USB add macros for debugging usb device setup Tom Rix
2009-09-28 16:37     ` [U-Boot] [PATCH 3/8] TWL4030 Add usb PHY support Tom Rix
2009-09-28 16:37       ` [U-Boot] [PATCH 4/8] OMAP3 Add usb device support Tom Rix
2009-09-28 16:37         ` [U-Boot] [PATCH 5/8] OMAP3 zoom1 Add usbtty configuration Tom Rix
2009-09-28 16:37           ` [U-Boot] [PATCH 6/8] OMAP3 beagle " Tom Rix
2009-09-28 16:37             ` [U-Boot] [PATCH 7/8] USBTTY make some function declarations easier to use Tom Rix
2009-09-28 16:37               ` [U-Boot] [PATCH 8/8] OMAP3 zoom2 Use usbtty if the debug board is not connected Tom Rix
2009-10-12 19:08   ` [U-Boot] [PATCH 1/8] USB Consolidate descriptor definitions Remy Bohmer
2009-10-14 11:14     ` Tom Rix [this message]
2009-10-11 16:25 ` [U-Boot] V2 of OMAP3 USB device Support Paulraj, Sandeep
2009-10-11 16:52   ` Tom Rix
  -- strict thread matches above, loose matches on Subject: below --
2009-09-28 16:34 y at windriver.com
2009-09-28 16:34 ` [U-Boot] [PATCH 1/8] USB Consolidate descriptor definitions y at windriver.com
2009-09-04 20:12 Tom Rix

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=4AD5B2AF.70503@bumblecow.com \
    --to=tom@bumblecow.com \
    --cc=u-boot@lists.denx.de \
    /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