RE: [PATCH] usb: renesas_usbhs: Use specific struct instead of USBHS_TYPE_* enums

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

 



Hi Geert-san,

> From: Geert Uytterhoeven, Sent: Friday, May 10, 2019 8:20 PM
> 
> Hi Shimoda-san,
> 
> On Fri, May 10, 2019 at 12:53 PM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote:
> > This patch adds a specific struct "usbhs_of_data" to add a new SoC
> > data easily instead of code basis in the future.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
> 
> Thanks for your patch!
> 
> Looks correct to me, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Thank you for your review!

> with a few suggestions/questions below...
> 
> > --- a/drivers/usb/renesas_usbhs/common.c
> > +++ b/drivers/usb/renesas_usbhs/common.c
> 
> > @@ -598,8 +638,15 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
> >         if (!info)
> >                 return NULL;
> >
> > +       data = of_device_get_match_data(dev);
> > +       if (!data)
> > +               return NULL;
> > +
> >         dparam = &info->driver_param;
> > -       dparam->type = (uintptr_t)of_device_get_match_data(dev);
> > +       memcpy(dparam, &data->param, sizeof(struct renesas_usbhs_driver_param));
> 
> sizeof(data->param), for increased safety?

I got it. I'll fix it on v2 (maybe I'll sumbmit it in next week).

> > +       memcpy(&info->platform_callback, data->platform_callback,
> > +              sizeof(struct renesas_usbhs_platform_callback));
> 
> sizeof(data->platform_callback)?

I'll fix it.

> I'm not really familiar with this driver and with the USB subsystem, but
> why is this driver copying so many structs around, instead of just
> keeping pointers to the originals?

# I'm also thinking if just kepping pointers are simple than copying when I made this patch though,
I don't know why because the original author is Morimoto-san :)
But, I guess:
 - Some SH boards has the renesas_usbhs_platform_info data.
 -- This is related to .platform_data.
 --- and it will be deleted after initialization because some reasons (__initdata section?).
 ---- So, keeping the data, the driver copies it to own allocated memory.

I'll try to simplify the code later.

> Is all of that done just so .notify_hotplug() can be overridden, or am I
> missing something?

Yes, it seems any SH boards don't have the .notify_hotplug.

Best regards,
Yoshihiro Shimoda

> Thanks again!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds




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

  Powered by Linux