From patchwork Wed Aug 2 08:21:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9876179 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 D119A60390 for ; Wed, 2 Aug 2017 08:22:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C207428609 for ; Wed, 2 Aug 2017 08:22:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F4428760; Wed, 2 Aug 2017 08:22:20 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable 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 6CEE928609 for ; Wed, 2 Aug 2017 08:22:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342AbdHBIWI (ORCPT ); Wed, 2 Aug 2017 04:22:08 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34099 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752330AbdHBIWF (ORCPT ); Wed, 2 Aug 2017 04:22:05 -0400 Received: by mail-pg0-f65.google.com with SMTP id y192so5744955pgd.1; Wed, 02 Aug 2017 01:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=x20bo1mfLbooxu0p8ARwEioa66n0lKT53Vc1hYxzOak=; b=I8DbcuSrfRezp18KjsXzfxACNRnRls+4qORArSt1EkVufpcR310b+/5zR3Xh9EDQW1 Aeoqjm+Cs/PRmHocLbAibezdS8EitN0RjqQjP6Od0PbJeuqbwi2vb5V+vw7BkCX54tnV 9YFQ1Zf71o8N0esmvvedFtLxvStBI7Nt3SqaK4fuGHQAL15bmFlVXVXO211s8ZKk2Lq8 qLvOlLPQswMbQP3WokzIuSqlEPBFpJFafVdPYMRzKlrONfsY1VZ+FkTRXP51/AY4dBYG ueU8Yj/v2A3RvRyZhusJ3U+UdyzOyjn2dPK8FexqWRfWKWOdHvcdy8cA1UXloQW+NT83 wsAg== 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=x20bo1mfLbooxu0p8ARwEioa66n0lKT53Vc1hYxzOak=; b=U7TqRbnJqYNx5U4Pr8QXVmrwFfEy7vfrEB4cX3d715KOn+wFOoJ9yoy5DKaF1FFAgs lCq1eMgC/iEoU8+Pyn/eUBPEOQdKO9Xl6a6LiYv77SQ5kdxaScxY4ZdleT2TITajqsPk pFFDwyXWLqmWj0ScBD3J3FtoDaOwOkhu3riedZaKUw8AzCH8GPoQYOzgMC19iBY5XVkF SlxfrvKpbcq9ais4p9qTrknQwpGORRkebxLaWlbe548ixLON1nwd4bIxd5vAPSRjLbV8 ZpjtLpsYVTVGNLbz1N4KlJuHgG5zX/yeaFhMSTdx5sMYJT/t7KdN750CAgPcNOcqRaUw QrGQ== X-Gm-Message-State: AIVw112QNIv6XIY9O8sOaPekv1MLoVpNvCsUE+ereo7Eg92OajyTtpp3 y/20iIZTpo8+pQ== X-Received: by 10.84.142.133 with SMTP id 5mr24023845plx.148.1501662124869; Wed, 02 Aug 2017 01:22:04 -0700 (PDT) Received: from gmail.com ([117.196.126.40]) by smtp.gmail.com with ESMTPSA id o29sm60378582pfa.60.2017.08.02.01.21.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 02 Aug 2017 01:22:04 -0700 (PDT) Received: by gmail.com (sSMTP sendmail emulation); Wed, 02 Aug 2017 13:51:56 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, aradford@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, brking@us.ibm.com, james.smart@broadcom.com, dick.kennedy@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] scsi: add const to bin_attribute structures Date: Wed, 2 Aug 2017 13:51:50 +0530 Message-Id: <1501662110-12388-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add const to bin_attribute structures as they are only passed to the functions sysfs_{remove/create}_bin_file. The arguments passed are of type const, so declare the structures to be const. Done using Coccinelle. @m disable optional_qualifier@ identifier s; position p; @@ static struct bin_attribute s@p={...}; @okay1@ position p; identifier m.s; @@ ( sysfs_create_bin_file(...,&s@p,...) | sysfs_remove_bin_file(...,&s@p,...) ) @bad@ position p!={m.p,okay1.p}; identifier m.s; @@ s@p @change depends on !bad disable optional_qualifier@ identifier m.s; @@ static +const struct bin_attribute s={...}; Signed-off-by: Bhumika Goyal --- drivers/scsi/3w-sas.c | 4 ++-- drivers/scsi/ipr.c | 2 +- drivers/scsi/lpfc/lpfc_attr.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index b150e13..5328a03 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -116,7 +116,7 @@ static ssize_t twl_sysfs_aen_read(struct file *filp, struct kobject *kobj, } /* End twl_sysfs_aen_read() */ /* aen_read sysfs attribute initializer */ -static struct bin_attribute twl_sysfs_aen_read_attr = { +static const struct bin_attribute twl_sysfs_aen_read_attr = { .attr = { .name = "3ware_aen_read", .mode = S_IRUSR, @@ -147,7 +147,7 @@ static ssize_t twl_sysfs_compat_info(struct file *filp, struct kobject *kobj, } /* End twl_sysfs_compat_info() */ /* compat_info sysfs attribute initializer */ -static struct bin_attribute twl_sysfs_compat_info_attr = { +static const struct bin_attribute twl_sysfs_compat_info_attr = { .attr = { .name = "3ware_compat_info", .mode = S_IRUSR, diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index b0c68d2..8f04f66 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -4206,7 +4206,7 @@ static ssize_t ipr_next_async_err_log(struct file *filep, struct kobject *kobj, return count; } -static struct bin_attribute ipr_ioa_async_err_log = { +static const struct bin_attribute ipr_ioa_async_err_log = { .attr = { .name = "async_err_log", .mode = S_IRUGO | S_IWUSR, diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 4ed48ed..be04408 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3974,7 +3974,7 @@ static DEVICE_ATTR(lpfc_stat_data_ctrl, S_IRUGO | S_IWUSR, return index; } -static struct bin_attribute sysfs_drvr_stat_data_attr = { +static const struct bin_attribute sysfs_drvr_stat_data_attr = { .attr = { .name = "lpfc_drvr_stat_data", .mode = S_IRUSR, @@ -5368,7 +5368,7 @@ struct device_attribute *lpfc_vport_attrs[] = { return count; } -static struct bin_attribute sysfs_ctlreg_attr = { +static const struct bin_attribute sysfs_ctlreg_attr = { .attr = { .name = "ctlreg", .mode = S_IRUSR | S_IWUSR, @@ -5426,7 +5426,7 @@ struct device_attribute *lpfc_vport_attrs[] = { return -EPERM; } -static struct bin_attribute sysfs_mbox_attr = { +static const struct bin_attribute sysfs_mbox_attr = { .attr = { .name = "mbox", .mode = S_IRUSR | S_IWUSR,