RE: [PATCHv2 02/13] usb: dwc2: Moves s3c_hsotg gadget data structure into dwc2_hsotg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2014-08-01 at 20:31 +0000, Paul Zimmerman wrote:
> > From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Paul Zimmerman
> > Sent: Friday, August 01, 2014 11:49 AM
> > 
> > > From: dinguyen@xxxxxxxxxx [mailto:dinguyen@xxxxxxxxxx]
> > > Sent: Wednesday, July 30, 2014 8:21 AM
> > >
> > > Adds the gadget data structure and appropriate data structure pointers
> > > to the common dwc2_hsotg data structure. This is needed so that the
> > > dwc2_hsotg data structure can be used by the hcd and gadget drivers.
> > >
> > > Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
> > > ---
> > >  drivers/usb/dwc2/core.h |    6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> > > index 3b4bd4c..ee34ee1 100644
> > > --- a/drivers/usb/dwc2/core.h
> > > +++ b/drivers/usb/dwc2/core.h
> > > @@ -604,6 +604,12 @@ struct dwc2_hsotg {
> > >  	struct timer_list wkp_timer;
> > >  	enum dwc2_lx_state lx_state;
> > >
> > > +	/* Gadget structures */
> > > +	struct s3c_hsotg *s3c_hsotg;
> > > +	struct usb_gadget       gadget;
> > > +	struct usb_gadget_driver *driver;
> > > +	struct s3c_hsotg_ep     *eps;
> > > +
> > 
> > Hi Dinh,
> > 
> > After looking at this some more, I'm not really happy with including
> > a pointer to the s3c_hsotg struct inside the dwc2_hsotg struct. It
> > makes the peripheral mode kind of a second class citizen, and requires
> > a bunch of double pointer indirections in gadget.c
> > (hsotg->s3c_hsotg->foo). Plus, when building for peripheral-only mode,
> > there are a lot of unused fields in the dwc2_hsotg struct.
> > 
> > So how about something like the below instead? This moves all of the
> > s3c_hsotg struct fields into the dwc2_hsotg struct, and adds ifdefs
> > around the host-only and peripheral-only fields. Doing this should
> > make the diff to gadget.c even smaller, since it eliminates the double
> > indirections.
> > 
> > This patch is on top of your series. And I'm only showing the changes
> > to core.h.
> 
> And here is a patch which actually compiles in all three modes. I am
> including the full patch, including the changes to gadget.c, this time.
> 

Thanks Paul. I agree that having the double pointers looked messy. I
like this suggestion. Can I add your Signed-by when I fold your patch
into mine?

Thanks,
Dinh
> These changes should really be folded into your series, instead of
> being tacked onto the end like this.
> 
> I have no way to test this, since I don't have non-PCI hardware that
> works in peripheral mode. (After this series goes in, I plan to add
> support for that on PCI.)
> 


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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux