Re: [PATCH 4/9] usb: roles: Leave the private driver data pointer to the drivers

From: Heikki Krogerus
Date: Mon Feb 17 2020 - 04:16:49 EST


On Sat, Feb 15, 2020 at 05:19:58PM +0800, Chunfeng Yun wrote:
> On Thu, 2020-02-13 at 16:24 +0300, Heikki Krogerus wrote:
> > Adding usb_role_switch_get/set_drvdata() functions that the
> > switch drivers can use for setting and getting private data
> > pointer that is associated with the switch.
> >
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> > ---
> > drivers/usb/roles/class.c | 22 ++++++++++++++++++++++
> > include/linux/usb/role.h | 16 ++++++++++++++++
> > 2 files changed, 38 insertions(+)
> >
> > diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c
> > index 63a00ff26655..f3132d231599 100644
> > --- a/drivers/usb/roles/class.c
> > +++ b/drivers/usb/roles/class.c
> > @@ -329,6 +329,7 @@ usb_role_switch_register(struct device *parent,
> > sw->dev.fwnode = desc->fwnode;
> > sw->dev.class = role_class;
> > sw->dev.type = &usb_role_dev_type;
> > + sw->dev.driver_data = desc->driver_data;
> How about use dev_set_drvdata()? will keep align with
> usb_role_switch_set/get_drvdata(),

Yes, makes sense. I'll change that.

Thanks,

--
heikki