From patchwork Tue Feb 26 14:54:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 159218 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp3304017jad; Tue, 26 Feb 2019 06:54:39 -0800 (PST) X-Received: by 2002:a2e:424f:: with SMTP id p76mr13427097lja.140.1551192879305; Tue, 26 Feb 2019 06:54:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551192879; cv=none; d=google.com; s=arc-20160816; b=XT9rQFtVmASPzsPniyV5q6rAIGLb+wxVKjyX3gPG7TpycdmJ7azuiEr18NwL66QoQd 6JePQdVaYWZ7oQpbqWkXzR8WrLDq7RayPpAop670xVmOM6rEC5y5yWh7na7L9n9zagY/ sqlOpvQ177RfdV7X2tcWLGDq6P3JXnzfXuFcDLmjRl+lXcud3B5AKNEwk4iGZk3UvCsx G901Jz2Fcd0g0mkasqvtFYfgG3L2yFlrVF6MPCL4q3QkUP3mqV3gZj2YAv8+QQdPsbJk 5gzyShp1xTMe1kdLEC9lRPirPipn0jmDHC/EBlEycMQUvhaQMhoPxitouJSPW13C8Y+7 CLlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QFP37LMPbDEXb2WSHVoMAA8Lx3svlyaybruT2DgQlU0=; b=c0qEA5Hy6dLmQpJVsQE0co+lEgQrNpVm105gSBsqrQEAxNDLpnFLwQs/dgkk2NH3HU iq5woXhbbxjMWci92r94oRHWVLLqC9QEP8EmfP/nMG5UlXiGNq9IeaMTevOLp4nTrmOf wLKEqmLZZWUKbbWTjDywBYx7J6IoGHqIqWznEY2F/Ejy3nBbEZqXf576oGDgUTLgAGU2 jn0piFMSoATLg9sF03tjdoNwUWWt2q+Y4txj0GTEQ1IoAkeKZM8Tz0nBEpaF0jQAaYQu mT3dz2aa4NmbbvtNHqOY8iulc/f6CdE8+2ZrxNCwRt70c7jBrNYOV8CdrM31mlJY60ZK KlKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fJhdwSZT; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 4sor7363182ljs.30.2019.02.26.06.54.39 for (Google Transport Security); Tue, 26 Feb 2019 06:54:39 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fJhdwSZT; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org 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=QFP37LMPbDEXb2WSHVoMAA8Lx3svlyaybruT2DgQlU0=; b=fJhdwSZT64oym87C1NPWYsxIEnup9PjcSrF5GkbD0dEkILjToBgGvkqSO1yuzAVcuY IwBVw3Zw38so85Mizik5Mbqonnymp5nRCUSAeVjgZe95R69zBRpRgVtL24+ppEzUedoB NpydwEpWMQecOd+BSrS93JvO1fV6wtFgLmZWITK7ROpK+jMaic+PXJolJziV/BwlXTzX 46B54oWIwMLMFkGtSgKTYVr9lZwnOlZciD2cQ2YKRrdsNPOE3vDQUKLzNfiAsaxGEY0K d4e3kfGe1XkyNlfUhSKLa0rGM+V8qMLWduf0o4coYslRwFKe7cLZOi2CAdNUg62Of95u 7oag== 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=QFP37LMPbDEXb2WSHVoMAA8Lx3svlyaybruT2DgQlU0=; b=PQRPBLxOpNvqIhhmRkKROHOuXhFp+xO6XOpsT8xqF67iic24+FofKSXWwY5hVsJSbQ BzIiYKl6RMLlPliv4YnnpYZapc+grrwQez5kOq7Ccw8dwEOL/5QY5dhbCsqCwFrJW7RJ zDGItI/UcgK7TQh4Jz1RB4VCPO501Ki/ljxOiBeV1wPw/Y84em/rH0pf5k0xS3OTFoqf LeiGraJAZD8MBEkeW1qtRynjY4oaglEOFsMk8D50oo4vnuTtJPamGCeukf2IAIkOcKHG 00gUODNGRalap5Tcti4W4miMayUQVTEh4fDR1IEOrhsPnQQo1LP41iE+2gHnHHmlrnkL vdrQ== X-Gm-Message-State: AHQUAua1biwj2bkESgq/sNLavq9077S7HK+eJBHBA1InTps5Y94AsYYM TJEEl7cLM7QXdSK/ZImUOr0uM5Dr X-Google-Smtp-Source: AHgI3IZoxyPbTSnljzQM1jRy5kabLjUHxsOiMNs290/aMYRRyMHraw0tJ9QXBiD8tu67oy3ls34hDA== X-Received: by 2002:a2e:9e03:: with SMTP id e3mr9516998ljk.92.1551192878914; Tue, 26 Feb 2019 06:54:38 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t11sm2206554ljj.92.2019.02.26.06.54.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 06:54:38 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Frederic Weisbecker , Thomas Gleixner , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v11 5/8] cpuidle: teo: Convert to tick_nohz_get_next_timer() Date: Tue, 26 Feb 2019 15:54:12 +0100 Message-Id: <20190226145415.19411-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190226145415.19411-1-ulf.hansson@linaro.org> References: <20190226145415.19411-1-ulf.hansson@linaro.org> From: Daniel Lezcano Rather than using tick_nohz_get_sleep_length(), let's convert to use the more flexible tick_nohz_get_next_timer|hrtimer() APIs. This should have no functional change, but allows following changes to later drop the tick_nohz_get_sleep_length() API. Signed-off-by: Daniel Lezcano [Ulf: Clarified information in changelog] Signed-off-by: Ulf Hansson --- Changes in v11: - New patch. --- drivers/cpuidle/governors/teo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index 7d05efdbd3c6..bef1e95c597e 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -244,6 +244,9 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, unsigned int duration_us, count; int max_early_idx, idx, i; ktime_t delta_tick; + ktime_t now = ktime_get(); + ktime_t next_hrtimer = tick_nohz_get_next_hrtimer(); + ktime_t next_timer = tick_nohz_get_next_timer(); if (cpu_data->last_state >= 0) { teo_update(drv, dev); @@ -252,7 +255,8 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, cpu_data->time_span_ns = local_clock(); - cpu_data->sleep_length_ns = tick_nohz_get_sleep_length(&delta_tick); + cpu_data->sleep_length_ns = ktime_sub(next_timer, now); + delta_tick = ktime_sub(next_hrtimer, now); duration_us = ktime_to_us(cpu_data->sleep_length_ns); count = 0;