Skip to contentSkip to conversation

usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

PATCH Superseded David Cohen 3 participants 7 messages Jan 7, 2014 – Mar 24, 2014

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

PATCH 1/1 usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

Instead of creating nested #ifdefs, this patch fixes it by defining the xHCI PCI stubs as inline.

---
 drivers/usb/host/xhci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.c +3 -3
index 4265b48856f6..672df9840014 100644
@@ -397,16 +397,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
 
 #else
 
-static int xhci_try_enable_msi(struct usb_hcd *hcd)
+static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
 {
 	return 0;
 }
 
-static void xhci_cleanup_msix(struct xhci_hcd *xhci)
+static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH v2 1/1 usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

It happens due to lack of __maybe_unused flag on xhci_msix_sync_irqs() function in case of !CONFIG_PCI.

---

Change v1 -> v2:
- xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline.

 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
index 4265b48856f6..ed6b717b8ee1 100644
@@ -406,7 +406,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 1 line
1.8.4.2
#2 lore raw

Hi Sarah,

Quoted 10 lines · David Cohen

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

It happens due to lack of __maybe_unused flag on xhci_msix_sync_irqs() function in case of !CONFIG_PCI.

---

Ping :)
Any comments here?

Br, David

Quoted 24 lines

Change v1 -> v2:
- xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline.

 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
index 4265b48856f6..ed6b717b8ee1 100644
@@ -406,7 +406,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 1 line
1.8.4.2
#3 lore raw
Quoted 36 lines · David Cohen

Hi Sarah,

Quoted 10 lines · David Cohen

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

It happens due to lack of __maybe_unused flag on xhci_msix_sync_irqs() function in case of !CONFIG_PCI.

---

Ping :)
Any comments here?

Br, David

Quoted 17 lines

Change v1 -> v2:
- xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline.

 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +0 -0
index 4265b48856f6..ed6b717b8ee1 100644
@@ -406,7 +406,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
Quoted 2 lines

drivers/usb/host/xhci.c static void xhci_cleanup_msix(struct xhci_hcd *xhci) · line 409

Quoted 2 lines
drivers/usb/host/xhci.c +1 -1
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)

bellow is likely a better fix. Usually stubs are marked inline, rather than getting an unused attribute:

drivers/usb/host/xhci.c +3 -3
index 3712359..8f1a6d5 100644
@@ -404,16 +404,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
 
 #else
 
-static int xhci_try_enable_msi(struct usb_hcd *hcd)
+static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
 {
 	return 0;
 }
 
-static void xhci_cleanup_msix(struct xhci_hcd *xhci)
+static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 1 line
balbi
#4 lore raw
Quoted 37 lines · Felipe Balbi
Quoted 36 lines · David Cohen

Hi Sarah,

Quoted 10 lines · David Cohen

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

It happens due to lack of __maybe_unused flag on xhci_msix_sync_irqs() function in case of !CONFIG_PCI.

---

Ping :)
Any comments here?

Br, David

Quoted 17 lines

Change v1 -> v2:
- xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline.

 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +0 -0
index 4265b48856f6..ed6b717b8ee1 100644
@@ -406,7 +406,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
Quoted 5 lines
Quoted 2 lines

drivers/usb/host/xhci.c static void xhci_cleanup_msix(struct xhci_hcd *xhci) · line 409

Quoted 2 lines
drivers/usb/host/xhci.c +1 -1
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)

bellow is likely a better fix. Usually stubs are marked inline, rather than getting an unused attribute:

Thanks for commenting. That would be actually the v1 of my patch :) I changed after I see the proper function has __maybe_unused flag.

But I'm fine with Sarah picking any of the patch's versions.

Br, David

Quoted 28 lines
drivers/usb/host/xhci.c +3 -3
index 3712359..8f1a6d5 100644
@@ -404,16 +404,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
 
 #else
 
-static int xhci_try_enable_msi(struct usb_hcd *hcd)
+static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
 {
 	return 0;
 }
 
-static void xhci_cleanup_msix(struct xhci_hcd *xhci)
+static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 2 lines
-- 
balbi
#5 lore raw

Hi Mathias,

Quoted 44 lines · David Cohen
Quoted 37 lines · Felipe Balbi
Quoted 36 lines · David Cohen

Hi Sarah,

Quoted 10 lines · David Cohen

When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning:
drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function]

It happens due to lack of __maybe_unused flag on xhci_msix_sync_irqs() function in case of !CONFIG_PCI.

---

Ping :)
Any comments here?

Br, David

Quoted 17 lines

Change v1 -> v2:
- xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline.

 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +0 -0
index 4265b48856f6..ed6b717b8ee1 100644
@@ -406,7 +406,7 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
Quoted 5 lines
Quoted 2 lines

drivers/usb/host/xhci.c static void xhci_cleanup_msix(struct xhci_hcd *xhci) · line 409

Quoted 2 lines
drivers/usb/host/xhci.c +1 -1
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static void __maybe_unused xhci_msix_sync_irqs(struct xhci_hcd *xhci)

bellow is likely a better fix. Usually stubs are marked inline, rather than getting an unused attribute:

Quoted 4 lines

Thanks for commenting. That would be actually the v1 of my patch :) I changed after I see the proper function has __maybe_unused flag.

But I'm fine with Sarah picking any of the patch's versions.

Guess you're handling the review of this trivial patch now :) Comments are very welcome.

Br, David

Quoted 34 lines

Br, David

Quoted 28 lines
drivers/usb/host/xhci.c +3 -3
index 3712359..8f1a6d5 100644
@@ -404,16 +404,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
 
 #else
 
-static int xhci_try_enable_msi(struct usb_hcd *hcd)
+static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
 {
 	return 0;
 }
 
-static void xhci_cleanup_msix(struct xhci_hcd *xhci)
+static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
 {
 }
 
-static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
+static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
 {
 }
 
Signature · 2 lines
-- 
balbi
#6 lore raw
Quoted 6 lines · David Cohen

Hi Mathias,

Quoted 4 lines

Thanks for commenting. That would be actually the v1 of my patch :) I changed after I see the proper function has __maybe_unused flag.

Quoted 7 lines
Quoted 1 line

But I'm fine with Sarah picking any of the patch's versions.

Guess you're handling the review of this trivial patch now :) Comments are very welcome.

Br, David

Hi

Patch version 1 inlining the stubs looks good to me. I'll queue it for Greg’s usb-linus once 3.15-rc1 is out.

-Mathias