From patchwork Fri Nov 9 18:20:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adham Abozaeid X-Patchwork-Id: 10676411 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-2.web.codeaurora.org (Postfix) with ESMTP id DAAE215A6 for ; Fri, 9 Nov 2018 18:20:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB9862F045 for ; Fri, 9 Nov 2018 18:20:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFFB72F051; Fri, 9 Nov 2018 18:20:22 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 19F682F045 for ; Fri, 9 Nov 2018 18:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728606AbeKJECF (ORCPT ); Fri, 9 Nov 2018 23:02:05 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:42620 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbeKJECE (ORCPT ); Fri, 9 Nov 2018 23:02:04 -0500 X-IronPort-AV: E=Sophos;i="5.54,484,1534834800"; d="scan'208";a="20925195" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Nov 2018 11:20:20 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 9 Nov 2018 11:20:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+3gTE5JQhB7vSm5YzqT3HNKg3Twpa62QwIHOEqiGGOc=; b=xHzSHmfAPEBYLMuXS2laZ2elL+k+lCq7V5SR3kpe86bpgJnNqnTchv0VzkLhIHMi+p03CIFKQyWeE34To1jJGpumqQjPTsMuFlP4M1tteBiEm1/7DeAR4r6jVPvVJR9hSu+VkchdYxduEh2tiaN4MIIEH/kdqNyEHpsgGz+XWrI= Received: from SN6PR11MB3407.namprd11.prod.outlook.com (52.135.111.96) by SN6PR11MB3392.namprd11.prod.outlook.com (52.135.111.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 9 Nov 2018 18:20:15 +0000 Received: from SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281]) by SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281%2]) with mapi id 15.20.1294.034; Fri, 9 Nov 2018 18:20:15 +0000 From: To: CC: , , , , Subject: [PATCH v5 1/3] staging: wilc1000: validate cfg parameters before scheduling the work Thread-Topic: [PATCH v5 1/3] staging: wilc1000: validate cfg parameters before scheduling the work Thread-Index: AQHUeFjcb7oe3q8UC0Sr223yHpSU2A== Date: Fri, 9 Nov 2018 18:20:15 +0000 Message-ID: <20181109182008.4328-2-adham.abozaeid@microchip.com> References: <20181109182008.4328-1-adham.abozaeid@microchip.com> In-Reply-To: <20181109182008.4328-1-adham.abozaeid@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [198.175.253.81] x-clientproxiedby: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To SN6PR11MB3407.namprd11.prod.outlook.com (2603:10b6:805:bd::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Adham.Abozaeid@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR11MB3392;6:FTnRtE7cJm3EKPY5v+71ZKYNk4A96RmE7XXZReWymIBLbVPDrtkh8/oZOFWQhSiQ2B8B2OZ4CqjyhtNuyCH4t6x6riNxSEqYPqIAmImKm1yM3sGTI8+pDl5eCNE2pZrdBnc4qS3EkORp34p9tUOmO+/ZzBPNzSprZhI3taZsi3r90vb/3ylVUuER3YGsGiQMjEjLAp1SB+smS9b2JhK+MvHmplVnEb6TNOE8VDcoGwTvXZbsTnukCzPQsIXuZtCvlXWDT/PouU2exV9H99jJtdfodPCC++knSBNTM/NZ2lRDQzXQXM77tPg2PtjqM8NGqfTN4dHl0sr42AwlZsdg7hv0o1X8yBOE5IbMpRk1V/IWhY7yFpsv+PjxWNzvsSvh9xkCf/wenrXF1s+qdMDCbEC6Lr9np+ALU+goB96MIIBzecs9iFtcaveee+jh28NBNzLr80o2Ph2j7ZK9WBnWlA==;5:gX+h3aoWuVbK4mVDcvJ5ENIBvVPb7YR/Y42lvYBH95H+/Eylv1o9dcHxfteK6geBHgzes7WkOPlC/AFuCwyOmRLaCQe2WU2riPp36UuWEKlu31I9SouNHvNwnF9o3owkx83X5GwlTp3Wl+mxmBKYOpEBwb3gXe7AEjM3plCISsw=;7:yy+DFBVrPpauUKhR57/UBbYHDLHrKPajh7N12O/23vAcw8NCYAKgMGkJI9QVlBzZ5S+pBq25EOff2TxAb4owORy/OcRIPodAyMiko1SANeso8jOFfil3FO+Bch2YLfhBHSan5MULy0uF4L1mJ5qBKw== x-ms-office365-filtering-correlation-id: d4753bc3-cc64-413b-02f4-08d6466fff36 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:SN6PR11MB3392; x-ms-traffictypediagnostic: SN6PR11MB3392: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR11MB3392;BCL:0;PCL:0;RULEID:;SRVR:SN6PR11MB3392; x-forefront-prvs: 08512C5403 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(396003)(346002)(376002)(39860400002)(199004)(189003)(14454004)(5640700003)(6436002)(386003)(52116002)(102836004)(76176011)(14444005)(53936002)(256004)(2900100001)(81166006)(2351001)(6512007)(81156014)(6506007)(4326008)(72206003)(36756003)(25786009)(6486002)(8936002)(8676002)(71200400001)(478600001)(68736007)(2906002)(1076002)(86362001)(5660300001)(6116002)(6916009)(3846002)(71190400001)(66066001)(476003)(2616005)(105586002)(11346002)(446003)(26005)(106356001)(99286004)(486006)(15650500001)(305945005)(54906003)(2501003)(316002)(97736004)(186003)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR11MB3392;H:SN6PR11MB3407.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: +YWHwKzm0vM7Zrfg3nGfmH69GrGI6R0QHru8taDI3qBkKZKq2U5Og5UkGcdvZjPWB0CTw0FHe+9tvjc8kLqYpQM5gumxMQeWbOdx07hFW7OCCbM8j49zKHkJVgZIWbqaRTRqSq/rdJuhqsWA1HhAt3JmNDwOf02EWYOhokIYjHNL9fcs6u7qIJCnoX0D+hAg174Z1K53BtvMojyvAwWYert6MeG3VrQC2FDPKLraRRjiwIxxyDERoobxP/UCSSg4G9lqNIqWHcU/IJ3zhJDrGYAKjPHJVBsJ14m/ZJMSQykOKL2ygirpBZlM+cHTbQn4/zMYR+YpmqHMFBLji3lPZuLgfZ5ta+1hBnpsqUZfQgI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d4753bc3-cc64-413b-02f4-08d6466fff36 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2018 18:20:15.8266 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3392 X-OriginatorOrg: microchip.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: Adham Abozaeid Validate cfg parameters after being called by cfg80211 in set_wiphy_params before scheduling the work executed in handle_cfg_param Signed-off-by: Adham Abozaeid --- drivers/staging/wilc1000/host_interface.c | 61 ++++++------------- .../staging/wilc1000/wilc_wfi_cfgoperations.c | 32 ++++++++-- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b89116c57064..c1215c194907 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -377,61 +377,41 @@ static void handle_cfg_param(struct work_struct *work) if (param->flag & RETRY_SHORT) { u16 retry_limit = param->short_retry_limit; - if (retry_limit > 0 && retry_limit < 256) { - wid_list[i].id = WID_SHORT_RETRY_LIMIT; - wid_list[i].val = (s8 *)¶m->short_retry_limit; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.short_retry_limit = retry_limit; - } else { - netdev_err(vif->ndev, "Range(1~256) over\n"); - goto unlock; - } + wid_list[i].id = WID_SHORT_RETRY_LIMIT; + wid_list[i].val = (s8 *)¶m->short_retry_limit; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + hif_drv->cfg_values.short_retry_limit = retry_limit; i++; } if (param->flag & RETRY_LONG) { u16 limit = param->long_retry_limit; - if (limit > 0 && limit < 256) { - wid_list[i].id = WID_LONG_RETRY_LIMIT; - wid_list[i].val = (s8 *)¶m->long_retry_limit; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.long_retry_limit = limit; - } else { - netdev_err(vif->ndev, "Range(1~256) over\n"); - goto unlock; - } + wid_list[i].id = WID_LONG_RETRY_LIMIT; + wid_list[i].val = (s8 *)¶m->long_retry_limit; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + hif_drv->cfg_values.long_retry_limit = limit; i++; } if (param->flag & FRAG_THRESHOLD) { u16 frag_th = param->frag_threshold; - if (frag_th > 255 && frag_th < 7937) { - wid_list[i].id = WID_FRAG_THRESHOLD; - wid_list[i].val = (s8 *)¶m->frag_threshold; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.frag_threshold = frag_th; - } else { - netdev_err(vif->ndev, "Threshold Range fail\n"); - goto unlock; - } + wid_list[i].id = WID_FRAG_THRESHOLD; + wid_list[i].val = (s8 *)¶m->frag_threshold; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + hif_drv->cfg_values.frag_threshold = frag_th; i++; } if (param->flag & RTS_THRESHOLD) { u16 rts_th = param->rts_threshold; - if (rts_th > 255) { - wid_list[i].id = WID_RTS_THRESHOLD; - wid_list[i].val = (s8 *)¶m->rts_threshold; - wid_list[i].type = WID_SHORT; - wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.rts_threshold = rts_th; - } else { - netdev_err(vif->ndev, "Threshold Range fail\n"); - goto unlock; - } + wid_list[i].id = WID_RTS_THRESHOLD; + wid_list[i].val = (s8 *)¶m->rts_threshold; + wid_list[i].type = WID_SHORT; + wid_list[i].size = sizeof(u16); + hif_drv->cfg_values.rts_threshold = rts_th; i++; } @@ -441,7 +421,6 @@ static void handle_cfg_param(struct work_struct *work) if (ret) netdev_err(vif->ndev, "Error in setting CFG params\n"); -unlock: mutex_unlock(&hif_drv->cfg_values_lock); kfree(msg); } diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 4fbbbbd5a64b..a6f4fad43bf7 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1149,21 +1149,45 @@ static int set_wiphy_params(struct wiphy *wiphy, u32 changed) cfg_param_val.flag = 0; if (changed & WIPHY_PARAM_RETRY_SHORT) { + netdev_dbg(vif->ndev, + "Setting WIPHY_PARAM_RETRY_SHORT %d\n", + wiphy->retry_short); cfg_param_val.flag |= RETRY_SHORT; cfg_param_val.short_retry_limit = wiphy->retry_short; } if (changed & WIPHY_PARAM_RETRY_LONG) { + netdev_dbg(vif->ndev, + "Setting WIPHY_PARAM_RETRY_LONG %d\n", + wiphy->retry_long); cfg_param_val.flag |= RETRY_LONG; cfg_param_val.long_retry_limit = wiphy->retry_long; } if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - cfg_param_val.flag |= FRAG_THRESHOLD; - cfg_param_val.frag_threshold = wiphy->frag_threshold; + if (wiphy->frag_threshold > 255 && + wiphy->frag_threshold < 7937) { + netdev_dbg(vif->ndev, + "Setting WIPHY_PARAM_FRAG_THRESHOLD %d\n", + wiphy->frag_threshold); + cfg_param_val.flag |= FRAG_THRESHOLD; + cfg_param_val.frag_threshold = wiphy->frag_threshold; + } else { + netdev_err(vif->ndev, + "Fragmentation threshold out of range\n"); + return -EINVAL; + } } if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - cfg_param_val.flag |= RTS_THRESHOLD; - cfg_param_val.rts_threshold = wiphy->rts_threshold; + if (wiphy->rts_threshold > 255) { + netdev_dbg(vif->ndev, + "Setting WIPHY_PARAM_RTS_THRESHOLD %d\n", + wiphy->rts_threshold); + cfg_param_val.flag |= RTS_THRESHOLD; + cfg_param_val.rts_threshold = wiphy->rts_threshold; + } else { + netdev_err(vif->ndev, "RTS threshold out of range\n"); + return -EINVAL; + } } ret = wilc_hif_set_cfg(vif, &cfg_param_val); From patchwork Fri Nov 9 18:20:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adham Abozaeid X-Patchwork-Id: 10676409 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-2.web.codeaurora.org (Postfix) with ESMTP id 7B46815A6 for ; Fri, 9 Nov 2018 18:20:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5BF2F045 for ; Fri, 9 Nov 2018 18:20:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61F442F051; Fri, 9 Nov 2018 18:20:21 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 E4FBA2F045 for ; Fri, 9 Nov 2018 18:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728437AbeKJECD (ORCPT ); Fri, 9 Nov 2018 23:02:03 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:59961 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbeKJECC (ORCPT ); Fri, 9 Nov 2018 23:02:02 -0500 X-IronPort-AV: E=Sophos;i="5.54,484,1534834800"; d="scan'208";a="22615794" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Nov 2018 11:20:18 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 9 Nov 2018 11:20:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TwYCMsnyjyNtuCKX3djKXmiWxH12KND11OArhXtXNOk=; b=bkkM00kIajBH2mUWP5st40u+KwXB8nm1QWCjRXSXtJIvupDMyNMyt7e8TkA9dja0YGLHLbGe7szi+hRNpS86qYUM2P3V/7kGvg4T4b3RDA/YY36z0DpxVJ+OTFccTGnCDbCh36oMXZG4EVRDp0YhlzC4Eq94Ea4M0npS7yoTu9U= Received: from SN6PR11MB3407.namprd11.prod.outlook.com (52.135.111.96) by SN6PR11MB3392.namprd11.prod.outlook.com (52.135.111.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 9 Nov 2018 18:20:16 +0000 Received: from SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281]) by SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281%2]) with mapi id 15.20.1294.034; Fri, 9 Nov 2018 18:20:16 +0000 From: To: CC: , , , , Subject: [PATCH v5 2/3] staging: wilc1000: Don't keep a copy of wiphy parameters in the driver Thread-Topic: [PATCH v5 2/3] staging: wilc1000: Don't keep a copy of wiphy parameters in the driver Thread-Index: AQHUeFjdAXf0QM8tu02vMmwkEhGbJA== Date: Fri, 9 Nov 2018 18:20:16 +0000 Message-ID: <20181109182008.4328-3-adham.abozaeid@microchip.com> References: <20181109182008.4328-1-adham.abozaeid@microchip.com> In-Reply-To: <20181109182008.4328-1-adham.abozaeid@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [198.175.253.81] x-clientproxiedby: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To SN6PR11MB3407.namprd11.prod.outlook.com (2603:10b6:805:bd::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Adham.Abozaeid@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR11MB3392;6:SjLZeEovTmAfNyXxdMTUMIQk2SslzdMJgkRajZ743Kg9ATnAIvOkecSAPXYVGifm/hYD7H+VYbrfsmNw8QjzMFTkauQtE89VJ+XItAHEipEiTeUcm5MmjqqBMcgykXNeprPJYNVblLHpgE+QE+B3NQuw1+q94KPTTVZ3CQlPgREjXcD0EaaWmdabl7+ogYBaA61p2SkynUmhQyArA2EE5Ayxa7mSeTXnIrB9hp5yZwPADmkhZwpUVJErb48P0+yofJ/axOOCpVljCyVTw4v2zsvIWKgVLfzoPxeOcqqHsc8XnOxwja0uydQN3cacGm1DeUSpMfQwEZEfVAidRN8GsrPhRNZRdMpYgbAwse2NtvypuxknGhfd86yT+nwCe37nVn76MydugO30XlBdzg1urgD6yiri9nC+012amz0k4zdYyxJsc65JCURHadzaWEs7wEb74BxRKs7hm+AmgMUtrg==;5:kgqCsa3M8jhGQfc3Ueq/f0OZQwQWDpr8SvbZ3c0QRU6kGzzx8NvJXnzN2q4iHrmGjWjCuR6raubiq4IBwAYMBkj8PGznYREC2Nw2NQylyuYnfIHH49o34ot/PZp1Y6e0VrSMr9oOAuF1mPIvXavBFkIg1uYV/OPhhC5Ixgk7d5c=;7:UjB4qYNELEZ+1EF1keXgkThKfuMN5D9aiR3qW7jNKWpm4mjQtjdXtA8Nmt7zMTaXLE7g9rVL4DZxyCGQihc0ltANVZ0XCEH65ldHwGcMtyeQabH+hoByGKczfGYQOW0KMfMGsi2GTGJqFIV4vq5WAQ== x-ms-office365-filtering-correlation-id: 736cfe6d-44dd-46f9-11fc-08d6466fffa6 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:SN6PR11MB3392; x-ms-traffictypediagnostic: SN6PR11MB3392: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR11MB3392;BCL:0;PCL:0;RULEID:;SRVR:SN6PR11MB3392; x-forefront-prvs: 08512C5403 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(396003)(346002)(376002)(39860400002)(199004)(189003)(14454004)(5640700003)(6436002)(386003)(52116002)(102836004)(76176011)(14444005)(53936002)(256004)(2900100001)(81166006)(2351001)(6512007)(81156014)(6506007)(4326008)(72206003)(36756003)(25786009)(6486002)(8936002)(8676002)(71200400001)(478600001)(68736007)(2906002)(1076002)(86362001)(5660300001)(6116002)(6916009)(3846002)(71190400001)(66066001)(476003)(2616005)(105586002)(11346002)(446003)(26005)(106356001)(99286004)(486006)(305945005)(54906003)(2501003)(316002)(97736004)(186003)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR11MB3392;H:SN6PR11MB3407.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: sXiTumJfIJW2o44U4NbNCI3543wpgFPTOYL13cPsBISJJSVHbr9HOsVXpMEPZ23TYMrRU/HMHBMXyXOqoZR6xWqjeMCyAQEwkitpSG6N38lHHISb4KrktYOSrgiJabbIrPnnWJnwOxYvgHfck3dmhaA68IItK/g3gvXVqI/+7aHH9CCgkY1qTbMTUUenKyl7odJQDDalTif5Bgj0lu67zU9ZNAHYDFzGbja0cGEFnvBVdXpLAHQ2kSJdKRboz/8mYOkRVf6bfZTfaN/T9exAB5u1HIRNVdUm7B6+kITrQVRGE/1U7ueX9iTpVdK/sfKQGffU/SxUPeqgCtzDJvCrlqWWdLRvSSiqHxkayO4dUao= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 736cfe6d-44dd-46f9-11fc-08d6466fffa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2018 18:20:16.5766 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3392 X-OriginatorOrg: microchip.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: Adham Abozaeid host_if_drv.cfg_values is a write only member, and can be removed Signed-off-by: Adham Abozaeid --- drivers/staging/wilc1000/host_interface.c | 13 ------------- drivers/staging/wilc1000/host_interface.h | 1 - 2 files changed, 14 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index c1215c194907..8d1142776310 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -375,43 +375,31 @@ static void handle_cfg_param(struct work_struct *work) mutex_lock(&hif_drv->cfg_values_lock); if (param->flag & RETRY_SHORT) { - u16 retry_limit = param->short_retry_limit; - wid_list[i].id = WID_SHORT_RETRY_LIMIT; wid_list[i].val = (s8 *)¶m->short_retry_limit; wid_list[i].type = WID_SHORT; wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.short_retry_limit = retry_limit; i++; } if (param->flag & RETRY_LONG) { - u16 limit = param->long_retry_limit; - wid_list[i].id = WID_LONG_RETRY_LIMIT; wid_list[i].val = (s8 *)¶m->long_retry_limit; wid_list[i].type = WID_SHORT; wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.long_retry_limit = limit; i++; } if (param->flag & FRAG_THRESHOLD) { - u16 frag_th = param->frag_threshold; - wid_list[i].id = WID_FRAG_THRESHOLD; wid_list[i].val = (s8 *)¶m->frag_threshold; wid_list[i].type = WID_SHORT; wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.frag_threshold = frag_th; i++; } if (param->flag & RTS_THRESHOLD) { - u16 rts_th = param->rts_threshold; - wid_list[i].id = WID_RTS_THRESHOLD; wid_list[i].val = (s8 *)¶m->rts_threshold; wid_list[i].type = WID_SHORT; wid_list[i].size = sizeof(u16); - hif_drv->cfg_values.rts_threshold = rts_th; i++; } @@ -3256,7 +3244,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) mutex_lock(&hif_drv->cfg_values_lock); hif_drv->hif_state = HOST_IF_IDLE; - hif_drv->cfg_values.scan_source = DEFAULT_SCAN; hif_drv->p2p_timeout = 0; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index df9fc33be094..1e2e50e91f76 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -293,7 +293,6 @@ struct host_if_drv { enum host_if_state hif_state; u8 assoc_bssid[ETH_ALEN]; - struct cfg_param_attr cfg_values; /*lock to protect concurrent setting of cfg params*/ struct mutex cfg_values_lock; From patchwork Fri Nov 9 18:20:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adham Abozaeid X-Patchwork-Id: 10676413 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-2.web.codeaurora.org (Postfix) with ESMTP id 69AAB15E9 for ; Fri, 9 Nov 2018 18:20:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D0332F045 for ; Fri, 9 Nov 2018 18:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 515E22F051; Fri, 9 Nov 2018 18:20:23 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 E69042F045 for ; Fri, 9 Nov 2018 18:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728589AbeKJECE (ORCPT ); Fri, 9 Nov 2018 23:02:04 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:59961 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728492AbeKJECE (ORCPT ); Fri, 9 Nov 2018 23:02:04 -0500 X-IronPort-AV: E=Sophos;i="5.54,484,1534834800"; d="scan'208";a="22615795" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 09 Nov 2018 11:20:19 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.106) with Microsoft SMTP Server (TLS) id 14.3.352.0; Fri, 9 Nov 2018 11:20:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JgnxwWXDopj28kybctKRII3R99URFSkCrlKSACLf6pA=; b=fSXjsxmrYV6yhpvs0yio0IIzqg+bUXxxnjOuHw9xVB/6VsksLVNY9tY58KEiduEiEgic2lqXu65CKtdKqcDfwib4xcDSSMbIVpl+1QofQNWrSD/Zi3X22eWmju2CYURu79Cel/J0ZmrBAOmaSFkTqCi4MR79BcUASZL63cGgH3c= Received: from SN6PR11MB3407.namprd11.prod.outlook.com (52.135.111.96) by SN6PR11MB3392.namprd11.prod.outlook.com (52.135.111.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 9 Nov 2018 18:20:17 +0000 Received: from SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281]) by SN6PR11MB3407.namprd11.prod.outlook.com ([fe80::7d22:c5b8:9e2e:2281%2]) with mapi id 15.20.1294.034; Fri, 9 Nov 2018 18:20:17 +0000 From: To: CC: , , , , Subject: [PATCH v5 3/3] staging: wilc1000: Remove unused mutex cfg_values_lock Thread-Topic: [PATCH v5 3/3] staging: wilc1000: Remove unused mutex cfg_values_lock Thread-Index: AQHUeFjdxx6+NtqwyEiUTdSV2ak5gA== Date: Fri, 9 Nov 2018 18:20:17 +0000 Message-ID: <20181109182008.4328-4-adham.abozaeid@microchip.com> References: <20181109182008.4328-1-adham.abozaeid@microchip.com> In-Reply-To: <20181109182008.4328-1-adham.abozaeid@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [198.175.253.81] x-clientproxiedby: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To SN6PR11MB3407.namprd11.prod.outlook.com (2603:10b6:805:bd::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Adham.Abozaeid@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR11MB3392;6:ExxwZUt1B3WYKaX+1FOHxn6XfmQUXG0R887mqotxzXqiklBD+UwwLzfiF+9141FtTvtUU7eKMPf7BA2rrSqVtwYJ2sPXRnCyyhg7afDqpoHbMwwBbJNABp5XzHEK3exCIlA1B1vppOM4CKeGisLgQROCvbTrLbFcB05RBHDvknxseGwf82w7VnBJkc3db/TPCrb0l1kX9MhrmkAoY3sG4iaG2EkqIGbcrOGmcz/qByWUILS8EG5qQiOA7LHBUAdYYQ5OxlyUrFEE3I0oCg7WKn/Bj1sl43zuywcw9VI2FPVVZs5/1x2TwtJReon6n0fAGHDhxMAdNvaeZy7bPPOx9EwfQBR0hiJUQ9K24R8XjKRCm6rhqLwfXCM9zCU6AKns1dptQej1K6S33OTHB5M0jexRnJE0DIYeOOH/YlcGbQruvXVOWRtQql777Qw9e8cmH7ra/i7dG/bbyNklQabMoA==;5:YW9rjBhACN7RGjdv2y6D2DbbDVk7ynKu3kDI0Dd+JeX2VA8ouPvfd4gplw/Ia0bWGjceiyOuw67aQIDQ2u0WwYSSPJO4VEKW0HG2MUYSsDkpTVyBcguHmEKDf5C78jJ8dSO4zUf+wvWF5DHxMdTrAr6gM1srbQnGKEWzE4CKFL8=;7:SfWHD3NvqBNKfm3Lbs1aeENe4Xg+b26HUqLjL/jGRRW4be+NV1PZ4XVNAenBplQbNL+go06nTvknIcPaLVjg6bh7Ft71tKQrpz8lmivS+nJCap5VIxSyNQiUcX67H6DsyXtiAYLlGbNktXRJRGip6A== x-ms-office365-filtering-correlation-id: 7c508456-f853-49f9-2119-08d646700016 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:SN6PR11MB3392; x-ms-traffictypediagnostic: SN6PR11MB3392: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(21532816269658); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR11MB3392;BCL:0;PCL:0;RULEID:;SRVR:SN6PR11MB3392; x-forefront-prvs: 08512C5403 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(136003)(396003)(346002)(376002)(39860400002)(199004)(189003)(14454004)(5640700003)(6436002)(386003)(52116002)(102836004)(76176011)(14444005)(53936002)(256004)(2900100001)(81166006)(2351001)(6512007)(81156014)(6506007)(4326008)(72206003)(36756003)(25786009)(6486002)(8936002)(8676002)(71200400001)(478600001)(68736007)(2906002)(1076002)(86362001)(5660300001)(6116002)(6916009)(3846002)(71190400001)(66066001)(476003)(2616005)(105586002)(11346002)(446003)(26005)(106356001)(99286004)(486006)(305945005)(54906003)(2501003)(316002)(97736004)(186003)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR11MB3392;H:SN6PR11MB3407.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: fFw0mWWD+WxAp3KyXXrDaiBds8mOWbUZDDRaKif1a9i51g5M0JvH/rUnEbaW8Tw4V3KPnPMMHrvbsG40Pz969Q+vDVtstJrmG7EIygVijSFnIwDlIdCMpGO1Ol5tSfDogLi5abG8zCu7hz3U5N4gsLFbDj9dqT04HeuWTtG/MB0VZVqrnVIHnIkr+tYVYzih5PzhBwksq87OoEt6uuSqoAJ5DkowDjXCWFfF85vTFIPPenFL4F9q1Mx9EqxjIB40RJv9xpz2FQ9grkmXF1CpUG4jeeXIOvalei7my7o58+wyeJmHoPbfrkRrBiONat548AqnBjKz19CddO3VqKNYa+MFucd9yndaTKyHOR3O1fk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 7c508456-f853-49f9-2119-08d646700016 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2018 18:20:17.3423 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3392 X-OriginatorOrg: microchip.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: Adham Abozaeid After removing cfg_values member, cfg_values_lock that was used to protect it can also be removed. Signed-off-by: Adham Abozaeid --- drivers/staging/wilc1000/host_interface.c | 9 --------- drivers/staging/wilc1000/host_interface.h | 2 -- 2 files changed, 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8d1142776310..2bf91df1ded1 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -369,11 +369,8 @@ static void handle_cfg_param(struct work_struct *work) struct cfg_param_attr *param = &msg->body.cfg_info; int ret; struct wid wid_list[32]; - struct host_if_drv *hif_drv = vif->hif_drv; int i = 0; - mutex_lock(&hif_drv->cfg_values_lock); - if (param->flag & RETRY_SHORT) { wid_list[i].id = WID_SHORT_RETRY_LIMIT; wid_list[i].val = (s8 *)¶m->short_retry_limit; @@ -409,7 +406,6 @@ static void handle_cfg_param(struct work_struct *work) if (ret) netdev_err(vif->ndev, "Error in setting CFG params\n"); - mutex_unlock(&hif_drv->cfg_values_lock); kfree(msg); } @@ -3240,15 +3236,10 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) timer_setup(&hif_drv->connect_timer, timer_connect_cb, 0); timer_setup(&hif_drv->remain_on_ch_timer, listen_timer_cb, 0); - mutex_init(&hif_drv->cfg_values_lock); - mutex_lock(&hif_drv->cfg_values_lock); - hif_drv->hif_state = HOST_IF_IDLE; hif_drv->p2p_timeout = 0; - mutex_unlock(&hif_drv->cfg_values_lock); - wilc->clients_count++; return 0; diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 1e2e50e91f76..523b46bfb488 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -293,8 +293,6 @@ struct host_if_drv { enum host_if_state hif_state; u8 assoc_bssid[ETH_ALEN]; - /*lock to protect concurrent setting of cfg params*/ - struct mutex cfg_values_lock; struct timer_list scan_timer; struct wilc_vif *scan_timer_vif;