From patchwork Mon Mar 13 18:29:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 69018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1345259wrd; Mon, 13 Mar 2023 11:42:24 -0700 (PDT) X-Google-Smtp-Source: AK7set+5ygehzdRc+KJxvKDftA0IRbdrnbFu1kEUaIOeN+xlluT8WbtGH1shMzpjAqtJVZS1OhsZ X-Received: by 2002:a05:6a20:8f27:b0:cc:65c3:c8cb with SMTP id b39-20020a056a208f2700b000cc65c3c8cbmr36659597pzk.42.1678732944718; Mon, 13 Mar 2023 11:42:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678732944; cv=none; d=google.com; s=arc-20160816; b=sDONuqyA/rP6yv774TiW1Ps9gwzjN60pC3e42lV4BzYt0b+Qv9W3HZWNSHJurD72iB FZ32u9AbSQFeehluzth4SGPcYh2RZMTk5Cjik3WxBRFeHqsxC6CuXHaw+0jMSlPxDP2g Nk2RdetkGvK8ngb4j3141ZItrl/w3ctWNszOZk9I+F9FU6Ndl73zKIT7D9R3myVQYwfJ MT3YRv5fKEFCUtWXm1rwc38x60BzyZ5ulTWdszn6hfeDL2+7OHIGxd7aeqAwLGiedIua EZnXlYrcagqooHIknfEFjotaDj9vp3mfQHeUFPX1JBvvULIGQPhb5V0CZuBM9KghGrEx O+cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Awlfz0SkLnzXmSuDQv/3vQMIO4BS1NmJaS1qLeNp3NI=; b=PU8yNzi1CcRhb+skyN5GMKKKik0cnwx817PhUuuxVconmRg6EPbZMXXjuovuiKYyYv qU/KQ13AG9SguFWxmLX8SI8MGtDueZOD/Vb50KPFphkF9792vZjDKheVBkUCX3a9259W vf7/BcpahB2V/8rIAEUdF10iFYfqwFuT+4zR11LSZVP25vU60MrU2fPrzfyl3MaiLfRJ RrzKzt2vSuTn7F1t9Mc060yGUtvBQwIZDWdix3Z3KUQlvwAPd1ZRTI4kuLFpXy28KcR1 6DEkHOT7fTGUb5Nri2k1tMH1e3YkeY0CWugplXNz68FSSZV7R9ec3YlM8rt9AZXo+cUB r22w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gGraI953; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r188-20020a632bc5000000b004fbbb35999dsi115129pgr.832.2023.03.13.11.42.12; Mon, 13 Mar 2023 11:42:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gGraI953; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231357AbjCMSbn (ORCPT + 99 others); Mon, 13 Mar 2023 14:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbjCMSbF (ORCPT ); Mon, 13 Mar 2023 14:31:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C908848D1 for ; Mon, 13 Mar 2023 11:30:39 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 1150261468 for ; Mon, 13 Mar 2023 18:30:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22936C433D2; Mon, 13 Mar 2023 18:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678732238; bh=2ZmWFDJP7W9Eu0QlisAwd3I2utOuVhHKcxmoQW6TiXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGraI953dU2dZ0Nusru0tb87Wdlaj65SktviZ5w0V9ohBhs5FZIyENihQoBFSb4yJ 8q6raFbGcA9U8RavAWu7jTrJA9BpjRtnlqDIXQcl5zEUbgwGVSPrWSwfoJz1TaPppp kf4ETJUT3aUtdlXITXA5Cl1YvnNBCQ+Qcuu7zMtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: rafael@kernel.org, Greg Kroah-Hartman Subject: [PATCH 24/36] driver core: bus: constantify bus_register() Date: Mon, 13 Mar 2023 19:29:06 +0100 Message-Id: <20230313182918.1312597-24-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313182918.1312597-1-gregkh@linuxfoundation.org> References: <20230313182918.1312597-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1810; i=gregkh@linuxfoundation.org; h=from:subject; bh=2ZmWFDJP7W9Eu0QlisAwd3I2utOuVhHKcxmoQW6TiXI=; b=owGbwMvMwCRo6H6F97bub03G02pJDCn82VVcAoekqg6erF/9rMh4tZxPzrkTYedXcqtnSZ50M nuadSmmI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACayRIRhfrlw+IEek1d1B+Na LvXafWtkv+FQxbBgfURPy9m+9VNezPFrvfXj6Rr5W/oeAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760279076002507375?= X-GMAIL-MSGID: =?utf-8?q?1760279076002507375?= bus_register() is now safe to take a constant * to bus_type, so make that change and mark the subsys_private bus_type * constant as well. Cc: "Rafael J. Wysocki" Signed-off-by: Greg Kroah-Hartman --- drivers/base/base.h | 2 +- drivers/base/bus.c | 2 +- include/linux/device/bus.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/base/base.h b/drivers/base/base.h index f1034e27e651..09c6682d16b5 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -49,7 +49,7 @@ struct subsys_private { struct klist klist_drivers; struct blocking_notifier_head bus_notifier; unsigned int drivers_autoprobe:1; - struct bus_type *bus; + const struct bus_type *bus; struct device *dev_root; struct kset glue_dirs; diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 819ab745fa9f..f739a2a79e59 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -841,7 +841,7 @@ static struct bus_attribute bus_attr_uevent = __ATTR(uevent, 0200, NULL, * infrastructure, then register the children subsystems it has: * the devices and drivers that belong to the subsystem. */ -int bus_register(struct bus_type *bus) +int bus_register(const struct bus_type *bus) { int retval; struct subsys_private *priv; diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index 78c875386c06..c30c4748c170 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -110,7 +110,7 @@ struct bus_type { bool need_parent_lock; }; -extern int __must_check bus_register(struct bus_type *bus); +extern int __must_check bus_register(const struct bus_type *bus); extern void bus_unregister(const struct bus_type *bus);