From patchwork Fri May 15 08:33:11 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: 215597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F06DC433DF for ; Fri, 15 May 2020 08:36:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76FA52054F for ; Fri, 15 May 2020 08:36:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="OXn1dTlK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbgEOIeL (ORCPT ); Fri, 15 May 2020 04:34:11 -0400 Received: from mail-dm6nam11on2053.outbound.protection.outlook.com ([40.107.223.53]:55808 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727853AbgEOIeK (ORCPT ); Fri, 15 May 2020 04:34:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSfMXlm+XHr6iBmbFfwq+qyJ3zF5vUoLIHEkT2tSFKNVmbeH/8BYBycHk8PZXRj/zRjpNKZa8TQhf1GMM03zi50OyqIIHUmH8d8YzJ/yQwoU1fJxBW4UPAWMd6E0XQIsJb3NKkc8fzcmNsSrxaUGZd1iYo4YoB1QOcuPO9wvEmpiKIptGPxtC8aWlYJLYE/mr0d6vpC34fQuQZIDhhNXFtAOYyJGJUS/sy7YmIBqOUNntRZhxahNb2K3o/XnDfgccgP4Hp8hF7b72LLZLOmCWnMnw2rvG2HKT+mQ1Sk+m2bXjdGyKrrtuL7WRfisRrYi/2sCwsmvAio0GFVJqumBJQ== 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=yRGzSAKxWDeKco+3lbUM824AhIj80UEP/NKfp2lWdm4=; b=BRCE+N5L79vZl5CRZbcu8orQ73h5gb3Pfk9ZA/yujsIw8IsPK0KxSRbsvQggg9wlXpoQSaA8T90ok4oPPRaDSpGCrNuScSveFs1q0IcFMzDM/RVKRnDM5WPMojormI2EJyzLpYZnzwSmrmjnGDzOVksO/5qo18hzztxrMLpDSCJbL5Jsy9iBSgVkIgW/141nArfFVIaZtTIfaPrs36ASFZqPq+Uw6UbSkHcgR8QISuFoU55UIXYyqQt2y0c0oQcjttkno26oE1nhFTHy/k+JNmwZWKEnLYxVeg35qiFc4JZGmVWTMCIOvSAFZGIWKtVTQrI2/j/D3oQHq0Xd0SjOyg== 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=yRGzSAKxWDeKco+3lbUM824AhIj80UEP/NKfp2lWdm4=; b=OXn1dTlK3W+hOtqQ1x5hzK6LlfHaYt7rzNdq2zmtA/PQB4G3uXGXjWzkMk6WCi0tw91aOKGkFA8bpEPPM31zFdP5TI8zCWDwRksc7wa3jUDz1HsN+LFuw5AWp4Rd9x4fjLI2duQs8Du7k13DEPtdgyY/6HTAcXsDNExALWCOK0c= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1310.namprd11.prod.outlook.com (2603:10b6:300:28::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Fri, 15 May 2020 08:33:58 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da%5]) with mapi id 15.20.3000.022; Fri, 15 May 2020 08:33:58 +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 05/19] staging: wfx: fix coherency of hif_scan() prototype Date: Fri, 15 May 2020 10:33:11 +0200 Message-Id: <20200515083325.378539-6-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> References: <20200515083325.378539-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.home (82.67.86.106) by PR0P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:18::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 08:33:56 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [82.67.86.106] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f408363-c6a3-47d4-0518-08d7f8aab5ed X-MS-TrafficTypeDiagnostic: MWHPR11MB1310: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uhDt7bKbqQFpQLDTfRV0T9/JMYa9czxGdItWY3j34w0SfCMA23zSHs58BtzHwELPtT6iYuVnRJBdGidqiMgHWrf8Yh6+fSCzbFWCWsuuuKAz2MtFzM44OQga0tk14/bThABYk4TzCj8crJpqfsVVhbTd3DjT6YF6VbCQJ+jMVKZOJrE/yqUYQ2wTmqJiUM5g0ahU2nqHXjctL8MMZkw1PvGzXTSgDCj+kmIdH8kr77TandDOtdppk3YsgF6TQ0d/Jmgyth+9mo4x7J4GeSbcxBO+aAOGkrktrFhmoyRovoxFMEiFN/mgo42miiB745bNCAWx30nbyTCPRyZ4ZUDTkBngr3xgcXvVnvZ+0rY4op5Kjbi2dvtGlCWh6/C1rginKRgkleOveTbNq3SyfXBueOpevj/ltHfXSh0n8ie1vzVTupyshldUzx1eVR2+TSPV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(346002)(136003)(376002)(366004)(39850400004)(396003)(8886007)(66556008)(186003)(6512007)(66946007)(6506007)(36756003)(316002)(66476007)(26005)(52116002)(16526019)(6666004)(54906003)(2906002)(2616005)(478600001)(66574014)(107886003)(956004)(8936002)(86362001)(8676002)(6486002)(5660300002)(4326008)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: b3nfpVl0OMkTslIA80A1d61DuTeknEQTnnypTlZswfUFoPhOGZ8v0NheP4c2dMebDDQzgEv00x2rTavrA+ZnAb83JHJrwWHfm8ViP1bVefBfz8s5KL4Qi6jp36isBZrOM51WNVz5E03AjDdlYN8+janh46lU0UJPwWey7tVxxMtbizcA7Ig/akx8+Dd/TYLw8gGeS/CMHnAFDR2zRbCDJTFsYugrhk4RUSUBux9yJboxHb0H636QrDPXESDl1MNs8GBEDl8YHDJaWBQwp3Kxnf3EsTWs9HWc9nL92guOd5vFNnYbs0w6IS2jsQEMIIFRNSUixR7y7N3ftulgljjHbLurMp7TwRp43rr297AH/nkmWdqfjcGIz9j3AezLX/A/EOLA5F2nSdqjQxoYiTFnT2h1vo9XexaOyJlRULi2yAfxL8Kjyji9WFvfwCpnMyzXbgqq+uKEiARh7TjakO96JDkYZ1BSR0TjAbiTFvzz8fM= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f408363-c6a3-47d4-0518-08d7f8aab5ed X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 08:33:57.8142 (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: Wus/aBxObzoCubdhe5csx7JmUqZySVwHAZPfnayKB0g7V7y2LMse4jDiT8P+OWUcPles4FP8taKWnHyyCsgyRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1310 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The function hif_scan() return the timeout for the completion of the scan request. It is the only function from hif_tx.c that return another thing than just an error code. This behavior is not coherent with the rest of file. Worse, if value returned is positive, the caller can't make say if it is a timeout or the value returned by the hardware. Uniformize API with other HIF functions, only return the error code and pass timeout with parameters. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 6 ++++-- drivers/staging/wfx/hif_tx.h | 2 +- drivers/staging/wfx/scan.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 893b67f2f792..6db41587cc7a 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -240,7 +240,7 @@ int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, } int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, - int chan_start_idx, int chan_num) + int chan_start_idx, int chan_num, int *timeout) { int ret, i; struct hif_msg *hif; @@ -289,11 +289,13 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, tmo_chan_fg = 512 * USEC_PER_TU + body->probe_delay; tmo_chan_fg *= body->num_of_probe_requests; tmo = chan_num * max(tmo_chan_bg, tmo_chan_fg) + 512 * USEC_PER_TU; + if (*timeout) + *timeout = usecs_to_jiffies(tmo); wfx_fill_header(hif, wvif->id, HIF_REQ_ID_START_SCAN, buf_len); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); - return ret ? ret : usecs_to_jiffies(tmo); + return ret; } int hif_stop_scan(struct wfx_vif *wvif) diff --git a/drivers/staging/wfx/hif_tx.h b/drivers/staging/wfx/hif_tx.h index e9eca9330178..e1da28aef706 100644 --- a/drivers/staging/wfx/hif_tx.h +++ b/drivers/staging/wfx/hif_tx.h @@ -42,7 +42,7 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *buf, size_t buf_size); int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req80211, - int chan_start, int chan_num); + int chan_start, int chan_num, int *timeout); int hif_stop_scan(struct wfx_vif *wvif); int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct ieee80211_channel *channel, const u8 *ssid, int ssidlen); diff --git a/drivers/staging/wfx/scan.c b/drivers/staging/wfx/scan.c index eff1be9fb28f..bf7ddc75c7db 100644 --- a/drivers/staging/wfx/scan.c +++ b/drivers/staging/wfx/scan.c @@ -56,10 +56,10 @@ static int send_scan_req(struct wfx_vif *wvif, wfx_tx_lock_flush(wvif->wdev); wvif->scan_abort = false; reinit_completion(&wvif->scan_complete); - timeout = hif_scan(wvif, req, start_idx, i - start_idx); - if (timeout < 0) { + ret = hif_scan(wvif, req, start_idx, i - start_idx, &timeout); + if (ret) { wfx_tx_unlock(wvif->wdev); - return timeout; + return -EIO; } ret = wait_for_completion_timeout(&wvif->scan_complete, timeout); if (req->channels[start_idx]->max_power != wvif->vif->bss_conf.txpower)