From patchwork Fri Dec 2 09:50:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9458095 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.web.codeaurora.org (Postfix) with ESMTP id 2F9E460515 for ; Fri, 2 Dec 2016 09:51:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3628C284F1 for ; Fri, 2 Dec 2016 09:51:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28C4328526; Fri, 2 Dec 2016 09:51:41 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable 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 C94D7284F1 for ; Fri, 2 Dec 2016 09:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755726AbcLBJvK (ORCPT ); Fri, 2 Dec 2016 04:51:10 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34849 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752144AbcLBJvI (ORCPT ); Fri, 2 Dec 2016 04:51:08 -0500 Received: by mail-pg0-f67.google.com with SMTP id p66so7484072pga.2; Fri, 02 Dec 2016 01:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=zpCaLCCNZ9cVGB9qZeQVUY1eaHY6jUbLgnmslSs4vLM=; b=V8UFTa0fVSbwNnuAuqotjIV7/ZreeuP/Rg22Cp9EMNTFem38lFSu+2R0i7G4fUGZOk fiNXvcSPQky7bNbfkImffy7c0Ttd3jqHpxeIN0XfjZrolFNdHE8JIn5+Ak64/sLWyZZW FjN2/BiIrPTBs227pTvq+5hbXl3cTHe1eHZ4hIutCL4fhhr6RG1v3ZN+MhSJTLpjI1hg g/esLMNd13HSJOGG93mzlt3NyP7OVX/HWPBRCkT5sV1FySUJeysT/lGhhFpkpycJj7ti KaC3b/mte61F9+p4RGZs9v2XTSgpIZfwQnaQWKYQkFGUl/eHpfDcUddt7uDbtvXRSc8M q9nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zpCaLCCNZ9cVGB9qZeQVUY1eaHY6jUbLgnmslSs4vLM=; b=Ixr6KUz6DaAiUJE4iB/e87X8BAx31DBY/zYSF0yL2cfzo1BEVpxmVOExWjZ/D5RpYG BIEB5Jpxfv/itT/sRImTc1LbiNomw9iPFT4DCEjSvO2nelA374x9q0vRaN5rl+19TEXo Bo/EqigLzZx4VrfxzcBpAdiU6CDzocY0xCjXwBl14i82a/Pj4+sJJNWyiKnMTIyNdVRu wE+2xZhXniGojUBygBzgubeyNKYne6WtJcQdDXnnpty5ycDa1rpa9xRBkMFrkE6KvHAp wLZITmifR17AFEOaR3hgW0XFW/aZLD9UDuECoSlicYOlLyj4fCpB5zah/WdvTUMlEG3k n8Eg== X-Gm-Message-State: AKaTC03WuvvWl6pd7IpJ5fIAy6bqyuB6i/20Y1mY0V5+kHqjn2M3/VebWqU+J3LHZ6KlNQ== X-Received: by 10.98.213.7 with SMTP id d7mr43039222pfg.3.1480672267499; Fri, 02 Dec 2016 01:51:07 -0800 (PST) Received: from gmail.com ([106.215.189.191]) by smtp.gmail.com with ESMTPSA id t193sm6379673pgb.4.2016.12.02.01.50.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Dec 2016 01:51:05 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Fri, 02 Dec 2016 15:20:55 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, Larry.Finger@lwfinger.net, chaoming_li@realsil.com.cn, kvalo@codeaurora.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] net: wireless: realtek: constify rate_control_ops structures Date: Fri, 2 Dec 2016 15:20:54 +0530 Message-Id: <1480672254-4986-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 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 The structures rate_control_ops are only passed as an argument to the functions ieee80211_rate_control_{register/unregister}. This argument is of type const, so rate_control_ops having this property can also be declared as const. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct rate_control_ops i@p = {...}; @ok1@ identifier r1.i; position p; @@ ieee80211_rate_control_register(&i@p) @ok2@ identifier r1.i; position p; @@ ieee80211_rate_control_unregister(&i@p) @bad@ position p!={r1.p,ok1.p,ok2.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct rate_control_ops i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct rate_control_ops i; File size before: text data bss dec hex filename 1991 104 0 2095 82f wireless/realtek/rtlwifi/rc.o File size after: text data bss dec hex filename 2095 0 0 2095 wireless/realtek/rtlwifi/rc.o Signed-off-by: Bhumika Goyal --- drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c index ce8621a..107c13c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c @@ -284,7 +284,7 @@ static void rtl_rate_free_sta(void *rtlpriv, kfree(rate_priv); } -static struct rate_control_ops rtl_rate_ops = { +static const struct rate_control_ops rtl_rate_ops = { .name = "rtl_rc", .alloc = rtl_rate_alloc, .free = rtl_rate_free,