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: 10361151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 38507601D3 for ; Tue, 24 Apr 2018 22:36:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F56028DCC for ; Tue, 24 Apr 2018 22:36:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 141E628E39; Tue, 24 Apr 2018 22:36:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CC6728DCC for ; Tue, 24 Apr 2018 22:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751155AbeDXWf5 (ORCPT ); Tue, 24 Apr 2018 18:35:57 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:42691 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeDXWfb (ORCPT ); Tue, 24 Apr 2018 18:35:31 -0400 Received: by mail-pf0-f195.google.com with SMTP id o16so13447798pfk.9 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=iE6rNECkYPptf/V7hxxX15btwjHPKqTHCjMdByH9DblcsInYuCvbvf46NcwDA9Qns3 +3vBFdf7qgzem/WT3hZIGWlCW9a7G7nWv06mUoGIhyvXRIbjAwLLbjze2LaLwty43c+o i8UjtlC01Wd5mui8Yjb3PYd2M+mm+Frhm65NNphnkgUn3cBz2mDBaHWhE0HhnvPe+dad njX9DastPe+XWfmxa7mdwOfUQuPybarwnOd9kpeGKWJycgcPj2edzObsuYRcNWI8eEku P+I1sT0uWYZl0/E0sfhNPzko8ADMYnYUL9Fxqb1UEdrMgCu6Q6JTeF6I0+T7gEUaH+Vj WCsg== X-Gm-Message-State: ALQs6tCg0g+4NAkyOdBeZVYLol4S/v1w9KrQDynSZgX4ujP8Z5p+jAEl h3WmxMxnfy61/w+VE9CAnTpuxg== X-Google-Smtp-Source: AIpwx48fGYWuGs2LG0PEWStWgzzH5wuUZo49bGpvfPrf4kv79LtsdgO+7Ia9jaUWwybrg3h+0TWbXw== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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) {