From patchwork Tue Apr 24 22:35:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 134201 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp120332lji; Tue, 24 Apr 2018 15:36:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+6dxJ+scpeDBJhW4OauoFAOANPefZUcM5gqdHoNQGGviQVLVI+hx9l1y42MMiojmlmEtDU X-Received: by 10.101.92.134 with SMTP id a6mr6173081pgt.273.1524609360095; Tue, 24 Apr 2018 15:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524609360; cv=none; d=google.com; s=arc-20160816; b=rGe4akad+V/cWb79QiahA0jvvgJQTmeoE+JUap/rTka91byGV2SV41Yf8GzXUzhWcv UWZ1qIeLxJombF1oXWQZWUmlipBvotZwNr2QTT99zAHWX4fYBUkY0am5eBsHrYAtuvu7 JhtXM/LMcnyUjLkjEDmadMMIztBb1hAJ/VZvkCdQkKRhmLZb7R3EJCHNnVfwtZARAfBd nVjxaeyjpvexby8cemTO56iIZprMC1JFN3pzEBeUcWIPQ6m19RpocrjLfwTYIF2pt0b6 W5Ow6rR6NmOQcsAXokWJE8Da0cePq3aPoxvec2LTDWs8eSP0j/27FqrB50tc2P0/+5WK Q2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dCVCBP4Fi4hvlrP/9WWWKbOXx90UzgpZRfevYYm1Z3c=; b=n92ppDx9cLcsAEFZMBr6WFiYUCCdjFLRPq/2BHetI1skD3vIJ4V0aBiQ/BnvlBETDP zksfrAnrC7u5b7GNaloJWW09PclPI5YWxH0KVOz/1r87iUkyOMLyPpUDwrBwK0rSDWRI qZTdZo00fqNDMPTe5pMka7poiSpbkKvmH2TNw4GpfERswC1ymqKl0ku/E47eionP6caN F6HG4ntqRLYMfamB+IBvjKUQGDdJ882g/XJi0/7EfSje1jSZHVpuZnQhA64mjmXXQCMN k5aKnTe7gHaPte60jidXd+j2nxooyns3KEYLEpExRtRoCNXqhh7/J9P81auJYW9fWofT qp6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MCuUZiq1; 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 v29si9213576pgo.483.2018.04.24.15.35.59; Tue, 24 Apr 2018 15:36:00 -0700 (PDT) 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=MCuUZiq1; 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 S1751365AbeDXWf6 (ORCPT + 29 others); Tue, 24 Apr 2018 18:35:58 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33323 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbeDXWfb (ORCPT ); Tue, 24 Apr 2018 18:35:31 -0400 Received: by mail-pf0-f194.google.com with SMTP id f15so13463678pfn.0 for ; Tue, 24 Apr 2018 15:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dCVCBP4Fi4hvlrP/9WWWKbOXx90UzgpZRfevYYm1Z3c=; b=MCuUZiq1zOCMaYBFJ7guY3VV0VQxe8U6eXevD7Nk0tGMTn+R/C7A2A+bql124GHFEV Dr7HvWwAudbiHt20UvCrCl8VBGvwodK5+4lyfEEOGw0yOQ+MZAZQQ2HoqneoyymgUYCa Mf9B8gzq5bYSvJruWzBiGRy+sOYP8ERCsC/uw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dCVCBP4Fi4hvlrP/9WWWKbOXx90UzgpZRfevYYm1Z3c=; b=Rvs23FglcaQ12XxhspBFYvVes+VbAR7Adu388+o1Yk3XrrvJ5yZBEIyipYsTDaBNYF obSR0lW3bqAml5Qrtp3oZ8jsUfb0EX5pQRGQRgR4V3/iz3v93h1hMskZFC8vp3BH55ct mXjkk6/y+e/1wKnY1VrY7hBlTail9dQ11RGSCBdvZFCyB+1BtIjK13dyCim9GFdVuzJP 90wMZlGtKYr6czqF1GcE0di7suaapdNSz1YfEC7uBPUfGI5OSDrlv4pe1l4JVb3wQ79q /LiLqMQ0EaT0IgAxPMwc9QifPSCr5o7jlAUvpSAHWkgNKU0YVt1OS3nk6YBnCzhRmC6Y oqpg== X-Gm-Message-State: ALQs6tCV1yznBbJeMSgCIsf0FDUqLeqTRjSz9RDvRO+sf16t3wo1nOfq fK0GlU9STDifdXwyRwUGbYPwVQ== X-Received: by 10.101.70.141 with SMTP id h13mr21820259pgr.166.1524609331091; Tue, 24 Apr 2018 15:35:31 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id w26sm35856621pfi.17.2018.04.24.15.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 15:35:30 -0700 (PDT) From: Bjorn Andersson To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] PM / devfreq: Reject client provided freq_table Date: Tue, 24 Apr 2018 15:35:21 -0700 Message-Id: <20180424223521.28193-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180424223521.28193-1-bjorn.andersson@linaro.org> References: <20180424223521.28193-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The devfreq profile's freq_table is an internal resource used to keep track of all levels described in the associated opp table, in order to support levels being enabled and disabled in runtime by e.g. devfreq_cooling. As it is required by the implementation that the device has an associated opp table and expected that the freq_table matches this, it is not possible for clients to provide a freq_table through the devfreq profile. Check for this in devfreq_add_device() and remove the unnecessary conditional generation of the internal freq_table. Signed-off-by: Bjorn Andersson --- drivers/devfreq/devfreq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.16.2 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index c804bd72a644..3d1f6a2edf68 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -557,7 +557,7 @@ struct devfreq *devfreq_add_device(struct device *dev, static atomic_t devfreq_no = ATOMIC_INIT(-1); int err = 0; - if (!dev || !profile || !governor_name) { + if (!dev || !profile || !governor_name || profile->freq_table) { dev_err(dev, "%s: Invalid parameters.\n", __func__); return ERR_PTR(-EINVAL); } @@ -590,11 +590,9 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->data = data; devfreq->nb.notifier_call = devfreq_notifier_call; - if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { - err = set_freq_table(devfreq); - if (err < 0) - goto err_dev; - } + err = set_freq_table(devfreq); + if (err < 0) + goto err_dev; devfreq->min_freq = find_available_min_freq(devfreq); if (!devfreq->min_freq) {