From patchwork Tue Dec 19 13:15:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 180940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1927223dyi; Tue, 19 Dec 2023 05:15:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYgnPBZvaCoeouQqqdpVaRvbeIgJYhIq2cJUgctDPv8qTdVg+V+3n1wm3Zn0vFACfq4pDq X-Received: by 2002:a05:6e02:148c:b0:35d:a38a:fc83 with SMTP id n12-20020a056e02148c00b0035da38afc83mr17688132ilk.67.1702991727431; Tue, 19 Dec 2023 05:15:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702991727; cv=none; d=google.com; s=arc-20160816; b=IwvoXD+cCgOcTITHkmt5O18lKXpPunp+mn53Aijoz+ST3XXlnxeGoW/ZduCIpLl9GV G4W5qJGjdYU9Np6dE8w3YuMsElK9VpeTqJeH3RfVAAUXuFIHvIxVCrAL+4zEohc7C5Om los4YICWHhcqk1OvQ4pz6ulkBypVqYWQMSn0C+1W8LQW3DewkKTOywUiSu4ffu6BLGxN Xe8ZNI/JJawKupOueLT621K/wxUljACwgQoGbarrEAUUtpXnam777NUbpFsEHo9VTzYK D7nsvCaZ3K3F4Mf+/km6+ygdYYIJwwLxBJRME2pTLqe6gTWW5wdSranCIVJbS1fAYQdM XuvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=R0Y3b2wLCOcNAZL4jTxrZHX/5oZwp2PJSRgiPerqCz0=; fh=MV9Knl1RWyvrdGPBBTPBkYgUvj+BcNAtpmtGSwz2IqE=; b=QSx+yNdtfOLvBQzsmPgJT4DRmnBSm1tcxYXu3wQaIVD1KDbkP6Eq1sxIIf+GCnxjSD +v5skGMYjKKLAql5rJbsOZIC9l1pu+/oDG6pXyzBjKVra+hwnpSvem7RCJz6wDNPrSjg UPaG5HDcwUrn2k2Sjfx0KB0JYIcABAgKieyEYrKS/uG8QqsN2EkHXOCzdOhaGgi0rid4 vbQBXAPbog5Dk06LIlVlWBTPJdbHc7/fZBDtCt191OmKBRW1+N3U2HiBbG+RWQTfK7g2 /cg2oxt23UVaf5AkyfTYY+LT43UYmhalW1u83AHDS6xIWP9Sm/d2Z6I/bk7t6n4WYcy/ BUMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vtjsv4H2; spf=pass (google.com: domain of linux-kernel+bounces-5245-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5245-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c9-20020a63d509000000b005bd03d4f2d7si19068446pgg.511.2023.12.19.05.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 05:15:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5245-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vtjsv4H2; spf=pass (google.com: domain of linux-kernel+bounces-5245-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5245-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 03AB12832C5 for ; Tue, 19 Dec 2023 13:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0126918EB3; Tue, 19 Dec 2023 13:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Vtjsv4H2" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4105E18E16 for ; Tue, 19 Dec 2023 13:15:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257A8C433C7; Tue, 19 Dec 2023 13:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702991712; bh=9eXFc0NMwtRCOlj8YbmAE3FjrOz7Fufp7aizqjfZxT4=; h=From:To:Cc:Subject:Date:From; b=Vtjsv4H2aiRYE3YLsDWGQEndsXQ0WY7ce8SyMNwKi+ShAb9fPuGQpjox27H9ONHNp oppy0WB+M5b6M5W8fO03Age/0vP/n8317yZgv63BJKhKLvo27Zs/kg6yRMot+e5n4q 6xWq9HnXG7aFi/mSEImfhEfrkscjjR53ipibPmro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko Subject: [PATCH] driver core: bus: constantify subsys_register() calls Date: Tue, 19 Dec 2023 14:15:09 +0100 Message-ID: <2023121908-grove-genetics-f8af@gregkh> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 74 X-Developer-Signature: v=1; a=openpgp-sha256; l=2932; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=9eXFc0NMwtRCOlj8YbmAE3FjrOz7Fufp7aizqjfZxT4=; b=owGbwMvMwCRo6H6F97bub03G02pJDKmN02Oy9yd9rb28at6RDa/+GpTfPWZYpLQ3Le53//HDn p8u8DC96YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJsPgyzNM23607O75qrUXy Sn6eFLtp9Qqr+BgWHI2PPTSrJnBCXvvtlweb/3CWR4Z+AwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785716253421154871 X-GMAIL-MSGID: 1785716253421154871 The functions subsys_register() and subsys_virtual_register() should be taking a constant pointer to a struct bus_type, as they do not actually modify anything in it, so fix up the function definitions to do so properly. This also changes the pointer type in struct subsys_interface to be constant as well, as again, that's the proper signature of it. Cc: "Rafael J. Wysocki" Cc: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman Reviewed-by: Andy Shevchenko --- drivers/base/bus.c | 6 +++--- include/linux/device.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 84a21084d67d..dddbaa024583 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -1194,7 +1194,7 @@ static void system_root_device_release(struct device *dev) kfree(dev); } -static int subsys_register(struct bus_type *subsys, +static int subsys_register(const struct bus_type *subsys, const struct attribute_group **groups, struct kobject *parent_of_root) { @@ -1264,7 +1264,7 @@ static int subsys_register(struct bus_type *subsys, * directory itself and not some create fake root-device placed in * /sys/devices/system/. */ -int subsys_system_register(struct bus_type *subsys, +int subsys_system_register(const struct bus_type *subsys, const struct attribute_group **groups) { return subsys_register(subsys, groups, &system_kset->kobj); @@ -1282,7 +1282,7 @@ EXPORT_SYMBOL_GPL(subsys_system_register); * There's no restriction on device naming. This is for kernel software * constructs which need sysfs interface. */ -int subsys_virtual_register(struct bus_type *subsys, +int subsys_virtual_register(const struct bus_type *subsys, const struct attribute_group **groups) { struct kobject *virtual_dir; diff --git a/include/linux/device.h b/include/linux/device.h index 4aa34c8d1361..aefc5ca7f1cf 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -63,7 +63,7 @@ struct msi_device_data; */ struct subsys_interface { const char *name; - struct bus_type *subsys; + const struct bus_type *subsys; struct list_head node; int (*add_dev)(struct device *dev, struct subsys_interface *sif); void (*remove_dev)(struct device *dev, struct subsys_interface *sif); @@ -72,9 +72,9 @@ struct subsys_interface { int subsys_interface_register(struct subsys_interface *sif); void subsys_interface_unregister(struct subsys_interface *sif); -int subsys_system_register(struct bus_type *subsys, +int subsys_system_register(const struct bus_type *subsys, const struct attribute_group **groups); -int subsys_virtual_register(struct bus_type *subsys, +int subsys_virtual_register(const struct bus_type *subsys, const struct attribute_group **groups); /*