Re: [PATCH 1/1] usb: roles: reference controller's parent device if existed

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

 



On 20-11-30 02:37:54, Jun Li wrote:
> Hi Peter,
> > -----Original Message-----
> > From: Peter Chen <peter.chen@xxxxxxxxxx>
> > Sent: Friday, November 27, 2020 2:28 PM
> > To: heikki.krogerus@xxxxxxxxxxxxxxx
> > Cc: linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>; Peter
> > Chen <peter.chen@xxxxxxx>; Jun Li <jun.li@xxxxxxx>
> > Subject: [PATCH 1/1] usb: roles: reference controller's parent device if
> > existed
> > 
> > From: Peter Chen <peter.chen@xxxxxxx>
> > 
> > For some DRD IP drivers (eg, dwc3/cdns3/chipidea), the core device is created
> > and deleted by glue layer device. So, if role switch user (eg, tcpci), core
> > device, and glue layer device are all built as module, and glue layer device
> > is removed first, the core device's driver ->remove function will be called,
> > and its device's driver pointer will be NULL, and cause below oops.
> > 
> > To fix it, if there is a parent for controller device (role switch device's
> > parent), it references to parent too.
> 
> This may not enough, the trouble is role switch class isn't aware of
> the role switch is unregistered by its provider while typec class is
> using it, this can happen by different ways, if we do role switch provider
> driver unbind, we still suffer this problem:
> 
> echo usb_controller_dev > unbind
> 

Yes, to fix this issue totally, we need to change the way role switch class
used by controller and type-c driver, until now, we still have not a good
way.

We could fix module unload issue first, unbind two devices may not a common
use case.

> I am not sure if we should prevent this happening at USB controller
> drivers(provider side), or this is allowed and we should enhance
> role switch class to be aware of this situation and properly handle it.
> 


-- 

Thanks,
Peter Chen



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

  Powered by Linux