Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10813611ybl; Fri, 27 Dec 2019 02:41:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwFfeQYSJbxbMkjl44K2dIhcgnAnzakXQ+s/KU36nYZbu2GFYq8M+f9uGmkSp+xPFZXzty7 X-Received: by 2002:a9d:2dca:: with SMTP id g68mr51563968otb.150.1577443302427; Fri, 27 Dec 2019 02:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577443302; cv=none; d=google.com; s=arc-20160816; b=TcaEb9cmQoDFb0sSyWzOgPu0KAt8ndgrgOdmGeyCAUgrwIx/pIUtZ2gS+GIRUlkgdU 2i0fL+wtuRLqS/l1XbkyT0G9CgVXm/9Fa6Reghk5ITFcx3rvpL+oM8LI8SYMsZAyhTcl 70pjmd04E0GMdExqpy/M6WOX0EpnOgCC9wbLKhE19lk9QlGnxhpWpAA9crpi+gXIPpZa 3fjKaxAEf+BBi2iKvvKrflmTUGV2OUMyz/d8UI7vS/MLlofj9TcTkb0FB94lvFMkIGAG p4EzblPMhhR++tZwVYiCXJxG1bU0IhdOhSPmKnow3sUnt0G7dqk/t3Q5L/QauqE61xAk 3hSg== 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 :message-id:date:subject:cc:to:from; bh=tA/m2NwbpIb3RbIzoAV2CPoQ+y+KbxbCdNyu8AScCwc=; b=eYhpVdxAko78ER+/ds9jlJ7o6P5cCNkrj0tLaiqUiiAXe3M4igxax3reke4jmxByGI SKjCfjIs6aNxZ/rwmEwVADV+r/SFReHLAsYA3WXxhB4CdB8l7QIGcLpciOvIPxazSBCI nG6cw1TFt+GZm5bZaDwZ6TYfOIrViN8TnvXehCwlN80IAcZ/RjBcJ3dSIIrSwNJ0LnMi oJ5ZmXE13y64luXEcmODPC9oUo+Hf2otOWh/AlL7ceuYl48WPFv9LQa59w0WYp6JcX4J vre2g4KU3Ycu+c2falJjWarjiq4wcIsOMqRrTHXFc9KFoxjkC3Yyvkss9nmbUyLDQHgT 6LMg== 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 l11si8366403oie.231.2019.12.27.02.41.30; Fri, 27 Dec 2019 02:41:42 -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 S1726607AbfL0Kko (ORCPT + 99 others); Fri, 27 Dec 2019 05:40:44 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:62862 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfL0Kkn (ORCPT ); Fri, 27 Dec 2019 05:40:43 -0500 Received: from 79.184.255.87.ipv4.supernova.orange.pl (79.184.255.87) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.320) id 17a46f8e8f570a8f; Fri, 27 Dec 2019 11:40:40 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Daniel Lezcano Subject: [PATCH] cpuidle: Drop unused cpuidle_driver_ref/unref() functions Date: Fri, 27 Dec 2019 11:40:40 +0100 Message-ID: <2529185.mvXUDI8C0e@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 The cpuidle_driver_ref() and cpuidle_driver_unref() functions are not used and the refcnt field in struct cpuidle_driver operated by them is not updated anywhere else (so it is permanently equal to 0), so drop both of them along with refcnt. Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/driver.c | 46 ---------------------------------------------- include/linux/cpuidle.h | 5 ----- 2 files changed, 51 deletions(-) Index: linux-pm/drivers/cpuidle/driver.c =================================================================== --- linux-pm.orig/drivers/cpuidle/driver.c +++ linux-pm/drivers/cpuidle/driver.c @@ -155,8 +155,6 @@ static void __cpuidle_driver_init(struct { int i; - drv->refcnt = 0; - /* * Use all possible CPUs as the default, because if the kernel boots * with some CPUs offline and then we online one of them, the CPU @@ -240,9 +238,6 @@ static int __cpuidle_register_driver(str */ static void __cpuidle_unregister_driver(struct cpuidle_driver *drv) { - if (WARN_ON(drv->refcnt > 0)) - return; - if (drv->bctimer) { drv->bctimer = 0; on_each_cpu_mask(drv->cpumask, cpuidle_setup_broadcast_timer, @@ -350,47 +345,6 @@ struct cpuidle_driver *cpuidle_get_cpu_d EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); /** - * cpuidle_driver_ref - get a reference to the driver. - * - * Increment the reference counter of the cpuidle driver associated with - * the current CPU. - * - * Returns a pointer to the driver, or NULL if the current CPU has no driver. - */ -struct cpuidle_driver *cpuidle_driver_ref(void) -{ - struct cpuidle_driver *drv; - - spin_lock(&cpuidle_driver_lock); - - drv = cpuidle_get_driver(); - if (drv) - drv->refcnt++; - - spin_unlock(&cpuidle_driver_lock); - return drv; -} - -/** - * cpuidle_driver_unref - puts down the refcount for the driver - * - * Decrement the reference counter of the cpuidle driver associated with - * the current CPU. - */ -void cpuidle_driver_unref(void) -{ - struct cpuidle_driver *drv; - - spin_lock(&cpuidle_driver_lock); - - drv = cpuidle_get_driver(); - if (drv && !WARN_ON(drv->refcnt <= 0)) - drv->refcnt--; - - spin_unlock(&cpuidle_driver_lock); -} - -/** * cpuidle_driver_state_disabled - Disable or enable an idle state * @drv: cpuidle driver owning the state * @idx: State index Index: linux-pm/include/linux/cpuidle.h =================================================================== --- linux-pm.orig/include/linux/cpuidle.h +++ linux-pm/include/linux/cpuidle.h @@ -116,7 +116,6 @@ DECLARE_PER_CPU(struct cpuidle_device, c struct cpuidle_driver { const char *name; struct module *owner; - int refcnt; /* used by the cpuidle framework to setup the broadcast timer */ unsigned int bctimer:1; @@ -148,8 +147,6 @@ extern u64 cpuidle_poll_time(struct cpui extern int cpuidle_register_driver(struct cpuidle_driver *drv); extern struct cpuidle_driver *cpuidle_get_driver(void); -extern struct cpuidle_driver *cpuidle_driver_ref(void); -extern void cpuidle_driver_unref(void); extern void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, bool disable); extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); @@ -187,8 +184,6 @@ static inline u64 cpuidle_poll_time(stru static inline int cpuidle_register_driver(struct cpuidle_driver *drv) {return -ENODEV; } static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } -static inline struct cpuidle_driver *cpuidle_driver_ref(void) {return NULL; } -static inline void cpuidle_driver_unref(void) {} static inline void cpuidle_driver_state_disabled(struct cpuidle_driver *drv, int idx, bool disable) { } static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }