Skip to contentSkip to conversation

usb: ohci-omap: avoid unused-variable warning

PATCH In review Arnd Bergmann 3 participants 3 messages Jan 18, 2023 – Jan 19, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: ohci-omap: avoid unused-variable warning

From: Arnd Bergmann <[email protected]>

The dead code removal has led to 'need_transceiver' not being used at all when OTG support is disabled:

drivers/usb/host/ohci-omap.c: In function 'ohci_omap_reset':
drivers/usb/host/ohci-omap.c:99:33: error: unused variable 'need_transceiver' [-Werror=unused-variable]
99 | int need_transceiver = (config->otg != 0);

Change the #ifdef check into an IS_ENABLED() check to make the code more readable and let the compiler see where it is used.

Fixes 8825acd7cc8a ("ARM: omap1: remove dead code")

---
The patch that caused the issue is in the boardfile-removal branch of the soc tree. I would just add the patch there.

---
 drivers/usb/host/ohci-omap.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/usb/host/ohci-omap.c +1 -7
index 3d57b9454a27..78088cd46908 100644
@@ -67,8 +67,6 @@ static void omap_ohci_clock_power(struct ohci_omap_priv *priv, int on)
 	}
 }
 
-#ifdef	CONFIG_USB_OTG
-
 static void start_hnp(struct ohci_hcd *ohci)
 {
 	struct usb_hcd *hcd = ohci_to_hcd(ohci);
@@ -87,8 +85,6 @@ static void start_hnp(struct ohci_hcd *ohci)
 	local_irq_restore(flags);
 }
 
-#endif
-
 /*-------------------------------------------------------------------------*/
 
 static int ohci_omap_reset(struct usb_hcd *hcd)
@@ -111,8 +107,7 @@ static int ohci_omap_reset(struct usb_hcd *hcd)
 	if (config->ocpi_enable)
 		config->ocpi_enable();
 
-#ifdef	CONFIG_USB_OTG
-	if (need_transceiver) {
+	if (IS_ENABLED(CONFIG_USB_OTG) && need_transceiver) {
 		hcd->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
 		if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
 			int	status = otg_set_host(hcd->usb_phy->otg,
@@ -129,7 +124,6 @@ static int ohci_omap_reset(struct usb_hcd *hcd)
 		hcd->skip_phy_initialization = 1;
 		ohci->start_hnp = start_hnp;
 	}
-#endif
 
 	omap_ohci_clock_power(priv, 1);
 
Signature · 1 line
2.39.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The dead code removal has led to 'need_transceiver' not being used at all when OTG support is disabled:

drivers/usb/host/ohci-omap.c: In function 'ohci_omap_reset':
drivers/usb/host/ohci-omap.c:99:33: error: unused variable 'need_transceiver' [-Werror=unused-variable]
99 | int need_transceiver = (config->otg != 0);

Quoted 6 lines

Change the #ifdef check into an IS_ENABLED() check to make the code more readable and let the compiler see where it is used.

Fixes 8825acd7cc8a ("ARM: omap1: remove dead code")

---

Quoted 2 lines

The patch that caused the issue is in the boardfile-removal branch of the soc tree. I would just add the patch there.

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The dead code removal has led to 'need_transceiver' not being used at all when OTG support is disabled:

drivers/usb/host/ohci-omap.c: In function 'ohci_omap_reset':
drivers/usb/host/ohci-omap.c:99:33: error: unused variable 'need_transceiver' [-Werror=unused-variable]
99 | int need_transceiver = (config->otg != 0);

Quoted 8 lines

Change the #ifdef check into an IS_ENABLED() check to make the code more readable and let the compiler see where it is used.

Fixes 8825acd7cc8a ("ARM: omap1: remove dead code")

---
The patch that caused the issue is in the boardfile-removal branch of the soc tree. I would just add the patch there.