From patchwork Wed Apr 1 11:03:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 11468959 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F80C1392 for ; Wed, 1 Apr 2020 11:07:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 436452082F for ; Wed, 1 Apr 2020 11:07:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="QWCHOiXW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732745AbgDALHn (ORCPT ); Wed, 1 Apr 2020 07:07:43 -0400 Received: from mail-eopbgr750070.outbound.protection.outlook.com ([40.107.75.70]:46082 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732006AbgDALFC (ORCPT ); Wed, 1 Apr 2020 07:05:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UMjCCSfMFGMYz4Xy9NFmXPU4fVd+zjN9MPvzmM/hCZvBa2GA3x+5VuSuuaw2VUhsfspNOt5TmMzsIdG0JFCX6UUx1y6Szy6Y4K4Vmy+1iX8fUknb1AHCBOxLfEKT8Y2IXawUBO0ZlDGrbSWNxqkAFdTXnWpx+HWi083Ac4qSo5L4h6kuYKN1xfmPCDi8B2EFdBz0o5g8ULJFZmG772v884beGq6UhKuCWz/usLeSd786U0pYPP1Z54OmyPGFM2pRhX4X5lXU67t9Tvu9leoHbRb4I0bnDQGLusk0pPzmvYidZFGCeFA9L8uTzssU04jN705CnOoUnfdtdRyJhLK2Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OI17RmbECAmpL6nfGn5OFPse05O3F+L2zD1msQh2kXI=; b=EAsRE6kxVp9Yff85cgMkacor0k9kP+zhuqj9M0LNcV8at95HI+IN4w5Vo+hmDK80O/m0jvlgJijRNoL7eZcs3fT/EtG4IN9xrStwmCGkopJTIb63EQsT3xT+SrY99oGbrozw/YKqDRdxRUifkb7ni/t4w+K219wCPSmp43BbFa8Jy2lCpZPlAReAsDhggKaSBx5eXzSiTFnoHwG7iUlVzrPHZE7BHfHyyv0SkPb5w9wj3ZbO2Q9/kOfoYb5z8dJ0H0RaqoZTuftijL2Qoc7SPhZRIAfkfwRGfo6S1SLwzqU2dpcE95FYzYqxnzr+ae6bv//do3Uc1pJsm7eDmG/zNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OI17RmbECAmpL6nfGn5OFPse05O3F+L2zD1msQh2kXI=; b=QWCHOiXW3V3yZYw9A6DYR80QwD5dw70eCLp2+znZk7sKblRvvWtMB9BN99ZibqS+A66nxi+iDmxQwvo85r9ZT6MgDn516qbBYOGRunvbwsaXsKY72MCId449/wXJQJhGoTEpxvXr+pnjBCOwK/NzHEecbp/czcbFO+9HQebJqPg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB4285.namprd11.prod.outlook.com (2603:10b6:208:191::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Wed, 1 Apr 2020 11:04:42 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::ade4:5702:1c8b:a2b3%7]) with mapi id 15.20.2856.019; Wed, 1 Apr 2020 11:04:42 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 11/32] staging: wfx: simplify wfx_tx_queue_mask_get() Date: Wed, 1 Apr 2020 13:03:44 +0200 Message-Id: <20200401110405.80282-12-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> References: <20200401110405.80282-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) To MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:1265:30ff:fefd:6e7f) by SN4PR0501CA0156.namprd05.prod.outlook.com (2603:10b6:803:2c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9 via Frontend Transport; Wed, 1 Apr 2020 11:04:40 +0000 X-Mailer: git-send-email 2.25.1 X-Originating-IP: [2a01:e35:2435:66a0:1265:30ff:fefd:6e7f] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 405b75bb-a459-4b5d-4c19-08d7d62c7ab8 X-MS-TrafficTypeDiagnostic: MN2PR11MB4285: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:862; X-Forefront-PRVS: 03607C04F0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR11MB4063.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(136003)(366004)(346002)(376002)(39850400004)(396003)(7696005)(8676002)(1076003)(16526019)(186003)(5660300002)(86362001)(4326008)(66574012)(52116002)(478600001)(66946007)(66476007)(54906003)(36756003)(8936002)(316002)(81156014)(6486002)(2906002)(66556008)(107886003)(81166006)(2616005);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RlIQgCWSZjSOX6jN7lKkQxMCESRlzwO5ntHB0S0gJczTzTn0lXr15WHr31gM8VGwGoxHDIURK2bzHuZiXZ4rZ8kQq/TixDhZQbeDqJdViuQfKGgwjXSAtHMIpoxVh8h9M2MNOg+ax0LJBiiveZlAlwkY9MihN8I7c0bQCpnOpLly91090rgk+hE1aIHMNYhB7UYyxoWs8vAXaUyXF4L/VoXqtMyer3osAbgQBufOWEcning4JaoIqOVBcQSlN0On75a8m28oqWE6W6b/RrI8ZRWNk+FXprmmvUOEJcJttuc1RsMKNi8cJjNl+PvMUgG+eUIP6GgEKkEyT32rC9r6UOLssp125ODULpmfqM34d7vAuU9Mh3Rzla+m5iZ8DzsaAWXikfE2Ga+Rnflu+Oc4MVhlQTFZFvvpfhJaU6KWZv/4bQvRCjtgIVVK82I5pAMk X-MS-Exchange-AntiSpam-MessageData: gRnXkQs4G/5j0sODkYCWlYp0OXMMSV++WlxnVxclVT6tJYb29NFZop6fTQDCsgpzjNTFnf2DdBn13SMRCdJ/QZcXiiVqZ0x7LeaF9nM+7N37O//+Lju8sHq8rUoxXb/6GPriBh2TO0yAgND6PGhxYPo15Mn/GTA4NF4yCHtUA01LhHkO0xT3nAaQmQqsXBKolm3LcQPpxEqbFM8JJFO9aQ== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 405b75bb-a459-4b5d-4c19-08d7d62c7ab8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2020 11:04:42.4286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0euN3I6vF25zGSeSxll9rReu7sL+dXp6bdjbRvHI3NEvfY4INa4SazOlvgZw4FJG0CcI4H/dqUstyomrrgqoyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4285 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller It is far simpler to return a pointer instead of an error. Thus, it is no more necessary to pass a pointer reference as argument. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/queue.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wfx/queue.c b/drivers/staging/wfx/queue.c index bbab6b192b0c..c602496580f7 100644 --- a/drivers/staging/wfx/queue.c +++ b/drivers/staging/wfx/queue.c @@ -382,9 +382,8 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif, u32 tx_allowed_mask) return winner; } -static int wfx_tx_queue_mask_get(struct wfx_vif *wvif, - struct wfx_queue **queue_p, - u32 *tx_allowed_mask_p) +static struct wfx_queue *wfx_tx_queue_mask_get(struct wfx_vif *wvif, + u32 *tx_allowed_mask_p) { int idx; u32 tx_allowed_mask; @@ -398,11 +397,10 @@ static int wfx_tx_queue_mask_get(struct wfx_vif *wvif, tx_allowed_mask |= BIT(WFX_LINK_ID_AFTER_DTIM); idx = wfx_get_prio_queue(wvif, tx_allowed_mask); if (idx < 0) - return -ENOENT; + return NULL; - *queue_p = &wvif->wdev->tx_queue[idx]; *tx_allowed_mask_p = tx_allowed_mask; - return 0; + return &wvif->wdev->tx_queue[idx]; } struct hif_msg *wfx_tx_queues_get_after_dtim(struct wfx_vif *wvif) @@ -434,7 +432,6 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) u32 tx_allowed_mask = 0; u32 vif_tx_allowed_mask = 0; struct wfx_vif *wvif; - int not_found; int i; if (atomic_read(&wdev->tx_lock)) @@ -469,12 +466,12 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev) while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { spin_lock_bh(&wvif->ps_state_lock); - not_found = wfx_tx_queue_mask_get(wvif, &vif_queue, + vif_queue = wfx_tx_queue_mask_get(wvif, &vif_tx_allowed_mask); spin_unlock_bh(&wvif->ps_state_lock); - if (!not_found) { + if (vif_queue) { if (queue && queue != vif_queue) dev_info(wdev->dev, "vifs disagree about queue priority\n"); tx_allowed_mask |= vif_tx_allowed_mask;