Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp218057imm; Tue, 12 Jun 2018 22:20:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKILEoRD0/pVwcro9N27r2Te4FEm9L6UdtI1EZyMdr8q2ab4vtIpOYF9Kn1IwCR7lUsWtcjN X-Received: by 2002:a65:6319:: with SMTP id g25-v6mr2838300pgv.437.1528867258095; Tue, 12 Jun 2018 22:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528867258; cv=none; d=google.com; s=arc-20160816; b=cdBJ+hWEG79Lc757DnnlkxIhHdpE0x1OR5qufubHLAPEzZmzOLtT9wbKawMyieP9ws QgW3Fnxa+s5h5Z3DDty0kdp4HchwcdzgiqkqBxK9jQmb3jo14KmyLYa5wMbTJFW5Hujk BUD/e4A9r8XqT/8wedwIdRHJSqbLJhF0Ubo0Pc1aBsuXx6TznlTyGentfW6V/FM3OkNr qJtDy4pU7psPSJlW1V/zx2XQfvO3aQyol+M3ePdHtZQIbnbC1fKS8HwbDX+Zp288d9zG JWb11Gg025E3KSQXYG2l2OPFxhatiIUPWlwmj0A/BP38qBGlXm8tJs+vbqKeltopiKnr hdZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bshJqXbn9vt8zoyVgGCKUltIw9YN7ZE/Aw4piCZyzwY=; b=0/lAAUhfor3ljKF9iwUehgjb9dliGiMu5iKE2KFadCI1XT58/XAOSWbMPhBM1hnRBR l5HZ/GkkBCpO+RBFSLaN65Ap1ONwfIh2Wl6Hs9PvEyBW+J8bPFXHsrXkkyCMtTtt5gXb UU0zGNUOEFdIrmWCsi1ZyxjPLHcimA7YauANJ23BQYXg9h2bhnryodt6ebVj360k6Rbl Lw/8yMdXqeNk5fKf8pJxNS24+oU+CHlRLUswG2g7wwA4XBPxSYbL4WKQmTyHyVcvGJeZ t1487Cf6KOLM5YhdtRWVFHjcupOk9sroRfNRfQjjHjIS5uCJjqlFRAiRr3GQOH7K2/td YL1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si1798887pfe.70.2018.06.12.22.20.41; Tue, 12 Jun 2018 22:20:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754473AbeFMFUS (ORCPT + 99 others); Wed, 13 Jun 2018 01:20:18 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46691 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754430AbeFMFUR (ORCPT ); Wed, 13 Jun 2018 01:20:17 -0400 X-IronPort-AV: E=Sophos;i="5.51,217,1526335200"; d="scan'208";a="331558471" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 13 Jun 2018 07:20:15 +0200 From: Julia Lawall To: Lee Jones Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mfd: kempld-core: constify variables that point to const structure Date: Wed, 13 Jun 2018 06:48:09 +0200 Message-Id: <1528865289-3875-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add const to the declaration of various local variables of type kempld_platform_data for which the referenced value is always only dereferenced or passed to a const parameter, to record the fact that kempld_platform_data_generic is declared as const. The semantic match that finds this issue is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier i,j; @@ const struct i j = { ... }; @ok@ identifier r.i; position p; @@ const struct i@p * @@ identifier r.i; position p != ok.p; @@ * struct i@p * // Signed-off-by: Julia Lawall --- drivers/mfd/kempld-core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c index 390b27c..fb5a10b 100644 --- a/drivers/mfd/kempld-core.c +++ b/drivers/mfd/kempld-core.c @@ -143,7 +143,7 @@ static int kempld_register_cells_generic(struct kempld_device_data *pld) static int kempld_create_platform_device(const struct dmi_system_id *id) { - struct kempld_platform_data *pdata = id->driver_data; + const struct kempld_platform_data *pdata = id->driver_data; int ret; kempld_pdev = platform_device_alloc("kempld", -1); @@ -259,7 +259,7 @@ void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data) */ void kempld_get_mutex(struct kempld_device_data *pld) { - struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); + const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); mutex_lock(&pld->lock); pdata->get_hardware_mutex(pld); @@ -272,7 +272,7 @@ void kempld_get_mutex(struct kempld_device_data *pld) */ void kempld_release_mutex(struct kempld_device_data *pld) { - struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); + const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); pdata->release_hardware_mutex(pld); mutex_unlock(&pld->lock); @@ -290,7 +290,7 @@ void kempld_release_mutex(struct kempld_device_data *pld) static int kempld_get_info(struct kempld_device_data *pld) { int ret; - struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); + const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); char major, minor; ret = pdata->get_info(pld); @@ -332,7 +332,7 @@ static int kempld_get_info(struct kempld_device_data *pld) */ static int kempld_register_cells(struct kempld_device_data *pld) { - struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); + const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); return pdata->register_cells(pld); } @@ -444,7 +444,8 @@ static int kempld_detect_device(struct kempld_device_data *pld) static int kempld_probe(struct platform_device *pdev) { - struct kempld_platform_data *pdata = dev_get_platdata(&pdev->dev); + const struct kempld_platform_data *pdata = + dev_get_platdata(&pdev->dev); struct device *dev = &pdev->dev; struct kempld_device_data *pld; struct resource *ioport; @@ -476,7 +477,7 @@ static int kempld_probe(struct platform_device *pdev) static int kempld_remove(struct platform_device *pdev) { struct kempld_device_data *pld = platform_get_drvdata(pdev); - struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); + const struct kempld_platform_data *pdata = dev_get_platdata(pld->dev); sysfs_remove_group(&pld->dev->kobj, &pld_attr_group);