From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A0A0C61DA4 for ; Mon, 13 Mar 2023 18:45:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjCMSp5 convert rfc822-to-8bit (ORCPT ); Mon, 13 Mar 2023 14:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbjCMSp4 (ORCPT ); Mon, 13 Mar 2023 14:45:56 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57F4D2E81E; Mon, 13 Mar 2023 11:45:21 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id x3so52552909edb.10; Mon, 13 Mar 2023 11:45:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678733013; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AS/WyNiPbCZftoU6jgkGbodsREzbGi5V+aiW+aiHpfA=; b=L2zhJEiOkmGDymsZjBs+793MRdgIfMPYM6EP9R10kjvxHwtrYF+EGlFP/SuG7x/rD7 qrODHLPtywPjZeDtb9DhOJu/Du6VIliBwhMgxfhG7DLaBcL9DYY9zNlDv4KKkSBbxKAd CX4Gt8+gaJaJDO2EJVTQs8+LpYmkBT11Fv0yAi1Pqulteamu0RS90cTlKMMpL6aBZKw2 1aJCDwKz8WpQ18jqZht722aIlwjKcCM6LDhtPKc1mP1sXtDqwK5LgFtNCSHXwuu+r1Rs Fg7A0XoIUj9CEPJMjGOaT00XHwcEuKq1lAXGWGHKQPbEdP9ca8SFhqMhjfKLndemN9zA EQsw== X-Gm-Message-State: AO0yUKU4CwT+j0FoHuK3Xi1O6FmEs9wjSbBBSOFNTCWsgCbxfApwnwNg fN/fegrD+Z+Ftm4yJ1x8K3ueG29GV9ERRxbzXQ5s39R24pQ= X-Google-Smtp-Source: AK7set/9f3wmhPrJ2AbY8kRIKM7r2Mh0TR/vaBbfcqgioIPTgCA78PHXksCgzdFKVdangTjqQPxoNfQjQE3moFrkiPM= X-Received: by 2002:a50:d59a:0:b0:4fb:f19:881 with SMTP id v26-20020a50d59a000000b004fb0f190881mr3581486edi.3.1678733013460; Mon, 13 Mar 2023 11:43:33 -0700 (PDT) MIME-Version: 1.0 References: <20230313182918.1312597-1-gregkh@linuxfoundation.org> <20230313182918.1312597-2-gregkh@linuxfoundation.org> In-Reply-To: <20230313182918.1312597-2-gregkh@linuxfoundation.org> From: "Rafael J. Wysocki" Date: Mon, 13 Mar 2023 19:43:22 +0100 Message-ID: Subject: Re: [PATCH 02/36] ACPI: LPIT: move to use bus_get_dev_root() To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, rafael@kernel.org, Len Brown , linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Mon, Mar 13, 2023 at 7:29 PM Greg Kroah-Hartman 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" > Cc: Len Brown > Cc: linux-acpi@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman > --- > 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); > + This can return here right away if dev_root is NULL, because it will not do anything useful in that case anyway. > 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 >