* [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Following a general rule, add the kerneldoc for a function next
to it's definition, but not next to its declaration in a header
file, meanwhile fix typo 'correspondig'
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 7 +++++++
include/linux/usb/otg.h | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 347fb3d3894a..fff318597337 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -187,6 +187,13 @@ static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
return (ret < 0) ? USB_DR_MODE_UNKNOWN : ret;
}
+/**
+ * usb_get_dr_mode - Get dual role mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the corresponding enum usb_dr_mode
+ */
enum usb_dr_mode usb_get_dr_mode(struct device *dev)
{
const char *dr_mode;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 69f1b6328532..a86ee6aad51b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -120,13 +120,6 @@ enum usb_dr_mode {
USB_DR_MODE_OTG,
};
-/**
- * usb_get_dr_mode - Get dual role mode for given device
- * @dev: Pointer to the given device
- *
- * The function gets phy interface string from property 'dr_mode',
- * and returns the correspondig enum usb_dr_mode
- */
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Following a general rule, add the kerneldoc for a function next
to it's definition, but not next to its declaration in a header
file, meanwhile fix typo 'correspondig'
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 7 +++++++
include/linux/usb/otg.h | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 347fb3d3894a..fff318597337 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -187,6 +187,13 @@ static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
return (ret < 0) ? USB_DR_MODE_UNKNOWN : ret;
}
+/**
+ * usb_get_dr_mode - Get dual role mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the corresponding enum usb_dr_mode
+ */
enum usb_dr_mode usb_get_dr_mode(struct device *dev)
{
const char *dr_mode;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 69f1b6328532..a86ee6aad51b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -120,13 +120,6 @@ enum usb_dr_mode {
USB_DR_MODE_OTG,
};
-/**
- * usb_get_dr_mode - Get dual role mode for given device
- * @dev: Pointer to the given device
- *
- * The function gets phy interface string from property 'dr_mode',
- * and returns the correspondig enum usb_dr_mode
- */
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Following a general rule, add the kerneldoc for a function next
to it's definition, but not next to its declaration in a header
file, meanwhile fix typo 'correspondig'
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 7 +++++++
include/linux/usb/otg.h | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 347fb3d3894a..fff318597337 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -187,6 +187,13 @@ static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
return (ret < 0) ? USB_DR_MODE_UNKNOWN : ret;
}
+/**
+ * usb_get_dr_mode - Get dual role mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets phy interface string from property 'dr_mode',
+ * and returns the corresponding enum usb_dr_mode
+ */
enum usb_dr_mode usb_get_dr_mode(struct device *dev)
{
const char *dr_mode;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 69f1b6328532..a86ee6aad51b 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -120,13 +120,6 @@ enum usb_dr_mode {
USB_DR_MODE_OTG,
};
-/**
- * usb_get_dr_mode - Get dual role mode for given device
- * @dev: Pointer to the given device
- *
- * The function gets phy interface string from property 'dr_mode',
- * and returns the correspondig enum usb_dr_mode
- */
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
2021-05-25 8:59 ` Chunfeng Yun
(?)
@ 2021-05-25 8:59 ` Chunfeng Yun
-1 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Add helper to get "role-switch-default-mode", and convert it
to the corresponding enum usb_dr_mode
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 20 ++++++++++++++++++++
include/linux/usb/otg.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index fff318597337..78a625a4e526 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
}
EXPORT_SYMBOL_GPL(usb_get_dr_mode);
+/**
+ * usb_get_role_switch_default_mode - Get default mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets string from property 'role-switch-default-mode',
+ * and returns the corresponding enum usb_dr_mode.
+ */
+enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
+{
+ const char *str;
+ int ret;
+
+ ret = device_property_read_string(dev, "role-switch-default-mode", &str);
+ if (ret < 0)
+ return USB_DR_MODE_UNKNOWN;
+
+ return usb_get_dr_mode_from_string(str);
+}
+EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
+
/**
* usb_decode_interval - Decode bInterval into the time expressed in 1us unit
* @epd: The descriptor of the endpoint
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index a86ee6aad51b..bde313c97fb6 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -121,5 +121,6 @@ enum usb_dr_mode {
};
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
+extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Add helper to get "role-switch-default-mode", and convert it
to the corresponding enum usb_dr_mode
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 20 ++++++++++++++++++++
include/linux/usb/otg.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index fff318597337..78a625a4e526 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
}
EXPORT_SYMBOL_GPL(usb_get_dr_mode);
+/**
+ * usb_get_role_switch_default_mode - Get default mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets string from property 'role-switch-default-mode',
+ * and returns the corresponding enum usb_dr_mode.
+ */
+enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
+{
+ const char *str;
+ int ret;
+
+ ret = device_property_read_string(dev, "role-switch-default-mode", &str);
+ if (ret < 0)
+ return USB_DR_MODE_UNKNOWN;
+
+ return usb_get_dr_mode_from_string(str);
+}
+EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
+
/**
* usb_decode_interval - Decode bInterval into the time expressed in 1us unit
* @epd: The descriptor of the endpoint
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index a86ee6aad51b..bde313c97fb6 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -121,5 +121,6 @@ enum usb_dr_mode {
};
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
+extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Add helper to get "role-switch-default-mode", and convert it
to the corresponding enum usb_dr_mode
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/common/common.c | 20 ++++++++++++++++++++
include/linux/usb/otg.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index fff318597337..78a625a4e526 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
}
EXPORT_SYMBOL_GPL(usb_get_dr_mode);
+/**
+ * usb_get_role_switch_default_mode - Get default mode for given device
+ * @dev: Pointer to the given device
+ *
+ * The function gets string from property 'role-switch-default-mode',
+ * and returns the corresponding enum usb_dr_mode.
+ */
+enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
+{
+ const char *str;
+ int ret;
+
+ ret = device_property_read_string(dev, "role-switch-default-mode", &str);
+ if (ret < 0)
+ return USB_DR_MODE_UNKNOWN;
+
+ return usb_get_dr_mode_from_string(str);
+}
+EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
+
/**
* usb_decode_interval - Decode bInterval into the time expressed in 1us unit
* @epd: The descriptor of the endpoint
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index a86ee6aad51b..bde313c97fb6 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -121,5 +121,6 @@ enum usb_dr_mode {
};
extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
+extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
#endif /* __LINUX_USB_OTG_H */
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/3] usb: dwc3: drd: use helper to get role-switch-default-mode
2021-05-25 8:59 ` Chunfeng Yun
(?)
@ 2021-05-25 8:59 ` Chunfeng Yun
-1 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Use the new helper usb_get_role_switch_default_mode() to
get property of "role-switch-default-mode"
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/dwc3/drd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index e2b68bb770d1..4e0a26683b06 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -541,14 +541,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
static int dwc3_setup_role_switch(struct dwc3 *dwc)
{
struct usb_role_switch_desc dwc3_role_switch = {NULL};
- const char *str;
u32 mode;
- int ret;
- ret = device_property_read_string(dwc->dev, "role-switch-default-mode",
- &str);
- if (ret >= 0 && !strncmp(str, "host", strlen("host"))) {
- dwc->role_switch_default_mode = USB_DR_MODE_HOST;
+ dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
+ if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
mode = DWC3_GCTL_PRTCAP_HOST;
} else {
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
--
2.18.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/3] usb: dwc3: drd: use helper to get role-switch-default-mode
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Use the new helper usb_get_role_switch_default_mode() to
get property of "role-switch-default-mode"
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/dwc3/drd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index e2b68bb770d1..4e0a26683b06 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -541,14 +541,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
static int dwc3_setup_role_switch(struct dwc3 *dwc)
{
struct usb_role_switch_desc dwc3_role_switch = {NULL};
- const char *str;
u32 mode;
- int ret;
- ret = device_property_read_string(dwc->dev, "role-switch-default-mode",
- &str);
- if (ret >= 0 && !strncmp(str, "host", strlen("host"))) {
- dwc->role_switch_default_mode = USB_DR_MODE_HOST;
+ dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
+ if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
mode = DWC3_GCTL_PRTCAP_HOST;
} else {
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/3] usb: dwc3: drd: use helper to get role-switch-default-mode
@ 2021-05-25 8:59 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-25 8:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Felipe Balbi
Cc: Matthias Brugger, Chunfeng Yun, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
Use the new helper usb_get_role_switch_default_mode() to
get property of "role-switch-default-mode"
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
drivers/usb/dwc3/drd.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index e2b68bb770d1..4e0a26683b06 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -541,14 +541,10 @@ static enum usb_role dwc3_usb_role_switch_get(struct usb_role_switch *sw)
static int dwc3_setup_role_switch(struct dwc3 *dwc)
{
struct usb_role_switch_desc dwc3_role_switch = {NULL};
- const char *str;
u32 mode;
- int ret;
- ret = device_property_read_string(dwc->dev, "role-switch-default-mode",
- &str);
- if (ret >= 0 && !strncmp(str, "host", strlen("host"))) {
- dwc->role_switch_default_mode = USB_DR_MODE_HOST;
+ dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
+ if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
mode = DWC3_GCTL_PRTCAP_HOST;
} else {
dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
2021-05-25 8:59 ` Chunfeng Yun
(?)
@ 2021-05-27 7:28 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:28 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> Add helper to get "role-switch-default-mode", and convert it
> to the corresponding enum usb_dr_mode
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 20 ++++++++++++++++++++
> include/linux/usb/otg.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index fff318597337..78a625a4e526 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(usb_get_dr_mode);
>
> +/**
> + * usb_get_role_switch_default_mode - Get default mode for given device
> + * @dev: Pointer to the given device
> + *
> + * The function gets string from property 'role-switch-default-mode',
> + * and returns the corresponding enum usb_dr_mode.
> + */
> +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> +{
> + const char *str;
> + int ret;
> +
> + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> + if (ret < 0)
> + return USB_DR_MODE_UNKNOWN;
> +
> + return usb_get_dr_mode_from_string(str);
> +}
> +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> +
> /**
> * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> * @epd: The descriptor of the endpoint
> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> index a86ee6aad51b..bde313c97fb6 100644
> --- a/include/linux/usb/otg.h
> +++ b/include/linux/usb/otg.h
> @@ -121,5 +121,6 @@ enum usb_dr_mode {
> };
>
> extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
What other code outside of the dwc3 driver will ever need to call this?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 7:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:28 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> Add helper to get "role-switch-default-mode", and convert it
> to the corresponding enum usb_dr_mode
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 20 ++++++++++++++++++++
> include/linux/usb/otg.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index fff318597337..78a625a4e526 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(usb_get_dr_mode);
>
> +/**
> + * usb_get_role_switch_default_mode - Get default mode for given device
> + * @dev: Pointer to the given device
> + *
> + * The function gets string from property 'role-switch-default-mode',
> + * and returns the corresponding enum usb_dr_mode.
> + */
> +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> +{
> + const char *str;
> + int ret;
> +
> + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> + if (ret < 0)
> + return USB_DR_MODE_UNKNOWN;
> +
> + return usb_get_dr_mode_from_string(str);
> +}
> +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> +
> /**
> * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> * @epd: The descriptor of the endpoint
> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> index a86ee6aad51b..bde313c97fb6 100644
> --- a/include/linux/usb/otg.h
> +++ b/include/linux/usb/otg.h
> @@ -121,5 +121,6 @@ enum usb_dr_mode {
> };
>
> extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
What other code outside of the dwc3 driver will ever need to call this?
thanks,
greg k-h
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 7:28 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:28 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> Add helper to get "role-switch-default-mode", and convert it
> to the corresponding enum usb_dr_mode
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 20 ++++++++++++++++++++
> include/linux/usb/otg.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> index fff318597337..78a625a4e526 100644
> --- a/drivers/usb/common/common.c
> +++ b/drivers/usb/common/common.c
> @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> }
> EXPORT_SYMBOL_GPL(usb_get_dr_mode);
>
> +/**
> + * usb_get_role_switch_default_mode - Get default mode for given device
> + * @dev: Pointer to the given device
> + *
> + * The function gets string from property 'role-switch-default-mode',
> + * and returns the corresponding enum usb_dr_mode.
> + */
> +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> +{
> + const char *str;
> + int ret;
> +
> + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> + if (ret < 0)
> + return USB_DR_MODE_UNKNOWN;
> +
> + return usb_get_dr_mode_from_string(str);
> +}
> +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> +
> /**
> * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> * @epd: The descriptor of the endpoint
> diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> index a86ee6aad51b..bde313c97fb6 100644
> --- a/include/linux/usb/otg.h
> +++ b/include/linux/usb/otg.h
> @@ -121,5 +121,6 @@ enum usb_dr_mode {
> };
>
> extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
What other code outside of the dwc3 driver will ever need to call this?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
2021-05-25 8:59 ` Chunfeng Yun
(?)
@ 2021-05-27 7:29 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:29 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:23PM +0800, Chunfeng Yun wrote:
> Following a general rule, add the kerneldoc for a function next
> to it's definition, but not next to its declaration in a header
> file, meanwhile fix typo 'correspondig'
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 7 +++++++
> include/linux/usb/otg.h | 7 -------
> 2 files changed, 7 insertions(+), 7 deletions(-)
Does not apply to my usb-next branch :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
@ 2021-05-27 7:29 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:29 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:23PM +0800, Chunfeng Yun wrote:
> Following a general rule, add the kerneldoc for a function next
> to it's definition, but not next to its declaration in a header
> file, meanwhile fix typo 'correspondig'
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 7 +++++++
> include/linux/usb/otg.h | 7 -------
> 2 files changed, 7 insertions(+), 7 deletions(-)
Does not apply to my usb-next branch :(
thanks,
greg k-h
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition
@ 2021-05-27 7:29 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 7:29 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Tue, May 25, 2021 at 04:59:23PM +0800, Chunfeng Yun wrote:
> Following a general rule, add the kerneldoc for a function next
> to it's definition, but not next to its declaration in a header
> file, meanwhile fix typo 'correspondig'
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/usb/common/common.c | 7 +++++++
> include/linux/usb/otg.h | 7 -------
> 2 files changed, 7 insertions(+), 7 deletions(-)
Does not apply to my usb-next branch :(
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
2021-05-27 7:28 ` Greg Kroah-Hartman
(?)
@ 2021-05-27 9:43 ` Chunfeng Yun
-1 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-27 9:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > Add helper to get "role-switch-default-mode", and convert it
> > to the corresponding enum usb_dr_mode
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > include/linux/usb/otg.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > index fff318597337..78a625a4e526 100644
> > --- a/drivers/usb/common/common.c
> > +++ b/drivers/usb/common/common.c
> > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > }
> > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> >
> > +/**
> > + * usb_get_role_switch_default_mode - Get default mode for given device
> > + * @dev: Pointer to the given device
> > + *
> > + * The function gets string from property 'role-switch-default-mode',
> > + * and returns the corresponding enum usb_dr_mode.
> > + */
> > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > +{
> > + const char *str;
> > + int ret;
> > +
> > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > + if (ret < 0)
> > + return USB_DR_MODE_UNKNOWN;
> > +
> > + return usb_get_dr_mode_from_string(str);
> > +}
> > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > +
> > /**
> > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > * @epd: The descriptor of the endpoint
> > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > index a86ee6aad51b..bde313c97fb6 100644
> > --- a/include/linux/usb/otg.h
> > +++ b/include/linux/usb/otg.h
> > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > };
> >
> > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
>
> What other code outside of the dwc3 driver will ever need to call this?
I prepare a series of pathes for mtu3, and will support
"role-switch-default-mode" property
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 9:43 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-27 9:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > Add helper to get "role-switch-default-mode", and convert it
> > to the corresponding enum usb_dr_mode
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > include/linux/usb/otg.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > index fff318597337..78a625a4e526 100644
> > --- a/drivers/usb/common/common.c
> > +++ b/drivers/usb/common/common.c
> > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > }
> > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> >
> > +/**
> > + * usb_get_role_switch_default_mode - Get default mode for given device
> > + * @dev: Pointer to the given device
> > + *
> > + * The function gets string from property 'role-switch-default-mode',
> > + * and returns the corresponding enum usb_dr_mode.
> > + */
> > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > +{
> > + const char *str;
> > + int ret;
> > +
> > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > + if (ret < 0)
> > + return USB_DR_MODE_UNKNOWN;
> > +
> > + return usb_get_dr_mode_from_string(str);
> > +}
> > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > +
> > /**
> > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > * @epd: The descriptor of the endpoint
> > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > index a86ee6aad51b..bde313c97fb6 100644
> > --- a/include/linux/usb/otg.h
> > +++ b/include/linux/usb/otg.h
> > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > };
> >
> > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
>
> What other code outside of the dwc3 driver will ever need to call this?
I prepare a series of pathes for mtu3, and will support
"role-switch-default-mode" property
>
> thanks,
>
> greg k-h
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 9:43 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-27 9:43 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > Add helper to get "role-switch-default-mode", and convert it
> > to the corresponding enum usb_dr_mode
> >
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > include/linux/usb/otg.h | 1 +
> > 2 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > index fff318597337..78a625a4e526 100644
> > --- a/drivers/usb/common/common.c
> > +++ b/drivers/usb/common/common.c
> > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > }
> > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> >
> > +/**
> > + * usb_get_role_switch_default_mode - Get default mode for given device
> > + * @dev: Pointer to the given device
> > + *
> > + * The function gets string from property 'role-switch-default-mode',
> > + * and returns the corresponding enum usb_dr_mode.
> > + */
> > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > +{
> > + const char *str;
> > + int ret;
> > +
> > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > + if (ret < 0)
> > + return USB_DR_MODE_UNKNOWN;
> > +
> > + return usb_get_dr_mode_from_string(str);
> > +}
> > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > +
> > /**
> > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > * @epd: The descriptor of the endpoint
> > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > index a86ee6aad51b..bde313c97fb6 100644
> > --- a/include/linux/usb/otg.h
> > +++ b/include/linux/usb/otg.h
> > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > };
> >
> > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
>
> What other code outside of the dwc3 driver will ever need to call this?
I prepare a series of pathes for mtu3, and will support
"role-switch-default-mode" property
>
> thanks,
>
> greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
2021-05-27 9:43 ` Chunfeng Yun
(?)
@ 2021-05-27 10:01 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 10:01 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > Add helper to get "role-switch-default-mode", and convert it
> > > to the corresponding enum usb_dr_mode
> > >
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > ---
> > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > include/linux/usb/otg.h | 1 +
> > > 2 files changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > index fff318597337..78a625a4e526 100644
> > > --- a/drivers/usb/common/common.c
> > > +++ b/drivers/usb/common/common.c
> > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > }
> > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > >
> > > +/**
> > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > + * @dev: Pointer to the given device
> > > + *
> > > + * The function gets string from property 'role-switch-default-mode',
> > > + * and returns the corresponding enum usb_dr_mode.
> > > + */
> > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > +{
> > > + const char *str;
> > > + int ret;
> > > +
> > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > + if (ret < 0)
> > > + return USB_DR_MODE_UNKNOWN;
> > > +
> > > + return usb_get_dr_mode_from_string(str);
> > > +}
> > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > +
> > > /**
> > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > * @epd: The descriptor of the endpoint
> > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > index a86ee6aad51b..bde313c97fb6 100644
> > > --- a/include/linux/usb/otg.h
> > > +++ b/include/linux/usb/otg.h
> > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > };
> > >
> > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> >
> > What other code outside of the dwc3 driver will ever need to call this?
> I prepare a series of pathes for mtu3, and will support
> "role-switch-default-mode" property
Ok, how about we wait until at least 2 drivers need it before accepting
this change.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 10:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 10:01 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > Add helper to get "role-switch-default-mode", and convert it
> > > to the corresponding enum usb_dr_mode
> > >
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > ---
> > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > include/linux/usb/otg.h | 1 +
> > > 2 files changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > index fff318597337..78a625a4e526 100644
> > > --- a/drivers/usb/common/common.c
> > > +++ b/drivers/usb/common/common.c
> > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > }
> > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > >
> > > +/**
> > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > + * @dev: Pointer to the given device
> > > + *
> > > + * The function gets string from property 'role-switch-default-mode',
> > > + * and returns the corresponding enum usb_dr_mode.
> > > + */
> > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > +{
> > > + const char *str;
> > > + int ret;
> > > +
> > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > + if (ret < 0)
> > > + return USB_DR_MODE_UNKNOWN;
> > > +
> > > + return usb_get_dr_mode_from_string(str);
> > > +}
> > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > +
> > > /**
> > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > * @epd: The descriptor of the endpoint
> > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > index a86ee6aad51b..bde313c97fb6 100644
> > > --- a/include/linux/usb/otg.h
> > > +++ b/include/linux/usb/otg.h
> > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > };
> > >
> > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> >
> > What other code outside of the dwc3 driver will ever need to call this?
> I prepare a series of pathes for mtu3, and will support
> "role-switch-default-mode" property
Ok, how about we wait until at least 2 drivers need it before accepting
this change.
thanks,
greg k-h
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-27 10:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 24+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-27 10:01 UTC (permalink / raw)
To: Chunfeng Yun
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > Add helper to get "role-switch-default-mode", and convert it
> > > to the corresponding enum usb_dr_mode
> > >
> > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > ---
> > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > include/linux/usb/otg.h | 1 +
> > > 2 files changed, 21 insertions(+)
> > >
> > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > index fff318597337..78a625a4e526 100644
> > > --- a/drivers/usb/common/common.c
> > > +++ b/drivers/usb/common/common.c
> > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > }
> > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > >
> > > +/**
> > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > + * @dev: Pointer to the given device
> > > + *
> > > + * The function gets string from property 'role-switch-default-mode',
> > > + * and returns the corresponding enum usb_dr_mode.
> > > + */
> > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > +{
> > > + const char *str;
> > > + int ret;
> > > +
> > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > + if (ret < 0)
> > > + return USB_DR_MODE_UNKNOWN;
> > > +
> > > + return usb_get_dr_mode_from_string(str);
> > > +}
> > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > +
> > > /**
> > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > * @epd: The descriptor of the endpoint
> > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > index a86ee6aad51b..bde313c97fb6 100644
> > > --- a/include/linux/usb/otg.h
> > > +++ b/include/linux/usb/otg.h
> > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > };
> > >
> > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> >
> > What other code outside of the dwc3 driver will ever need to call this?
> I prepare a series of pathes for mtu3, and will support
> "role-switch-default-mode" property
Ok, how about we wait until at least 2 drivers need it before accepting
this change.
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
2021-05-27 10:01 ` Greg Kroah-Hartman
(?)
@ 2021-05-28 2:07 ` Chunfeng Yun
-1 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-28 2:07 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 12:01 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> > On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > > Add helper to get "role-switch-default-mode", and convert it
> > > > to the corresponding enum usb_dr_mode
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > > include/linux/usb/otg.h | 1 +
> > > > 2 files changed, 21 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > > index fff318597337..78a625a4e526 100644
> > > > --- a/drivers/usb/common/common.c
> > > > +++ b/drivers/usb/common/common.c
> > > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > > }
> > > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > > >
> > > > +/**
> > > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > > + * @dev: Pointer to the given device
> > > > + *
> > > > + * The function gets string from property 'role-switch-default-mode',
> > > > + * and returns the corresponding enum usb_dr_mode.
> > > > + */
> > > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > > +{
> > > > + const char *str;
> > > > + int ret;
> > > > +
> > > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > > + if (ret < 0)
> > > > + return USB_DR_MODE_UNKNOWN;
> > > > +
> > > > + return usb_get_dr_mode_from_string(str);
> > > > +}
> > > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > > +
> > > > /**
> > > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > > * @epd: The descriptor of the endpoint
> > > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > > index a86ee6aad51b..bde313c97fb6 100644
> > > > --- a/include/linux/usb/otg.h
> > > > +++ b/include/linux/usb/otg.h
> > > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > > };
> > > >
> > > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> > >
> > > What other code outside of the dwc3 driver will ever need to call this?
> > I prepare a series of pathes for mtu3, and will support
> > "role-switch-default-mode" property
>
> Ok, how about we wait until at least 2 drivers need it before accepting
> this change.
Makes sense, thank you
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-28 2:07 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-28 2:07 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 12:01 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> > On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > > Add helper to get "role-switch-default-mode", and convert it
> > > > to the corresponding enum usb_dr_mode
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > > include/linux/usb/otg.h | 1 +
> > > > 2 files changed, 21 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > > index fff318597337..78a625a4e526 100644
> > > > --- a/drivers/usb/common/common.c
> > > > +++ b/drivers/usb/common/common.c
> > > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > > }
> > > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > > >
> > > > +/**
> > > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > > + * @dev: Pointer to the given device
> > > > + *
> > > > + * The function gets string from property 'role-switch-default-mode',
> > > > + * and returns the corresponding enum usb_dr_mode.
> > > > + */
> > > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > > +{
> > > > + const char *str;
> > > > + int ret;
> > > > +
> > > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > > + if (ret < 0)
> > > > + return USB_DR_MODE_UNKNOWN;
> > > > +
> > > > + return usb_get_dr_mode_from_string(str);
> > > > +}
> > > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > > +
> > > > /**
> > > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > > * @epd: The descriptor of the endpoint
> > > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > > index a86ee6aad51b..bde313c97fb6 100644
> > > > --- a/include/linux/usb/otg.h
> > > > +++ b/include/linux/usb/otg.h
> > > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > > };
> > > >
> > > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> > >
> > > What other code outside of the dwc3 driver will ever need to call this?
> > I prepare a series of pathes for mtu3, and will support
> > "role-switch-default-mode" property
>
> Ok, how about we wait until at least 2 drivers need it before accepting
> this change.
Makes sense, thank you
>
> thanks,
>
> greg k-h
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/3] usb: common: add helper to get role-switch-default-mode
@ 2021-05-28 2:07 ` Chunfeng Yun
0 siblings, 0 replies; 24+ messages in thread
From: Chunfeng Yun @ 2021-05-28 2:07 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Felipe Balbi, Matthias Brugger, Thinh Nguyen, linux-usb,
linux-kernel, linux-arm-kernel, linux-mediatek
On Thu, 2021-05-27 at 12:01 +0200, Greg Kroah-Hartman wrote:
> On Thu, May 27, 2021 at 05:43:39PM +0800, Chunfeng Yun wrote:
> > On Thu, 2021-05-27 at 09:28 +0200, Greg Kroah-Hartman wrote:
> > > On Tue, May 25, 2021 at 04:59:24PM +0800, Chunfeng Yun wrote:
> > > > Add helper to get "role-switch-default-mode", and convert it
> > > > to the corresponding enum usb_dr_mode
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > > drivers/usb/common/common.c | 20 ++++++++++++++++++++
> > > > include/linux/usb/otg.h | 1 +
> > > > 2 files changed, 21 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > > > index fff318597337..78a625a4e526 100644
> > > > --- a/drivers/usb/common/common.c
> > > > +++ b/drivers/usb/common/common.c
> > > > @@ -207,6 +207,26 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
> > > > }
> > > > EXPORT_SYMBOL_GPL(usb_get_dr_mode);
> > > >
> > > > +/**
> > > > + * usb_get_role_switch_default_mode - Get default mode for given device
> > > > + * @dev: Pointer to the given device
> > > > + *
> > > > + * The function gets string from property 'role-switch-default-mode',
> > > > + * and returns the corresponding enum usb_dr_mode.
> > > > + */
> > > > +enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev)
> > > > +{
> > > > + const char *str;
> > > > + int ret;
> > > > +
> > > > + ret = device_property_read_string(dev, "role-switch-default-mode", &str);
> > > > + if (ret < 0)
> > > > + return USB_DR_MODE_UNKNOWN;
> > > > +
> > > > + return usb_get_dr_mode_from_string(str);
> > > > +}
> > > > +EXPORT_SYMBOL_GPL(usb_get_role_switch_default_mode);
> > > > +
> > > > /**
> > > > * usb_decode_interval - Decode bInterval into the time expressed in 1us unit
> > > > * @epd: The descriptor of the endpoint
> > > > diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
> > > > index a86ee6aad51b..bde313c97fb6 100644
> > > > --- a/include/linux/usb/otg.h
> > > > +++ b/include/linux/usb/otg.h
> > > > @@ -121,5 +121,6 @@ enum usb_dr_mode {
> > > > };
> > > >
> > > > extern enum usb_dr_mode usb_get_dr_mode(struct device *dev);
> > > > +extern enum usb_dr_mode usb_get_role_switch_default_mode(struct device *dev);
> > >
> > > What other code outside of the dwc3 driver will ever need to call this?
> > I prepare a series of pathes for mtu3, and will support
> > "role-switch-default-mode" property
>
> Ok, how about we wait until at least 2 drivers need it before accepting
> this change.
Makes sense, thank you
>
> thanks,
>
> greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2021-05-28 2:09 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 8:59 [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-25 8:59 ` [PATCH 2/3] usb: common: add helper to get role-switch-default-mode Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-27 7:28 ` Greg Kroah-Hartman
2021-05-27 7:28 ` Greg Kroah-Hartman
2021-05-27 7:28 ` Greg Kroah-Hartman
2021-05-27 9:43 ` Chunfeng Yun
2021-05-27 9:43 ` Chunfeng Yun
2021-05-27 9:43 ` Chunfeng Yun
2021-05-27 10:01 ` Greg Kroah-Hartman
2021-05-27 10:01 ` Greg Kroah-Hartman
2021-05-27 10:01 ` Greg Kroah-Hartman
2021-05-28 2:07 ` Chunfeng Yun
2021-05-28 2:07 ` Chunfeng Yun
2021-05-28 2:07 ` Chunfeng Yun
2021-05-25 8:59 ` [PATCH 3/3] usb: dwc3: drd: use " Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-25 8:59 ` Chunfeng Yun
2021-05-27 7:29 ` [PATCH 1/3] usb: common: move usb_get_dr_mode() kerneldoc next to its definition Greg Kroah-Hartman
2021-05-27 7:29 ` Greg Kroah-Hartman
2021-05-27 7:29 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.