From patchwork Mon Jun 6 17:02:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 9158853 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 36ECB6086C for ; Mon, 6 Jun 2016 17:03:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 280392833E for ; Mon, 6 Jun 2016 17:03:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C93628350; Mon, 6 Jun 2016 17:03:55 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 763242834A for ; Mon, 6 Jun 2016 17:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbcFFRDK (ORCPT ); Mon, 6 Jun 2016 13:03:10 -0400 Received: from lists.s-osg.org ([54.187.51.154]:41339 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752681AbcFFRDJ (ORCPT ); Mon, 6 Jun 2016 13:03:09 -0400 Received: from minerva.sisa.samsung.com (host-153.58.217.201.copaco.com.py [201.217.58.153]) by lists.s-osg.org (Postfix) with ESMTPSA id 8D44AE274A; Mon, 6 Jun 2016 10:03:49 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Julian Calaby , Shengzhen Li , Enric Balletbo i Serra , Amitkumar Karwar , Javier Martinez Canillas , Kalle Valo , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Nishant Sarmukadam Subject: [PATCH v2 2/3] mwifiex: move .get_tx_power logic to station ioctl file Date: Mon, 6 Jun 2016 13:02:37 -0400 Message-Id: <1465232558-31678-3-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465232558-31678-1-git-send-email-javier@osg.samsung.com> References: <1465232558-31678-1-git-send-email-javier@osg.samsung.com> 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: Shengzhen Li Most cfg80211 operations are just a wrappers to functions defined in the sta_ioctl.c file, so for consistency move the .get_tx_power logic there. Signed-off-by: Shengzhen Li Signed-off-by: Amitkumar Karwar [javier: update the subject line and commit message] Signed-off-by: Javier Martinez Canillas Tested-by: Enric Balletbo i Serra --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 14 +++----------- drivers/net/wireless/marvell/mwifiex/main.h | 2 ++ drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index b17f3d09a2c7..ff3f63ed95e1 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -385,18 +385,10 @@ mwifiex_cfg80211_get_tx_power(struct wiphy *wiphy, int *dbm) { struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); - struct mwifiex_private *priv = mwifiex_get_priv(adapter, - MWIFIEX_BSS_ROLE_ANY); - int ret = mwifiex_send_cmd(priv, HostCmd_CMD_RF_TX_PWR, - HostCmd_ACT_GEN_GET, 0, NULL, true); - - if (ret < 0) - return ret; - - /* tx_power_level is set in HostCmd_CMD_RF_TX_PWR command handler */ - *dbm = priv->tx_power_level; + struct mwifiex_private *priv; - return 0; + priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); + return mwifiex_get_tx_power(priv, dbm); } /* diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 0207af00be42..79c28cfb7780 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1464,6 +1464,8 @@ int mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, int mwifiex_set_tx_power(struct mwifiex_private *priv, struct mwifiex_power_cfg *power_cfg); +int mwifiex_get_tx_power(struct mwifiex_private *priv, int *dbm); + int mwifiex_main_process(struct mwifiex_adapter *); int mwifiex_queue_tx_pkt(struct mwifiex_private *priv, struct sk_buff *skb); diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c index 8e0862657122..70ff9b805b5b 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c @@ -775,6 +775,24 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv, } /* + * IOCTL request handler to get tx power configuration. + * + * This function prepares the correct firmware command and + * issues it. + */ +int mwifiex_get_tx_power(struct mwifiex_private *priv, int *dbm) +{ + int ret; + + ret = mwifiex_send_cmd(priv, HostCmd_CMD_TXPWR_CFG, + HostCmd_ACT_GEN_GET, 0, NULL, true); + + *dbm = priv->tx_power_level; + + return ret; +} + +/* * IOCTL request handler to get power save mode. * * This function prepares the correct firmware command and