Skip to contentSkip to conversation

usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

RFC Superseded Faiz Abbas 4 participants 10 messages Feb 14, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Faiz Abbas

author
#0 lore raw

RFC 1/1 usb: host: xhci-omap: Remove redundant board_usb_init and board_usb_cleanup functions

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

---
Since 1a9a5f7 ("fix double weak board_usb_init functions") the board_usb_init()/_cleanup() a prefix omap_xhci_* was added to the board files and in omap-xhci.c because there was a duplicate implementation in common/usb.c. However, this broke the gadget mode path which uses the same board_usb_init/cleanup() in the board specific files.

I think a better way would be to just remove the functions from xhci-omap like in this patch. Any issues with this?

 board/ti/am43xx/board.c      |  4 ++--
 board/ti/am57xx/board.c      |  4 ++--
 board/ti/dra7xx/evm.c        |  4 ++--
 drivers/usb/host/xhci-omap.c | 22 ----------------------
 4 files changed, 6 insertions(+), 28 deletions(-)
board/ti/am43xx/board.c +2 -2
index 06082f1..6286af4 100644
@@ -744,7 +744,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -775,7 +775,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
board/ti/am57xx/board.c +2 -2
index 1128784..c3f60f6 100644
@@ -867,7 +867,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -901,7 +901,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
board/ti/dra7xx/evm.c +2 -2
index 6ecf971..519475e 100644
@@ -907,7 +907,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.index = 1,
 };
 
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -944,7 +944,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 	switch (index) {
 	case 0:
drivers/usb/host/xhci-omap.c +0 -22
index d6c5744..b814500 100644
@@ -27,28 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-	enable_usb_clocks(index);
-	return 0;
-}
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-	return omap_xhci_board_usb_init(index, init);
-}
-
-__weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
-{
-	disable_usb_clocks(index);
-	return 0;
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-	return omap_xhci_board_usb_cleanup(index, init);
-}
-
 static int omap_xhci_core_init(struct omap_xhci *omap)
 {
 	int ret = 0;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

Quoted 116 lines

---
Since 1a9a5f7 ("fix double weak board_usb_init functions") the board_usb_init()/_cleanup() a prefix omap_xhci_* was added to the board files and in omap-xhci.c because there was a duplicate implementation in common/usb.c. However, this broke the gadget mode path which uses the same board_usb_init/cleanup() in the board specific files.

I think a better way would be to just remove the functions from xhci-omap like in this patch. Any issues with this?

 board/ti/am43xx/board.c      |  4 ++--
 board/ti/am57xx/board.c      |  4 ++--
 board/ti/dra7xx/evm.c        |  4 ++--
 drivers/usb/host/xhci-omap.c | 22 ----------------------
 4 files changed, 6 insertions(+), 28 deletions(-)
board/ti/am43xx/board.c +2 -2
index 06082f1..6286af4 100644
@@ -744,7 +744,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 #ifdef CONFIG_USB_DWC3
@@ -775,7 +775,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
board/ti/am57xx/board.c +2 -2
index 1128784..c3f60f6 100644
@@ -867,7 +867,7 @@ int usb_gadget_handle_interrupts(int index)
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -901,7 +901,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_USB_DWC3
 	switch (index) {
board/ti/dra7xx/evm.c +2 -2
index 6ecf971..519475e 100644
@@ -907,7 +907,7 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.index = 1,
 };
 
-int omap_xhci_board_usb_init(int index, enum usb_init_type init)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
 	switch (index) {
@@ -944,7 +944,7 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
+int board_usb_cleanup(int index, enum usb_init_type init)
 {
 	switch (index) {
 	case 0:
drivers/usb/host/xhci-omap.c +0 -22
index d6c5744..b814500 100644
@@ -27,28 +27,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct omap_xhci omap;
 
-__weak int omap_xhci_board_usb_init(int index, enum usb_init_type init)
-{
-	enable_usb_clocks(index);
-	return 0;
-}
-
-int board_usb_init(int index, enum usb_init_type init)
-{
-	return omap_xhci_board_usb_init(index, init);
-}
-
-__weak int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
-{
-	disable_usb_clocks(index);
-	return 0;
-}
-
-int board_usb_cleanup(int index, enum usb_init_type init)
-{
-	return omap_xhci_board_usb_cleanup(index, init);
-}
-
 static int omap_xhci_core_init(struct omap_xhci *omap)
 {
 	int ret = 0;
Signature · 2 lines
Best regards,
Marek Vasut
author
#2 lore raw

Hi,

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

Thanks,
Faiz

#3 lore raw
Quoted 9 lines · Faiz Abbas

Hi,

Quoted 6 lines · Marek Vasut
Quoted 5 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

So why is it marked RFC ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#4 lore raw

Hi,

Quoted 12 lines · Marek Vasut
Quoted 11 lines · Faiz Abbas

Hi,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

So why is it marked RFC ?

Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix double weak board_usb_init functions").

Thanks,
Faiz

#5 lore raw
Quoted 19 lines · Faiz Abbas

Hi,

Quoted 16 lines · Marek Vasut
Quoted 15 lines · Faiz Abbas

Hi,

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I have tested this for dra7xx, am43xx and am57xx.

So why is it marked RFC ?

Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix double weak board_usb_init functions").

OK, submit it as a normal patch with my RB.

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

Hi,
Sorry for the late response.

Quoted 22 lines · Marek Vasut
Quoted 21 lines · Faiz Abbas

Hi,

Quoted 18 lines · Marek Vasut
Quoted 16 lines · Faiz Abbas

Hi,

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So why is it marked RFC ?

Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix double weak board_usb_init functions").

OK, submit it as a normal patch with my RB.

As mentioned in 1a9a5f7, the functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup() are called for the boards with the CONFIG_USB_XHCI_OMAP definition.

The weak implementation of the functions omap_xhci_board_usb_init() executed enable_usb_clocks().
The weak implementation of the function omap_xhci_board_usb_cleanup() executed the function disable_usb_clocks().

For the boards compulab/cl-som-am57x and compulab/cm_t43:
* CONFIG_USB_XHCI_OMAP is defined
* omap_xhci_board_usb_init is not implemented, relying on the weak implementation.
* omap_xhci_board_usb_cleanup is not defined, relying on the weak implementation.

The fix is missing the implementation of board_usb_init and board_usb_cleanup in the compulab/cl-som-am57x and compulab/cm_t43. The implementation should include the content of the deleted weak functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup().

Signature · 2 lines
Thanks,
Uri
author
#7 lore raw

Hi Uri,

Quoted 51 lines · Uri Mashiach

Hi,
Sorry for the late response.

Quoted 22 lines · Marek Vasut
Quoted 21 lines · Faiz Abbas

Hi,

Quoted 18 lines · Marek Vasut
Quoted 16 lines · Faiz Abbas

Hi,

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So why is it marked RFC ?

Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix double weak board_usb_init functions").

OK, submit it as a normal patch with my RB.

As mentioned in 1a9a5f7, the functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup() are called for the boards with the CONFIG_USB_XHCI_OMAP definition.

The weak implementation of the functions omap_xhci_board_usb_init() executed enable_usb_clocks().
The weak implementation of the function omap_xhci_board_usb_cleanup() executed the function disable_usb_clocks().

For the boards compulab/cl-som-am57x and compulab/cm_t43:
* CONFIG_USB_XHCI_OMAP is defined
* omap_xhci_board_usb_init is not implemented, relying on the weak implementation.
* omap_xhci_board_usb_cleanup is not defined, relying on the weak implementation.

Quoted 5 lines

The fix is missing the implementation of board_usb_init and board_usb_cleanup in the compulab/cl-som-am57x and compulab/cm_t43. The implementation should include the content of the deleted weak functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup().

Thanks for clarifying. Shouldn't that be implemented in the board files? I can add board_usb_init and board_usb_cleanup for those platforms in v2. Can you help me test this on those platforms?

Thanks,
Faiz

#8 lore raw

Hi Faiz,

Quoted 54 lines · Faiz Abbas

Hi Uri,

Quoted 51 lines · Uri Mashiach

Hi,
Sorry for the late response.

Quoted 22 lines · Marek Vasut
Quoted 21 lines · Faiz Abbas

Hi,

Quoted 18 lines · Marek Vasut
Quoted 16 lines · Faiz Abbas

Hi,

Quoted 11 lines · Marek Vasut
Quoted 6 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

I'd like some TBs from the people using those boards.

I have tested this for dra7xx, am43xx and am57xx.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So why is it marked RFC ?

Because I was unclear why Uri Mashiach did not do this in 1a9a5f7 ("fix double weak board_usb_init functions").

OK, submit it as a normal patch with my RB.

As mentioned in 1a9a5f7, the functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup() are called for the boards with the CONFIG_USB_XHCI_OMAP definition.

The weak implementation of the functions omap_xhci_board_usb_init() executed enable_usb_clocks().
The weak implementation of the function omap_xhci_board_usb_cleanup() executed the function disable_usb_clocks().

For the boards compulab/cl-som-am57x and compulab/cm_t43:
* CONFIG_USB_XHCI_OMAP is defined
* omap_xhci_board_usb_init is not implemented, relying on the weak implementation.
* omap_xhci_board_usb_cleanup is not defined, relying on the weak implementation.

Quoted 7 lines
Quoted 5 lines

The fix is missing the implementation of board_usb_init and board_usb_cleanup in the compulab/cl-som-am57x and compulab/cm_t43. The implementation should include the content of the deleted weak functions omap_xhci_board_usb_init() and omap_xhci_board_usb_cleanup().

Thanks for clarifying. Shouldn't that be implemented in the board files?

Yes

Quoted 2 lines

I can add board_usb_init and board_usb_cleanup for those platforms in v2. Can you help me test this on those platforms?

Yes

Quoted 4 lines

Thanks,
Faiz

Signature · 2 lines
Thanks,
Uri
Reviewed-by on v1 1/1
#9 lore raw
In reply to Faiz Abbas
Quoted 13 lines · Faiz Abbas

board_usb_init()/_cleanup() should be in board files and don't have a place in the xhci-omap driver. Weak versions for board_usb_init()/_cleanup() already exist in common/usb.c (for host mode) and drivers/usb/gadget/g_dnl.c (for gadget mode).

---
Since 1a9a5f7 ("fix double weak board_usb_init functions") the board_usb_init()/_cleanup() a prefix omap_xhci_* was added to the board files and in omap-xhci.c because there was a duplicate implementation in common/usb.c. However, this broke the gadget mode path which uses the same board_usb_init/cleanup() in the board specific files.

Quoted 9 lines

I think a better way would be to just remove the functions from xhci-omap like in this patch. Any issues with this?

 board/ti/am43xx/board.c      |  4 ++--
 board/ti/am57xx/board.c      |  4 ++--
 board/ti/dra7xx/evm.c        |  4 ++--
 drivers/usb/host/xhci-omap.c | 22 ----------------------
 4 files changed, 6 insertions(+), 28 deletions(-)