From patchwork Mon Nov 21 20:30:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9440009 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 A724260469 for ; Mon, 21 Nov 2016 20:30:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 977FE28826 for ; Mon, 21 Nov 2016 20:30:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 894BB28835; Mon, 21 Nov 2016 20:30: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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 313F028826 for ; Mon, 21 Nov 2016 20:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754550AbcKUUaf (ORCPT ); Mon, 21 Nov 2016 15:30:35 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35446 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753566AbcKUUae (ORCPT ); Mon, 21 Nov 2016 15:30:34 -0500 Received: by mail-pf0-f196.google.com with SMTP id i88so18794925pfk.2; Mon, 21 Nov 2016 12:30:33 -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=ifeBOx1KvGcEFhvLi2cOcgB+mi/IeDQuiyfTDHyq+qM=; b=W8Eneh3s/sAvbcSZN1jaFrSjBTx/cxdov2x3Qo13EHJs6EZp8/9WendLKWUKkf6bfW 9pJbYmebypkB/sA3lCfCoIFx5DfOMFJKkRnOvfwkstPIlznvcUE73opw4cxCPSA208hz oINDXy5CBpjtxN7PSA7eobxoI8PENSZS8zQLCrkZ5qZW+K0TtjbFl3ndsgOzHGr7zye0 wL/8lhNtqEu9otRCWDVw2x1A0Sq6MKovxGCFf6m8NcFdDRejHRIBaO08tbRHCfwUKGVc DlY/GnUQtwrjYf9za5omLw/PgriQ/gkMHnqKRBcGJl8crXkDMqbYaGlPer+EQNEe/xms NKlg== 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=ifeBOx1KvGcEFhvLi2cOcgB+mi/IeDQuiyfTDHyq+qM=; b=WYjfKZ2dAfpZq2xsFkYno7Sky7CbkIGM2AelzatekuanUdPr1fC742RNjgXfVeV2Ej Lwwr+gKxI2X83p7nIH0y6psLdNi1mJ5IpNFg4FtHIHvzpQKmBX/aI/hDh544+9XihjWR y0ZfzvFoI+V183s+f4uAcWwtwm31sFEpi7R1Rk+YzypHiiutKYkJuFJQ0yxJDBi7UzaU pjyCXwkEiNA0vwwBFtYEx4RiiOy1w5nZYpIIiOG+7B5dSr8/uSwKLvnF/Vd4k12Dqr28 O2j2h33Tt4s4rCTBffSTl8CXW3C/cWQPDKQOtFfejFu4jcRr5YfQdL/SZr3Qpp9U5vni 8yaw== X-Gm-Message-State: AKaTC02xQmUmz/OI3DXU914igyej48adUnTBCGiNdYq7ZOfBJTnzHDR5OT0+lNTSWpdxQQ== X-Received: by 10.98.149.81 with SMTP id p78mr20429546pfd.95.1479760233234; Mon, 21 Nov 2016 12:30:33 -0800 (PST) Received: from gmail.com ([106.215.151.52]) by smtp.gmail.com with ESMTPSA id a24sm23477442pfh.57.2016.11.21.12.30.22 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 21 Nov 2016 12:30:31 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Tue, 22 Nov 2016 02:00:15 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, michael.hennerich@analog.com, aar@pengutronix.de, stefan@osg.samsung.com, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] net: ieee802154: constify ieee802154_ops structures Date: Tue, 22 Nov 2016 02:00:14 +0530 Message-Id: <1479760214-32624-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Declare the structure ieee802154_ops as const as it is only passed as an argument to the function ieee802154_alloc_hw. This argument is of type const struct ieee802154_ops *, so ieee80254_ops structures having this property can be declared as const. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct ieee802154_ops i@p = {...}; @ok1@ identifier r1.i; position p; expression e1; @@ ieee802154_alloc_hw(e1,&i@p) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct ieee802154_ops i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct ieee802154_ops i; The before and after size details of the affected files are: text data bss dec hex filename 8669 1176 16 9861 2685 drivers/net/ieee802154/adf7242.o 8805 1048 16 9869 268d drivers/net/ieee802154/adf7242.o text data bss dec hex filename 7211 2296 32 9539 2543 drivers/net/ieee802154/atusb.o 7339 2160 32 9531 253b drivers/net/ieee802154/atusb.o Signed-off-by: Bhumika Goyal Acked-by: Stefan Schmidt --- drivers/net/ieee802154/adf7242.c | 2 +- drivers/net/ieee802154/atusb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c index 9fa7ac9..4ff4c7d 100644 --- a/drivers/net/ieee802154/adf7242.c +++ b/drivers/net/ieee802154/adf7242.c @@ -874,7 +874,7 @@ static int adf7242_rx(struct adf7242_local *lp) return 0; } -static struct ieee802154_ops adf7242_ops = { +static const struct ieee802154_ops adf7242_ops = { .owner = THIS_MODULE, .xmit_sync = adf7242_xmit, .ed = adf7242_ed, diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c index 1056ed1..322864a 100644 --- a/drivers/net/ieee802154/atusb.c +++ b/drivers/net/ieee802154/atusb.c @@ -567,7 +567,7 @@ static void atusb_stop(struct ieee802154_hw *hw) return 0; } -static struct ieee802154_ops atusb_ops = { +static const struct ieee802154_ops atusb_ops = { .owner = THIS_MODULE, .xmit_async = atusb_xmit, .ed = atusb_ed,