From nobody Wed Nov 27 02:44:52 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EAF11741C3 for ; Tue, 15 Oct 2024 08:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979238; cv=none; b=RvF70W26lKOojGNyuGVmPlDNAR3EeF1V8hOJ6iqbN87gB+imk27N+2bl0SZiFh8cvGP9Qe1FuLOVDbfaI2jA+bL1rwn61LAWSwrmRcQKmOI97jGixdkPP4nbPdAl24CMwMGPrlZZDcKUnqAKTL3TqmT32ZNnujirVvnDXKUiCMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728979238; c=relaxed/simple; bh=lShOssYYZ4xdaJbyNHqanMXvuVDf0req6t/NTfNf7nY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WYwAQ5P+ZFv864lTRfdb8gqJrnD7JCBSOqt8sa+KikpSwuNii4DzIgch7NKNyPQA/MQbRsAHmfuVUjfgvvMVSsTOQ8PlYSHD/CDOqKtuPvpji5dxp61bRu77h4aHmnhjHNXNGAZaJEbYAS56KUOj4+7UqShHTg1rM/YeEjitEoM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=C8uG4Guw; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="C8uG4Guw" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-42f6bec84b5so48783455e9.1 for ; Tue, 15 Oct 2024 01:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1728979235; x=1729584035; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DPmBnjRzQjanP1Mw6RBxSNqB3Ne/ZGQb73RhNFBuRkg=; b=C8uG4GuwTNHV9EqR/BtD39M2ZOVdJtXC3cEBIc3xSh2PgCa6eZNemYGcJU+JQxHISa UCbMvlaDDNeZjBOZ3uz4D+dREtyFMCDzF5scxcAmRXSNgDnlva72LtUOvh8vzalER6fo THMwEQQPTrGY/NsdGSXrG4K/SIhj8XPR6G+MNEJ7e5lPeyHTOLZ0uV3H4RfhGF32CM1a lST4YVtSUJY4EHBXlG+RfmXhgT8skX+y8pyjKtCSb/UZLuMgo3UEXsZHKKcghUrN8tut S77T4k2Uq8oXWG+xopSoHTq+wQttnBCdw5olKKnQ/9CHCTIIZ3dWBLDntpe8Wfmkf4U9 yKwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728979235; x=1729584035; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DPmBnjRzQjanP1Mw6RBxSNqB3Ne/ZGQb73RhNFBuRkg=; b=mrKmZ2pCjUeaM7jJ8FBkhHmOUjjwvaU1els83C8oqK71HK/E85iUJGqOulvC6yZ5Qz s7D1p+DCt749Ao9AvSYm9Zu3dn0lhmQ0OW3By1rymIv3BoDfauSV3j9X9y16mE4qs8lJ orIeBSqA8L5JO+TAGqjptKv31XyeBi6YDkbdr59FMqZ/9AjNz+DgTI3B5jfGhAUi6aCH IuiDXGWsdwcz6GAQHImQGhhfFMiTXbgStjucNtEYSiJQZr8V48uKK3bfJH5/aqwzB4Pk a+3olSaJVL01z1WpwJ/KQo5vT85NoIRxGv+eVTRiL1f5CyAwdyKR5PxsSCjzW7cSKmEV Mq0A== X-Gm-Message-State: AOJu0YwyiRd5hxsxEKOL5rFT9W1ZWp6NSgLvZFDhWyyVv2vQ/RTveJiv pDahwxZug7cXaz9jTb9+2nzKPsv0uYE8G9bXh3S/Tayd989kNeqYCvUeJjjoCzg= X-Google-Smtp-Source: AGHT+IEUywC+aHx8Z0+/e73fat6PMCBV3/OMS++EeHAQrljRwiBLDr/pa2onfeqqcFJG0JSYBp3U2A== X-Received: by 2002:a05:600c:6d48:b0:431:44aa:ee2e with SMTP id 5b1f17b1804b1-43144aaeed1mr4322285e9.4.1728979235307; Tue, 15 Oct 2024 01:00:35 -0700 (PDT) Received: from [127.0.1.1] ([2a01:cb1d:dc:7e00:d382:b11b:c441:d747]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f6c5531sm9962385e9.46.2024.10.15.01.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 01:00:34 -0700 (PDT) From: Bartosz Golaszewski Date: Tue, 15 Oct 2024 10:00:23 +0200 Subject: [PATCH v2 1/2] driver core: class: expose the class kobject Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241015-gpio-class-mountpoint-v2-1-7709301876ef@linaro.org> References: <20241015-gpio-class-mountpoint-v2-0-7709301876ef@linaro.org> In-Reply-To: <20241015-gpio-class-mountpoint-v2-0-7709301876ef@linaro.org> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Linus Walleij , Bartosz Golaszewski , Kent Gibson Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Bartosz Golaszewski X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1570; i=bartosz.golaszewski@linaro.org; h=from:subject:message-id; bh=xdeL0K0ax/Y+4XPXJs5CzHWIMj0+eRuCDAFQgt0geww=; b=kA0DAAoBEacuoBRx13IByyZiAGcOISGhKwaCS/er5T4wAxp/HjzMKJo3xyuU0cEhq74QKUqYU IkCMwQAAQoAHRYhBBad62wLw8RgE9LHnxGnLqAUcddyBQJnDiEhAAoJEBGnLqAUcddy+iQP+wRm Q9YBOVvXAgenreppoNEPkVmNCkgnPoZep6I+RbrXKPiE3VVycvOVsVBml3QfQSKVFWIbE7wVJXM P0OyasicWOluUUlEn5W3juVds1FIU1ZwlzT/wl5+HUjsmAy1dqjB8bpBLLaaCbQZALwwX4th8ZV pY/jI1lrx6GbOdk9tir2xx+gD6gGBGOs2vEFj7tP4OFDoSVEbYiv20TbayEHC1pv9ALtqz4zMlx YlS84X2PGxHjSsk18rMD2JXYieczaDk6Pgw4LrIYg+QTA15IY2riKDpm21kjKdFOdYyTGtQOHf/ nC9F0QKwgO86rw8nNkr78nG/+0c5+ZC+BW6hmzN5jDHmjsay7Ao512csecRfLrCK0l3XqUk82nU JHbHlL7eJzfRBRwvmztsDQ3CSykX6wkkztLcF7fWj82GVd0zh2CeB1wJT2MaheEr/xysylfiEWm 3fXzgp/fbZt4rHk9X5SBd167WoYjt+gMSh9TbrXeRmOn7JAF0QMsmV79tPnBdz2vFbrDYvfXJjm xSw4e9FRpODUGp/M1h0H6j2/5EDv2WphzyIRlzwlXa7eGkVS4CJ8t1kAQjuATfI/gMkOq8lNU00 tDWYdp9gzLkEmEU9nXo3VfbcrZjWEVQxMvb0jR7ztGy5FHe5zHQf2yED+JFG7wcmFxfWarpzhgb KJ+dE X-Developer-Key: i=bartosz.golaszewski@linaro.org; a=openpgp; fpr=169DEB6C0BC3C46013D2C79F11A72EA01471D772 From: Bartosz Golaszewski Export the address of the /sys/class kobject to users that need to chain off of it by means other than calling register_class(). This will be used by the GPIO subsystem to provide a backward compatibility mount-point for the GPIO sysfs class once it's disabled. Signed-off-by: Bartosz Golaszewski --- drivers/base/class.c | 6 ++++++ include/linux/device/class.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/base/class.c b/drivers/base/class.c index cb5359235c70..68474aff53df 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -23,6 +23,9 @@ /* /sys/class */ static struct kset *class_kset; =20 +struct kobject *class_kobj; +EXPORT_SYMBOL_GPL(class_kobj); + #define to_class_attr(_attr) container_of(_attr, struct class_attribute, a= ttr) =20 /** @@ -668,5 +671,8 @@ int __init classes_init(void) class_kset =3D kset_create_and_add("class", NULL, NULL); if (!class_kset) return -ENOMEM; + + class_kobj =3D &class_kset->kobj; + return 0; } diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 518c9c83d64b..898f7948293d 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -69,6 +69,12 @@ struct class { const struct dev_pm_ops *pm; }; =20 +/* + * Global /sys/class kobject for creating sub-groups by means other than + * class_register(). + */ +extern struct kobject *class_kobj; + struct class_dev_iter { struct klist_iter ki; const struct device_type *type; --=20 2.43.0