From patchwork Tue Jan 2 13:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10140621 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 F1C16601A1 for ; Tue, 2 Jan 2018 14:06:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F27D828BA0 for ; Tue, 2 Jan 2018 14:06:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E762A28BA7; Tue, 2 Jan 2018 14:06:24 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8135428BA0 for ; Tue, 2 Jan 2018 14:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=e3k9lRr1HdceqsbvmCx4PNjzV8S1GRiLiTwQM6sRj9c=; b=dpnMNSr9YF2XsUjoo48axr0nae KPvC5sEJXGwXMh53nh7lTHQsFI01hOMXJ1jZ1G5LaH/pTndhXH+5hV1qZDau0MD0igr/qtYhvF+i1 SLcMoPrlcR6cHDn+pZigNBQnCOB9l1+gzkrUH7GX7BZfXqsYYInTxRd16mt9lHvvjDq8yC445k0c/ 55wzSUzoq2KvdqEZdtS5I8tPNOn+iyeNGYg976Of4iIdDwSRm5WhQ8BRFKnmQcNVOEsi40rI+/ZWE 1I4lwM+ype60h4Vww1QsL5WZOUjbWkN5b9NFm+Sw1eUsiBj/gWWBpIKQUyK3WO317QkWHi11ZaTcG s62R+sxA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWNCv-0004aP-V4; Tue, 02 Jan 2018 14:06:21 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWNCW-0003q7-Pg for linux-arm-kernel@lists.infradead.org; Tue, 02 Jan 2018 14:06:18 +0000 X-IronPort-AV: E=Sophos;i="5.45,497,1508796000"; d="scan'208";a="307399615" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 02 Jan 2018 14:56:46 +0100 From: Julia Lawall To: Nicolas Ferre Subject: [PATCH 12/12] power: reset: account for const type of of_device_id.data Date: Tue, 2 Jan 2018 14:28:08 +0100 Message-Id: <1514899688-27844-13-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514899688-27844-1-git-send-email-Julia.Lawall@lip6.fr> References: <1514899688-27844-1-git-send-email-Julia.Lawall@lip6.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180102_060558_229955_CFDA0F5F X-CRM114-Status: GOOD ( 10.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel , Alexandre Belloni , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This driver creates a const structure that it stores in the data field of an of_device_id array. Add const to the declaration of the location that receives a value from the data field to ensure that the compiler will continue to check that the value is not modified and remove the const-dropping cast on the access to the data field. Done using Coccinelle. Signed-off-by: Julia Lawall Acked-by: Alexandre Belloni --- drivers/power/reset/at91-sama5d2_shdwc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -68,7 +68,7 @@ struct shdwc_config { }; struct shdwc { - struct shdwc_config *cfg; + const struct shdwc_config *cfg; void __iomem *at91_shdwc_base; }; @@ -260,7 +260,7 @@ static int __init at91_shdwc_probe(struc } match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node); - at91_shdwc->cfg = (struct shdwc_config *)(match->data); + at91_shdwc->cfg = match->data; sclk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(sclk))