From patchwork Mon Sep 10 19:59:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fieah Lim X-Patchwork-Id: 10594741 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5162914E5 for ; Mon, 10 Sep 2018 19:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3632C2921C for ; Mon, 10 Sep 2018 19:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A09228B4B; Mon, 10 Sep 2018 19:59:24 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 E6E3528B4B for ; Mon, 10 Sep 2018 19:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbeIKAzD (ORCPT ); Mon, 10 Sep 2018 20:55:03 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35892 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727649AbeIKAzD (ORCPT ); Mon, 10 Sep 2018 20:55:03 -0400 Received: by mail-pf1-f193.google.com with SMTP id b11-v6so11013106pfo.3 for ; Mon, 10 Sep 2018 12:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieahl-im.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=sBdJ9oYViXeZVkyZb9vjRimCOqGFkJZUAVyoAp38IlA=; b=dx8fef+b/pua3UaSNK05cTCINcCht2eSfodVHcxtrasMBnXWs8Jjz9rKHwTPUDqXeT B8baqPQOAxfFlm6Gltk1ndesmuE8msHK+ieqMgUdSlKMbsLDP507YY9N6rUzVTTMX/Se UXRgWkgpsbeJ2IulwLVnSnLU/3M6Lxc0DhEjnO/eCnrrLfMcMKZS8PU7Frcjh3qKaYO+ oBbn/5zmC3ELyHl7Zj+2kAITJaha5OvwlP/W0aTNjs7qXX8j9DaylgM9QU80FWFEXZrI +XlanzAs9DBB6J9rCPb14atKBrB18WaQ8i6j2Qi6kc4pNRUd8rsLf36YreSJv/HUCH/2 QRYw== 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; bh=sBdJ9oYViXeZVkyZb9vjRimCOqGFkJZUAVyoAp38IlA=; b=mCmyjZm5hMi5bsGmPt5JzLYiWAoKDmiRl2xq4iGIu1ilBZLkbfokDiZ6b2QRAJOcrm vTPDk6WWzG+EqF7Cs7Xq42YB50YCtIBcBVYnTvOEF44XFUONxRhuYy8hw73Ev7RTpfK6 +61/N80Rp/AFqFRu/pobOSXxwQoY/H3zHeihQfIG04FYFmHVsUVk4WrYgvQjKuO8/qbq qMGV52ItOmPORfezmdC58spLmLX/YiyY4Ywj1b9UdxyQoU/ZKnVFbki9o/lbhf27Jokr SDUDp2C1KdQKsTzx8Wb76CPy1RCTvSxZUDGHWxyK+o/XO5DLBopG5XCiuBKSqTQCRrFv /3IQ== X-Gm-Message-State: APzg51D+Pg2QwQtd4MzGsFCDhCgekyniS4T1rgBDmURmrbRG/aOizS6M LX604+4oR/0WFA35M4gM46CXfQ== X-Google-Smtp-Source: ANB0VdY8cYQgm5jz9qIt2LyfT9BTsFS7HMi4OqEGJpWszBaYaUJPKvKqHJ1Td2C0utG03OOflpCKew== X-Received: by 2002:a62:565c:: with SMTP id k89-v6mr25442861pfb.212.1536609561286; Mon, 10 Sep 2018 12:59:21 -0700 (PDT) Received: from WorkZone.localdomain ([60.51.52.116]) by smtp.gmail.com with ESMTPSA id l3-v6sm20062604pff.8.2018.09.10.12.59.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 12:59:20 -0700 (PDT) From: Fieah Lim To: "Rafael J. Wysocki" , Daniel Lezcano , linux-kernel@vger.kernel.org (open list), linux-pm@vger.kernel.org (open list:CPUIDLE DRIVERS) Cc: Fieah Lim Subject: [PATCH v2] cpuidle: Remove unnecessary wrapper cpuidle_get_last_residency() Date: Tue, 11 Sep 2018 03:59:01 +0800 Message-Id: <20180910195901.15200-1-kw@fieahl.im> X-Mailer: git-send-email 2.18.0 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 cpuidle_get_last_residency() is just a wrapper for retrieves device's last_residency, it's also weirdly the only wrapper function for accessing cpuidle_* struct member, and my best guess is it could be a leftover from v2.x Anyhow, since the only two users(ladder and menu governor) can access dev->last_residency directly, and it's more intuitive, let's just get rid of it. This patch tidies up CPU idle driver a bit without functional changes. Signed-off-by: Fieah Lim --- Changes from v1: - Rewrite changelog as Rafael J. Wysocki suggested --- drivers/cpuidle/governors/ladder.c | 2 +- drivers/cpuidle/governors/menu.c | 2 +- include/linux/cpuidle.h | 10 ---------- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 704880a6612a..f0dddc66af26 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -80,7 +80,7 @@ static int ladder_select_state(struct cpuidle_driver *drv, last_state = &ldev->states[last_idx]; - last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency; + last_residency = dev->last_residency - drv->states[last_idx].exit_latency; /* consider promotion */ if (last_idx < drv->state_count - 1 && diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 1aef60d160eb..715520e339da 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -492,7 +492,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) measured_us = 9 * MAX_INTERESTING / 10; } else { /* measured value */ - measured_us = cpuidle_get_last_residency(dev); + measured_us = dev->last_residency; /* Deduct exit latency */ if (measured_us > 2 * target->exit_latency) diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 4325d6fdde9b..d262f620890e 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -99,16 +99,6 @@ struct cpuidle_device { DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); -/** - * cpuidle_get_last_residency - retrieves the last state's residency time - * @dev: the target CPU - */ -static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) -{ - return dev->last_residency; -} - - /**************************** * CPUIDLE DRIVER INTERFACE * ****************************/