[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iaR7mqdKqCL-WH+GXa=pxnV+r_tta+UqX1aVgEysYu9Q@mail.gmail.com>
Date: Mon, 13 Mar 2023 19:45:34 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, rafael@...nel.org,
Viresh Kumar <viresh.kumar@...aro.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Len Brown <lenb@...nel.org>, linux-pm@...r.kernel.org
Subject: Re: [PATCH 03/36] cpufreq: move to use bus_get_dev_root()
On Mon, Mar 13, 2023 at 7:29 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> 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@...nel.org>
> Cc: Viresh Kumar <viresh.kumar@...aro.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
> Cc: Len Brown <lenb@...nel.org>
> Cc: linux-pm@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> 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/cpufreq/cpufreq.c | 7 ++++++-
> drivers/cpufreq/intel_pstate.c | 7 +++++--
> 2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 6d8fd3b8dcb5..6ad3119b8e15 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2932,11 +2932,16 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
> static int __init cpufreq_core_init(void)
> {
> struct cpufreq_governor *gov = cpufreq_default_governor();
> + struct device *dev_root;
>
> if (cpufreq_disabled())
> return -ENODEV;
>
> - cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
> + dev_root = bus_get_dev_root(&cpu_subsys);
> + if (dev_root) {
> + cpufreq_global_kobject = kobject_create_and_add("cpufreq", &dev_root->kobj);
> + put_device(dev_root);
> + }
> BUG_ON(!cpufreq_global_kobject);
>
> if (!strlen(default_governor))
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 48a4613cef1e..102cf7f0ac63 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1473,10 +1473,13 @@ static struct kobject *intel_pstate_kobject;
>
> static void __init intel_pstate_sysfs_expose_params(void)
> {
> + struct device *dev_root = bus_get_dev_root(&cpu_subsys);
> int rc;
>
> - intel_pstate_kobject = kobject_create_and_add("intel_pstate",
> - &cpu_subsys.dev_root->kobj);
> + if (dev_root) {
> + intel_pstate_kobject = kobject_create_and_add("intel_pstate", &dev_root->kobj);
> + put_device(dev_root);
> + }
> if (WARN_ON(!intel_pstate_kobject))
> return;
>
> --
> 2.39.2
>
Powered by blists - more mailing lists