Skip to contentSkip to conversation

brcmfmac: BRCMFMAC should depend on HAS_DMA

PATCH In review Geert Uytterhoeven 3 participants 9 messages Aug 29, 2014 – Sep 1, 2014

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

PATCH 1/1 brcmfmac: BRCMFMAC should depend on HAS_DMA

If NO_DMA=y:

drivers/built-in.o: In function `brcmf_msgbuf_release_array':
msgbuf.c:(.text+0x34dbbe): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_proto_msgbuf_detach':
(.text+0x34dca4): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_get_pktid':
msgbuf.c:(.text+0x34dd2a): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_msgbuf_alloc_pktid':
msgbuf.c:(.text+0x34de12): undefined reference to dma_map_single' msgbuf.c:(.text+0x34de20): undefined reference to dma_mapping_error' drivers/built-in.o: In function `brcmf_msgbuf_remove_flowring':
msgbuf.c:(.text+0x34e3d6): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_flowring_create':
msgbuf.c:(.text+0x34e4f8): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f5fe): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f798): undefined reference to `dma_free_coherent'

---
 drivers/net/wireless/brcm80211/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/Kconfig +1 -1
index b8e2561ea645..2e0da8925834 100644
@@ -19,7 +19,7 @@ config BRCMSMAC
 
 config BRCMFMAC
 	tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
-	depends on CFG80211
+	depends on CFG80211A && HAS_DMA
 	select BRCMUTIL
 	---help---
 	  This module adds support for embedded wireless adapters based on
Signature · 1 line
1.9.1
#1 lore raw

Hi Geert,

Quoted 30 lines · Geert Uytterhoeven

If NO_DMA=y:

drivers/built-in.o: In function `brcmf_msgbuf_release_array':
msgbuf.c:(.text+0x34dbbe): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_proto_msgbuf_detach':
(.text+0x34dca4): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_get_pktid':
msgbuf.c:(.text+0x34dd2a): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_msgbuf_alloc_pktid':
msgbuf.c:(.text+0x34de12): undefined reference to dma_map_single' msgbuf.c:(.text+0x34de20): undefined reference to dma_mapping_error' drivers/built-in.o: In function `brcmf_msgbuf_remove_flowring':
msgbuf.c:(.text+0x34e3d6): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_flowring_create':
msgbuf.c:(.text+0x34e4f8): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f5fe): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f798): undefined reference to `dma_free_coherent'

---
  drivers/net/wireless/brcm80211/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/Kconfig +0 -0
index b8e2561ea645..2e0da8925834 100644

drivers/net/wireless/brcm80211/Kconfig config BRCMSMAC · line 25

Quoted 8 lines
drivers/net/wireless/brcm80211/Kconfig +1 -1
@@ -19,7 +19,7 @@ config BRCMSMAC
 
  config BRCMFMAC
  	tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
-	depends on CFG80211
+	depends on CFG80211A && HAS_DMA
  	select BRCMUTIL
  	---help---
  	  This module adds support for embedded wireless adapters based on

Thanks for reporting this. All complaints are from msgbuf code. So the dependency should belong to BRCMFMAC_PCIE not BRCMFMAC.

Thanks,
Franky

#2 lore raw

Hi Franky,

Quoted 10 lines · Franky Lin

drivers/net/wireless/brcm80211/Kconfig config BRCMSMAC · line 25

Quoted 7 lines

config BRCMFMAC
tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"

drivers/net/wireless/brcm80211/Kconfig +1 -1
-       depends on CFG80211
+       depends on CFG80211A && HAS_DMA
        select BRCMUTIL
        ---help---
          This module adds support for embedded wireless adapters based on

Thanks for reporting this. All complaints are from msgbuf code. So the dependency should belong to BRCMFMAC_PCIE not BRCMFMAC.

I have PCI=n, hence BRCMFMAC_PCIE=n.

IIRC, I did try adding the HAS_DMA dependencies to the suboptions, but then it still failed to link. Hence I restored to the main BRCMFMAC.

Besides, msgbuf.o is part of the core.
I've just tried moving it to brcmfmac-$(CONFIG_BRCMFMAC_PCIE), but that doesn't help. Other parts use msgbuf, too.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 1 line · Geert Uytterhoeven

