From patchwork Tue Mar 21 13:44:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9636629 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1595E60216 for ; Tue, 21 Mar 2017 13:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F30C27D29 for ; Tue, 21 Mar 2017 13:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03BEF27D8D; Tue, 21 Mar 2017 13:44:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E63FD27D29 for ; Tue, 21 Mar 2017 13:44:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932563AbdCUNoc (ORCPT ); Tue, 21 Mar 2017 09:44:32 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:35820 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756343AbdCUNoa (ORCPT ); Tue, 21 Mar 2017 09:44:30 -0400 Received: by mail-lf0-f67.google.com with SMTP id v2so13077305lfi.2 for ; Tue, 21 Mar 2017 06:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ho1N0QinPqNogX4pu+92tejMppj3tc6yBGsFI3Zk+Vk=; b=WoRkdo+Y0SJyw12wmg+T5D3bQP34elJGdQTUj/kgJDc5a7CHj/V7EmZd0h9pyZoa/A /4m0EDIYUCXaypN6xN+U6DA5139iWTvqLbLGpyUua6M6OHaEOPQr/6bYoc8s8E2SlepA 6CojVXJeWHVl07KK58J7c4YFL1sRt6smQKpW1z3qhbQ0dvXl00QFdb5tVLkI0/mfBlXV vFJsVRvduInLI2Xb0dOZmwLX06uP/L7J2sXZ4DsV9/WfhiynHGCujzJTLBqI1wzdm7nO +1F/1MGFm0c3yfkBSZSOmkR1NRAdJPm0O11lqo1s3uLMybDrp/xwvvHeszwe3uTXBxJ5 6s+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ho1N0QinPqNogX4pu+92tejMppj3tc6yBGsFI3Zk+Vk=; b=pDKvlK9E+b19BxVbJoVSPm15498y5XwP+QXDvzf1aG4Ucl033Utrf472xiRorOQh4W YWQkffxqXUf3Ueebc35CHRIxD+wux7qL6st8p5vGzq0ChiSfajq8q8BgkrQRjx3dXXtX lRTFPfyoSRrahf6toXSGGh/GZ88tatFI3GSydTGSxErzCwwGhsQEUhPnOYwGd3rdjSmW XqllCRM39s4hUvokCJQTFVw15d6UUgyF74onKHxWDHGoMugJtrnkEPb4MX0HU68BAWPt 2UsjIuCZa3lemAwsllPFU+k6qIsStmnLKAKP6VjPznN6qOy1MC0nbBopfQrz5ZqDBNR2 XY0Q== X-Gm-Message-State: AFeK/H0nvdZaaEVMY47mvRPKZ6G+LH2g5+8evY987lq65SfRX1WtOtEt1e+0E9fTbtyEKw== X-Received: by 10.25.151.196 with SMTP id z187mr9328381lfd.126.1490103868031; Tue, 21 Mar 2017 06:44:28 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id o80sm3578502lff.25.2017.03.21.06.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Mar 2017 06:44:27 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Pieter-Paul Giesberts , Franky Lin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] brcmfmac: wrap brcmf_fws_(de)init into bcdc layer Date: Tue, 21 Mar 2017 14:44:22 +0100 Message-Id: <20170321134422.888-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafał Miłecki 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 --- 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)