From patchwork Thu Mar 10 08:44:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 8554501 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01151C0553 for ; Thu, 10 Mar 2016 08:44:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1D8020304 for ; Thu, 10 Mar 2016 08:44:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1AB7202FF for ; Thu, 10 Mar 2016 08:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935176AbcCJIog (ORCPT ); Thu, 10 Mar 2016 03:44:36 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36283 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935187AbcCJIod (ORCPT ); Thu, 10 Mar 2016 03:44:33 -0500 Received: by mail-wm0-f47.google.com with SMTP id n186so19330629wmn.1 for ; Thu, 10 Mar 2016 00:44:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GGMNb2DNodm4tJWt/Qq5V07pSRD3Z09yxczzze+TB0g=; b=IwDAqEvCM8QuLShLOoIZrVYMWr57FxfDq8Qlql/UP84KLJ34Qg4gP5mpWpI1p0CrU+ d8q6drZIgemnzmbeTCYuM5lBn8xpHLy7ndTitXJXh2m/bX5AA8h5NzFmN3Dw7IJsuAI4 N/EyUir/MIX0PKQ0k8bcceCssy3/D2IfV3/ELAJOUaHeym3nPS3P8vxvoj7sV3Hi0tkO YrSXRuCM2c7Qb5d6KH/ldJtq/m+kC76XpZDN/IRcKEtS4fwqONXc0cZxTUapK/vCuF+v Vw7aKhKFj1QleEGVeP6+0XENuBwPiBicpabXKXriVVh+ZGglhtAHpfpEBQKnjmz4CAi7 gW/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GGMNb2DNodm4tJWt/Qq5V07pSRD3Z09yxczzze+TB0g=; b=NEXSwFqf4J3SFQJ279/5ihAD3lKojsZtVj4/AwH5Vse2S+un0x7AQE4gxn3s3y7b1u 271CwU4eRNhpgVvgdfgZkBBjqemlW5uFKoHrz06nrBZY4HvCa9WyrRcYV2vJjgVMFPZD Ad4oHttsSxiJkcHRjlV8FBbxrVwXaa2mM/B/2FsMW5WmUWuwHLaTpv6zsdlyRGSXgwNq SBTJIs3kgGRRB/SxGWNP5oq/VjkX22vnBdzbsmXnHnIqFAERw0Z+Fk65TojRq3vQjuCT G2Y8R7lVEchZTD55Kjb7X9DWfut4dsgSJT33dFTyW+ACpdyj8tYIAReRae5Fg3V7CuhV e6qw== X-Gm-Message-State: AD7BkJLCKn+1FC52SPgFcO5TjF+F6Adkpn2mnqQZ+ulONprJwgz7S48mBjziavq7Nl4caA== X-Received: by 10.194.185.144 with SMTP id fc16mr2302897wjc.123.1457599471937; Thu, 10 Mar 2016 00:44:31 -0800 (PST) Received: from localhost (ip-89-176-167-254.net.upcbroadband.cz. [89.176.167.254]) by smtp.gmail.com with ESMTPSA id ei9sm2362157wjd.40.2016.03.10.00.44.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Mar 2016 00:44:31 -0800 (PST) From: Andreas Fenkart To: linux-wireless@vger.kernel.org Cc: Amitkumar Karwar , Nishant Sarmukadam , Julian Calaby , Kalle Valo , Andreas Fenkart Subject: [PATCH v2 7/7] mwifiex: make mwifiex_insert_cmd_to_free_q local static Date: Thu, 10 Mar 2016 09:44:11 +0100 Message-Id: <1457599451-13910-8-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457599451-13910-1-git-send-email-afenkart@gmail.com> References: <1457599451-13910-1-git-send-email-afenkart@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP after factoring out mwifiex_cancel_pending_scan_cmd the function is not called outside of cmdevt file moved function to head of file to avoid forward declaration, also moved mwifiex_recycle_cmd_node since they are very similar Signed-off-by: Andreas Fenkart --- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 82 +++++++++++++-------------- drivers/net/wireless/marvell/mwifiex/main.h | 2 - 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 61426b3..3d7de4a 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -105,6 +105,47 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter, } /* + * This function returns a command to the command free queue. + * + * The function also calls the completion callback if required, before + * cleaning the command node and re-inserting it into the free queue. + */ +static void +mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, + struct cmd_ctrl_node *cmd_node) +{ + unsigned long flags; + + if (!cmd_node) + return; + + if (cmd_node->wait_q_enabled) + mwifiex_complete_cmd(adapter, cmd_node); + /* Clean the node */ + mwifiex_clean_cmd_node(adapter, cmd_node); + + /* Insert node into cmd_free_q */ + spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); + list_add_tail(&cmd_node->list, &adapter->cmd_free_q); + spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); +} + +/* This function reuses a command node. */ +void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, + struct cmd_ctrl_node *cmd_node) +{ + struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data; + + mwifiex_insert_cmd_to_free_q(adapter, cmd_node); + + atomic_dec(&adapter->cmd_pending); + mwifiex_dbg(adapter, CMD, + "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n", + le16_to_cpu(host_cmd->command), + atomic_read(&adapter->cmd_pending)); +} + +/* * This function sends a host command to the firmware. * * The function copies the host command into the driver command @@ -614,47 +655,6 @@ int mwifiex_send_cmd(struct mwifiex_private *priv, u16 cmd_no, } /* - * This function returns a command to the command free queue. - * - * The function also calls the completion callback if required, before - * cleaning the command node and re-inserting it into the free queue. - */ -void -mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - unsigned long flags; - - if (!cmd_node) - return; - - if (cmd_node->wait_q_enabled) - mwifiex_complete_cmd(adapter, cmd_node); - /* Clean the node */ - mwifiex_clean_cmd_node(adapter, cmd_node); - - /* Insert node into cmd_free_q */ - spin_lock_irqsave(&adapter->cmd_free_q_lock, flags); - list_add_tail(&cmd_node->list, &adapter->cmd_free_q); - spin_unlock_irqrestore(&adapter->cmd_free_q_lock, flags); -} - -/* This function reuses a command node. */ -void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node) -{ - struct host_cmd_ds_command *host_cmd = (void *)cmd_node->cmd_skb->data; - - mwifiex_insert_cmd_to_free_q(adapter, cmd_node); - - atomic_dec(&adapter->cmd_pending); - mwifiex_dbg(adapter, CMD, - "cmd: FREE_CMD: cmd=%#x, cmd_pending=%d\n", - le16_to_cpu(host_cmd->command), - atomic_read(&adapter->cmd_pending)); -} - -/* * This function queues a command to the command pending queue. * * This in effect adds the command to the command list to be executed. diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index f71f894..840e5d4 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1045,8 +1045,6 @@ void mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter); void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); -void mwifiex_insert_cmd_to_free_q(struct mwifiex_adapter *adapter, - struct cmd_ctrl_node *cmd_node); void mwifiex_recycle_cmd_node(struct mwifiex_adapter *adapter, struct cmd_ctrl_node *cmd_node);