From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08BFCC00449 for ; Fri, 5 Oct 2018 06:54:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9208320834 for ; Fri, 5 Oct 2018 06:54:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9208320834 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbeJENv5 (ORCPT ); Fri, 5 Oct 2018 09:51:57 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40433 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727025AbeJENv5 (ORCPT ); Fri, 5 Oct 2018 09:51:57 -0400 Received: by mail-ot1-f68.google.com with SMTP id w67so11701974ota.7 for ; Thu, 04 Oct 2018 23:54:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ErgCZiuWQWMwXPiAm/q4OdvjWtbS4JkYZ6UuJ/yrSi8=; b=sUlMeL3zDRHRiwiIkYk34OxB8Ju60FWClAxk1i9H+yNMJ+drPoSlhFFOHERRFojS0i rNFryc6qFmRUnvqqWvYUYiTC/b2qkRKTav3bGkmRzVEvJ7a3QmvL20CVjE4ZxDEgLjYN ib1dgbgCo1VGwYdhJy1NJVn4DaOJUtXHR16ccU43Nq2dq8qo4+jOO+VCg9BrBIluve9Z ddfAWMm3tJSG+s4MDtlrcLDul+Nc14bKcHXE93kA+R1T7/Q/uit/o2x6D/fY3FpVLB0Q R5D8WqCE1pZYS5Xv5iY++T0+asCP/TX8IKPXWATd6RuBOXmpZxBaQm2Mle31DBd1V5CX WRzg== X-Gm-Message-State: ABuFfoioHZs4bluPY5wMUnPgUmCix4d4eQoTNLz+mynED5Kp1m8dp6qA CDlOwejfTHqb5MH/q+edrEJpQ7oIrnlqpN+OQy0= X-Google-Smtp-Source: ACcGV61DWwIo9+Rd9XZCXA71Wc7XWvtiWiNdg9vdcLFqVwrYoQCNI+x14cihhVj4cQAAEXyXpufqCweV66U5AxG3ZM8= X-Received: by 2002:a9d:4c90:: with SMTP id m16mr1162123otf.124.1538722478981; Thu, 04 Oct 2018 23:54:38 -0700 (PDT) MIME-Version: 1.0 References: <20181004143750.30880-1-jani.nikula@intel.com> In-Reply-To: <20181004143750.30880-1-jani.nikula@intel.com> From: "Rafael J. Wysocki" Date: Fri, 5 Oct 2018 08:54:27 +0200 Message-ID: Subject: Re: [PATCH 1/2] sysfs: constify sysfs create/remove files harder To: Jani Nikula Cc: Linux Kernel Mailing List , intel-gfx , Greg Kroah-Hartman , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 4, 2018 at 4:38 PM Jani Nikula wrote: > > Let the passed in array be const (and thus placed in rodata) instead of > a mutable array of const pointers. I'm not sure if the changes guarantee what you want. If I'm not mistaken, they just mean that the function itself cannot modify either the pointer passed to it, or the contents of the array pointed to by that pointer. They don't imply the location of the array itself, though. As for the changes: Reviewed-by: Rafael J. Wysocki > 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 >