Thread (5 messages) 5 messages, 2 authors, 2020-01-30

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

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2020-01-30 14:22:43

On Thu, Jan 30, 2020 at 02:05:17PM +0000, Peter Chen wrote:
 
quoted
quoted
Signed-off-by: Peter Chen <redacted>
---
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",
quoted
+	[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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help