Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5424470ybv; Tue, 11 Feb 2020 15:40:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwkaSRPiAfRsXFa7oifHyAScEoKWddUr8cFM+O5xt/nja7//T+OGVv6kYAseo3aRVn4TPWL X-Received: by 2002:a05:6830:18d4:: with SMTP id v20mr7284895ote.29.1581464417825; Tue, 11 Feb 2020 15:40:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581464417; cv=none; d=google.com; s=arc-20160816; b=dWrN7W9DD8OqpGQjnCooxp114a5RujRoTJC6Dw6vqj3kFr/E70QT8ZwZKUQZAv1sdj khGhT6kJmSbxtsh86Elw5zfXahvi27uz88bGTKKRrbT/VENk+Y5GlcnBORMp0QK0SuqV 8m0NDHlc0Q3dodN2U+tW2sx07BJrgvrtJUvMl5YIcLqbInNGALkB1F9SyS9NUW2QwYG1 68gkQeBTcGd2ytlIgnt7B6g4NNWPCjimlrtbWJsJ3AWbELTWZlYo6p1JnyhZW88alGO7 6aRZGWIEJwi0Uk1CnQuEe3Kia7+2eoZXdEOpJz5iW54sRTtKwFG5ebJAIWsZIC+IK5+7 fqOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nQfU07NunOiOxSy7r1mf+b3buEDc29GWjQFWx/jrUXI=; b=NuZKVPJYVNz1cUWqzEj1ox0sfH9VtfBMR5QlM5Ah2YpZaWQ6nlnQvJzM3grEcRQzKr qR5hz/IOQ6NHk1jpg70bANbcDvWFr8l061Zapgt1wGDF8mTiby9xCkjnyd81sfBNmcMh zJxoYC5ne/S2oMMf4ERp+PXefejycjXhjr2p+9HOxiAnvQZt6iUBmOGhuBju/6dSRn3k pa2Ifg+6utmOYZT1/xgPx9nfWkQaHf7vAjDxr9GwZaBTSYEB66KOokEbY/n2lKLVnMKC 9yhBr1lcsV4Q6MiMnrPJl+x4BdZmIzt55g8ylrF6s0mupFT1IyrCr+gQTaL5uIhMg1Q0 DhFQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si2444886oig.53.2020.02.11.15.40.05; Tue, 11 Feb 2020 15:40:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728324AbgBKXja (ORCPT + 99 others); Tue, 11 Feb 2020 18:39:30 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:59281 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728199AbgBKXjC (ORCPT ); Tue, 11 Feb 2020 18:39:02 -0500 Received: from 79.184.254.199.ipv4.supernova.orange.pl (79.184.254.199) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 6c68c8faf8632b37; Wed, 12 Feb 2020 00:38:59 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Amit Kucheria Subject: [PATCH 05/28] PM: QoS: Clean up pm_qos_read_value() and pm_qos_get/set_value() Date: Tue, 11 Feb 2020 23:58:39 +0100 Message-ID: <4773736.iBQsUQvRLO@kreacher> In-Reply-To: <1654227.8mz0SueHsU@kreacher> References: <1654227.8mz0SueHsU@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" Move the definition of pm_qos_read_value() before the one of pm_qos_get_value() and add a kerneldoc comment to it (as it is not static). Also replace the BUG() in pm_qos_get_value() with WARN() (to prevent the kernel from crashing if an unknown PM QoS type is used by mistake) and drop the comment next to it that is not necessary any more. Additionally, drop the unnecessary inline modifier from the header of pm_qos_set_value(). Signed-off-by: Rafael J. Wysocki --- kernel/power/qos.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 6a36809d6160..f09eca5ffe07 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c @@ -98,8 +98,16 @@ static const struct file_operations pm_qos_power_fops = { .llseek = noop_llseek, }; -/* unlocked internal variant */ -static inline int pm_qos_get_value(struct pm_qos_constraints *c) +/** + * pm_qos_read_value - Return the current effective constraint value. + * @c: List of PM QoS constraint requests. + */ +s32 pm_qos_read_value(struct pm_qos_constraints *c) +{ + return c->target_value; +} + +static int pm_qos_get_value(struct pm_qos_constraints *c) { if (plist_head_empty(&c->list)) return c->no_constraint_value; @@ -112,18 +120,12 @@ static inline int pm_qos_get_value(struct pm_qos_constraints *c) return plist_last(&c->list)->prio; default: - /* runtime check for not using enum */ - BUG(); + WARN(1, "Unknown PM QoS type in %s\n", __func__); return PM_QOS_DEFAULT_VALUE; } } -s32 pm_qos_read_value(struct pm_qos_constraints *c) -{ - return c->target_value; -} - -static inline void pm_qos_set_value(struct pm_qos_constraints *c, s32 value) +static void pm_qos_set_value(struct pm_qos_constraints *c, s32 value) { c->target_value = value; } -- 2.16.4