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 16, 2020 at 11:28:52AM +0800, Peter Chen wrote:
> Current USB charger framework only shows charger state for user, but the
> user may also need charger type for further use, add support for it.
> 
> 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.

But that's kind of independant of this series, sorry, I just noticed it.

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