Re: [PATCH v2 4/7] usb: dwc3: core: Expose core driver as library

From: Bjorn Andersson
Date: Thu Sep 12 2024 - 22:35:13 EST


On Fri, Sep 13, 2024 at 07:21:35AM +0900, Masahiro Yamada wrote:
> On Mon, Aug 12, 2024 at 12:07 PM Bjorn Andersson <andersson@xxxxxxxxxx> wrote:
[..]
> > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> > index 1e561fd8b86e..4a0ee9ef72e2 100644
> > --- a/drivers/usb/dwc3/core.h
> > +++ b/drivers/usb/dwc3/core.h
> > @@ -1160,6 +1160,7 @@ struct dwc3_scratchpad_array {
> > * @gsbuscfg0_reqinfo: store GSBUSCFG0.DATRDREQINFO, DESRDREQINFO,
> > * DATWRREQINFO, and DESWRREQINFO value passed from
> > * glue driver.
> > + * @glue: private reference to any glue context
> > */
> > struct dwc3 {
> > struct work_struct drd_work;
> > @@ -1388,6 +1389,8 @@ struct dwc3 {
> > int num_ep_resized;
> > struct dentry *debug_root;
> > u32 gsbuscfg0_reqinfo;
> > +
> > + void *glue;
>
>
> This is ugly.
>
>
> 'struct dwc3_qcom' can wrap 'struct dwc3'
> instead of having two separate structures
> pointing at each other.
>
>
> You can use container_of() to
> convert (struct dwc3 *) to (struct dwc3_qcom *).
>
>
> I attached a diff to delete the reverse ->glue pointer.
>
> I did not compile-test it (I cannot due to missing glue.h
> anyway), but you will understand my suggestion.
>

Thanks for your suggestion, Yamada-san.
I agree, that will look better.

Regards,
Bjorn