public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: rafael@kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH 02/36] ACPI: LPIT: move to use bus_get_dev_root()
Date: Mon, 13 Mar 2023 19:28:44 +0100	[thread overview]
Message-ID: <20230313182918.1312597-2-gregkh@linuxfoundation.org> (raw)
In-Reply-To: <20230313182918.1312597-1-gregkh@linuxfoundation.org>

Direct access to the struct bus_type dev_root pointer is going away soon
so replace that with a call to bus_get_dev_root() instead, which is what
it is there for.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
Note, this is a patch that is a prepatory cleanup as part of a larger
series of patches that is working on resolving some old driver core
design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
its own, but I'd prefer if I could take it through my driver-core tree
so that the driver core changes can be taken through there for 6.4-rc1.

 drivers/acpi/acpi_lpit.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
index 3843d2576d3f..73b5c4800150 100644
--- a/drivers/acpi/acpi_lpit.c
+++ b/drivers/acpi/acpi_lpit.c
@@ -98,6 +98,8 @@ EXPORT_SYMBOL_GPL(lpit_read_residency_count_address);
 static void lpit_update_residency(struct lpit_residency_info *info,
 				 struct acpi_lpit_native *lpit_native)
 {
+	struct device *dev_root = bus_get_dev_root(&cpu_subsys);
+
 	info->frequency = lpit_native->counter_frequency ?
 				lpit_native->counter_frequency : tsc_khz * 1000;
 	if (!info->frequency)
@@ -111,15 +113,18 @@ static void lpit_update_residency(struct lpit_residency_info *info,
 			return;
 
 		/* Silently fail, if cpuidle attribute group is not present */
-		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
-					&dev_attr_low_power_idle_system_residency_us.attr,
-					"cpuidle");
+		if (dev_root)
+			sysfs_add_file_to_group(&dev_root->kobj,
+						&dev_attr_low_power_idle_system_residency_us.attr,
+						"cpuidle");
 	} else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
 		/* Silently fail, if cpuidle attribute group is not present */
-		sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
-					&dev_attr_low_power_idle_cpu_residency_us.attr,
-					"cpuidle");
+		if (dev_root)
+			sysfs_add_file_to_group(&dev_root->kobj,
+						&dev_attr_low_power_idle_cpu_residency_us.attr,
+						"cpuidle");
 	}
+	put_device(dev_root);
 }
 
 static void lpit_process(u64 begin, u64 end)
-- 
2.39.2


       reply	other threads:[~2023-03-13 18:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230313182918.1312597-1-gregkh@linuxfoundation.org>
2023-03-13 18:28 ` Greg Kroah-Hartman [this message]
2023-03-13 18:43   ` [PATCH 02/36] ACPI: LPIT: move to use bus_get_dev_root() Rafael J. Wysocki
2023-03-17 14:50     ` Greg Kroah-Hartman
2023-03-22  8:36     ` [PATCH v2 02/19] " Greg Kroah-Hartman
2023-03-22 14:15       ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313182918.1312597-2-gregkh@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox