Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1061999imm; Thu, 4 Oct 2018 07:39:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV61dGTZyE9b5cuAE/3MBXcCG9MMhNUcbBlXq7jxa7MSJQn7YtwSAwEMIM+m2G/aI3f64tVYI X-Received: by 2002:a65:43cd:: with SMTP id n13-v6mr5972762pgp.185.1538663976344; Thu, 04 Oct 2018 07:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538663976; cv=none; d=google.com; s=arc-20160816; b=Da7YvVRTeuSk2iGmrTgRFtQhsQJjXTLg5+Za3yFboAWiutJRSkyXZaVktTTVaton7M e3jePBP/d7YnI8hWNgZ8TXqBi3kQGwle5ZHglFXaHIxDD6gmVZD7H+8M0Cx0+DJfl3m2 fvx/eGncUJB4s8zIsLGid8zWXHr8FE1cIaXyUn+iUbygirAstGdMBOBQyu+hZVgDE717 vpY7Pr3mTWQAHZwatT96P8Fovt8iiJ9d68VYVUfmok5/F2HvhME2fu7VNKL9oPqx+V56 GAwDHD/R+tUX9bJH1y5M/OksSH0eAu3qFEojxbRtYeUpESa2jmG1sqlkB4y2PuICSYqU c8MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:message-id:date:subject:cc :to:from; bh=ZOZcQhXCrVF7rn9tUYRQSC2mesh1nohyqk9euxYfMoc=; b=0gloqCRYc/9Vy5gh1QrnABTe1a39nSyaXX3gtAoPmgYfp6u3Oz4S5/Cg+BYpKx6C72 Ln8jRt7xW47S/lgKWpyksjT1Ushu6Tzi9/JV6z4zs00nim5V/o/OxgY6R/9QSIZXu8jH 0vEvczP0thkhOJuTzduSvHdklkJtrPA8zym0slm/TNiL64YM3dHRQ9mR/S8C4QFQa24o UGCCx3EkKo/4zPdO/mwHzDkq/VA0VZjEoJHtLeloGlGRX12jSZLBieBIdD5vZmfh5Yii qA+Yr+6jmxN5Z2RnsjqtNdhetINt+7/z4LxSiblhtv5CLWXK9PbdJuWFJb10daWpChcl JI7A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m4-v6si5084404plt.432.2018.10.04.07.39.21; Thu, 04 Oct 2018 07:39:36 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727746AbeJDVch (ORCPT + 99 others); Thu, 4 Oct 2018 17:32:37 -0400 Received: from mga12.intel.com ([192.55.52.136]:62464 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727679AbeJDVca (ORCPT ); Thu, 4 Oct 2018 17:32:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 07:38:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,340,1534834800"; d="scan'208";a="96059378" Received: from jnikula-mobl3.fi.intel.com (HELO localhost) ([10.237.72.61]) by fmsmga001.fm.intel.com with ESMTP; 04 Oct 2018 07:38:16 -0700 From: Jani Nikula To: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org Cc: jani.nikula@intel.com, Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH 1/2] sysfs: constify sysfs create/remove files harder Date: Thu, 4 Oct 2018 17:37:49 +0300 Message-Id: <20181004143750.30880-1-jani.nikula@intel.com> X-Mailer: git-send-email 2.11.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let the passed in array be const (and thus placed in rodata) instead of a mutable array of const pointers. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Jani Nikula --- fs/sysfs/file.c | 4 ++-- include/linux/sysfs.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 0a7252aecfa5..bb71db63c99c 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -334,7 +334,7 @@ int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr, } EXPORT_SYMBOL_GPL(sysfs_create_file_ns); -int sysfs_create_files(struct kobject *kobj, const struct attribute **ptr) +int sysfs_create_files(struct kobject *kobj, const struct attribute * const *ptr) { int err = 0; int i; @@ -493,7 +493,7 @@ bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr) return ret; } -void sysfs_remove_files(struct kobject *kobj, const struct attribute **ptr) +void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *ptr) { int i; for (i = 0; ptr[i]; i++) diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 987cefa337de..786816cf4aa5 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -234,7 +234,7 @@ int __must_check sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr, const void *ns); int __must_check sysfs_create_files(struct kobject *kobj, - const struct attribute **attr); + const struct attribute * const *attr); int __must_check sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, umode_t mode); struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj, @@ -243,7 +243,7 @@ void sysfs_unbreak_active_protection(struct kernfs_node *kn); void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, const void *ns); bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); -void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); +void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attr); int __must_check sysfs_create_bin_file(struct kobject *kobj, const struct bin_attribute *attr); @@ -342,7 +342,7 @@ static inline int sysfs_create_file_ns(struct kobject *kobj, } static inline int sysfs_create_files(struct kobject *kobj, - const struct attribute **attr) + const struct attribute * const *attr) { return 0; } @@ -377,7 +377,7 @@ static inline bool sysfs_remove_file_self(struct kobject *kobj, } static inline void sysfs_remove_files(struct kobject *kobj, - const struct attribute **attr) + const struct attribute * const *attr) { } -- 2.11.0