Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1981656rwr; Fri, 28 Apr 2023 04:44:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RrA/UXP6vmB5ei5I4S5GR7/6AjJK9Msyv4+RylVa+/XmXmjMsT1uTdlDIaQxvAd0Z0sQ0 X-Received: by 2002:a17:90b:4acf:b0:246:fc58:d77b with SMTP id mh15-20020a17090b4acf00b00246fc58d77bmr5226806pjb.44.1682682283307; Fri, 28 Apr 2023 04:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682682283; cv=none; d=google.com; s=arc-20160816; b=j80IrzczfRLjQ31ewtDcQwpG2HMBeVcBLcrixALkOBqFSuPWEdzapWuy0KirqjFUzp oe+kJYwQrTWBwyuS0HdYUxG41bDJWbr9YjIRdcbmh4M1X42CZxdHflyCMfXVRo84k1gQ vP4qUJ4+BEutV16auWIv/NdmXicKC78kbcJbJpA6YQ4kkfs1aFKHb9bYsAqwOQmHzVwJ glLuFy/bhIU7KQaNSW1cULN5UoOPAiIKgclCsYw8NdTbKIA39EEysSWn5pVRrT/WKrA2 q4b0zQ2S7UqWe7NW0dVoastZoXlqkMnutm2q6nHkxie2Cbqk2gopJsLBp4f44LobuNA6 PQrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=y/v0h1/VgBg3TNWty361sFN7HQo6Ts2b7hoUYyNAPpg=; b=GvN9qKodpxHZkKiAHaPbueZSGSyKHzBTbhIFicn3SbmyoiL0XzojFRwIbNOz+IjHG2 7d/Pnia2QAKcNktXL4O5F2aSFKTPMVtiwr32b6ebk5jFwsndgL9pWSDUr+rMfi/Zdhhq KZpEdmRn7KyCYgvzT0HPShVQoadNsWD7SCsOvaiwtL5sWZuv+AnC53ZsTxfUEa1hLZDg xuIKBcI/fBsLoEdK1Ycb7+pTjq3J1+uKAlQOOi3Zik3Abc0P678cEcuzvLJ3Ykvguy+K zRCfgFywewoSz46Gs7AA/nn+qHrYasZ8gBvvhOIqnLoSusjkL7sT1eBROjljFkNHL95q rgvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a170902d4d100b0019a96849d6dsi22855578plg.605.2023.04.28.04.44.27; Fri, 28 Apr 2023 04:44:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbjD1Lho convert rfc822-to-8bit (ORCPT + 99 others); Fri, 28 Apr 2023 07:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjD1Lhl (ORCPT ); Fri, 28 Apr 2023 07:37:41 -0400 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A221F59FB; Fri, 28 Apr 2023 04:37:40 -0700 (PDT) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-94f59fbe2cbso280472866b.1; Fri, 28 Apr 2023 04:37:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682681859; x=1685273859; 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=pQiAdmvtnwSb14cjiMRaVpHdjTkVg4P9ZJ6La/hDMEU=; b=YnHhrlJqThjMfhttHi0UKColRYCW+VNH+8p6WSzKrTdmsPidLH4qPE5Hf4JmzVIt4Q y1s4+4Zw2yxrR782iDd/4VWVj9aBXfjjPvxnwY3dICQzFLrVzhWJy4ovBkpKbNJyGXiL TN8Cyf3Bn2wAZzhR6wLC0wSxNkLQDIfswekCC64zo8+ycVu5EdubwcptkVh7WiYW6b16 +X30/5JkPKn28A4xmNMKsVtotqzBwabEaWrEwenNJ5JrumD8l/EGM0SHc4OkOaCpJepg Mz4QIQqR9E43VpX4q3YD2Szub6z4GXlhP9e2KfIKFZPB6/6j2wrj5HhWh5EsBsRJa6vP twrg== X-Gm-Message-State: AC+VfDyCOrcM9rXELEraPCPcDZAcglJ7In1ZgZ9UyYgk/0idiM3iU49a hur45jVbu3TK04DMh506wOjBrhNEUuDcl6efY0w= X-Received: by 2002:a17:906:7a51:b0:94e:63ae:5b9b with SMTP id i17-20020a1709067a5100b0094e63ae5b9bmr2033742ejo.7.1682681858835; Fri, 28 Apr 2023 04:37:38 -0700 (PDT) MIME-Version: 1.0 References: <20230428070314.225560-1-wangyouwan@126.com> In-Reply-To: <20230428070314.225560-1-wangyouwan@126.com> From: "Rafael J. Wysocki" Date: Fri, 28 Apr 2023 13:37:26 +0200 Message-ID: Subject: Re: [PATCH] cpufreq: create cooling device based on ACPI To: wangyouwan@126.com Cc: rafael@kernel.org, viresh.kumar@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 28, 2023 at 9:19 AM wrote: > > From: youwan Wang > > When using the "scpi_cpufreq" driver, an error > occurs:cpufreq_cooling: OF node not available for cpu*. > The current computer motherboard is using ACPI firmware. > Go to see that the error is caused by calling the > "of_cpufreq_cooling_register" interface. > comment:create cpufreq cooling device based on DT. > > Signed-off-by: youwan Wang > --- > drivers/cpufreq/cpufreq.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 6b52ebe5a890..3418c68959d5 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu) > if (cpufreq_driver->ready) > cpufreq_driver->ready(policy); > > - if (cpufreq_thermal_control_enabled(cpufreq_driver)) > + if (cpufreq_thermal_control_enabled(cpufreq_driver)) { > +#ifdef CONFIG_ACPI > + policy->cdev = cpufreq_cooling_register(policy); > +#else > policy->cdev = of_cpufreq_cooling_register(policy); > +#endif Please avoid adding #ifdefs like this in random places. Moreover, what if the kernel supports ACPI and the platform is DT-based? > + } > > pr_debug("initialization complete\n"); > > --