From patchwork Wed Mar 2 02:38:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 63363 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2154866lbc; Tue, 1 Mar 2016 18:38:45 -0800 (PST) X-Received: by 10.66.246.234 with SMTP id xz10mr35087435pac.49.1456886325624; Tue, 01 Mar 2016 18:38:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rw10si5129418pac.147.2016.03.01.18.38.45; Tue, 01 Mar 2016 18:38:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbcCBCih (ORCPT + 11 others); Tue, 1 Mar 2016 21:38:37 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:34598 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752873AbcCBCif (ORCPT ); Tue, 1 Mar 2016 21:38:35 -0500 Received: by mail-pa0-f53.google.com with SMTP id fy10so123180113pac.1 for ; Tue, 01 Mar 2016 18:38:35 -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:content-transfer-encoding:in-reply-to :user-agent; bh=63dJbXC44dQsQ3iI/UoB5i4YUJwUqQ2ieTQBCXCslYc=; b=ihMa5RU0jyr1hh/owhMydUP/h6y1PvPVRR2Hx8aT44TAzxvSPbz1cGn+r2q+2MhxNS QJpVYJjUIh1h+cxZrZM8HimM4ESzGrjSf02M6hI+OJ6RVDND3Rv0WQrY4ZuXGyUsSQ43 9J9bukzx2H0WP2SEJ8IM4cVzFwgX2Bbd+ib+o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=63dJbXC44dQsQ3iI/UoB5i4YUJwUqQ2ieTQBCXCslYc=; b=INFbkt/kHyymokvJvdfGIVcfUW0p7a/qC996Gkfh14I+SuBr99U4JVtsu77rMtaqZ3 ZlC+f7nEV8yd8Fr8QAgfX97yH9ISsRpyYBB+yO9RqGwia6J4FeUrqMj97brVinDgcOeG ImhvO7D6MeLAXHIv+PwNp34pNjZflGUqswpcO53OJ3Xsl+W7i36LugWW7DsAntyAW1hi jcdv3CmSHHyggliWRUakRAA07wAQYcffwnRl+Ie4Us3aWlqzB2IP7oHYFV//DA/UQ8wU JDuink7MjwAUblGpvOA6XnXBzdljfYBHNKJ9LX0kZbD/rsMRLQHvbwZSMg2ySd54MUsn +rLQ== X-Gm-Message-State: AD7BkJJWjv4qqPjlu4LIv60jI7GKC7tOY+A2lqjBVrY5E1HPJibacWfqfBdwvbnJaa9NEkI3 X-Received: by 10.66.221.167 with SMTP id qf7mr20555607pac.94.1456886314532; Tue, 01 Mar 2016 18:38:34 -0800 (PST) Received: from localhost ([122.172.106.152]) by smtp.gmail.com with ESMTPSA id 87sm48406576pfq.93.2016.03.01.18.38.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Mar 2016 18:38:33 -0800 (PST) Date: Wed, 2 Mar 2016 08:08:22 +0530 From: Viresh Kumar To: Srinivas Pandruvada Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org Subject: Re: [PATCH] cpufreq: acpi_cpufreq: base frequency attribute support Message-ID: <20160302023822.GM16437@vireshk-i7> References: <1456778205-19197-1-git-send-email-srinivas.pandruvada@linux.intel.com> <20160301022830.GX2791@vireshk-i7> <1456855841.21069.59.camel@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1456855841.21069.59.camel@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 01-03-16, 10:10, Srinivas Pandruvada wrote: > > What about: > > > >                                 acpi_cpufreq_attr[ARRAY_SIZE(acpi_cpu > > freq_attr) - 2] = &base_frequency; > > > >                                 and a comment to describe that ? > > > Will it work in this case? > " > Even if CONFIG_X86_ACPI_CPUFREQ_CPB is defined,  > acpi_cpufreq_attr[2] will be set to NULL in the init callback when > some condition fails. So we will have a NULL in the acpi_cpufreq_attr[] > before &base_frequency if we add at fixed place.  > " Oh dude, you already have this hack in place in a different way. Though its doable this way: And then the above statement: acpi_cpufreq_attr[ARRAY_SIZE(acpi_cpufreq_attr) - 2 - cpb_removed] = &base_frequency; But I would rather add another patch first to set the CPB thing in the array to NULL and remove the ifdef from within the array. And then set it to a valid attribute only if we are making an addition. And then you can easily keep a count of the next NULL entry you can update. -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 51eef87bbc37..26c026a34e1e 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -937,7 +937,7 @@ static void acpi_cpufreq_boost_exit(void) static int __init acpi_cpufreq_init(void) { - int ret; + int ret, cpb_removed = 0; if (acpi_disabled) return -ENODEV; @@ -967,6 +967,7 @@ static int __init acpi_cpufreq_init(void) for (attr = acpi_cpufreq_attr; *attr; attr++) if (*attr == &cpb) { *attr = NULL; + cpb_removed = 1; break; } }