From patchwork Tue Jan 2 13:27:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10140591 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 3FF886034B for ; Tue, 2 Jan 2018 13:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3FDAE28B5C for ; Tue, 2 Jan 2018 13:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34AE028B7B; Tue, 2 Jan 2018 13:59:17 +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 EADF528B5C for ; Tue, 2 Jan 2018 13:59:15 +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=DKaDuM45rxXKF3b0BgmmIaXwj82UgxjqqS6ihAFddtg=; b=FIfqC30orl2+K3CAvMhISdnRoB 9GPeufLFFOlUiJUhXwW11P4b8UC8sZiw6t+e/fBfxD2Lfi8x1ZkFmu1t2S6pRyTB9ZKd8y3UhXPQM Q0bB5lZq66RWt0v94Eedz1hXSj9NDas62yL7E0rdLRQuexAHsyTSiH6C3Uuc/zB3rK1Hgb+37RVqC nREegHOjaeJOqlglu6xo76WAxnflEsUFVrz/wQwJkFF0CugvklSDtOPbWMg144S4mEM5065M8v9Ls M8i6Y4V3eDXVsLiJO9oayYfsPKHJdtv9kR59Whg1IkYYrr/LWvGUR9MKqxHq4kCMMy8nOMq/HHRkT vAlZsbiw==; 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 1eWN5z-0008Gq-KL; Tue, 02 Jan 2018 13:59:11 +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 1eWN4c-00079o-6z for linux-arm-kernel@lists.infradead.org; Tue, 02 Jan 2018 13:58:52 +0000 X-IronPort-AV: E=Sophos;i="5.45,497,1508796000"; d="scan'208";a="307399605" 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:45 +0100 From: Julia Lawall To: Ludovic Desroches Subject: [PATCH 02/12] pinctrl: at91-pio4: account for const type of of_device_id.data Date: Tue, 2 Jan 2018 14:27:58 +0100 Message-Id: <1514899688-27844-3-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_055747_440452_DB47C9BD X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. 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: Linus Walleij , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, 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. Adding const to the declaration of the location that receives the const value from the data field ensures that the compiler will continue to check that the value is not modified. Furthermore, the const-discarding cast on the extraction from the data field is no longer needed. Done using Coccinelle. Signed-off-by: Julia Lawall --- drivers/pinctrl/pinctrl-at91-pio4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -u -p a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -910,7 +910,7 @@ static int atmel_pinctrl_probe(struct pl int i, ret; struct resource *res; struct atmel_pioctrl *atmel_pioctrl; - struct atmel_pioctrl_data *atmel_pioctrl_data; + const struct atmel_pioctrl_data *atmel_pioctrl_data; atmel_pioctrl = devm_kzalloc(dev, sizeof(*atmel_pioctrl), GFP_KERNEL); if (!atmel_pioctrl) @@ -924,7 +924,7 @@ static int atmel_pinctrl_probe(struct pl dev_err(dev, "unknown compatible string\n"); return -ENODEV; } - atmel_pioctrl_data = (struct atmel_pioctrl_data *)match->data; + atmel_pioctrl_data = match->data; atmel_pioctrl->nbanks = atmel_pioctrl_data->nbanks; atmel_pioctrl->npins = atmel_pioctrl->nbanks * ATMEL_PIO_NPINS_PER_BANK;