Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp625562imu; Wed, 23 Jan 2019 02:46:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN55iOL2q2/ACJCu06DekmIjlICdMcQFuB6AGio2LYUpXsn9v7Qb4wRvSYHLMdQv3abM10+B X-Received: by 2002:a17:902:4324:: with SMTP id i33mr1673296pld.227.1548240375587; Wed, 23 Jan 2019 02:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548240375; cv=none; d=google.com; s=arc-20160816; b=FmfqRv5rJlHwWLKweHikBgHjIm61OocANA7sUojejCvryw/D9cZBBvexl2vGz9hoyH iakBn9odE84MSRlNwhJfD+0NVHyaz7/K1J2jpzlBAaEqVU8QhP6b8vBjoPouOWT/K6ep ueMRa/BjNjGhZHRFAiSIfLXzl8AI8PtXL4b7Z3ke1uP2M5zDNEyKynqAQ4HEb2r5W/s1 y4zB8JsgI7fHuS8AAX/eYkpm+KixcI1MKnUnZ9aALFw2Cxpri5jnaBdUMx2KkFi9lJkp HWmrkYzZ3DeXdcBwgaXp5qcGh2+Q1Z4RFagV6NSBxDtC/hExfP5zSc4sKWBa5Ren+XS4 +33w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bz19SppYde9VYVOJqe3AHw5ZOnn7YaLj6WXKEyVlAGk=; b=SiVtuiIfJ/Gn3xAwUntK7GXQ3WZIMYx2CjFpWA0iDMu1oQPgcXZHFDxXX6au6628D7 pw0KcIrAGY6ZitlETsP2jojx80u1MmRnqcrFP58w67M63SX5aRCm2kT/MJFf2Q6ziyc5 cPwDxpKxXRzf3JtWwVu2sLjqiuXe6Cr8sIYw/kNedvenRgEINoX3fxglUZ214qSaDl+m PnrYQNjQ5NSwzAQfhDsGxsgL5ZeIP2vWmy3E2XLVlvLjoyU9UkjwjsZWQg/XBoaY5+wA OsPiQCkKtjf3O3BttS8x8gAovxYC9Bu5eyKVo81AnIYXGBWPoxUdf3sqZHVy5DtRi0ml dFSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BHsJ2jhk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si18605035pli.418.2019.01.23.02.46.00; Wed, 23 Jan 2019 02:46:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BHsJ2jhk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727403AbfAWKn0 (ORCPT + 99 others); Wed, 23 Jan 2019 05:43:26 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43913 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727237AbfAWKnZ (ORCPT ); Wed, 23 Jan 2019 05:43:25 -0500 Received: by mail-pl1-f195.google.com with SMTP id gn14so971411plb.10 for ; Wed, 23 Jan 2019 02:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bz19SppYde9VYVOJqe3AHw5ZOnn7YaLj6WXKEyVlAGk=; b=BHsJ2jhkGJd/dHVP5weJiEIQrHH6uFCDaRUWeQlGIpRgC6uccdNJkiWHP9/k/Si0Py 8jCiLTVTvoMP88gE8UlakTdmKJKLxVeLWBXsiqnOHjzkyDjEFtspgvWLOFzTsOR6bzFA ELEWsxb4QUle1p1Z4ggRf1VXgNyrgN4HwDPX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bz19SppYde9VYVOJqe3AHw5ZOnn7YaLj6WXKEyVlAGk=; b=WjL0kmyUFx9kirftEa6w5s7oJWevqPxf6UEjaWq5DRpfrdP8G4Tp5M8yQg1lODIfAQ qh9pkVQhxjBM1aRaWS/ZbabwzbeK1eDgrR0dMXDJ1w0G9a/Lu4HV6KI1674gDrUKNPED 6D1qZY5PDo5aR8m8Eg5XV+XI6Z+jQaGx/o5sEtNDGzVqXb1owk7ye7eTAfSnOxjrJquQ HyaI3hYQkABmdV7iiaxlKJWwenY3eDacgsI9/IjcfJ6qIcjNaTZZDjA+EVsVnMp9E6mc e1k758ZW4UEsml3t3L//YAtswlFgiyhv6oe7R9kq818D0dID468gZmofb/jfVwLy+Pi7 YU6Q== X-Gm-Message-State: AJcUukfI9AB9hesqxm/P9+HvGVbmIeMJhHjTDR7euij2rG/r/GnBZvJn a9h2MWOEM+ghL1HFHjVl55nGoQ== X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr1753893plp.180.1548240204782; Wed, 23 Jan 2019 02:43:24 -0800 (PST) Received: from localhost ([122.172.102.63]) by smtp.gmail.com with ESMTPSA id w185sm26666827pfb.135.2019.01.23.02.43.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 02:43:24 -0800 (PST) Date: Wed, 23 Jan 2019 16:13:22 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Amit Kucheria , Linux Kernel Mailing List , linux-arm-msm , Eduardo Valentin , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , "Rafael J. Wysocki" , Ingo Molnar , Sudeep Holla , Tao Wang , Linux PM Subject: Re: [PATCH v2 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Message-ID: <20190123104322.o3whk6rfiaootspn@vireshk-i7> References: <0036de796308b8919eac74a9a910f0d7b9c0cbf8.1548084260.git.amit.kucheria@linaro.org> <20190123103624.t4b2ij3bfvpezgjf@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23-01-19, 11:39, Rafael J. Wysocki wrote: > On Wed, Jan 23, 2019 at 11:36 AM Viresh Kumar wrote: > > > > On 21-01-19, 21:10, Amit Kucheria wrote: > > > @@ -151,6 +152,11 @@ struct cpufreq_policy { > > > > > > /* For cpufreq driver's internal use */ > > > void *driver_data; > > > + > > > +#ifdef CONFIG_CPU_THERMAL > > > + /* Pointer to the cooling device if used for thermal mitigation */ > > > + struct thermal_cooling_device *cdev; > > > +#endif > > > }; > > > > > > /* Only for ACPI */ > > > @@ -386,6 +392,12 @@ struct cpufreq_driver { > > > */ > > > #define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6) > > > > > > +/* > > > + * Set by drivers that want the core to automatically register the cpufreq > > > + * driver as a thermal cooling device. > > > + */ > > > +#define CPUFREQ_AUTO_REGISTER_COOLING_DEV BIT(7) > > > + > > > int cpufreq_register_driver(struct cpufreq_driver *driver_data); > > > int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); > > > > > > @@ -415,6 +427,19 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) > > > policy->cpuinfo.max_freq); > > > } > > > > > > +#ifdef CONFIG_CPU_THERMAL > > > +static inline void register_cooling_device(struct cpufreq_policy *policy) { > > > + policy->cdev = of_cpufreq_cooling_register(policy); > > > +} > > > + > > > +static inline void unregister_cooling_device(struct cpufreq_policy *policy) { > > > + cpufreq_cooling_unregister(policy->cdev); > > > + policy->cdev = NULL; > > > +} > > > +#else > > > +static inline void register_cooling_device(struct cpufreq_policy *policy) {} > > > +static inline void unregister_cooling_device(struct cpufreq_policy *policy) {} > > > +#endif > > > > The whole ifdef hackery here saves space for a pointer per policy. > > Just get rid of it, it isn't worth it. > > Is struct thermal_cooling_device defined if CONFIG_THERMAL is unset? No and it is defined in thermal.h without any ifdef stuff. -- viresh