but then it still failed to link. Hence I restored to the main BRCMFMAC.

s/restored/resorted/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw
In reply to Geert Uytterhoeven
Quoted 4 lines · Geert Uytterhoeven

Besides, msgbuf.o is part of the core.
I've just tried moving it to brcmfmac-$(CONFIG_BRCMFMAC_PCIE), but that doesn't help. Other parts use msgbuf, too.

I was about to send my ACK but had a second thought. If the dependency is added, SDIO driver may not work on no DMA platform. Shall we separate the protocol as a selectable option that selects by bus option?

Thanks,
Franky

#5 lore raw
In reply to Geert Uytterhoeven
Quoted 30 lines · Geert Uytterhoeven

If NO_DMA=y:

drivers/built-in.o: In function `brcmf_msgbuf_release_array':
msgbuf.c:(.text+0x34dbbe): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_proto_msgbuf_detach':
(.text+0x34dca4): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_get_pktid':
msgbuf.c:(.text+0x34dd2a): undefined reference to dma_unmap_single' drivers/built-in.o: In function brcmf_msgbuf_alloc_pktid':
msgbuf.c:(.text+0x34de12): undefined reference to dma_map_single' msgbuf.c:(.text+0x34de20): undefined reference to dma_mapping_error' drivers/built-in.o: In function `brcmf_msgbuf_remove_flowring':
msgbuf.c:(.text+0x34e3d6): undefined reference to dma_free_coherent' drivers/built-in.o: In function brcmf_msgbuf_flowring_create':
msgbuf.c:(.text+0x34e4f8): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f5fe): undefined reference to dma_alloc_coherent' drivers/built-in.o: In function brcmf_proto_msgbuf_attach':
(.text+0x34f798): undefined reference to `dma_free_coherent'

---
  drivers/net/wireless/brcm80211/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/Kconfig +0 -0
index b8e2561ea645..2e0da8925834 100644

drivers/net/wireless/brcm80211/Kconfig config BRCMSMAC · line 22

Quoted 5 lines
drivers/net/wireless/brcm80211/Kconfig +1 -1
@@ -19,7 +19,7 @@ config BRCMSMAC
 
  config BRCMFMAC
  	tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
-	depends on CFG80211
+	depends on CFG80211A&&  HAS_DMA

Hi Geert,

Not sure what happened here, but CFG80211 kconfig option did was not renamed as far as I know. Anyway, I would like to propose a different solution. Will get back to you when I have it ready.

Regards,
Arend

Quoted 3 lines
drivers/net/wireless/brcm80211/Kconfig +0 -0
  	select BRCMUTIL
  	---help---
  	  This module adds support for embedded wireless adapters based on
#6 lore raw

Hi Arend,

Quoted 7 lines · Arend van Spriel

Review

Quoted 4 lines

config BRCMFMAC
tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"

(quoted diff) +1 -1
-       depends on CFG80211
+       depends on CFG80211A&&  HAS_DMA

Not sure what happened here, but CFG80211 kconfig option did was not renamed as far as I know. Anyway, I would like to propose a different solution. Will

Oops, that was me typing the vim append-command twice :-( Thanks for noticing!

Quoted 1 line

get back to you when I have it ready.

OK. Thanks again!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw
Quoted 11 lines · Geert Uytterhoeven

Hi Arend,

Quoted 7 lines · Arend van Spriel

Review

Quoted 4 lines

config BRCMFMAC
tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"

(quoted diff) +1 -1
-       depends on CFG80211
+       depends on CFG80211A&&   HAS_DMA

Not sure what happened here, but CFG80211 kconfig option did was not renamed as far as I know. Anyway, I would like to propose a different solution. Will

Quoted 6 lines

Oops, that was me typing the vim append-command twice :-( Thanks for noticing!

Quoted 1 line

get back to you when I have it ready.

OK. Thanks again!

Hi Geert,

I added Kconfig options for the proto layer which are selected by the host interface selection. So the HAS_DMA dependency is checked for BRCMFMAC_PCIE. I am wondering whether GENERIC_IO should also be checked.

Can you verify the patch below works with your configuration?

Regards,
Arend
---

drivers/net/wireless/brcm80211/Kconfig +10 -0
index b8e2561..fe3dc12 100644
@@ -27,10 +27,17 @@ config BRCMFMAC
 	  one of the bus interface support. If you choose to build a module,
 	  it'll be called brcmfmac.ko.
 
+config BRCMFMAC_PROTO_BCDC
+	bool
+
+config BRCMFMAC_PROTO_MSGBUF
+	bool
+
 config BRCMFMAC_SDIO
 	bool "SDIO bus interface support for FullMAC driver"
 	depends on (MMC = y || MMC = BRCMFMAC)
 	depends on BRCMFMAC
+	select BRCMFMAC_PROTO_BCDC
 	select FW_LOADER
 	default y
 	---help---
@@ -42,6 +49,7 @@ config BRCMFMAC_USB
 	bool "USB bus interface support for FullMAC driver"
 	depends on (USB = y || USB = BRCMFMAC)
 	depends on BRCMFMAC
+	select BRCMFMAC_PROTO_BCDC
 	select FW_LOADER
 	---help---
 	  This option enables the USB bus interface support for Broadcom
@@ -52,6 +60,8 @@ config BRCMFMAC_PCIE
 	bool "PCIE bus interface support for FullMAC driver"
 	depends on BRCMFMAC
 	depends on PCI
+	depends on HAS_DMA
+	select BRCMFMAC_PROTO_MSGBUF
 	select FW_LOADER
 	---help---
 	  This option enables the PCIE bus interface support for Broadcom
drivers/net/wireless/brcm80211/brcmfmac/Makefile +6 -4
index c35adf4..90a977f 100644
@@ -30,16 +30,18 @@ brcmfmac-objs += \
 		fwsignal.o \
 		p2p.o \
 		proto.o \
-		bcdc.o \
-		commonring.o \
-		flowring.o \
-		msgbuf.o \
 		dhd_common.o \
 		dhd_linux.o \
 		firmware.o \
 		feature.o \
 		btcoex.o \
 		vendor.o
+brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \
+		bcdc.o
+brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \
+		commonring.o \
+		flowring.o \
+		msgbuf.o
 brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \
 		dhd_sdio.o \
 		bcmsdh.o
drivers/net/wireless/brcm80211/brcmfmac/bcdc.h +5 -2
index 17e8c03..6003179 100644
@@ -16,9 +16,12 @@
 #ifndef BRCMFMAC_BCDC_H
 #define BRCMFMAC_BCDC_H
 
-
+#ifdef CONFIG_BRCMFMAC_PROTO_BCDC
 int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr);
 void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr);
-
+#else
+static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; }
+static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {}
+#endif
 
 #endif /* BRCMFMAC_BCDC_H */
drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h +9 -2
index f901ae5..e6395ee 100644
@@ -32,9 +32,16 @@
 
 
 int brcmf_proto_msgbuf_rx_trigger(struct device *dev);
+void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
+#ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF
 int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr);
 void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr);
-void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid);
-
+#else
+static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
+{
+	return 0;
+}
+static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {}
+#endif
 
 #endif /* BRCMFMAC_MSGBUF_H */
Quoted 10 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#8 lore raw

Hi Arend,

Quoted 9 lines · Arend van Spriel
Quoted 8 lines · Geert Uytterhoeven
Quoted 6 lines · Arend van Spriel
Quoted 5 lines

config BRCMFMAC
tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"

(quoted diff) +1 -1
-       depends on CFG80211
+       depends on CFG80211A&&   HAS_DMA
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Not sure what happened here, but CFG80211 kconfig option did was not renamed
as far as I know. Anyway, I would like to propose a different solution. Will get back to you when I have it ready.

I added Kconfig options for the proto layer which are selected by the host interface selection. So the HAS_DMA dependency is checked for BRCMFMAC_PCIE.

Thanks!

Quoted 1 line

I am wondering whether GENERIC_IO should also be checked.

Probably not. Let's see if anyone complains ;-)

Quoted 1 line

Can you verify the patch below works with your configuration?

Yes, it compiles and links fine now (after applying it manually due to whitespace mess-up).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds