All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer
@ 2017-03-21 13:44 Rafał Miłecki
  2017-03-22 19:43 ` Arend Van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2017-03-21 13:44 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman,
	Pieter-Paul Giesberts, Franky Lin, linux-wireless,
	brcm80211-dev-list.pdl, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

fwsignal is only used by bcdc. Create new protocol interface functions
for core code to perform proto specific (de)initialization. This makes
core agnostic to the protocol which will allow further optimizations.
We will be able to avoid compiling unused protocols or modularize them.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c  | 12 ++++++++++++
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c  |  7 +++----
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h | 16 ++++++++++++++++
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
index 92eafccf087b..bb27a5f3cbdf 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
@@ -106,6 +106,16 @@ struct brcmf_bcdc {
 };
 
 
+static int brcmf_proto_bcdc_init(struct brcmf_pub *pub)
+{
+	return brcmf_fws_init(pub);
+}
+
+static void brcmf_proto_bcdc_deinit(struct brcmf_pub *pub)
+{
+	return brcmf_fws_deinit(pub);
+}
+
 static int
 brcmf_proto_bcdc_msg(struct brcmf_pub *drvr, int ifidx, uint cmd, void *buf,
 		     uint len, bool set)
@@ -431,6 +441,8 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)
 		goto fail;
 	}
 
+	drvr->proto->init = brcmf_proto_bcdc_init;
+	drvr->proto->deinit = brcmf_proto_bcdc_deinit;
 	drvr->proto->hdrpull = brcmf_proto_bcdc_hdrpull;
 	drvr->proto->query_dcmd = brcmf_proto_bcdc_query_dcmd;
 	drvr->proto->set_dcmd = brcmf_proto_bcdc_set_dcmd;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 60c6c7839cc2..d2be20627b5c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -32,7 +32,6 @@
 #include "p2p.h"
 #include "cfg80211.h"
 #include "fwil.h"
-#include "fwsignal.h"
 #include "feature.h"
 #include "proto.h"
 #include "pcie.h"
@@ -986,7 +985,7 @@ int brcmf_bus_started(struct device *dev)
 	}
 	brcmf_feat_attach(drvr);
 
-	ret = brcmf_fws_init(drvr);
+	ret = brcmf_proto_init(drvr);
 	if (ret < 0)
 		goto fail;
 
@@ -1036,7 +1035,7 @@ int brcmf_bus_started(struct device *dev)
 	}
 	if (drvr->fws) {
 		brcmf_proto_del_if(ifp->drvr, ifp);
-		brcmf_fws_deinit(drvr);
+		brcmf_proto_deinit(drvr);
 	}
 	brcmf_net_detach(ifp->ndev, false);
 	if (p2p_ifp)
@@ -1103,7 +1102,7 @@ void brcmf_detach(struct device *dev)
 
 	brcmf_cfg80211_detach(drvr->config);
 
-	brcmf_fws_deinit(drvr);
+	brcmf_proto_deinit(drvr);
 
 	brcmf_bus_stop(drvr->bus_if);
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
index 3048ed529f95..2a5d691be562 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.h
@@ -27,6 +27,8 @@ struct brcmf_skb_reorder_data {
 };
 
 struct brcmf_proto {
+	int (*init)(struct brcmf_pub *pub);
+	void (*deinit)(struct brcmf_pub *pub);
 	int (*hdrpull)(struct brcmf_pub *drvr, bool do_fws,
 		       struct sk_buff *skb, struct brcmf_if **ifp);
 	int (*query_dcmd)(struct brcmf_pub *drvr, int ifidx, uint cmd,
@@ -54,6 +56,20 @@ struct brcmf_proto {
 int brcmf_proto_attach(struct brcmf_pub *drvr);
 void brcmf_proto_detach(struct brcmf_pub *drvr);
 
+static inline int brcmf_proto_init(struct brcmf_pub *pub)
+{
+	if (!pub->proto->init)
+		return 0;
+	return pub->proto->init(pub);
+}
+
+static inline void brcmf_proto_deinit(struct brcmf_pub *pub)
+{
+	if (!pub->proto->deinit)
+		return;
+	pub->proto->deinit(pub);
+}
+
 static inline int brcmf_proto_hdrpull(struct brcmf_pub *drvr, bool do_fws,
 				      struct sk_buff *skb,
 				      struct brcmf_if **ifp)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer
  2017-03-21 13:44 [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer Rafał Miłecki
@ 2017-03-22 19:43 ` Arend Van Spriel
  2017-03-29 11:27   ` Rafał Miłecki
  0 siblings, 1 reply; 4+ messages in thread
From: Arend Van Spriel @ 2017-03-22 19:43 UTC (permalink / raw)
  To: Rafał Miłecki, Kalle Valo
  Cc: Franky Lin, Hante Meuleman, Pieter-Paul Giesberts, Franky Lin,
	linux-wireless, brcm80211-dev-list.pdl, Rafał Miłecki

On 21-3-2017 14:44, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> fwsignal is only used by bcdc. Create new protocol interface functions
> for core code to perform proto specific (de)initialization. This makes
> core agnostic to the protocol which will allow further optimizations.
> We will be able to avoid compiling unused protocols or modularize them.

Thanks, Rafał

Franky had tackled this with two patches, which are queued to be submitted.

Regards,
Arend

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer
  2017-03-22 19:43 ` Arend Van Spriel
@ 2017-03-29 11:27   ` Rafał Miłecki
  2017-03-30  9:33     ` Arend Van Spriel
  0 siblings, 1 reply; 4+ messages in thread
From: Rafał Miłecki @ 2017-03-29 11:27 UTC (permalink / raw)
  To: Arend Van Spriel, Kalle Valo
  Cc: Franky Lin, Hante Meuleman, Pieter-Paul Giesberts, Franky Lin,
	linux-wireless, brcm80211-dev-list.pdl, Rafał Miłecki

On 03/22/2017 08:43 PM, Arend Van Spriel wrote:
> On 21-3-2017 14:44, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> fwsignal is only used by bcdc. Create new protocol interface functions
>> for core code to perform proto specific (de)initialization. This makes
>> core agnostic to the protocol which will allow further optimizations.
>> We will be able to avoid compiling unused protocols or modularize them.
>
> Thanks, Rafał
>
> Franky had tackled this with two patches, which are queued to be submitted.

Given that your implementation (you now published) doesn't do any magic, is
there any real problem with my patch except of /not invented here/?

[0] https://en.wikipedia.org/wiki/Not_invented_here

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer
  2017-03-29 11:27   ` Rafał Miłecki
@ 2017-03-30  9:33     ` Arend Van Spriel
  0 siblings, 0 replies; 4+ messages in thread
From: Arend Van Spriel @ 2017-03-30  9:33 UTC (permalink / raw)
  To: Rafał Miłecki, Kalle Valo
  Cc: Franky Lin, Hante Meuleman, Pieter-Paul Giesberts, Franky Lin,
	linux-wireless, brcm80211-dev-list.pdl, Rafał Miłecki



On 29-3-2017 13:27, Rafał Miłecki wrote:
> On 03/22/2017 08:43 PM, Arend Van Spriel wrote:
>> On 21-3-2017 14:44, Rafał Miłecki wrote:
>>> From: Rafał Miłecki <rafal@milecki.pl>
>>>
>>> fwsignal is only used by bcdc. Create new protocol interface functions
>>> for core code to perform proto specific (de)initialization. This makes
>>> core agnostic to the protocol which will allow further optimizations.
>>> We will be able to avoid compiling unused protocols or modularize them.
>>
>> Thanks, Rafał
>>
>> Franky had tackled this with two patches, which are queued to be
>> submitted.
> 
> Given that your implementation (you now published) doesn't do any magic, is
> there any real problem with my patch except of /not invented here/?

You could see it like that, but no. These two patches were already
reviewed and I requested more testing as explained in another email
response. Your patch needed a bit of rework and you can safely assume
that my remarks on your patch would make it even more like the one we
already had queued up. So it seemed unreasonable to have Kalle apply
yours and then the two from Franky. It would only be for the sake of
kernel git stats, which is not something I want to factor in.

Regards,
Arend

> [0] https://en.wikipedia.org/wiki/Not_invented_here

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-30  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 13:44 [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer Rafał Miłecki
2017-03-22 19:43 ` Arend Van Spriel
2017-03-29 11:27   ` Rafał Miłecki
2017-03-30  9:33     ` Arend Van Spriel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.