Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2440EC74A4B for ; Mon, 13 Mar 2023 19:16:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229871AbjCMTQK (ORCPT ); Mon, 13 Mar 2023 15:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjCMTQF (ORCPT ); Mon, 13 Mar 2023 15:16:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3F93E087 for ; Mon, 13 Mar 2023 12:15:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 329F5B811F6 for ; Mon, 13 Mar 2023 19:14:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1495C433EF; Mon, 13 Mar 2023 19:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678734888; bh=DOBzOLTykg4Bkts9SRDACUFbbp1KDjxkPfQPMcCP18w=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=LQI8Wgo4qhThtvauuC6XvG65lxvonNFQFqdRrsxchQXe9PPFpAI3iMLTZT+nKtnVV EYUWcs5eS9InwwxsnR7gOmd3cVpl27ZNdtJ3ssCkgYBNe7ufzTfhBwTb04l9xyOFS9 XypQqaZvlnV7Kq8Is75m6P0Cy2dry0h7xboIg0yUiOxNHI3Y6JWLdOxlA1dEtJ+z4e OxRFsExFjj5PxgW8bLeaUwraAbpon6eMWoprcn/zzvpnRmQFP/rjrPATHXdlf7wsmg tGBnj5pXZ42erj1AmND+mZGX6Medny9opHW5e5BvGYLGK+OPvo7DeZ97qWKHLM87KM dVEsdJdDHAv/w== Date: Mon, 13 Mar 2023 14:14:47 -0500 From: Bjorn Helgaas To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, "David S. Miller" , "James E.J. Bottomley" , "K. Y. Srinivasan" , "Martin K. Petersen" , Alex Shi , Alexander Gordeev , Alexandre Bounine , Alison Schofield , Ben Widawsky , Bjorn Helgaas , Dan Williams , Dexuan Cui , Eric Dumazet , Haiyang Zhang , Hannes Reinecke , Harald Freudenberger , Heiko Carstens , Hu Haowen , Ilya Dryomov , Ira Weiny , Iwona Winiarska , Jakub Kicinski , Jens Axboe , Jonathan Corbet , Laurentiu Tudor , Matt Porter , Michael Ellerman , Paolo Abeni , Stuart Yoder , Vasily Gorbik , Vishal Verma , Wei Liu , Yanteng Si Subject: Re: [PATCH 23/36] driver core: bus: mark the struct bus_type for sysfs callbacks as constant Message-ID: <20230313191447.GA1528028@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230313182918.1312597-23-gregkh@linuxfoundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 13, 2023 at 07:29:05PM +0100, Greg Kroah-Hartman wrote: > struct bus_type should never be modified in a sysfs callback as there is > nothing in the structure to modify, and frankly, the structure is almost > never used in a sysfs callback, so mark it as constant to allow struct > bus_type to be moved to read-only memory. > > Cc: "David S. Miller" > Cc: "James E.J. Bottomley" > Cc: "K. Y. Srinivasan" > Cc: "Martin K. Petersen" > Cc: Alex Shi > Cc: Alexander Gordeev > Cc: Alexandre Bounine > Cc: Alison Schofield > Cc: Ben Widawsky > Cc: Bjorn Helgaas > Cc: Dan Williams > Cc: Dexuan Cui > Cc: Eric Dumazet > Cc: Haiyang Zhang > Cc: Hannes Reinecke > Cc: Harald Freudenberger > Cc: Heiko Carstens > Cc: Hu Haowen > Cc: Ilya Dryomov > Cc: Ira Weiny > Cc: Iwona Winiarska > Cc: Jakub Kicinski > Cc: Jens Axboe > Cc: Jonathan Corbet > Cc: Laurentiu Tudor > Cc: Matt Porter > Cc: Michael Ellerman > Cc: Paolo Abeni > Cc: Stuart Yoder > Cc: Vasily Gorbik > Cc: Vishal Verma > Cc: Wei Liu > Cc: Yanteng Si > Signed-off-by: Greg Kroah-Hartman Acked-by: Bjorn Helgaas # pci > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index dd0d9d9bc509..ab32a91f287b 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -428,7 +428,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr, > } > static DEVICE_ATTR_RW(msi_bus); > > -static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count) > +static ssize_t rescan_store(const struct bus_type *bus, const char *buf, size_t count) > { > unsigned long val; > struct pci_bus *b = NULL; > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 7a67611dc5f4..45c3bb039f21 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -6679,7 +6679,7 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) > } > } > > -static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) > +static ssize_t resource_alignment_show(const struct bus_type *bus, char *buf) > { > size_t count = 0; > > @@ -6691,7 +6691,7 @@ static ssize_t resource_alignment_show(struct bus_type *bus, char *buf) > return count; > } > > -static ssize_t resource_alignment_store(struct bus_type *bus, > +static ssize_t resource_alignment_store(const struct bus_type *bus, > const char *buf, size_t count) > { > char *param, *old, *end;