Re: [PATCH v4 1/2] usb: phy: show USB charger type for user

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

 



On Thu, Jan 30, 2020 at 02:05:17PM +0000, Peter Chen wrote:
>  
> > > Signed-off-by: Peter Chen <peter.chen@xxxxxxx>
> > > ---
> > > Changes for v4:
> > > - No changes.
> > >
> > >  drivers/usb/phy/phy.c | 13 ++++++++++++-
> > >  1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index
> > > 0277f62739a2..ad2554630889 100644
> > > --- a/drivers/usb/phy/phy.c
> > > +++ b/drivers/usb/phy/phy.c
> > > @@ -34,6 +34,14 @@ struct phy_devm {
> > >  	struct notifier_block *nb;
> > >  };
> > >
> > > +static const char *const usb_chger_type[] = {
> > > +	[UNKNOWN_TYPE]			=
> > "USB_CHARGER_UNKNOWN_TYPE",
> > > +	[SDP_TYPE]			= "USB_CHARGER_SDP_TYPE",
> > > +	[CDP_TYPE]			= "USB_CHARGER_CDP_TYPE",
> > > +	[DCP_TYPE]			= "USB_CHARGER_DCP_TYPE",
> > > +	[ACA_TYPE]			= "USB_CHARGER_ACA_TYPE",
> > > +};
> > 
> > As these are exported values (CDP_TYPE and friends), they really need to have
> > explicit values on the .h file, otherwise it might not work properly on all systems.
> > 
> 
> Sorry, what do you mean? These values are defined at include/uapi/linux/usb/charger.h

Yes, but they are not set to a specific value, so they can really be
"anything".  That .h file needs to have specific numbers set to the
enum values in order for this to work properly on all arches/compilers.

thanks,

greg k-h



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

  Powered by Linux