2014-08-29 16:24:25

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH] 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'

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/net/wireless/brcm80211/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
index b8e2561ea645..2e0da8925834 100644
--- a/drivers/net/wireless/brcm80211/Kconfig
+++ b/drivers/net/wireless/brcm80211/Kconfig
@@ -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
--
1.9.1



2014-08-29 19:23:50

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

Hi Franky,

On Fri, Aug 29, 2014 at 8:18 PM, Franky Lin <[email protected]> wrote:
>> 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.

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

2014-08-29 18:18:17

by Franky Lin

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

Hi Geert,

On 8/29/2014 9:24 AM, Geert Uytterhoeven wrote:
> 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'
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> ---
> drivers/net/wireless/brcm80211/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
> index b8e2561ea645..2e0da8925834 100644
> --- a/drivers/net/wireless/brcm80211/Kconfig
> +++ b/drivers/net/wireless/brcm80211/Kconfig
> @@ -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

2014-08-29 19:24:20

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

On Fri, Aug 29, 2014 at 9:23 PM, Geert Uytterhoeven
<[email protected]> wrote:
> 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

2014-08-29 19:50:59

by Franky Lin

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

On 8/29/2014 12:23 PM, Geert Uytterhoeven wrote:
> 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

2014-09-01 12:55:01

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

On 09/01/14 10:44, Geert Uytterhoeven wrote:
> Hi Arend,
>
> On Mon, Sep 1, 2014 at 10:21 AM, Arend van Spriel<[email protected]> wrote:
>>> config BRCMFMAC
>>> tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
>>> - 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!
>
>> 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
---
diff --git a/drivers/net/wireless/brcm80211/Kconfig
b/drivers/net/wireless/brcm80211/Kconfig
index b8e2561..fe3dc12 100644
--- a/drivers/net/wireless/brcm80211/Kconfig
+++ b/drivers/net/wireless/brcm80211/Kconfig
@@ -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
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
index c35adf4..90a977f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile
+++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile
@@ -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
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
index 17e8c03..6003179 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h
@@ -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 */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
index f901ae5..e6395ee 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h
@@ -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 */
> 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


2014-09-01 16:51:21

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

Hi Arend,

On Mon, Sep 1, 2014 at 2:54 PM, Arend van Spriel <[email protected]> wrote:
> On 09/01/14 10:44, Geert Uytterhoeven wrote:
>> On Mon, Sep 1, 2014 at 10:21 AM, Arend van Spriel<[email protected]>
>> wrote:
>>>>
>>>> config BRCMFMAC
>>>> tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
>>>> - 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 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!

> I am wondering whether GENERIC_IO should also be checked.

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

> 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

2014-09-01 08:21:56

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

On 08/29/14 18:24, Geert Uytterhoeven wrote:
> 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'
>
> Signed-off-by: Geert Uytterhoeven<[email protected]>
> ---
> drivers/net/wireless/brcm80211/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig
> index b8e2561ea645..2e0da8925834 100644
> --- a/drivers/net/wireless/brcm80211/Kconfig
> +++ b/drivers/net/wireless/brcm80211/Kconfig
> @@ -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

> select BRCMUTIL
> ---help---
> This module adds support for embedded wireless adapters based on


2014-09-01 08:44:27

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: BRCMFMAC should depend on HAS_DMA

Hi Arend,

On Mon, Sep 1, 2014 at 10:21 AM, Arend van Spriel <[email protected]> wrote:
>> config BRCMFMAC
>> tristate "Broadcom IEEE802.11n embedded FullMAC WLAN driver"
>> - 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!

> 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