From patchwork Tue Dec 20 10:56:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9481439 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 D6C0D606DB for ; Tue, 20 Dec 2016 11:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4C9E27EE2 for ; Tue, 20 Dec 2016 11:04:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C96972846A; Tue, 20 Dec 2016 11:04:26 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 5C0CA27EE2 for ; Tue, 20 Dec 2016 11:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757636AbcLTLEZ (ORCPT ); Tue, 20 Dec 2016 06:04:25 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34716 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755594AbcLTLEY (ORCPT ); Tue, 20 Dec 2016 06:04:24 -0500 Received: by mail-pg0-f66.google.com with SMTP id b1so11520773pgc.1; Tue, 20 Dec 2016 03:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=CWYM2wFYCZuRH8uPn6y61bbPdKO2ZMzlRVLvYzMK8Ks=; b=Q993Ip1tZrNuIWyQsERqWScB9wdtN2x9+aQkaSnvS/72nKoJm+lquMcnhepCIddB4T TZ3MOW5JKnS8BBVFPkjFi/UEqntXriAHQXfQeW24gIhfDzJp+dPISuRIyitAgcsWpCB8 ls9HLxQ89VcTH2msnQzK5rWk/QUg/XCwacGSeZfg8BWbsZC0b/tZiPeRbEXFYV2wh7FP a47YGCSh1hI4CPjdJX8p1WQpMniO9dhbFtrFoNfYGio5UgCceC6S4V2bvv9YAwvd46qp m2WEHcQ9n2nFR69XWcN5jiK1VItW5a3VPOvvO8tyXbrsTQvW1L+EzaOvgTtq+pCjkQxy WsaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CWYM2wFYCZuRH8uPn6y61bbPdKO2ZMzlRVLvYzMK8Ks=; b=dukte2NuTmZdnDy5tQe4s+nNcuLeS3ZspJyP05qVHm8QbPvAGlsINQLkw4KUmDs42C yh9RuN40ShFQMOcSPiNWlE2AWGgwICL3XIWPOJ1nhugvzG4Sjo8sCUU5GzpekWqGWEza TVsEYt8317beuJ7THxMN1XhI7angFNLKLsaW1fcO2geylojdzgrqa3gbFuAEg8qZS2hI RQfpQDZ0qfQ56RiimgA/h5/+cwqi+p9RFf2VGf24anZpOVef16k+q3WOv8ZLI6cNFUgd YIRGgj5j8wpked3ebVROjeS//6i98dvZ+drrCS/WXb7w934o9JEFOY1zX2Vz0JrMJZ1I sBaA== X-Gm-Message-State: AKaTC02KKMTIY71QH56w82MRxKuzb93xGtkh0A+HyRMbgNI1oasbJywd5AaNKkLgC1m7WA== X-Received: by 10.84.137.169 with SMTP id 38mr42281245pln.128.1482231387403; Tue, 20 Dec 2016 02:56:27 -0800 (PST) Received: from gmail.com ([59.95.252.249]) by smtp.gmail.com with ESMTPSA id s8sm38213937pfj.45.2016.12.20.02.56.22 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 20 Dec 2016 02:56:26 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Tue, 20 Dec 2016 16:26:19 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, sudeep.dutt@intel.com, ashutosh.dixit@intel.com, vinod.koul@intel.com, dan.j.williams@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] drivers: misc: mic: constify mbus_hw_ops structures Date: Tue, 20 Dec 2016 16:26:17 +0530 Message-Id: <1482231377-25864-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The fields of structure mbus_hw_ops are never modified after initialization, so declare these structures as const. Add a const annotation to all its initializations and uses like function arguments and pointers. Used Coccinelle to find all the occurences. Size details: File size before: text data bss dec hex filename 1401 1752 232 3385 d39 drivers/misc/mic/card/mic_x100.o 4116 584 0 4700 125c drivers/misc/mic/host/mic_boot.o File size after: text data bss dec hex filename 1432 1728 232 3392 d40 drivers/misc/mic/card/mic_x100.o 4148 552 0 4700 125c drivers/misc/mic/host/mic_boot.o Signed-off-by: Bhumika Goyal --- drivers/dma/mic_x100_dma.h | 2 +- drivers/misc/mic/bus/mic_bus.c | 2 +- drivers/misc/mic/card/mic_x100.c | 2 +- drivers/misc/mic/host/mic_boot.c | 2 +- include/linux/mic_bus.h | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/dma/mic_x100_dma.h b/drivers/dma/mic_x100_dma.h index d899820..3cf3f99 100644 --- a/drivers/dma/mic_x100_dma.h +++ b/drivers/dma/mic_x100_dma.h @@ -165,7 +165,7 @@ static inline struct mbus_device *to_mbus_device(struct mic_dma_chan *ch) return to_mic_dma_dev(ch)->mbdev; } -static inline struct mbus_hw_ops *to_mbus_hw_ops(struct mic_dma_chan *ch) +static inline const struct mbus_hw_ops *to_mbus_hw_ops(struct mic_dma_chan *ch) { return to_mbus_device(ch)->hw_ops; } diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c index be37890..df0c156 100644 --- a/drivers/misc/mic/bus/mic_bus.c +++ b/drivers/misc/mic/bus/mic_bus.c @@ -144,7 +144,7 @@ static void mbus_release_dev(struct device *d) struct mbus_device * mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops, - struct mbus_hw_ops *hw_ops, int index, + const struct mbus_hw_ops *hw_ops, int index, void __iomem *mmio_va) { int ret; diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c index b9f0710..5ec6c35 100644 --- a/drivers/misc/mic/card/mic_x100.c +++ b/drivers/misc/mic/card/mic_x100.c @@ -234,7 +234,7 @@ static void _mic_ack_interrupt(struct mbus_device *mbdev, int num) mic_ack_interrupt(&mbdev_to_mdrv(mbdev)->mdev); } -static struct mbus_hw_ops mbus_hw_ops = { +static const struct mbus_hw_ops mbus_hw_ops = { .request_threaded_irq = _mic_request_threaded_irq, .free_irq = _mic_free_irq, .ack_interrupt = _mic_ack_interrupt, diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c index 9599d73..5d86e75 100644 --- a/drivers/misc/mic/host/mic_boot.c +++ b/drivers/misc/mic/host/mic_boot.c @@ -371,7 +371,7 @@ static void _mic_ack_interrupt(struct mbus_device *mbdev, int num) mdev->ops->intr_workarounds(mdev); } -static struct mbus_hw_ops mbus_hw_ops = { +static const struct mbus_hw_ops mbus_hw_ops = { .request_threaded_irq = _mic_request_threaded_irq, .free_irq = _mic_free_irq, .ack_interrupt = _mic_ack_interrupt, diff --git a/include/linux/mic_bus.h b/include/linux/mic_bus.h index 27d7c95..722f3f9 100644 --- a/include/linux/mic_bus.h +++ b/include/linux/mic_bus.h @@ -49,7 +49,7 @@ struct mbus_device_id { */ struct mbus_device { void __iomem *mmio_va; - struct mbus_hw_ops *hw_ops; + const struct mbus_hw_ops *hw_ops; struct mbus_device_id id; struct device dev; int index; @@ -91,7 +91,7 @@ struct mbus_hw_ops { struct mbus_device * mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops, - struct mbus_hw_ops *hw_ops, int index, + const struct mbus_hw_ops *hw_ops, int index, void __iomem *mmio_va); void mbus_unregister_device(struct mbus_device *mbdev);