From patchwork Tue Feb 5 07:15:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796951 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 B366113B5 for ; Tue, 5 Feb 2019 07:15:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B7FA2B520 for ; Tue, 5 Feb 2019 07:15:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F5DD2B5C9; Tue, 5 Feb 2019 07:15:36 +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 268E72B520 for ; Tue, 5 Feb 2019 07:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727138AbfBEHPf (ORCPT ); Tue, 5 Feb 2019 02:15:35 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:40009 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726876AbfBEHPe (ORCPT ); Tue, 5 Feb 2019 02:15:34 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="25864234" 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; 05 Feb 2019 00:15:33 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.107) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:33 -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=UyJElnNE+5EWbsGKipid2rvF6ubpvN6mmr9iIrgLtUA=; b=D6yRDHM/z7cQ6MZ/ASh/kezpFIghW7LePfxllMQFVmTep4+DGC2cML1s39AlTQx45RucLj/CsB3LFsQX4J7Xuy8hPRu2jd2tHSdhIiC9wX8/MwvOuwSAlmC1bu4M7MbJc0wDC1TsRf9qXSAgLybede15kNpl7C6fyz4SxtwIdn8= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:32 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:32 +0000 From: To: CC: , , , , Subject: [PATCH 01/12] staging: wilc1000: remove use of 'terminated_handle' static variable Thread-Topic: [PATCH 01/12] staging: wilc1000: remove use of 'terminated_handle' static variable Thread-Index: AQHUvSKUmuF7q6pl/UyNs3QCBI6Big== Date: Tue, 5 Feb 2019 07:15:31 +0000 Message-ID: <1549350913-645-2-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:hrOQ5M4DqVn6ToonK2euTNkqjNUNpyk2eX29t0n8T+nVSPzG6B12dV09h9xptVxC9k5MUg1anY8Di+Mdneusr7CZYDCHGvZ5BEwL7+dxDOq8j/S7P8wQsx5w6zsnma6EJ7/jSxMZu+lAlEVzjDg19nDmHtOrG+4YrkyDE1e23e9zSEDKPUhO+122etkUIOBojOpKybc8qi6JIobCecUnclI8nB1QPW0MdcwLTF59EuAcJ+U2npxv1VNsK7plHUMdh4Wh/CU2PLynsZGyIl8wysGusl1oIO5EtFVXduB9v0CKNXPg9LM5L6eTq1cCIEq1MdDPiidd80cau0vAE1RsSFoHZHgQbG0OTkDj9DrKlGqYYPIUxUB2M8VsDwSwL9WzaBqdF0tv3s8w5vnCx82qyuB5deFJ7QudeBCQyIhUIA95JYjsEywp89m606b0CrsdS9Dpbt81Q7AIekPSjnkryg==;5:u/8ORY8zr4XhvguOGRSCqMVCbkCvLWoQKsc/QsxCU0Z+eF8v4bVXu4zKiTjTvVyu3vFvlif981oTPRcoVxY15S1SzJXNGrZjtS3mo8cnQGhFoU6Q2pzdoQ8bZDVKPj/Il6afIrfbRTBQjW/JS8vl3xKe4pkQuycUpOgRwcOqG21xH0MUiyn+1bgzrha0ismwxo75wKEDxj3/eDx/Q8rkTQ==;7:vSSGxvizrQf+pkaH+eqseLHQ1hZYadSYgMysPy2Q/GyhD86NdLKlDcw5bWxkZWebRHxl/eF7yVMDnyVfCTAzX09rR1p4lYJct33/u66bUAlyuXhkEJ3uVQhJH8VWrv/ceUHUoKQa45oCcRrQLgHyaw== x-ms-office365-filtering-correlation-id: 09183276-ccec-4d81-710f-08d68b39b6cc x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9Jv8Qeb1vU3l81t/ioYUEkbfQCZhAE5nDavaGc+Gdh5mLLHQBpvX+D4xhLeMvNxB/oiC8lvEKFWHY/0zgabSLWwwc1J9/Jct99+3LGe7Ta7NI4W2rZ3k99CwQoXumInXK84Wg7KNHLRjtBPrf9fY2uwx0d1rKHReukX16a3JVzWQKP+/ltmd+q5t52i1KME40NcTXJ46u7dygXfmuf5PxPBK+fEGE8GMBNj95CntrVZXBoALj8Bos3ADVmjxRzA9v3jjwRRsLQryuhxnVE6ZlovPxHvbXTvlqPO+O940zAbtvIBC+WJ0NgWJNWDfyJKpBC4nRvHj3Ux/t7bQn620q4/rTIg91PkLohSMRk5+DTcM+E6l6IvUEa8c11ign8faKOJAowjt6uLaF8iV7Ffi12YL8/Jv5PcUfJvs6MLjMKA= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 09183276-ccec-4d81-710f-08d68b39b6cc X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:29.4887 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Remove use of 'terminated_handle' variable and set the 'hif_drv' to NULL once it's free. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 3576834..97bf747 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -130,7 +130,6 @@ struct wilc_join_bss_param { }; } __packed; -static struct host_if_drv *terminated_handle; static struct mutex hif_deinit_lock; /* 'msg' should be free by the caller for syc */ @@ -1478,6 +1477,9 @@ int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, int result; struct wilc_drv_handler drv; + if (!hif_drv) + return -EFAULT; + wid.id = WID_SET_DRV_HANDLER; wid.type = WID_STR; wid.size = sizeof(drv); @@ -1699,8 +1701,6 @@ int wilc_deinit(struct wilc_vif *vif) mutex_lock(&hif_deinit_lock); - terminated_handle = hif_drv; - del_timer_sync(&hif_drv->scan_timer); del_timer_sync(&hif_drv->connect_timer); del_timer_sync(&vif->periodic_rssi); @@ -1717,9 +1717,8 @@ int wilc_deinit(struct wilc_vif *vif) hif_drv->hif_state = HOST_IF_IDLE; kfree(hif_drv); - + vif->hif_drv = NULL; vif->wilc->clients_count--; - terminated_handle = NULL; mutex_unlock(&hif_deinit_lock); return result; } @@ -1738,7 +1737,7 @@ void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length) return; hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) { + if (!hif_drv) { netdev_err(vif->ndev, "driver not init[%p]\n", hif_drv); return; } @@ -1784,7 +1783,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) { + if (!hif_drv) { mutex_unlock(&hif_deinit_lock); return; } @@ -1824,7 +1823,7 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) return; hif_drv = vif->hif_drv; - if (!hif_drv || hif_drv == terminated_handle) + if (!hif_drv) return; if (hif_drv->usr_scan_req.scan_result) { From patchwork Tue Feb 5 07:15:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796953 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 14A49922 for ; Tue, 5 Feb 2019 07:15:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D772B520 for ; Tue, 5 Feb 2019 07:15:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E59272B5CC; Tue, 5 Feb 2019 07:15:44 +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 1239F2B520 for ; Tue, 5 Feb 2019 07:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbfBEHPi (ORCPT ); Tue, 5 Feb 2019 02:15:38 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:26915 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfBEHPi (ORCPT ); Tue, 5 Feb 2019 02:15:38 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="26323434" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:15:36 -0700 Received: from NAM05-CO1-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; Tue, 5 Feb 2019 00:15:36 -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=Q1WWZYGDmRKXz3PeI8SMpZsWBdDRoH9uwZ21MP/Xryo=; b=iNMi6ybnLe36d63IynbK9S7rKtagPsYzGVd8UHOP4FWYoEPvb042WV8ba2TF/istUQbDoHRPzTCl+p9NThpBE0O0I1W2QcNy8pFJcWBXraGkCT0wVoclFzBAtx9VstJux2T2Ui/3pedjjkjhhkRJ29QuKGmZD16A7R7pgSkZoRM= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:34 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:34 +0000 From: To: CC: , , , , Subject: [PATCH 02/12] staging: wilc1000: refactor linux_wlan_init_test_config() Thread-Topic: [PATCH 02/12] staging: wilc1000: refactor linux_wlan_init_test_config() Thread-Index: AQHUvSKWR872PpjXs0GEuJlT8N3L4w== Date: Tue, 5 Feb 2019 07:15:34 +0000 Message-ID: <1549350913-645-3-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:v2FbyrZa3YjDDCyIm9r1pKohNBQ1APiHL1Uz4Guf6ouZIyH76w1BqKjdEm9OYEeayJYDzGCGb11iikkfy5LoFW7dM3oGv7bjNeKnIgBEk208fACiEKOZnKNYlvDTKw9VIzPBaql/qCTD6S12TOfG5SJuJDLPnAqVS+ck1QNxPcdfWlQR+d02ewNN6zJ3UxwkLNqCfvVF2lQRg3TVwFdg4tcyTm3zwRhRRJuPGF206XbS2r6ykdgiDO/twzNcaasahCYluxDcLNOM3b7tXobaOgpXhHlxo+QHNN0wSX//7AZXS87BWuzb/e+KzCqJHETCpCEq4XICEVYZUVqwQnlIx1WqLhBofHVggq0MOJ1CnEqD4KiD3R+DyJ8a2As+dmnc0MoAEcKlUJ363qtcTA1Zk3OjvcgxDRvwaw9OYT8ulV5SfC6D5XbsmFYkWLwpeEbclRD3hqVmD2kHojoz0qZqbA==;5:BCY5C0IWYHzzUlcm/CNHYGrJLarkTM1UCX/B0nFkBb6Ivtrv33UzJOKZifER4oEMvDyl9xOdnMR/kCEcEvuAfLkXSm3IyXzGULC7a1f1R2pw/gAEoTRUrK6a5n5l1fa6kpFidp1TtiUgTwO6Udk18F/T9L9DlM7E3ARVWBEHwhofggNxtbPnKfzwIGn6QY7ypO0ZpvVpagyOmAx8DZXerQ==;7:BXRskpuT/1p0UpeCJrme1yRvDi8B7Z0qzqsxaG731vYnwtahAJZonyxPgMa8IkIK/txl/q6mtiIrcXcif/6lhqXIxL/1qixS7oFWarUZ4XFNgwaeelt1qs+sYJgZFCSbFx0kJEl1KdF3OMA72rerkQ== x-ms-office365-filtering-correlation-id: b5a58acc-b717-4507-3321-08d68b39b865 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: vtal9o9tQvkP8HQok3wboPVBK+ikpqhWsVDJHUApD8OrRS5lf2qbUriqOMUY7gWX7irlY/pP0xh0BD9LFGeGF752QyRflP5RjgOD5ix7PWlGFZbEA2iHpEMzvDJndgjboJy5mmbS4iGaemCeEJKL9uSp8xATClPcJmq1xo/7F3x34ipyOGZ/R1il9QkAeQCgKOhZ+/QKDBfIu0L9UNoRbA89c/sgXlwVpeBZQIQpg4bdCprJxaroXsjtKFUTalMM/ppTDQ+1RGdYOB4I9WYk1Jg/tYtFB4SHnHbi5POjf/69u+hsPZz1C5lwSXj3k+wQB8TLFkSlglSpU2iE2q+yZs59IIo6epOHeAg7pY/9GfFhUF1ByVKWiJYi+Gtp64cJ/+KdlxbJ4gzviNwXnW+PJkX8mrJsJFjL4tseG+U0ngM= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b5a58acc-b717-4507-3321-08d68b39b865 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:32.2917 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Refactor linux_wlan_init_test_config() to use correct endianness for wid values and remove unnecessary code. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 200 +++++++++++++------------------- drivers/staging/wilc1000/wilc_wlan_if.h | 1 - 2 files changed, 83 insertions(+), 118 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 81472d2..86a38f1 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -304,204 +304,170 @@ static int wilc1000_firmware_download(struct net_device *dev) return 0; } -static int linux_wlan_init_test_config(struct net_device *dev, - struct wilc_vif *vif) +static int linux_wlan_init_fw_config(struct net_device *dev, + struct wilc_vif *vif) { - unsigned char c_val[64]; - struct wilc *wilc = vif->wilc; struct wilc_priv *priv; struct host_if_drv *hif_drv; + u8 b; + u16 hw; + u32 w; netdev_dbg(dev, "Start configuring Firmware\n"); priv = wiphy_priv(dev->ieee80211_ptr->wiphy); hif_drv = (struct host_if_drv *)priv->hif_drv; netdev_dbg(dev, "Host = %p\n", hif_drv); - wilc_get_chipid(wilc, false); - - *(int *)c_val = 1; - - if (!wilc_wlan_cfg_set(vif, 1, WID_SET_DRV_HANDLER, c_val, 4, 0, 0)) - goto fail; - - c_val[0] = 0; - if (!wilc_wlan_cfg_set(vif, 0, WID_PC_TEST_MODE, c_val, 1, 0, 0)) - goto fail; - - c_val[0] = WILC_FW_BSS_TYPE_INFRA; - if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, c_val, 1, 0, 0)) - goto fail; - - c_val[0] = WILC_FW_TX_RATE_AUTO; - if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, c_val, 1, 0, 0)) - goto fail; - - c_val[0] = WILC_FW_OPER_MODE_G_MIXED_11B_2; - if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, c_val, 1, 0, - 0)) - goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_CHANNEL, c_val, 1, 0, 0)) - goto fail; - - c_val[0] = WILC_FW_PREAMBLE_SHORT; - if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, c_val, 1, 0, 0)) + w = vif->iftype; + cpu_to_le32s(&w); + if (!wilc_wlan_cfg_set(vif, 1, WID_SET_OPERATION_MODE, (u8 *)&w, 4, + 0, 0)) goto fail; - c_val[0] = WILC_FW_11N_PROT_AUTO; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, c_val, 1, 0, 0)) + b = WILC_FW_BSS_TYPE_INFRA; + if (!wilc_wlan_cfg_set(vif, 0, WID_BSS_TYPE, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_ACTIVE_SCAN; - if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, c_val, 1, 0, 0)) + b = WILC_FW_TX_RATE_AUTO; + if (!wilc_wlan_cfg_set(vif, 0, WID_CURRENT_TX_RATE, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_SITE_SURVEY_OFF; - if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, c_val, 1, 0, 0)) + b = WILC_FW_OPER_MODE_G_MIXED_11B_2; + if (!wilc_wlan_cfg_set(vif, 0, WID_11G_OPERATING_MODE, &b, 1, 0, 0)) goto fail; - *((int *)c_val) = 0xffff; - if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, c_val, 2, 0, 0)) + b = WILC_FW_PREAMBLE_SHORT; + if (!wilc_wlan_cfg_set(vif, 0, WID_PREAMBLE, &b, 1, 0, 0)) goto fail; - *((int *)c_val) = 2346; - if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, c_val, 2, 0, 0)) + b = WILC_FW_11N_PROT_AUTO; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_PROT_MECH, &b, 1, 0, 0)) goto fail; - c_val[0] = 0; - if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, c_val, 1, 0, 0)) + b = WILC_FW_ACTIVE_SCAN; + if (!wilc_wlan_cfg_set(vif, 0, WID_SCAN_TYPE, &b, 1, 0, 0)) goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, c_val, 1, 0, 0)) + b = WILC_FW_SITE_SURVEY_OFF; + if (!wilc_wlan_cfg_set(vif, 0, WID_SITE_SURVEY, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_NO_POWERSAVE; - if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0)) + hw = 0xffff; + cpu_to_le16s(&hw); + if (!wilc_wlan_cfg_set(vif, 0, WID_RTS_THRESHOLD, (u8 *)&hw, 2, 0, 0)) goto fail; - c_val[0] = WILC_FW_SEC_NO; - if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, c_val, 1, 0, 0)) + hw = 2346; + cpu_to_le16s(&hw); + if (!wilc_wlan_cfg_set(vif, 0, WID_FRAG_THRESHOLD, (u8 *)&hw, 2, 0, 0)) goto fail; - c_val[0] = WILC_FW_AUTH_OPEN_SYSTEM; - if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, c_val, 1, 0, 0)) + b = 0; + if (!wilc_wlan_cfg_set(vif, 0, WID_BCAST_SSID, &b, 1, 0, 0)) goto fail; - strcpy(c_val, "123456790abcdef1234567890"); - if (!wilc_wlan_cfg_set(vif, 0, WID_WEP_KEY_VALUE, c_val, - (strlen(c_val) + 1), 0, 0)) + b = 1; + if (!wilc_wlan_cfg_set(vif, 0, WID_QOS_ENABLE, &b, 1, 0, 0)) goto fail; - strcpy(c_val, "12345678"); - if (!wilc_wlan_cfg_set(vif, 0, WID_11I_PSK, c_val, (strlen(c_val)), 0, - 0)) + b = WILC_FW_NO_POWERSAVE; + if (!wilc_wlan_cfg_set(vif, 0, WID_POWER_MANAGEMENT, &b, 1, 0, 0)) goto fail; - strcpy(c_val, "password"); - if (!wilc_wlan_cfg_set(vif, 0, WID_1X_KEY, c_val, (strlen(c_val) + 1), - 0, 0)) + b = WILC_FW_SEC_NO; + if (!wilc_wlan_cfg_set(vif, 0, WID_11I_MODE, &b, 1, 0, 0)) goto fail; - c_val[0] = 192; - c_val[1] = 168; - c_val[2] = 1; - c_val[3] = 112; - if (!wilc_wlan_cfg_set(vif, 0, WID_1X_SERV_ADDR, c_val, 4, 0, 0)) + b = WILC_FW_AUTH_OPEN_SYSTEM; + if (!wilc_wlan_cfg_set(vif, 0, WID_AUTH_TYPE, &b, 1, 0, 0)) goto fail; - c_val[0] = 3; - if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, c_val, 1, 0, 0)) + b = 3; + if (!wilc_wlan_cfg_set(vif, 0, WID_LISTEN_INTERVAL, &b, 1, 0, 0)) goto fail; - c_val[0] = 3; - if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, c_val, 1, 0, 0)) + b = 3; + if (!wilc_wlan_cfg_set(vif, 0, WID_DTIM_PERIOD, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_ACK_POLICY_NORMAL; - if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, c_val, 1, 0, 0)) + b = WILC_FW_ACK_POLICY_NORMAL; + if (!wilc_wlan_cfg_set(vif, 0, WID_ACK_POLICY, &b, 1, 0, 0)) goto fail; - c_val[0] = 0; - if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, c_val, 1, + b = 0; + if (!wilc_wlan_cfg_set(vif, 0, WID_USER_CONTROL_ON_TX_POWER, &b, 1, 0, 0)) goto fail; - c_val[0] = 48; - if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, c_val, 1, 0, - 0)) + b = 48; + if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11A, &b, 1, 0, 0)) goto fail; - c_val[0] = 28; - if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, c_val, 1, 0, - 0)) + b = 28; + if (!wilc_wlan_cfg_set(vif, 0, WID_TX_POWER_LEVEL_11B, &b, 1, 0, 0)) goto fail; - *((int *)c_val) = 100; - if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, c_val, 2, 0, 0)) + hw = 100; + cpu_to_le16s(&hw); + if (!wilc_wlan_cfg_set(vif, 0, WID_BEACON_INTERVAL, (u8 *)&hw, 2, 0, 0)) goto fail; - c_val[0] = WILC_FW_REKEY_POLICY_DISABLE; - if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, c_val, 1, 0, 0)) + b = WILC_FW_REKEY_POLICY_DISABLE; + if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_POLICY, &b, 1, 0, 0)) goto fail; - *((int *)c_val) = 84600; - if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, c_val, 4, 0, 0)) + w = 84600; + cpu_to_le32s(&w); + if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PERIOD, (u8 *)&w, 4, 0, 0)) goto fail; - *((int *)c_val) = 500; - if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, c_val, 4, 0, + w = 500; + cpu_to_le32s(&w); + if (!wilc_wlan_cfg_set(vif, 0, WID_REKEY_PACKET_COUNT, (u8 *)&w, 4, 0, 0)) goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, c_val, 1, 0, + b = 1; + if (!wilc_wlan_cfg_set(vif, 0, WID_SHORT_SLOT_ALLOWED, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_ERP_PROT_SELF_CTS; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, c_val, 1, 0, 0)) + b = WILC_FW_ERP_PROT_SELF_CTS; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ERP_PROT_TYPE, &b, 1, 0, 0)) goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, c_val, 1, 0, 0)) + b = 1; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_ENABLE, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_11N_OP_MODE_HT_MIXED; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, c_val, 1, 0, - 0)) + b = WILC_FW_11N_OP_MODE_HT_MIXED; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OPERATING_MODE, &b, 1, 0, 0)) goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, c_val, 1, 0, - 0)) + b = 1; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_TXOP_PROT_DISABLE, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, c_val, 1, + b = WILC_FW_OBBS_NONHT_DETECT_PROTECT_REPORT; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_OBSS_NONHT_DETECTION, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_HT_PROT_RTS_CTS_NONHT; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, c_val, 1, 0, 0)) + b = WILC_FW_HT_PROT_RTS_CTS_NONHT; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_HT_PROT_TYPE, &b, 1, 0, 0)) goto fail; - c_val[0] = 0; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, c_val, 1, 0, + b = 0; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_RIFS_PROT_ENABLE, &b, 1, 0, 0)) goto fail; - c_val[0] = WILC_FW_SMPS_MODE_MIMO; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_SMPS_MODE, c_val, 1, 0, 0)) - goto fail; - - c_val[0] = 7; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, c_val, 1, 0, - 0)) + b = 7; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_CURRENT_TX_MCS, &b, 1, 0, 0)) goto fail; - c_val[0] = 1; - if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, c_val, 1, + b = 1; + if (!wilc_wlan_cfg_set(vif, 0, WID_11N_IMMEDIATE_BA_ENABLED, &b, 1, 1, 1)) goto fail; @@ -671,7 +637,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif) firmware_ver[size] = '\0'; netdev_dbg(dev, "Firmware Ver = %s\n", firmware_ver); } - ret = linux_wlan_init_test_config(dev, vif); + ret = linux_wlan_init_fw_config(dev, vif); if (ret < 0) { netdev_err(dev, "Failed to configure firmware\n"); diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 9370caa..26aad49 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -686,7 +686,6 @@ enum { WID_TX_POWER_LEVEL_11N = 0x00B1, /* Custom Character WID list */ - WID_PC_TEST_MODE = 0x00C8, /* SCAN Complete notification WID*/ WID_SCAN_COMPLETE = 0x00C9, From patchwork Tue Feb 5 07:15:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796955 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 5706113B5 for ; Tue, 5 Feb 2019 07:15:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3B32B520 for ; Tue, 5 Feb 2019 07:15:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 332392B5C9; Tue, 5 Feb 2019 07:15:45 +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 491042B5BB for ; Tue, 5 Feb 2019 07:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727186AbfBEHPm (ORCPT ); Tue, 5 Feb 2019 02:15:42 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:40017 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfBEHPm (ORCPT ); Tue, 5 Feb 2019 02:15:42 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="25864240" 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; 05 Feb 2019 00:15:41 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:40 -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=Zm4WWu9iLF1SygaMCtEOYKQTAqihB7EFsgji56a0NRM=; b=vFshcT2t/ZKi1G/4jHa8qAZBV9rf+HG+y1obvkS64OXRVwjGwdZpIZbM1zSmO87cXJHW3/6FCZ2z4mcF3/zPSLLdiCUSHEVlLkKgX7Qg+vgq237J74/lz1Hk70yZfuOeWWeDe2HYflHX7e6a5lAdKGBTSXOlK4mTkwOdO/MszZ0= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:39 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:39 +0000 From: To: CC: , , , , Subject: [PATCH 03/12] staging: wilc1000: refactor code to use cookie information Thread-Topic: [PATCH 03/12] staging: wilc1000: refactor code to use cookie information Thread-Index: AQHUvSKYI9HKTZSjE0uTwgzCE2iHAQ== Date: Tue, 5 Feb 2019 07:15:39 +0000 Message-ID: <1549350913-645-4-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:S4N+vnH1CA2eGvZGRWQT9Tasrs/I3CAFyUvWexgvi3kQrEORBMjmcmxj28ROrG+DISCbuaM5Vdnsg/3UIcpqhSbWI8ZFZR3hQ1srn6O6bJSI3MfRjUwuEi+rt9QJCwgZz51gNmczWW6lmza3aJGEaGWQH9wc90l3vkFvLC9lzas4Q/vRTt94zQSU6ZKChY3vNEI5b5wrE+hEwZAMmYDNqpLwzTHUM7TyPLkIx2Vay4/8MvTUJ8gbAmAqAMPQLigoVSSsWd+TBS5Yy7Z/CL0U9Kd0cdwzjhuxE/No93+HKqqsGnzehSgNPvvhfkUc24Z+ezNP8GDFrsupPyfDE8TNxL367YDwM67TtO29V4drfeCccuJmRmi387xspJpbihwHa8Gzt3RE9clS++w51ltbPkyGPPmThNWDbo60aSf8jhmk2CTDPTq5KKZIfvX9eFPvhdYhCriiZLliasNOMiC3Yg==;5:FfrgZRbsn91eNn3h+IWvOVXMK6nqembtUpnNXqMPhYiBGJsqLhhW/PA4+GNA5jLuDoPcPNq0uRFsvftGQrq1jmkNro9RjQ78JiF1UHaATGKMxqqUIO8v/uAm3wYgbQO28r2bAyKof2kNbDM8kECJWGzD10jY8whcRCAx+LZ+ZtSW7AOYXfI6lyGN3cLdW0Q7vlmcB3AAKT4Emt92tyxGYg==;7:X27ix002OULVaCMFlEdt1y76PFTq7IoE+vXhxGm5pgDDcvz/JcZLwZdqdg5SLVjuzroYLGkAIDYqNscWfr0AzfWoSxoyfNDeb6KUochOq3GCbMZK5SUv2D2MpahZmVUkaIb6iuC4DkWPoS2Xc7dlbA== x-ms-office365-filtering-correlation-id: 3985e61d-0235-485c-a1d1-08d68b39bab7 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 1qkNddNWUz0+EC+WJ/CPAk+8uZBn4ddNhMQTPp4qd6b7+SzXo4/1M3rNOtJWZ+tTKa/C2FDQYEQm63EjODxwH3lQffD2DGLFyquMySBtwPWV420l4X61hemHEvQzfsqfD6j6CLR+vDloggKdRSLBeGWzr8payMd9yYwrE7P3hG1WR6jLLH7ifssfmEAwuANd/wtai1EdH9iY03D6mcMBblW21kTwjXlTnFCv08+LPfvNyvgsImn8w32QdEIT01zaZk5TuHiq91SgyvG1zYJoY87KbtdsyLY05Gq6/BA7tP8UpP9cNipFoKzrJGoy3mYf0W1t1d5V1WUgFwJa9ECKqVnLwKGdhSzT6PkrdxCKRDAKDwrPhoYP57LFAFP9jwK1A71WoEF1vPyyeJigQuz8KUUIDf0lx7g4gSdvP2omwtU= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3985e61d-0235-485c-a1d1-08d68b39bab7 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:34.9365 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Make use of cookie information to pass to wpa_s and handle cookie value received in the cfg80211_ops callbacks. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 72 +++++++---------------- drivers/staging/wilc1000/host_interface.h | 13 ++-- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 51 ++++++++-------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +- 4 files changed, 53 insertions(+), 85 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 97bf747..115b6f25 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -920,40 +920,22 @@ static int handle_remain_on_chan(struct wilc_vif *vif, struct wid wid; struct host_if_drv *hif_drv = vif->hif_drv; - if (!hif_drv->remain_on_ch_pending) { - hif_drv->remain_on_ch.arg = hif_remain_ch->arg; - hif_drv->remain_on_ch.expired = hif_remain_ch->expired; - hif_drv->remain_on_ch.ready = hif_remain_ch->ready; - hif_drv->remain_on_ch.ch = hif_remain_ch->ch; - hif_drv->remain_on_ch.id = hif_remain_ch->id; - } else { - hif_remain_ch->ch = hif_drv->remain_on_ch.ch; - } + if (hif_drv->usr_scan_req.scan_result) + return -EBUSY; - if (hif_drv->usr_scan_req.scan_result) { - hif_drv->remain_on_ch_pending = 1; - result = -EBUSY; - goto error; - } - if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { - result = -EBUSY; - goto error; - } + if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) + return -EBUSY; - if (vif->obtaining_ip || vif->connecting) { - result = -EBUSY; - goto error; - } + if (vif->obtaining_ip || vif->connecting) + return -EBUSY; remain_on_chan_flag = true; wid.id = WID_REMAIN_ON_CHAN; wid.type = WID_STR; wid.size = 2; wid.val = kmalloc(wid.size, GFP_KERNEL); - if (!wid.val) { - result = -ENOMEM; - goto error; - } + if (!wid.val) + return -ENOMEM; wid.val[0] = remain_on_chan_flag; wid.val[1] = (s8)hif_remain_ch->ch; @@ -961,21 +943,16 @@ static int handle_remain_on_chan(struct wilc_vif *vif, result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, wilc_get_vif_idx(vif)); kfree(wid.val); - if (result != 0) - netdev_err(vif->ndev, "Failed to set remain on channel\n"); + if (result) + return -EBUSY; -error: + hif_drv->remain_on_ch.arg = hif_remain_ch->arg; + hif_drv->remain_on_ch.expired = hif_remain_ch->expired; + hif_drv->remain_on_ch.ch = hif_remain_ch->ch; + hif_drv->remain_on_ch.cookie = hif_remain_ch->cookie; hif_drv->remain_on_ch_timer_vif = vif; - mod_timer(&hif_drv->remain_on_ch_timer, - jiffies + msecs_to_jiffies(hif_remain_ch->duration)); - - if (hif_drv->remain_on_ch.ready) - hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg); - if (hif_drv->remain_on_ch_pending) - hif_drv->remain_on_ch_pending = 0; - - return result; + return 0; } static void handle_listen_state_expired(struct work_struct *work) @@ -1012,7 +989,7 @@ static void handle_listen_state_expired(struct work_struct *work) if (hif_drv->remain_on_ch.expired) { hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, - hif_remain_ch->id); + hif_remain_ch->cookie); } } else { netdev_dbg(vif->ndev, "Not in listen state\n"); @@ -1036,7 +1013,7 @@ static void listen_timer_cb(struct timer_list *t) if (IS_ERR(msg)) return; - msg->body.remain_on_ch.id = vif->hif_drv->remain_on_ch.id; + msg->body.remain_on_ch.cookie = vif->hif_drv->remain_on_ch.cookie; result = wilc_enqueue_work(msg); if (result) { @@ -1102,9 +1079,6 @@ static void handle_scan_complete(struct work_struct *work) handle_scan_done(msg->vif, SCAN_EVENT_DONE); - if (msg->vif->hif_drv->remain_on_ch_pending) - handle_remain_on_chan(msg->vif, - &msg->vif->hif_drv->remain_on_ch); kfree(msg); } @@ -1842,10 +1816,9 @@ void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) } } -int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, +int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u32 duration, u16 chan, - void (*expired)(void *, u32), - void (*ready)(void *), + void (*expired)(void *, u64), void *user_arg) { struct remain_ch roc; @@ -1853,10 +1826,9 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, roc.ch = chan; roc.expired = expired; - roc.ready = ready; roc.arg = user_arg; roc.duration = duration; - roc.id = session_id; + roc.cookie = cookie; result = handle_remain_on_chan(vif, &roc); if (result) netdev_err(vif->ndev, "%s: failed to set remain on channel\n", @@ -1865,7 +1837,7 @@ int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, return result; } -int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id) +int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie) { int result; struct host_if_msg *msg; @@ -1882,7 +1854,7 @@ int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id) if (IS_ERR(msg)) return PTR_ERR(msg); - msg->body.remain_on_ch.id = session_id; + msg->body.remain_on_ch.cookie = cookie; result = wilc_enqueue_work(msg); if (result) { diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 0feb63f..994e641 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -140,10 +140,9 @@ struct wilc_conn_info { struct remain_ch { u16 ch; u32 duration; - void (*expired)(void *priv, u32 session_id); - void (*ready)(void *priv); + void (*expired)(void *priv, u64 cookie); void *arg; - u32 id; + u32 cookie; }; struct wilc; @@ -151,7 +150,6 @@ struct host_if_drv { struct user_scan_req usr_scan_req; struct wilc_conn_info conn_info; struct remain_ch remain_on_ch; - u8 remain_on_ch_pending; u64 p2p_timeout; enum host_if_state hif_state; @@ -227,12 +225,11 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac, int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout); int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count, u8 *mc_list); -int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, +int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie, u32 duration, u16 chan, - void (*expired)(void *, u32), - void (*ready)(void *), + void (*expired)(void *, u64), void *user_arg); -int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); +int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie); void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, u8 ifc_id); diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 08b60ddd..f719b74 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1119,27 +1119,12 @@ static void wilc_wfi_mgmt_tx_complete(void *priv, int status) kfree(pv_data); } -static void wilc_wfi_remain_on_channel_ready(void *priv_data) -{ - struct wilc_priv *priv; - - priv = priv_data; - - priv->p2p_listen_state = true; - - cfg80211_ready_on_channel(priv->wdev, - priv->remain_on_ch_params.listen_cookie, - priv->remain_on_ch_params.listen_ch, - priv->remain_on_ch_params.listen_duration, - GFP_KERNEL); -} - -static void wilc_wfi_remain_on_channel_expired(void *data, u32 session_id) +static void wilc_wfi_remain_on_channel_expired(void *data, u64 cookie) { struct wilc_priv *priv = data; struct wilc_wfi_p2p_listen_params *params = &priv->remain_on_ch_params; - if (session_id != params->listen_session_id) + if (cookie != params->listen_cookie) return; priv->p2p_listen_state = false; @@ -1156,24 +1141,36 @@ static int remain_on_channel(struct wiphy *wiphy, int ret = 0; struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); + u64 id; if (wdev->iftype == NL80211_IFTYPE_AP) { netdev_dbg(vif->ndev, "Required while in AP mode\n"); return ret; } + id = ++priv->inc_roc_cookie; + if (id == 0) + id = ++priv->inc_roc_cookie; + + ret = wilc_remain_on_channel(vif, id, duration, chan->hw_value, + wilc_wfi_remain_on_channel_expired, + (void *)priv); + if (ret) + return ret; + curr_channel = chan->hw_value; priv->remain_on_ch_params.listen_ch = chan; - priv->remain_on_ch_params.listen_cookie = *cookie; + priv->remain_on_ch_params.listen_cookie = id; + *cookie = id; + priv->p2p_listen_state = true; priv->remain_on_ch_params.listen_duration = duration; - priv->remain_on_ch_params.listen_session_id++; - return wilc_remain_on_channel(vif, - priv->remain_on_ch_params.listen_session_id, - duration, chan->hw_value, - wilc_wfi_remain_on_channel_expired, - wilc_wfi_remain_on_channel_ready, (void *)priv); + cfg80211_ready_on_channel(wdev, *cookie, chan, duration, GFP_KERNEL); + mod_timer(&vif->hif_drv->remain_on_ch_timer, + jiffies + msecs_to_jiffies(duration)); + + return ret; } static int cancel_remain_on_channel(struct wiphy *wiphy, @@ -1183,8 +1180,10 @@ static int cancel_remain_on_channel(struct wiphy *wiphy, struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); - return wilc_listen_state_expired(vif, - priv->remain_on_ch_params.listen_session_id); + if (cookie != priv->remain_on_ch_params.listen_cookie) + return -ENOENT; + + return wilc_listen_state_expired(vif, cookie); } static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index cc06ef9..a06b0c0 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -65,7 +65,6 @@ struct wilc_wfi_p2p_listen_params { struct ieee80211_channel *listen_ch; u32 listen_duration; u64 listen_cookie; - u32 listen_session_id; }; struct wilc_p2p_var { @@ -161,6 +160,7 @@ struct wilc_priv { struct ieee80211_rate bitrates[ARRAY_SIZE(wilc_bitrates)]; struct ieee80211_supported_band band; u32 cipher_suites[ARRAY_SIZE(wilc_cipher_suites)]; + u64 inc_roc_cookie; }; struct frame_reg { From patchwork Tue Feb 5 07:15:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796957 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 4492E922 for ; Tue, 5 Feb 2019 07:15:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EA122B520 for ; Tue, 5 Feb 2019 07:15:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22F192B5C9; Tue, 5 Feb 2019 07:15:46 +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 C5D6A2B520 for ; Tue, 5 Feb 2019 07:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbfBEHPp (ORCPT ); Tue, 5 Feb 2019 02:15:45 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:40017 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726696AbfBEHPo (ORCPT ); Tue, 5 Feb 2019 02:15:44 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="25864245" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES128-SHA; 05 Feb 2019 00:15:43 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.37) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:43 -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=z96Q4nbyeiUbKc7ZDmGyrWqQr36PYnqfQ8P2r7fNAm0=; b=iUb/hMGOa61jHrOQzWR7ptfG9D8iv2oiveZz/jxYNqZwUMpBywxQb0LD3DSHtJeWNM1TlSmiPOD+l+sZMSyqJGFzSuUITkw/cCUTc4NFarP2ao5m9ChBREvjF/10X0CqXqNkHc9OAU/q6dOVmnL4/yXrQaPeZGdODmhb6W8sj9c= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:42 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:42 +0000 From: To: CC: , , , , Subject: [PATCH 04/12] staging: wilc1000: use random number for cookie instead of pointer Thread-Topic: [PATCH 04/12] staging: wilc1000: use random number for cookie instead of pointer Thread-Index: AQHUvSKaS6hHkVYN8km/dpl7QS87GA== Date: Tue, 5 Feb 2019 07:15:42 +0000 Message-ID: <1549350913-645-5-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:M6GzKijTA9GmsYlGXYBq201gcfjcqz5i8JtgBmuOj5m+yRoWMaPIlsnVF4+L4qheSOoxoP3Kbf6tXCrcpcAyhB7abxiY0qUKF4uIJaVwXg7gR6qk8P7pItWsyYKjJ4i7QtDDcsZLR0X4o2V1cHPz/8fiM6mRJzm+0/YmIs3SSVmcPU+nKeYg6hbacIqmKNKYw72tYDaV8zr4BeDGLIPpUj0JKkUjEXVCNu6RGvXQpBDJJyOSAvCYaWx9n3Pnw1oftAhalnF48t+9nqauT08S8xgbPnkQ1A2NJuywLTS3LLrgzmh/9rQIR50MFMnkE6bnA6oEgpmzBHiiu2tFpRYH+b/8DZlcDHn40qBPkFEsmKNuIZhqnNDn2VkedM7WuDAlwfj0nXRsglhCMzqNK4BCjocSsjKMypZvRBvO+SO12PhWsBvS5520tHoMuXNnmkujpC2o3CcR4ToVr/iXkYw7QA==;5:CGjGEjGH303V/0vpT6kPr30OZCYqknNImviI5SlMVOMQIUFkbYhvimq6BGK1dMHf2sZTJKXQJfiICUnC69oOtcBgy7ypdMgwNVTgBdWCfKxnY3Q0DF+ZZT4h8lN2m1AxTUlpYT3oVL4c5iGKVzB4NADA5tr9WoE9t1rBdmoHUj3iVI04ebaj+rNW68yBVksAtCyOYeOMFGgdxO+y6zfT/g==;7:A2WA+RQ7HqbAvNvNMdRASdjP2q+3AuCok7MBz9wBeNp4/edzZIj1sfiv168Qo7J2XNpJEath+pfOD7oanR28fMCZ7kN2NQ0s+G14qYjSmzoNtCOwNFzumTVMqr7KdZgpViuhHD1K17ncX+WjBTenkQ== x-ms-office365-filtering-correlation-id: d702bcee-bddf-4aab-2944-08d68b39bcc0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(4744005)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: xFXDPA6VNtzNQ6GDD3k94IehhWctQwbutSJvi+2+4jbVBVka7AWsvoBrEkRbVgGTtnlDpYRaLNG0KHoUiw4FlIBZLysADlsdvsdx9Jtvqe/wiMAP5uWHXEqrc6g0oyOOuuIrRpQGFZG1txtzfHTH4LDxx6UjNPI4kFFhoZAzbjRXuhVDYHGKvzFEwybLpShXvRx6iKCe5SbOzQdFjNn1g53g0uuAuD7BHjbmJwousK3p28+HuYmRhDrUsfFFklbS1VfdM0pk1o6pALNJwmTCdUAdswClDznz6jn83uMIglsktErzQsKSHQypVfaUTbUqRRm2yg/QEZSNdH8UDa7huMw0lx+WPs381FUA+2zi9jzWT1hgp0QQgjl/0T7cp//B6jdV1vYmUsBT7XzceGUkx+6qU/E+szH/LU/SLuKuMdY= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d702bcee-bddf-4aab-2944-08d68b39bcc0 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:39.7098 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Use random number to assign to cookie value. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f719b74..98121ec 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -1252,7 +1252,7 @@ static int mgmt_tx(struct wiphy *wiphy, u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(priv->p2p.local_random); int ret = 0; - *cookie = (unsigned long)buf; + *cookie = prandom_u32(); priv->tx_cookie = *cookie; mgmt = (const struct ieee80211_mgmt *)buf; From patchwork Tue Feb 5 07:15:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796959 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 2E37C922 for ; Tue, 5 Feb 2019 07:15:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 167C42B520 for ; Tue, 5 Feb 2019 07:15:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A8912B5C9; Tue, 5 Feb 2019 07:15:51 +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 7BAD72B520 for ; Tue, 5 Feb 2019 07:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbfBEHPt (ORCPT ); Tue, 5 Feb 2019 02:15:49 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:39559 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHPt (ORCPT ); Tue, 5 Feb 2019 02:15:49 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="26155322" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:15:48 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:48 -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=P/+aU0HVV/cWS60AnnXabj+rfGTyhh/ZyFOZjYXq8Vw=; b=2mD6cfcuIgkoM8KpTlKdz6gHorXJ3/4/3GslS30z/7mzAITJlrRoxqSBvZ4T98moCXsDWuBMjirLKlt8kFYNp3wNJ7usiPVWC8432+RLBtQOYchbZhDs5iVp7MwBj2W7nqaB1mYSDaIhjq4iDIzVMers4MaaF12RYDgcaa+mcYE= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:46 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:46 +0000 From: To: CC: , , , , Subject: [PATCH 05/12] staging: wilc1000: avoid use of interface names for validation Thread-Topic: [PATCH 05/12] staging: wilc1000: avoid use of interface names for validation Thread-Index: AQHUvSKduSYTQ4cmgkSeAf1fJ4XsDg== Date: Tue, 5 Feb 2019 07:15:46 +0000 Message-ID: <1549350913-645-6-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:MyfWzGiDuHXSUh714T0A08S4UIqI8u394lu0ktTsa4GcuncDxDaNd2sbgPHmmHCxqAwme9RAhaQ1OD8H8uj4Jzplnx9Mtt3LWRy/6nBErUi0EPEWrcH5fNVVoIUqqsiaVb7gxw0wssUwYloDckwiVn7Olwhr2qS1JtaiYT4vfWmhoyUa31W1nRbnVz6HnzGoictjRg+Wj2EV42V4GvlbaDPVnuwgLx9CeipwqiTCekEP1Bl6E3fDDNGfquPmfjjNvX3JHgOxPop3kPLGdfI0aXVZYV/4Twd8d8fLhN+/kw4FFM8svVJOU9mvACc7YEjv1VjzZV+WbtVBBWf36WJm5gXx0MnZkUWyL7dxQi+wu6mY2UrDZinNiaMEVfBO8w0VbfpYUAmezL6otFPrOEsC1qr0HRaMalbbHW16oqogPKb50FlOHdHXi+tBfF+NbAp9s559bTbSW8q2wGbYvLHo1Q==;5:UO550/eDw6H50LSsYCX6LOuGprEjMS2p8LmyN3FNnLhHME5yAkrfVQahtHwfJryXjL8tmUC+O7AAiaIGxGissdL3hxflkguC2zn3zyHI1odWYEndkOYHs1Im0NHKXmEEERTR5Gd8yuy2vyeXAHdKq6iuclK17DRnkaIdIMmY1q1K9AldpZ+fkPx0OTpERITa3BQSeJARqmZ/TSC8YvWPag==;7:UwkU71nCIQHHLULkYIod59u60Mu3/+aJyaSMuLWqwaoK9KlKfSyprbScEx31U7rNuT7TJ0Qyh6+qRWwz2WKlu6cbg+CFyeCsyxromkIzO3D439py4+ywSuuEtp9Q7LCifoZqBWj+JcepteMwR/eGcQ== x-ms-office365-filtering-correlation-id: f67be220-0b18-4995-5544-08d68b39bf0c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 4qFIWtu1L+2VRahS7hn7NP5twPiuZ6KgwKQVL84ow2N0/HVCWzncP6kIjmA5uj+MaL4rp+DXst/4OduqnIzseryW/OvzOADYEikH4IaWJYUVsUicSv4fW0zuCVRekb0amg0r/Y4yfRUW6vteVw3m0rR22u66+hCFKccN/I2jPW5Cy8P3J5YR10M93sI98EfR/PVdBAmg6nRahKjAt6eiwv2LYUIRLF13d7f7ZEY7cFpoSAXPRmKHqcbAXkm+79zXAvipRKVpP2Vnxk5Sk75b4ZqL/xkq/NLNDOzOV6GHocL4nXyyJMYVGhQudHdlTak+ZPcUnjWrIgCX064vGeYXtx2sSg+mNoJPKUn5buO7vkZEX62ab1ta30HUYzsTFjqrdKLOvlzILh4wNWtZ+KD8gxBfYu8ilXrDMT1TR48eWRM= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: f67be220-0b18-4995-5544-08d68b39bf0c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:42.4466 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Avoid use of interface name i.e 'wlan0' & 'p2p0' to check the interface type in dev_state_ev_handler(). Now making use of netdev_ops and iface type to know interface. Reorder the functions to avoid the forward declaration after the above changes Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 144 +++++++++++++++++----------------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 86a38f1..56272b3 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -12,71 +12,6 @@ #include "wilc_wfi_cfgoperations.h" -static int dev_state_ev_handler(struct notifier_block *this, - unsigned long event, void *ptr) -{ - struct in_ifaddr *dev_iface = ptr; - struct wilc_priv *priv; - struct host_if_drv *hif_drv; - struct net_device *dev; - struct wilc_vif *vif; - char wlan_dev_name[5] = "wlan0"; - - if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) - return NOTIFY_DONE; - - if (memcmp(dev_iface->ifa_label, "wlan0", 5) && - memcmp(dev_iface->ifa_label, "p2p0", 4)) - return NOTIFY_DONE; - - dev = (struct net_device *)dev_iface->ifa_dev->dev; - if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) - return NOTIFY_DONE; - - priv = wiphy_priv(dev->ieee80211_ptr->wiphy); - if (!priv) - return NOTIFY_DONE; - - hif_drv = (struct host_if_drv *)priv->hif_drv; - vif = netdev_priv(dev); - if (!vif || !hif_drv) - return NOTIFY_DONE; - - switch (event) { - case NETDEV_UP: - if (vif->iftype == WILC_STATION_MODE || - vif->iftype == WILC_CLIENT_MODE) { - hif_drv->ifc_up = 1; - vif->obtaining_ip = false; - del_timer(&vif->during_ip_timer); - } - - if (vif->wilc->enable_ps) - wilc_set_power_mgmt(vif, 1, 0); - - break; - - case NETDEV_DOWN: - if (vif->iftype == WILC_STATION_MODE || - vif->iftype == WILC_CLIENT_MODE) { - hif_drv->ifc_up = 0; - vif->obtaining_ip = false; - } - - if (memcmp(dev_iface->ifa_label, wlan_dev_name, 5) == 0) - wilc_set_power_mgmt(vif, 0, 0); - - wilc_resolve_disconnect_aberration(vif); - - break; - - default: - break; - } - - return NOTIFY_DONE; -} - static irqreturn_t isr_uh_routine(int irq, void *user_data) { struct net_device *dev = user_data; @@ -921,6 +856,76 @@ void wilc_wfi_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size) wilc_wfi_p2p_rx(wilc->vif[1]->ndev, buff, size); } +static const struct net_device_ops wilc_netdev_ops = { + .ndo_init = mac_init_fn, + .ndo_open = wilc_mac_open, + .ndo_stop = wilc_mac_close, + .ndo_start_xmit = wilc_mac_xmit, + .ndo_get_stats = mac_stats, + .ndo_set_rx_mode = wilc_set_multicast_list, +}; + +static int dev_state_ev_handler(struct notifier_block *this, + unsigned long event, void *ptr) +{ + struct in_ifaddr *dev_iface = ptr; + struct wilc_priv *priv; + struct host_if_drv *hif_drv; + struct net_device *dev; + struct wilc_vif *vif; + + if (!dev_iface || !dev_iface->ifa_dev || !dev_iface->ifa_dev->dev) + return NOTIFY_DONE; + + dev = (struct net_device *)dev_iface->ifa_dev->dev; + if (dev->netdev_ops != &wilc_netdev_ops) + return NOTIFY_DONE; + + if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) + return NOTIFY_DONE; + + priv = wiphy_priv(dev->ieee80211_ptr->wiphy); + if (!priv) + return NOTIFY_DONE; + + hif_drv = (struct host_if_drv *)priv->hif_drv; + vif = netdev_priv(dev); + if (!vif || !hif_drv) + return NOTIFY_DONE; + + switch (event) { + case NETDEV_UP: + if (vif->iftype == WILC_STATION_MODE || + vif->iftype == WILC_CLIENT_MODE) { + hif_drv->ifc_up = 1; + vif->obtaining_ip = false; + del_timer(&vif->during_ip_timer); + } + + if (vif->wilc->enable_ps) + wilc_set_power_mgmt(vif, 1, 0); + + break; + + case NETDEV_DOWN: + if (vif->iftype == WILC_STATION_MODE || + vif->iftype == WILC_CLIENT_MODE) { + hif_drv->ifc_up = 0; + vif->obtaining_ip = false; + wilc_set_power_mgmt(vif, 0, 0); + } + + wilc_resolve_disconnect_aberration(vif); + + break; + + default: + break; + } + + return NOTIFY_DONE; +} + static struct notifier_block g_dev_notifier = { .notifier_call = dev_state_ev_handler }; @@ -957,15 +962,6 @@ void wilc_netdev_cleanup(struct wilc *wilc) } EXPORT_SYMBOL_GPL(wilc_netdev_cleanup); -static const struct net_device_ops wilc_netdev_ops = { - .ndo_init = mac_init_fn, - .ndo_open = wilc_mac_open, - .ndo_stop = wilc_mac_close, - .ndo_start_xmit = wilc_mac_xmit, - .ndo_get_stats = mac_stats, - .ndo_set_rx_mode = wilc_set_multicast_list, -}; - int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type, const struct wilc_hif_func *ops) { From patchwork Tue Feb 5 07:15:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796961 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 25AD113B5 for ; Tue, 5 Feb 2019 07:15:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EAB52B520 for ; Tue, 5 Feb 2019 07:15:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 030362B5C9; Tue, 5 Feb 2019 07:15:52 +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 A14902B520 for ; Tue, 5 Feb 2019 07:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727337AbfBEHPv (ORCPT ); Tue, 5 Feb 2019 02:15:51 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:40026 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHPv (ORCPT ); Tue, 5 Feb 2019 02:15:51 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="25864249" 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; 05 Feb 2019 00:15:50 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:50 -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=k074ym7KmObrCIsuMvbBa3oFwhGPtudy9pakRN5sfpw=; b=bxXqHD//MvwLreLh1zUUyQEYDBSTTytT9Qg4AIqJF1nh1q3Eo7PShC6DYKOUIJTu2crnJk96xqyld0WSKdyNnVikQ8/Q07xjCd57WuWNqqUUJiybJme5Nu+sQatmDZKQIBdhE1CXLCbwy82cS6HCyiBI8KQWBGBNaTGY+ABrXLQ= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2984.namprd11.prod.outlook.com (20.177.224.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:48 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:48 +0000 From: To: CC: , , , , Subject: [PATCH 06/12] staging: wilc1000: add check before performing operation on net_device Thread-Topic: [PATCH 06/12] staging: wilc1000: add check before performing operation on net_device Thread-Index: AQHUvSKexLDCLg1O/kCWQYxf7/PrOQ== Date: Tue, 5 Feb 2019 07:15:48 +0000 Message-ID: <1549350913-645-7-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2984;6:3CZCu1eBgYksDPjIMrK23CYszQPS7LCKUcyGRhvSAMdq6Eqkj/UmcHLAz41LyqVWrYTvIHlqkYcpQduihNQMz4PMBAtQICEn/ytRdnaUeqa2B5Opj5mNZEhwBh2UTxZ8eD4S0zAA5X5JCLTN0lMNNCDQFaphMOaOrrkMc/uwScWLCawQZeWeFHeXCyPYaFG6/RWX1lPAFropa71pL7S+CYAdieJRHfLLe98XxcAGtTvhWxfBObH/wd51Qk8y6Gdfdg1UvR2MexVbvFo3iU/BHBTUbt9zG/CeW+xmAR2Fe5SPH0/L4IJLcdcH75otQZb2vFzPv0EIAVwxOXiY2SU+f8vJeCJ34oqFj3tYVmCHZc1OHuQCBYiVtnp7lD2DrHYPGQ/sLp+dfSCTIxeM+FtfhKCGLta1NnkMlnU69P0ix1EEHglLSaxIOr4IE4J8A1cMl1nW33RSak/qCUMc3LoffQ==;5:v/x/RBlRfp3aMIt+OdVDUYl1jH9kR6qJSPiUcbqoDhSY6OnfjQqEPlcWtYs73QMP0JBbeRE9HVuYYe5RRqcmEdS+ZlpTVOnQYTw1/s4I2fNA/CGUGuemamdFsXGD6ptW8tH5brCPxMhimzMwj+p1zfeG59Pwas7xVfwzhpXI28wIJqXokRZk9FX7toxbM4on8o02bTXLi+zzKy42uojyfw==;7:8awTMcb6Vrma/xrdTn0iiHO4rylZvJpNdDXhkpBiw8fsk4YWcaz02D61nsZ2LO+5BU4YS8JJn6AmbcmS4MhkNT66nYl6yzStpJgoAY22fGrYL07Y6sDxVwAPmZW9dajZvjyOGzHpUnLJ0dYyk8c49w== x-ms-office365-filtering-correlation-id: 6edd0b62-f940-427c-cf1d-08d68b39c0de x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2984; x-ms-traffictypediagnostic: BYAPR11MB2984: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(376002)(396003)(346002)(136003)(199004)(189003)(4326008)(36756003)(386003)(6116002)(3846002)(102836004)(14454004)(68736007)(97736004)(11346002)(78486014)(316002)(2351001)(5640700003)(478600001)(25786009)(6436002)(53936002)(71190400001)(26005)(71200400001)(6486002)(106356001)(72206003)(6916009)(446003)(8676002)(105586002)(305945005)(6512007)(186003)(6506007)(7736002)(486006)(476003)(66066001)(2616005)(8936002)(107886003)(52116002)(81166006)(81156014)(76176011)(2501003)(50226002)(256004)(14444005)(99286004)(54906003)(2906002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2984;H:BYAPR11MB2567.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6AyXDrvr2yj9tADXZz7jjZ5a1NnGiHxdS1gpzPmXptB3DOHK3wHKDWcEloWwbpfPx/M7iXMStvpQM5sJ/5GWjl7k6sGqczH41N4zwLf0MHpnKjAA13DKNML0qNbfUElkLAb4NOv0vVQgX7PJy3FGZ46EAL0ySaoA+VohMQGrK8Mg04SEGTRkYXWXxnbRSLxi3aV+GUjN8Mmt5ELkrau9OEVB+fZt1IjK6IZqU1JksLoiJKEi6orJT1dOUX/U6rUs/snyy3oSea2fo+eH9pu8Sat6UAvNIGF/CD82s2Oid0PrPMIRICGfNpvqQP7FXXNHX4sMmC3CUBZHiZjol8m7Nq+ciGbekAcnZjafuX3B/uIpu59usoBQy+m3juoYpGSI7YJxmGX+3ZiIUEuBG05SeCC2g0aC9l30brA0zFEQGvo= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 6edd0b62-f940-427c-cf1d-08d68b39c0de X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:46.5164 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2984 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: Ajay Singh Before calling an operation on net_device check if that interface is available. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_wlan.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 56272b3..f096f9e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -159,9 +159,11 @@ static int linux_wlan_txq_task(void *vp) do { ret = wilc_wlan_handle_txq(dev, &txq_count); if (txq_count < FLOW_CONTROL_LOWER_THRESHOLD) { - if (netif_queue_stopped(wl->vif[0]->ndev)) + if (wl->vif[0]->mac_opened && + netif_queue_stopped(wl->vif[0]->ndev)) netif_wake_queue(wl->vif[0]->ndev); - if (netif_queue_stopped(wl->vif[1]->ndev)) + if (wl->vif[1]->mac_opened && + netif_queue_stopped(wl->vif[1]->ndev)) netif_wake_queue(wl->vif[1]->ndev); } } while (ret == -ENOBUFS && !wl->close); @@ -761,8 +763,10 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) linux_wlan_tx_complete); if (queue_count > FLOW_CONTROL_UPPER_THRESHOLD) { - netif_stop_queue(wilc->vif[0]->ndev); - netif_stop_queue(wilc->vif[1]->ndev); + if (wilc->vif[0]->mac_opened) + netif_stop_queue(wilc->vif[0]->ndev); + if (wilc->vif[1]->mac_opened) + netif_stop_queue(wilc->vif[1]->ndev); } return 0; From patchwork Tue Feb 5 07:15:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796963 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 0E0A6922 for ; Tue, 5 Feb 2019 07:15:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77FE2B520 for ; Tue, 5 Feb 2019 07:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D85652B5C9; Tue, 5 Feb 2019 07:15:55 +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 89E3E2B520 for ; Tue, 5 Feb 2019 07:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727346AbfBEHPy (ORCPT ); Tue, 5 Feb 2019 02:15:54 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:18918 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHPy (ORCPT ); Tue, 5 Feb 2019 02:15:54 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="27292481" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:15:53 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.49) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:53 -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=gdvtgetk+wRTZgdewoJhpaIeSsbqUcri9L7kv32NukA=; b=d7kjfZpjW06lwY/56HFv91Jss13FhJPIHn07MsnyUgAloBh8J/Bfa5n9zVjGdhXIbYj24iTPgQcyOuysdWGuat+9isV8wc0M/OKNBLI+EuVB2bYx9/iy7DHwBrfeeJCfMEdzfJ3X5mn+n/cf5qOknetk/i+uAQ4tPv3KRj3QZr4= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:51 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:51 +0000 From: To: CC: , , , , Subject: [PATCH 07/12] staging: wilc1000: remove unused struct 'add_sta_param' Thread-Topic: [PATCH 07/12] staging: wilc1000: remove unused struct 'add_sta_param' Thread-Index: AQHUvSKgza2kxws0nEuC2mBx7THKEg== Date: Tue, 5 Feb 2019 07:15:51 +0000 Message-ID: <1549350913-645-8-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:xQ3N5rPIatlD/zpDngT2xxH/1+cZsW4+zDs0sjJQBPaK3ra/QRNMWu/2107HZXDNgbUHJ3gKrbtEnjFURjnqSJX2u8OAPKxXc8bG3DJLmhBuFtY3z6sA1tc9A8g8yOYzTkfuih9dow1P1ngVt79+G3yTTdnVML2nO5+76E7j+NwOBjCVXP92zD478yPlOFA8z48cDdOEh9SmUlYttFNEm/1sZ1fj+YC1MraFIDBHeYTGhC8IxwpiC4rMmyikE+5Y1lTF/Jgv0niWnQglI0iUXy1gJ+JqYYpnrwO8ROeiW2IgDWirDuggVQSVY+jMwExCtHRkvQ1QpxcpK63qxHFZkNfVxsAhs1TmqZsj8GoFborD0mge35uc7NqTLB7ksZxgOX5l5eBBXn7EOqnqcIptkpXAwSKy1etpSu6glkQiLEDnr8wvY6/tJZZtDfFRnxE1CqTAhMmEOAD925P+LE7yVg==;5:Dg0JHLtqbYv/9a/4RgXuxcDanfPx6fYsM3upUs3rfMKfFXGP6z2RKtwhb69CY3c3KdclpuHEoO5PifS4BBSTk6c1c8czwfLpLVKSMiG7bnMTaE4BiyDb2i6b44KortNuJ2FV4q0U/ilcU56bLy8RhjzImyMcb3UdvfmrLbwveFlT6BcKUn2rwMQx0SaUD11jS2jG5Km1Trf638HhBVX0cw==;7:GroXy5iUkBNYoJCdNJaPVTILdVHZY4UnYUg4+ea5SDYji2KLCkHr4rfa/A6dHvqwE3iZ/siCF/7uIW9INaUXvaQ6E97DZBbacjQCx1KaU9ih5H+dqIj8R/LbC8H31IZ9t82Tb429XwP4UZ7Wnjj+lA== x-ms-office365-filtering-correlation-id: 4fc0af4a-a3a9-43a9-659e-08d68b39c265 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(4744005)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ypShLWwcu6+oZbteMF5Up6xD+lDpmLHw7mgs+qE0I4T4KTNVVfC0ICyUyTEWcU1Linr6E9SRdVCpnqSAuKu3s2uO0XiF8juDdiDKxsEiSwnt9326AsT6Mi2LMopp2l9R3Vfw1u8T5I9KBViCUQglAgkrYP8/sD/t1eg+Eszj8VU5WWrNLsG4YZZiVz9GxuJ5cc6iKdqLDgFU0+F2WH8S6TJzQ/0NKjRpNOzL80JThG6Wb9jin2e15S9Vl9qhCSB2GOP3WLVdEz4w2/ujL+Vvxt6fG+uLk03VR2AHQqOmgT8eC3HSoJwQMCH2iQyzf92I5tou58ElSfbjTSmdSoiYiEpsxNZAlrrFpdiaVtsUCNSqhCuCVpPYHMgxsTGpKmPjXemIqkfv/2v4VBtkX6YDVSP8rjq+dxS9IeYzzlIzp9s= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 4fc0af4a-a3a9-43a9-659e-08d68b39c265 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:49.1342 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Remove 'add_sta_param' structure as its not used now. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index 994e641..790f83e 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -170,17 +170,6 @@ struct host_if_drv { u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE]; }; -struct add_sta_param { - u8 bssid[ETH_ALEN]; - u16 aid; - u8 rates_len; - const u8 *rates; - bool ht_supported; - struct ieee80211_ht_cap ht_capa; - u16 flags_mask; - u16 flags_set; -}; - struct wilc_vif; int wilc_remove_wep_key(struct wilc_vif *vif, u8 index); int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index); From patchwork Tue Feb 5 07:15:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796965 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 29633922 for ; Tue, 5 Feb 2019 07:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 121152B520 for ; Tue, 5 Feb 2019 07:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 066FC2B5C9; Tue, 5 Feb 2019 07:15:59 +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 87F672B520 for ; Tue, 5 Feb 2019 07:15:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727432AbfBEHP5 (ORCPT ); Tue, 5 Feb 2019 02:15:57 -0500 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:43453 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHP5 (ORCPT ); Tue, 5 Feb 2019 02:15:57 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="23448477" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:15:56 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:55 -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=zn5xndLfNGTBiR3+TmhFWF53CClglaWArdwMLOzoXRo=; b=gBBsF6cGI4sajYtFEG0n2jIOjVryfltKkBXaeJtaeJGlL8gYe/QzpkfKIZdPOPqKIriXGjg+y5IKaYyYUt5pdOuYIpKEsJzExiNmKdHFVdMaNwQ82hquW48QEXqVaXvskcwC81jAutRMmn03gqHU3T21qhWrf3PC7H5n45BCqps= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:54 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:54 +0000 From: To: CC: , , , , Subject: [PATCH 08/12] staging: wilc1000: avoid use of 'hif_deinit_lock' static variable Thread-Topic: [PATCH 08/12] staging: wilc1000: avoid use of 'hif_deinit_lock' static variable Thread-Index: AQHUvSKhAfibxsZJjE2drSj0RpW/gQ== Date: Tue, 5 Feb 2019 07:15:54 +0000 Message-ID: <1549350913-645-9-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:/Wl+TYtFkZc++kVP3dL9oYfj6lOnYKz1k42jrCLPd8U0bsdS1kbJK/MBl1qkRkbPd00gpjh7AQqG5Etu3V7TtwzzXS/n8cr70t4vSpuAW6le2F2EDZvfbaRhHut8Xy4CpWG8okMVcc8VV6hWXUoLRWcSJlMFM+P0vngARYGgrvUXmziY3grgjzBtDa8z8i8sovWTcaA+w0uqylZzb8OW3LtsGJjzWUWpQMA1GCiyJ2bGukQsGdC0IAExfdItZOgAyFNuXq7JzCOsTAJ3TrCLKrBw0UuGtRU/HnkoscboAVOtQqW+O4HgnXIJt+rz2GEcJPAjjQFOeJmt4LLtmJKtNSuh5z63k1OO9XWRbK2NMpy6NDvXTp9nYi9pSSBR/c/qNDBswUl5QqLow2RJfqKHHyndMRpvGZWKNq5QzfPIWDa+jh08kPHalEu4V80fDp074viRKPvJF6XxOs8wmPj20A==;5:X1ybOOKWPuoPwArfaAYlySX2KGAKTZYP2yG/a/POwGKNRKEv+4tmcQo23l5hD7YQSkhariQ7fHkUF8hrbK0p3C5p5iWiugNuAj3xiiW8VdYKcmvtN+M31Je8Z+82bwUqcQWg7E3z2tYeIMpMy25gdyG1eoUblCv5yoiLCkTqVj4WRPYSAUMb2wE6Myc7ImxkHo2CEr0cZwpjN65ZRXJk+w==;7:JFqNVI0dvaHkoNqWA9rLHaPIEW7ddNXX8f1uOoJ3yXaYhjFPRfPyLwUNPfXV9cJivFZpLg0DQ8+C7jpahJTG5p3SH9N2YlCqrBvi2aHgnvxh1wu7uPA+FMbKHWXbt0ImLgVxL+C+V+E0AMCDGv8jSg== x-ms-office365-filtering-correlation-id: 5f6af578-0f81-48f5-1d90-08d68b39c42c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(14444005)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: fyf5kMzhCnFKaZSCXPl/cLsRZFg9OmZ5b7TgHFP3HvIhT7Bul3Fx1B8p05TZ8A3Dgcebb5RWQsD0bWhbxLJr4UE05Yp/KESI7cIIthPNtupd04bnNmnaZ4ezP7gFGQgXb/o7yeGAiuLkUeOStE2MQyQ0x2ZPEXVyItCDwdCnr0phd4ZniOtcFTT4gsspDFEa3ucmPeiKTR3GVCipeEzD3yZV5SDUhUEWZtRHjHiMIGRX/xp5XsifJ1GsW9SMucLWHpK7bmYs+u8otm9KfC9Yg+8DshE9O21ie4ImVJ3kTpGJ0aC9FVevHUYWiXT+WIzOUMyrslPPHUnWKgJhmItEc+X+Eqml8/2CcV0q3zTeSAuV+3yRwj1SjzYv9FkZnEhJRvq0ZgnoB1RQlTkB6gBK/VpDbUpBZjztXMMS/vei/Xk= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5f6af578-0f81-48f5-1d90-08d68b39c42c X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:51.9281 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Avoid use of static variable 'hif_deinit_lock' and move it as part of wilc struct. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/host_interface.c | 20 +++++++++----------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 ++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 115b6f25..0fb6ca3 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -130,8 +130,6 @@ struct wilc_join_bss_param { }; } __packed; -static struct mutex hif_deinit_lock; - /* 'msg' should be free by the caller for syc */ static struct host_if_msg* wilc_alloc_work(struct wilc_vif *vif, void (*work_fun)(struct work_struct *), @@ -1645,7 +1643,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) vif->obtaining_ip = false; if (wilc->clients_count == 0) - mutex_init(&hif_deinit_lock); + mutex_init(&wilc->deinit_lock); timer_setup(&vif->periodic_rssi, get_periodic_rssi, 0); mod_timer(&vif->periodic_rssi, jiffies + msecs_to_jiffies(5000)); @@ -1673,7 +1671,7 @@ int wilc_deinit(struct wilc_vif *vif) return -EFAULT; } - mutex_lock(&hif_deinit_lock); + mutex_lock(&vif->wilc->deinit_lock); del_timer_sync(&hif_drv->scan_timer); del_timer_sync(&hif_drv->connect_timer); @@ -1693,7 +1691,7 @@ int wilc_deinit(struct wilc_vif *vif) kfree(hif_drv); vif->hif_drv = NULL; vif->wilc->clients_count--; - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&vif->wilc->deinit_lock); return result; } @@ -1746,31 +1744,31 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) struct host_if_drv *hif_drv; struct wilc_vif *vif; - mutex_lock(&hif_deinit_lock); + mutex_lock(&wilc->deinit_lock); id = get_unaligned_le32(&buffer[length - 4]); vif = wilc_get_vif_from_idx(wilc, id); if (!vif) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->deinit_lock); return; } hif_drv = vif->hif_drv; if (!hif_drv) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->deinit_lock); return; } if (!hif_drv->conn_info.conn_result) { netdev_err(vif->ndev, "%s: conn_result is NULL\n", __func__); - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->deinit_lock); return; } msg = wilc_alloc_work(vif, handle_rcvd_gnrl_async_info, false); if (IS_ERR(msg)) { - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->deinit_lock); return; } @@ -1781,7 +1779,7 @@ void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length) kfree(msg); } - mutex_unlock(&hif_deinit_lock); + mutex_unlock(&wilc->deinit_lock); } void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length) diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index a06b0c0..3a78ffd 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -271,6 +271,8 @@ struct wilc { struct wilc_cfg cfg; void *bus_data; struct net_device *monitor_dev; + /* deinit lock */ + struct mutex deinit_lock; }; struct wilc_wfi_mon_priv { From patchwork Tue Feb 5 07:15:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796967 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 E3866922 for ; Tue, 5 Feb 2019 07:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCD912B520 for ; Tue, 5 Feb 2019 07:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0C272B5C9; Tue, 5 Feb 2019 07:16:00 +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 685A72B520 for ; Tue, 5 Feb 2019 07:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727470AbfBEHP7 (ORCPT ); Tue, 5 Feb 2019 02:15:59 -0500 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:39565 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHP7 (ORCPT ); Tue, 5 Feb 2019 02:15:59 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="26155325" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:15:58 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:15:58 -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=EZQ2PNe3meXnWl0hNKgkqckL+NNFHJaVhcYVkmnwYeM=; b=GHG4SCtJnCCkELgjFDG78q39ty5p7pIuVd+mlVrm6whZL2hJ5TnXR04nZIK3iadjff85Qn2aciWpfEX5JnNIYv55Cpl/NPUhPTNgBB+wv/6FAzowHA7S08yXRX+MVH7szUlf8orJAg+IoU92ZUJ8z8d1PIV5NuFg5B0eB5dLphI= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2982.namprd11.prod.outlook.com (20.177.224.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:57 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:57 +0000 From: To: CC: , , , , Subject: [PATCH 09/12] staging: wilc1000: avoid use of static variable in linux_mon.c Thread-Topic: [PATCH 09/12] staging: wilc1000: avoid use of static variable in linux_mon.c Thread-Index: AQHUvSKjXIoZopQ6pUaZdt1u8kkEDQ== Date: Tue, 5 Feb 2019 07:15:56 +0000 Message-ID: <1549350913-645-10-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2982;6:dRGgzpkC3bp2trmutTLn8HjSxqr2CLik9BvBpzyiRR9LJvu+1w/n858TgBiiFuio4YKiV/ICDpDYxsfek7fZj1DlgKfMQkWQwhNyh2OtLyi95Dby9YE4+JkUt5oM6CQlIg+kLH4zI6jIzwJr/ftkhg5mmT6n5je8J9RyOG4kVhqGmOu9Jf30VtYa8w4C2D5Ld7VKgvhsMvm1irH6oNegS6JdF2GwZUN6fCSysVNmdCh3eos1eQtS7Y/qq6qFh1axGZ3/TboTxM295w1JjZluK3dHx9kz7ov46ZybMonlumnl/6BGMGZoD1WdLRRGrUokvrMP2LTZ2xCxwoAiikv3QnhU4TW+9KrBihqqtzRUpFY2zKEyDATUdrjkD6c1Qj5lzRaR0WSI3r1mT9HrPCHdtKJdqZqE4G/+WUZgjf1K+netyscCOBmo9jmxhkRevdb1fclaD4dSgQ4YaQpuNesJVQ==;5:p5gRHF2XfV+EEEANan0Kj9r5ALEHNkukI0Eu17z0g4cY8radNLdnIw110Dwf8zr7qII8XEHxBGMMNh0roOsh8aPF2LnCNpwKMkkArmFFk61aiv9lsuWOY84x48zYKJ7SecAX2zZRxvy3AaTTEBFDm5XRLgLZgR00GruLgcAWS2nCoj/fdAIQk6OwvtICujic5l34vG38fA6sTic7+t7L3w==;7:pd2YKca3tcixOnCoDZuXARy7CQNKwsZSlTC3At2fJTGOZfU2IjMIYkzj+27IAmv2Bpt96cSe4JZBvzGpeZu3BH2lO970tehEC2XsrLrNaNxFhbd6cFTdLtOO7fZDlzf8bK4fvx83hjKnm+J6xtuvbg== x-ms-office365-filtering-correlation-id: 42ccfa08-7e5f-418c-bc5e-08d68b39c5c2 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2982; x-ms-traffictypediagnostic: BYAPR11MB2982: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(39860400002)(346002)(376002)(366004)(396003)(189003)(199004)(478600001)(36756003)(305945005)(102836004)(6486002)(81156014)(76176011)(81166006)(71190400001)(5640700003)(6436002)(186003)(14454004)(99286004)(52116002)(11346002)(386003)(446003)(26005)(2616005)(476003)(256004)(8676002)(6512007)(316002)(6506007)(2906002)(53936002)(54906003)(3846002)(4326008)(25786009)(2351001)(106356001)(6116002)(7736002)(486006)(86362001)(2501003)(68736007)(50226002)(66066001)(97736004)(107886003)(105586002)(72206003)(78486014)(71200400001)(8936002)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2982;H:BYAPR11MB2567.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: YtO5+j88maiKkvT9qVke5QzaqJZ3Tb/VM4bu1CWbZR73Qb4XkHDjFra+OlfOzQQSdb5K97dTnq5Vi2PdxcvFOfhT8Bn7vHg9m7P/5xx7bfDfV0N99pfMESgsKU1t4amwNr9dj23WLW/vZiXL8nksNnEajeY72BmgXREzgaA6LrRlf5bRX5OkBKuggEw7rdGGEKaFrWf1JrkOZvAv3YJ0wuxBN0aqRScTtZmzvZcqOraZIXYbDQELOQhXQjkDYodeS+WgpIMzteTRXPq7hIPH9pztdKHITkl+YrzA5Tn0Ber7E1GpIDMBuk9RmJEzcCVvZEXmfQGu5s3eK4iBOvnUQFqHRW+IYB6MeX/pP/zi9rSh7wmKTVRwQa+/gWQdgxeXXqwqjW/JcL28Pvl1zw1qojSpiVnGV1O2n1d4uHhvejE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 42ccfa08-7e5f-418c-bc5e-08d68b39c5c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:54.7331 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2982 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: Ajay Singh Define local variable for 'srcadd' & 'bssid' static variables and use ether_addr_copy() to copy value into them. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/linux_mon.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index ce37b6f..9fe19a3 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -18,9 +18,6 @@ struct wilc_wfi_radiotap_cb_hdr { u16 tx_flags; } __packed; -static u8 srcadd[6]; -static u8 bssid[6]; - #define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) | \ (1 << IEEE80211_RADIOTAP_TX_FLAGS)) @@ -150,6 +147,8 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb, struct wilc_wfi_mon_priv *mon_priv; struct sk_buff *skb2; struct wilc_wfi_radiotap_cb_hdr *cb_hdr; + u8 srcadd[ETH_ALEN]; + u8 bssid[ETH_ALEN]; mon_priv = netdev_priv(dev); if (!mon_priv) @@ -193,8 +192,8 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb, } skb->dev = mon_priv->real_ndev; - memcpy(srcadd, &skb->data[10], 6); - memcpy(bssid, &skb->data[16], 6); + ether_addr_copy(srcadd, &skb->data[10]); + ether_addr_copy(bssid, &skb->data[16]); /* * Identify if data or mgmt packet, if source address and bssid * fields are equal send it to mgmt frames handler From patchwork Tue Feb 5 07:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796969 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 7399E13B5 for ; Tue, 5 Feb 2019 07:16:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B19D2B520 for ; Tue, 5 Feb 2019 07:16:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F5732B5C9; Tue, 5 Feb 2019 07:16:04 +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 B4DB62B520 for ; Tue, 5 Feb 2019 07:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727503AbfBEHQD (ORCPT ); Tue, 5 Feb 2019 02:16:03 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:40034 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHQC (ORCPT ); Tue, 5 Feb 2019 02:16:02 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="25864257" 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; 05 Feb 2019 00:16:01 -0700 Received: from NAM05-CO1-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 5 Feb 2019 00:16:01 -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=8wfKAu+ZdM7SyuK7O1msKomwsm1BhYEtmQIA6zvyzPo=; b=Jis1zP+ljEOabUxWE6UzGiPqhVtBidkbZ1Wrk07BFJOjCQipmUxfZqdVuhszHroGPT0ap0cFjbr2YbQ2g9B0S9hlRyoQDVPslySrWnvOSnCmuw2a/i05vBMTXQaq8hvVsZJ8P4KiQXCYaqr/O3S5arWz+LRormJHatWcAY3SXiY= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2984.namprd11.prod.outlook.com (20.177.224.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:15:59 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:15:59 +0000 From: To: CC: , , , , Subject: [PATCH 10/12] staging: wilc1000: move static variable 'wlan_channel' to 'wilc' struct Thread-Topic: [PATCH 10/12] staging: wilc1000: move static variable 'wlan_channel' to 'wilc' struct Thread-Index: AQHUvSKlgFsEsEm8ZUaIyW1x7vlBqg== Date: Tue, 5 Feb 2019 07:15:59 +0000 Message-ID: <1549350913-645-11-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2984;6:amTnJ0DTRrwjlY5X3i/DpiULk4Na0bG+AVEfd32W8Tv8Y/Du5QrLCPLFgCegP1EdEJNYuSABBppgbciPBETW7+Y72bu2msO6bbZ4fQaixL9OjbUruuWw+GM6UYVpsZ6UW63X1Qgim8TnCoey+BDmuC8Km1uhvqJnWMHtrxgpTL5iZ3+jpVd/pTuylTo4n5XkcHIKKV7BgoOo8h2lYxNOumLx8lx0CcwlPRtsV87gWRJYkuupMw21KAz5yxMltEJioPUdHZuEIhzxAOYJq/n1dDHWA2bEg6bTcqls2txhAm6VrMfqSsnDMfTus07bJemkbzysDasbRWURAlaMMccZ66SssIGM/2AHeUtGXzNgak5tmyZ79PICO6ah8cklz9eO4WAa37fKtJEU73wsUERjPdO/mF1NAij3p9c2iBgfBf3BqyBfSnxgUkiFjj+Qg4SDMavDVfz8lZT0HwNopvXG1w==;5:Qw8AVMdvcFjg0fIOM8E+ww+xDbWZ0CL00qpYDIJqSOiKmgA6slWIvK1OSo9mfhzEt7VVRaFw37ItgKz71vMWodFQ/PNKpFlv1Ztgw4sMDZuDkWsbVuB92Cl5e2WreccdlxmLuk6/Ni3dU/4sXoMsebUzUO3in8fUPbR4MediWzwZNagydb6TaAEw3u3ppp9z0g4ABWYN4oXC7Uw3VdXT8g==;7:0ioaUvuQqcl0jBp1CLNkup4aCznKXxipD/3e9Be0pa/17QOLXGTfpRQJWC+vCXtAbA//GQpajiNZ8Wv7BORqhfgIWQfx1O6fRUcJEBGvFFsbBg1LopK7bZA5fvsZ5HtdZBeJsTGxH2z9/g/H00WJUA== x-ms-office365-filtering-correlation-id: 2b2f0f46-806e-478b-0886-08d68b39c747 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2984; x-ms-traffictypediagnostic: BYAPR11MB2984: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(376002)(396003)(346002)(136003)(199004)(189003)(4326008)(36756003)(386003)(6116002)(3846002)(102836004)(14454004)(68736007)(97736004)(11346002)(78486014)(316002)(2351001)(5640700003)(478600001)(25786009)(6436002)(53936002)(71190400001)(26005)(71200400001)(6486002)(106356001)(72206003)(6916009)(446003)(8676002)(105586002)(305945005)(6512007)(186003)(6506007)(7736002)(486006)(476003)(66066001)(2616005)(8936002)(107886003)(52116002)(81166006)(81156014)(76176011)(2501003)(50226002)(256004)(14444005)(99286004)(54906003)(2906002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2984;H:BYAPR11MB2567.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: utq6j/k26Fz3+UEtlGSEzXFFJ8wIOtkhQf5Q7zBPGQ/TBgcvMeD1TK7+VbK9ce9zGH66kvQsrQpWNy2NoGO8l6+LFmhRhHpKooEL1chgMDWZbHPgH5sa/3LY55//6tI4bN7xATQ5+OaXaqqzTu6dQOv/ND6+NaetfUeOFNuxNnmChnlCPDzXSWsF7EbvAS3HJqFPAvLSfmnQ7Lir+BqJvT6/YfY+TVbDEZpprqVY/hHUseNftDsf/sTErxHKmlGbOL8HQIjtHI4PhHDLrr3/Hw9Ch3pExDn/hynAUDP7qeAJBzQKrQ41v8tHdIuV0ZbPtYjkRighm8uz3kPdoqq8CYgSZriY0NLpTiX3rO2qOOMkl+wJU54bGG73c2HVEJF6PRiAcBJfyTNur7j2B3jYki5orYSpp/gc9SLKFf6l2+M= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 2b2f0f46-806e-478b-0886-08d68b39c747 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:15:57.2978 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2984 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: Ajay Singh Avoid use of static variable 'wlan_channel' by moving it inside the wilc structure. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 36 ++++++++++++----------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 98121ec..f1ce34f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -67,7 +67,6 @@ struct p2p_mgmt_data { u8 *buff; }; -static u8 wlan_channel = INVALID_CHANNEL; static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; @@ -160,7 +159,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, u8 mac_status, wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE); if (vif->iftype != WILC_CLIENT_MODE) - wlan_channel = INVALID_CHANNEL; + wl->sta_ch = INVALID_CHANNEL; netdev_err(dev, "Unspecified failure\n"); } @@ -186,7 +185,7 @@ static void cfg_connect_result(enum conn_event conn_disconn_evt, u8 mac_status, wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE); if (vif->iftype != WILC_CLIENT_MODE) - wlan_channel = INVALID_CHANNEL; + wl->sta_ch = INVALID_CHANNEL; if (wfi_drv->ifc_up && dev == wl->vif[1]->ndev) reason = 3; @@ -431,7 +430,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, curr_channel = ieee80211_frequency_to_channel(bss->channel->center_freq); if (vif->iftype != WILC_CLIENT_MODE) - wlan_channel = curr_channel; + vif->wilc->sta_ch = curr_channel; wilc_wlan_set_bssid(dev, bss->bssid, WILC_STATION_MODE); @@ -447,7 +446,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, netdev_err(dev, "wilc_set_join_req(): Error\n"); ret = -ENOENT; if (vif->iftype != WILC_CLIENT_MODE) - wlan_channel = INVALID_CHANNEL; + vif->wilc->sta_ch = INVALID_CHANNEL; wilc_wlan_set_bssid(dev, NULL, WILC_STATION_MODE); wfi_drv->conn_info.conn_result = NULL; kfree(join_params); @@ -485,7 +484,7 @@ static int disconnect(struct wiphy *wiphy, struct net_device *dev, } if (vif->iftype != WILC_CLIENT_MODE) - wlan_channel = INVALID_CHANNEL; + wilc->sta_ch = INVALID_CHANNEL; wilc_wlan_set_bssid(priv->dev, NULL, WILC_STATION_MODE); priv->p2p.local_random = 0x01; @@ -936,7 +935,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) } static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx, - u8 op_ch_attr_idx) + u8 op_ch_attr_idx, u8 sta_ch) { int i = 0; int j = 0; @@ -947,7 +946,7 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx, for (i = ch_list_attr_idx + 3; i < limit; i++) { if (buf[i] == 0x51) { for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) - buf[j] = wlan_channel; + buf[j] = sta_ch; break; } } @@ -955,11 +954,11 @@ static inline void wilc_wfi_cfg_parse_ch_attr(u8 *buf, u8 ch_list_attr_idx, if (op_ch_attr_idx) { buf[op_ch_attr_idx + 6] = 0x51; - buf[op_ch_attr_idx + 7] = wlan_channel; + buf[op_ch_attr_idx + 7] = sta_ch; } } -static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len) +static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len, u8 sta_ch) { u32 index = 0; u8 op_channel_attr_index = 0; @@ -975,13 +974,13 @@ static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len) op_channel_attr_index = index; index += buf[index + 1] + 3; } - if (wlan_channel != INVALID_CHANNEL) + if (sta_ch != INVALID_CHANNEL) wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index, - op_channel_attr_index); + op_channel_attr_index, sta_ch); } static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, - u8 iftype) + u8 iftype, u8 sta_ch) { u32 index = 0; u8 op_channel_attr_index = 0; @@ -1000,9 +999,9 @@ static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, op_channel_attr_index = index; index += buf[index + 1] + 3; } - if (wlan_channel != INVALID_CHANNEL && oper_ch) + if (sta_ch != INVALID_CHANNEL && oper_ch) wilc_wfi_cfg_parse_ch_attr(buf, channel_list_attr_index, - op_channel_attr_index); + op_channel_attr_index, sta_ch); } static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, @@ -1037,7 +1036,8 @@ static void wilc_wfi_cfg_parse_rx_vendor_spec(struct wilc_priv *priv, u8 *buff, if (buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, &buff[i + 2], 4))) { wilc_wfi_cfg_parse_rx_action(&buff[i + 6], - size - (i + 6)); + size - (i + 6), + vif->wilc->sta_ch); break; } } @@ -1195,6 +1195,7 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, size_t len = params->len; u32 i; u8 subtype = buf[P2P_PUB_ACTION_SUBTYPE]; + struct wilc_vif *vif = netdev_priv(priv->dev); if (subtype == GO_NEG_REQ || subtype == GO_NEG_RSP) { if (priv->p2p.local_random == 1 && @@ -1219,7 +1220,8 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct wilc_priv *priv, oper_ch = true; wilc_wfi_cfg_parse_tx_action(tx_buff, len - (i + 6), - oper_ch, iftype); + oper_ch, iftype, + vif->wilc->sta_ch); break; } diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 3a78ffd..29f220d 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -273,6 +273,7 @@ struct wilc { struct net_device *monitor_dev; /* deinit lock */ struct mutex deinit_lock; + u8 sta_ch; }; struct wilc_wfi_mon_priv { From patchwork Tue Feb 5 07:16:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796971 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 050AA13B5 for ; Tue, 5 Feb 2019 07:16:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E11F42B520 for ; Tue, 5 Feb 2019 07:16:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D59542B5C9; Tue, 5 Feb 2019 07:16:06 +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 5BA772B520 for ; Tue, 5 Feb 2019 07:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727580AbfBEHQF (ORCPT ); Tue, 5 Feb 2019 02:16:05 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:26935 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHQF (ORCPT ); Tue, 5 Feb 2019 02:16:05 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="26323441" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:16:04 -0700 Received: from NAM05-CO1-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; Tue, 5 Feb 2019 00:16:03 -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=Gi7CD7HvY2ZfWcyyQAIDqB8+38Gny2rrizbEgBRKkJE=; b=bFEafvTkK0dKiVMFO45AtK01GL/X4wv0GPfc1w44typbFffxWMMP1KvJyx+27ElGKCOK6yYoYOLdDeVo34Jf05jwkxIRBVvIFvkRppC6y8MAjKDU26B10DLl0k7q8uFfG3P2yMMsFq77qepM+rErsxdawbcoFzmvwo1HbWOlax8= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2984.namprd11.prod.outlook.com (20.177.224.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:16:02 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:16:02 +0000 From: To: CC: , , , , Subject: [PATCH 11/12] staging: wilc1000: move 'curr_channel' static variable in 'wilc' struct Thread-Topic: [PATCH 11/12] staging: wilc1000: move 'curr_channel' static variable in 'wilc' struct Thread-Index: AQHUvSKmslXJticxFka56zBK4xq01Q== Date: Tue, 5 Feb 2019 07:16:02 +0000 Message-ID: <1549350913-645-12-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2984;6:mlWups0JOWvmNEJT7Idie4ef8/znyrfj7OVm3QPt7U6DOlITd1dHa/hyyEHr5EmgwSM+ozPB1GKjkmrAVSxzLxtxssykBP1WXk6pcJB9AC1ZLKHD+ZoKCiguSbXrdOAfF+X8Fzz/w4b4SsfDCRmJvrdrumiWY862yZzjU51OQkwvHqBbxGPCHJU/Kbp3sOQL6Re2CmQjyxUmW8QdxHjtlN/yvwrUXh/bXvb54rXdRFDhY6xp9ccXlQafO3KtuAU0rkxFZUKwJkM8GMoMnE2xOCX3lWb4xphXrgZKgNJ/53cvoWw97r6OpYptVhG7j+mJcITb1PDu0GDUiY3YKlLcIt3SJv9QiEirPwk9eBRBVkTLrFHHG6AvE1RnCZ/ilNiVMEGQYTgOi+FfXhjWDeuWcWw/y/S/de7bBNeZJ0pIS5xzYxm0m9L2YAaRf89fmXvcRa/TokXaRukn4FxjEFWaqg==;5:OfKYUQgHT/APM7+Mr7fyAfqwK3tm+XJA9xSP+yC1WlPW4BptQEh8BqS9nQMlEGONDUf9gZBPi6CmEzFPIKZDA6tESdYW0IBBWJpfdc2gaMdsMSXXHrN2goQvCP70DKM1bd/6CqoLXD3Lzi8k3oyixUSUlH0+5GRV30Ccgs4QLMo0kqpXTyGBJ1N7ZBx6CpXPWvx1ZilPYO8hN5dJLjL+Zw==;7:G5jm6VXGyvNQgIu2kvcYOly1KzPjpzepm6hAHzXGQPtXpUIlXhh+RW3sYoDp00/CHPnfaL+ERIIwUZHa8xz55gI14nmxjpCmigJj+SDtBJ8FIMCCknCqP26QPY9aP4DPMxrYAFf0yku5+1qrCnl9fQ== x-ms-office365-filtering-correlation-id: 01107d48-86c3-4ad1-c150-08d68b39c8ee x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2984; x-ms-traffictypediagnostic: BYAPR11MB2984: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(376002)(396003)(346002)(136003)(199004)(189003)(4326008)(36756003)(386003)(6116002)(3846002)(102836004)(14454004)(68736007)(97736004)(11346002)(78486014)(316002)(2351001)(5640700003)(478600001)(25786009)(6436002)(53936002)(71190400001)(26005)(71200400001)(6486002)(106356001)(72206003)(6916009)(446003)(8676002)(105586002)(305945005)(6512007)(186003)(6506007)(7736002)(486006)(476003)(66066001)(2616005)(8936002)(107886003)(52116002)(81166006)(81156014)(76176011)(2501003)(50226002)(256004)(14444005)(99286004)(54906003)(2906002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2984;H:BYAPR11MB2567.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: jQvAxSe8vr5XCtsXCsIxJGZswGlC+ym4gfedbKnk8ziWThFqCN9loUXWyllOKtn49WYGCEz0WholqpNtECQKzJ8M5gP27/hk8EVQK5r8gr8dulyAFUXCQpHB6aWObdNPBQl8wM3eOJCnSRTKNsSR8dshav+ORqxYZup5P/oETqLdHiXrZlfng5GOiJQaHZzWtrfe9cv73fTolg2CuBTxQrFhBN2PxDlNAUJA3tem8VHWxVZ+3LLLWRnphVfm5GO+Y7YaxtvwVACuYQ1xIsxsMHBCTe0AphuJFg6hRG6hVGSvPNWDSZp8p1/m7W4uoDTysaJKPQeG02FvyY+Kdie6uVO0IeLQTYAS/4Rr3nXQKoJWqwJ8hN2KvQIhM/jeaIaUgzT/Y/v008cZOIjLGbEJiuGF/xlaBHkx+yqde4xWdGs= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 01107d48-86c3-4ad1-c150-08d68b39c8ee X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:16:00.0747 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2984 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: Ajay Singh Avoid the use of static variable and move it as part of wilc structure. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 ++++++++++++---------- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 + 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index f1ce34f..dd1fe3f 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -67,7 +67,6 @@ struct p2p_mgmt_data { u8 *buff; }; -static u8 curr_channel; static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; @@ -206,7 +205,7 @@ static int set_channel(struct wiphy *wiphy, channelnum = ieee80211_frequency_to_channel(chandef->chan->center_freq); - curr_channel = channelnum; + vif->wilc->op_ch = channelnum; result = wilc_set_mac_chnl_num(vif, channelnum); if (result != 0) @@ -324,6 +323,7 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, u32 cipher_group; struct cfg80211_bss *bss; void *join_params; + u8 ch; vif->connecting = true; @@ -427,16 +427,16 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, goto out_put_bss; } - curr_channel = ieee80211_frequency_to_channel(bss->channel->center_freq); - + ch = ieee80211_frequency_to_channel(bss->channel->center_freq); + vif->wilc->op_ch = ch; if (vif->iftype != WILC_CLIENT_MODE) - vif->wilc->sta_ch = curr_channel; + vif->wilc->sta_ch = ch; wilc_wlan_set_bssid(dev, bss->bssid, WILC_STATION_MODE); wfi_drv->conn_info.security = security; wfi_drv->conn_info.auth_type = auth_type; - wfi_drv->conn_info.ch = curr_channel; + wfi_drv->conn_info.ch = ch; wfi_drv->conn_info.conn_result = cfg_connect_result; wfi_drv->conn_info.arg = priv; wfi_drv->conn_info.param = join_params; @@ -1048,6 +1048,8 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) { struct wilc_priv *priv = wiphy_priv(dev->ieee80211_ptr->wiphy); struct host_if_drv *wfi_drv = priv->hif_drv; + struct wilc_vif *vif = netdev_priv(dev); + struct wilc *wl = vif->wilc; u32 header, pkt_offset; s32 freq; __le16 fc; @@ -1068,7 +1070,7 @@ void wilc_wfi_p2p_rx(struct net_device *dev, u8 *buff, u32 size) return; } - freq = ieee80211_channel_to_frequency(curr_channel, NL80211_BAND_2GHZ); + freq = ieee80211_channel_to_frequency(wl->op_ch, NL80211_BAND_2GHZ); fc = ((struct ieee80211_hdr *)buff)->frame_control; if (!ieee80211_is_action(fc)) { @@ -1158,7 +1160,7 @@ static int remain_on_channel(struct wiphy *wiphy, if (ret) return ret; - curr_channel = chan->hw_value; + vif->wilc->op_ch = chan->hw_value; priv->remain_on_ch_params.listen_ch = chan; priv->remain_on_ch_params.listen_cookie = id; @@ -1279,7 +1281,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (ieee80211_is_probe_resp(mgmt->frame_control)) { wilc_set_mac_chnl_num(vif, chan->hw_value); - curr_channel = chan->hw_value; + vif->wilc->op_ch = chan->hw_value; goto out_txq_add_pkt; } @@ -1290,7 +1292,7 @@ static int mgmt_tx(struct wiphy *wiphy, if (buf[ACTION_SUBTYPE_ID] != PUBLIC_ACT_VENDORSPEC || buf[P2P_PUB_ACTION_SUBTYPE] != GO_NEG_CONF) { wilc_set_mac_chnl_num(vif, chan->hw_value); - curr_channel = chan->hw_value; + vif->wilc->op_ch = chan->hw_value; } switch (buf[ACTION_SUBTYPE_ID]) { case GAS_INITIAL_REQ: diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h b/drivers/staging/wilc1000/wilc_wfi_netdevice.h index 29f220d..2b9b8b5 100644 --- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h +++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h @@ -274,6 +274,7 @@ struct wilc { /* deinit lock */ struct mutex deinit_lock; u8 sta_ch; + u8 op_ch; }; struct wilc_wfi_mon_priv { From patchwork Tue Feb 5 07:16:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10796973 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 BFA12922 for ; Tue, 5 Feb 2019 07:16:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A782D2B520 for ; Tue, 5 Feb 2019 07:16:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BD0E2B5C9; Tue, 5 Feb 2019 07:16:09 +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 4C94B2B520 for ; Tue, 5 Feb 2019 07:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727572AbfBEHQI (ORCPT ); Tue, 5 Feb 2019 02:16:08 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:26935 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbfBEHQI (ORCPT ); Tue, 5 Feb 2019 02:16:08 -0500 X-IronPort-AV: E=Sophos;i="5.56,562,1539673200"; d="scan'208";a="26323443" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 05 Feb 2019 00:16:07 -0700 Received: from NAM05-CO1-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; Tue, 5 Feb 2019 00:16:06 -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=1BTP8tXWIxOrqmI4HruCkIGA5KpEVacVUbjcJpqs8W4=; b=jO9xAyPoV/eUF5y+4UhoMoElhxnWbGWiZ34h0bIb4kZMEXApZ7yg0v7+i5VmuN0oQm4/szlu8/Y08DOLMvjSMrMJw3x1qjyC4DnqM2PsgTgJz/FaNPnDhG97kraR6pDMhmNY0ca/QsC1V+yOT1yRWu+uzsSN0KncefRWkuSGZgQ= Received: from BYAPR11MB2567.namprd11.prod.outlook.com (52.135.226.160) by BYAPR11MB2984.namprd11.prod.outlook.com (20.177.224.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.20; Tue, 5 Feb 2019 07:16:05 +0000 Received: from BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d]) by BYAPR11MB2567.namprd11.prod.outlook.com ([fe80::cc6d:bc31:d5b:a27d%5]) with mapi id 15.20.1580.019; Tue, 5 Feb 2019 07:16:05 +0000 From: To: CC: , , , , Subject: [PATCH 12/12] staging: wilc1000: define p2p related static variable as constants Thread-Topic: [PATCH 12/12] staging: wilc1000: define p2p related static variable as constants Thread-Index: AQHUvSKobv2cAy9GF026f9awEGfvLA== Date: Tue, 5 Feb 2019 07:16:05 +0000 Message-ID: <1549350913-645-13-git-send-email-ajay.kathat@microchip.com> References: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> In-Reply-To: <1549350913-645-1-git-send-email-ajay.kathat@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MAXPR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:e::28) To BYAPR11MB2567.namprd11.prod.outlook.com (2603:10b6:a02:c5::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Ajay.Kathat@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [183.82.17.42] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BYAPR11MB2984;6:vRUpNt2VaujOhB25zYON3KGLS0zAy+Co4ZIZwI9b2f0tTH/S1HlJpIwDl4qFnJSIkRypFtl37o6r2+WpsX+/ZhvQS+Yd/sHsmI7r0TEjR7TbIPUMfVzV2XLw2MoU8AnffB50LaXCnGHR4WvsXWwe5Qm1TDMdz9p8e39wsDZ4+PHIEHNVmlV0DqUCSm1TZrB79XdnwgCeo6G9427hRx2ITrIG99UMeQn8PxMvVW9hhzeKOxf9IwF+j16DzskCdWJh2qY45nbrSWinjpF4YoZfl/9bveTPRWO3xN2uSW2Db9fRo5vnKPZCczynwNpQb3f0WMgclHn/x9YRLDlu+94lo92eKasooXinvRF5GhkSLIkfdPIgSn/kV9RQ4T1+8L5ZWd6cigSAE8L/ZNMfay7V9JmscYkYH+3FxKsFy9yfIeen0rI8KAo5hAw7pFITkvOTJSKa/8o9B7bGgCJfV3shdg==;5:Q4ccKuiQUvcIRpHXSo23W8cxlDRI5i0ouWudKBY0PP1X3QUjY4vLO0pUMiB1CpNAdmV/Ja9imEzxaLzuKfoEcJtqnrJVNNaUZLCDfJmrfK5nxi1r7i7wzTHxZMrlMsHyaEhWAkyckxPz2aTXQUKddf8AvlrJTPkmpsOhlv/ussy2b/1+OXlUAZFyECBR4dhJrq7CoL0BAkgC9QJk0O0ghA==;7:INGQOhMRfwOiMgtygSIi0sdEZr4TDWBJQksxjIDY1YnpRiJh40BSBygiyYFtK/XZ2uPzHgEOlS52B3z/gLI1X6jzSoVp8tnZi4HP7+BoTuZRUn4646rWtm5kHqXTdvRXNbGuz0Gb3AQuCFldauIXKw== x-ms-office365-filtering-correlation-id: 1325cea4-1672-48ae-6b82-08d68b39cab2 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:BYAPR11MB2984; x-ms-traffictypediagnostic: BYAPR11MB2984: x-microsoft-antispam-prvs: x-forefront-prvs: 0939529DE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(39860400002)(376002)(396003)(346002)(136003)(199004)(189003)(4326008)(36756003)(386003)(6116002)(3846002)(102836004)(14454004)(68736007)(97736004)(11346002)(78486014)(316002)(2351001)(5640700003)(478600001)(25786009)(6436002)(4744005)(53936002)(71190400001)(26005)(71200400001)(6486002)(106356001)(72206003)(6916009)(446003)(8676002)(105586002)(305945005)(6512007)(186003)(6506007)(7736002)(486006)(476003)(66066001)(2616005)(8936002)(107886003)(52116002)(81166006)(81156014)(76176011)(2501003)(50226002)(256004)(99286004)(54906003)(2906002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR11MB2984;H:BYAPR11MB2567.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NBDFq97VYafOeDZWarkgwUWvD0WttqHysleNpxjP3WA6BMSeUIgfRZFJTedq0oo63yUwSkJwtB+FlxiF8fYu8dd5ng8CDrHdH1YauPGL91JHA/ahm3aFFkc5kzWorqkm56MevpDsvHxDRdwhpUQvH+nCkhvcgOHf+dHBXLXbMDsx/tmoyIr2RfMq/Zz9rwFy/b99DW0U3672MQzdfErXoUdVy1jqPdbB82CbH9hx8JcGb+1ffAG+pkSbcq3YbSIwD4Bh01hIgALtMyDWGvBYfcoaM31n7G1yCPAOzXsW1bP9XLBsUCR1kEOoyH9lyGH+kca2mWa+lyHT2OF+J9PQULjNKG5rD5JIxc8xOHFZ67n3gGb8/oq5V8WZNrqJc8SoRevr5AsgChtFyWMu1AZpiW7htthQPUrsG1YM1BgW85g= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 1325cea4-1672-48ae-6b82-08d68b39cab2 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Feb 2019 07:16:02.7165 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2984 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: Ajay Singh Add constant qualifer for 'p2p_vendor_spec' & 'p2p_oui' static variable because they are treated like constant values. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index dd1fe3f..8fb4bd4 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -67,8 +67,8 @@ struct p2p_mgmt_data { u8 *buff; }; -static u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; -static u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; +static const u8 p2p_oui[] = {0x50, 0x6f, 0x9A, 0x09}; +static const u8 p2p_vendor_spec[] = {0xdd, 0x05, 0x00, 0x08, 0x40, 0x03}; #define WILC_IP_TIMEOUT_MS 15000