From patchwork Fri Oct 26 14:57:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 1652241 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9A0953FD4E for ; Fri, 26 Oct 2012 14:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675Ab2JZO5n (ORCPT ); Fri, 26 Oct 2012 10:57:43 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:54206 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486Ab2JZO5m (ORCPT ); Fri, 26 Oct 2012 10:57:42 -0400 Received: by mail-qc0-f174.google.com with SMTP id o22so1353428qcr.19 for ; Fri, 26 Oct 2012 07:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=IhGL4U0imtBaE0QBNmfRkj3LjB9GN7Vor48kxHwZQiw=; b=QyVT1jb8h0aJmtLEVyb3CfkGOtxr4SQtBgyifTs+dIkK0vLmcWyDEcARYRc4ORNLfV X51hWi2A81jp9/nCCuAfKdut2tEA3EhhOputfOhzBLZxMNlrpKXyo15tQTSTn4ZUc8DX SMORWoYkItIVx0KjJStCi64WS0uX4w646LpF9F4xcMvFNIE4Zig3i1tZpFrpjI8Uqvlj D9Pb1YXyfP7Zi6qthyMYZOx+p/O9NYJqSAqisOexjbXBzfWsINwt7wrILxfIgWNQCfnR ZLL13gBWfLWra4lnM6+ithNvrwHYUxsXxP/SskMhikkmjjGoJfg9+PKpC7hrP8ibW2oW VG2A== MIME-Version: 1.0 Received: by 10.224.196.132 with SMTP id eg4mr11593303qab.93.1351263461902; Fri, 26 Oct 2012 07:57:41 -0700 (PDT) Received: by 10.229.207.197 with HTTP; Fri, 26 Oct 2012 07:57:41 -0700 (PDT) Date: Fri, 26 Oct 2012 22:57:41 +0800 Message-ID: Subject: [PATCH -next] PM / OPP: using kfree_rcu() to simplify the code From: Wei Yongjun To: len.brown@intel.com, pavel@ucw.cz, rjw@sisk.pl, gregkh@linuxfoundation.org Cc: yongjun_wei@trendmicro.com.cn, linux-pm@vger.kernel.org Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Wei Yongjun The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun --- drivers/base/power/opp.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index c8a908b..50b2831 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -461,17 +461,6 @@ int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt) } /** - * opp_free_rcu() - helper to clear the struct opp when grace period has - * elapsed without blocking the the caller of opp_set_availability - */ -static void opp_free_rcu(struct rcu_head *head) -{ - struct opp *opp = container_of(head, struct opp, head); - - kfree(opp); -} - -/** * opp_set_availability() - helper to set the availability of an opp * @dev: device for which we do this operation * @freq: OPP frequency to modify availability @@ -542,7 +531,7 @@ static int opp_set_availability(struct device *dev, unsigned long freq, list_replace_rcu(&opp->node, &new_opp->node); mutex_unlock(&dev_opp_list_lock); - call_rcu(&opp->head, opp_free_rcu); + kfree_rcu(opp, head); /* Notify the change of the OPP availability */ if (availability_req)