From patchwork Fri May 29 12:12:56 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: 215443 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.7 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, URIBL_BLOCKED, 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 239FEC433E0 for ; Fri, 29 May 2020 12:13:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC7CE20C09 for ; Fri, 29 May 2020 12:13:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="O4tQQd6b" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbgE2MNP (ORCPT ); Fri, 29 May 2020 08:13:15 -0400 Received: from mail-mw2nam12on2089.outbound.protection.outlook.com ([40.107.244.89]:41665 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725865AbgE2MNO (ORCPT ); Fri, 29 May 2020 08:13:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ebcbzsnyGsxICLboYQviSixPTwtdufi8aj6kTP2FC2Y5DXS69qpMwZHf9XhmOlJtfDqp9h0iX5T/Smc4sOP0aQjTIP5Zj6lmPJR67aCcUy9AqyVlRIFQisVxg5aJdqDu2e8h82y7crcc7kSKOWx9RuhQoCe9Q1JXOj1M2uyxtU5uFrzdFuFV+47IJyuQFuj2OHTIDnNt23uhFmQeW0pGeLvude0C0zXomTo9FtxkPWGUE3DKkM6gt2n9H0/Ku/aD6KQuL/pKm8GZbj0ePKGzngsVuPBeBb1FTPoF95bFOm1AvOYfxcAjZ+ej3bauAGqAYpefdhX5GmzvgY8Xbrq8qg== 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=k04/jIoT8mbQE9s9jyergHe6EA0xMx64gE6i0tErU6s=; b=KmsVymE5UPWWXZtUvxyzRYFYyvL6HUdfl1iXGQgZN8VaR8GzAB4qE0JJCHCsl6kKs2YB1vOPGVY5HI5JlFx0H37+N0h4IXKx9Ti3TlCQslCN2dYJiC5CYNEnYNQ1UbyOYudIU5+Qhhskl1DQvGNbWGhPWHpt/UWENSAYsYcHkW6l6ZCk0ZSabrzvsLQfZyyqlgLsIa947LSUZyZamAd/0mNVZBzs2Xpt7fBAAXBmnsZA1qOURO9vTcEmnS0fznb5SHV8wumGTE+mKhoaWUWUhL4htup05xHREP2bPeq5r/fka+5MD8AwMoswKwpdk196rW4Jo1U3MzpJaFbHjcXpUw== 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=k04/jIoT8mbQE9s9jyergHe6EA0xMx64gE6i0tErU6s=; b=O4tQQd6b3Ztkzq5BCcE7OfV7Y/hnvP66xLoPUdHtux7Z89aMZiAcROz7vrwpCNg/BxvrklSA9tAHATF4VISnI6nP3Pijt/CWtbIt98rjWq1ukKKikxbirUGgaWOMjFao0boo4jPcwzsBTW57/5Jz1wK5hPek56zfgaulEwMhbbM= 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 SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SN6PR11MB3469.namprd11.prod.outlook.com (2603:10b6:805:bf::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Fri, 29 May 2020 12:13:11 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::c504:2d66:a8f7:2336%7]) with mapi id 15.20.3045.018; Fri, 29 May 2020 12:13:11 +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 v2] staging: wfx: fix coherency of hif_scan() prototype Date: Fri, 29 May 2020 14:12:56 +0200 Message-Id: <20200529121256.1045521-1-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 X-ClientProxiedBy: SA9PR03CA0018.namprd03.prod.outlook.com (2603:10b6:806:20::23) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (2a01:e35:2435:66a0:544b:f17b:7ae8:fb7) by SA9PR03CA0018.namprd03.prod.outlook.com (2603:10b6:806:20::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.19 via Frontend Transport; Fri, 29 May 2020 12:13:09 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [2a01:e35:2435:66a0:544b:f17b:7ae8:fb7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3bf1c157-8dc0-414d-99a5-08d803c9a7c1 X-MS-TrafficTypeDiagnostic: SN6PR11MB3469: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 04180B6720 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /lAXs+xBrLycry2psuAOEDOb3GmIVI/tih2lGmjBdWYLESKzeitLHTXNmvcu8tRfgG6MPFHeL/20EjxpSG7QcpHUEy365MvJeVEi5w2Enjh2kPS1O3gnAt/tjd2BPS78j8b0yUUW0cEoKEBf5+pF14y3t7ulS61HN4xjUfGsIfFyXTXf2bGDgs/YfYi3LyeZeo/o5fr+HHZzaSBPk18e0v/BVSBPbVFzC7+GmJ+jes6b0bHj55aP3/fxlUcZfMZl4Fy1bMxtZ2mu2iO2WogdtT9VkcK4Uc1+ftNO+wrfrWITJRb+tUgkl50aYdVaMYV9MNwO0jAbUbfpBG7TlyiCqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2718.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(39850400004)(136003)(346002)(376002)(396003)(366004)(66556008)(66476007)(66946007)(2616005)(2906002)(107886003)(54906003)(478600001)(6486002)(86362001)(4326008)(8676002)(316002)(186003)(52116002)(7696005)(16526019)(8936002)(1076003)(36756003)(66574014)(5660300002)(83380400001)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PP8/DAXC54xDk1f5F4iO3+NiISMbS25YP5bwZ05ktyFFwMIBsfjU4YwWB3KJkaoELiK/xTrD/Nuxp1ypHTvsbwtJ4om9QR9I099jGO3JO5VzhJ6I0ityOKqglrMap7/9PCjpTO4Z5XBzOwP5qVtXfolaujiFX58WKLOA50igQMQSe30FPWn4RwufoUZhT61rzFf1NTfV3H0/wMpJsJQXkLPoQpoHL7wL0eUDFR4hcsc84PenHenwkOr0ETP1PTmMcB3vUdifV15gbrpxIq+eH9SXmOaFzs3jS3hNNcfLcYKGY/fETmJ7bwEVxd05fTcnHN540kyAXMNX+iN6obbKW9qO6RMsmnLEjzigWp0LMqDNO3EZlWVigBYP1xC3T53Ufjew4eJ88DBIWPteAU2qMP8mvjbUSIiP9mTkA4tOxZ3Q7tL8lunbpDaBlkOljGXAC+pbPwHiaXmXaDFDsAwhDdctly63h1XaQp4dtJl8osyERrM9QsuO60m/VsELOuOo8SFov+7wj/cRCafpAmyCR+wOu+9GJT1kr6/HhSZmbOk= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bf1c157-8dc0-414d-99a5-08d803c9a7c1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2020 12:13:11.5295 (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: j2LQ9kxTUosqnVo901wteBfMQMKf/TaL2wkdCYhySGm7gcQVu/Lc+1pUXclmFYydZK0/0mgxx5MedUmXPOAvwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3469 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 --- I have already send this patch some time ago but it seems it has been forgotten in the merges. It is a good news because I have found a bug inside. So this is the v2. v2: Fix "if (*timeout)" instead of "if (timeout)" in hif_scan() (that led to unexpected scan timeouts) --- 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 893b67f2f792e..5110f9b93762c 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 e9eca93301788..e1da28aef706e 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 57ea9997800b5..e9de19784865c 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)