From patchwork Mon Dec 19 15:03:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 9480463 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.web.codeaurora.org (Postfix) with ESMTP id 12CD8601C2 for ; Mon, 19 Dec 2016 15:10:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00056284E5 for ; Mon, 19 Dec 2016 15:10:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E895B284F8; Mon, 19 Dec 2016 15:10:08 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 28B55284E5 for ; Mon, 19 Dec 2016 15:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756151AbcLSPFG (ORCPT ); Mon, 19 Dec 2016 10:05:06 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33208 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755854AbcLSPDV (ORCPT ); Mon, 19 Dec 2016 10:03:21 -0500 Received: by mail-pg0-f65.google.com with SMTP id g1so6932734pgn.0; Mon, 19 Dec 2016 07:03:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BwINCSXKFzVd3Fdtc0p7CZerF+oHsP8rzTnRGHaYJCI=; b=leN795QfmLNh4WrVVCUlKVgvs8jXfZ40Uw6AOP8lcbCkn2lBZqfLrik2HadP9tYHG/ dhZ/zb7spPKnggTaGTyvAehayMD1UmEr1ebzVL9VBWCYbJi7m8yleHAnW8FDV57lunEc Uy87V54Kt8lYKNiq/cG2dNoxVNFMIHPO8rGmfk9HMub3/8cAvFfnbNOMPpG3Ahp8PR/S 5nJy57si57ygfpVRVGrLWumdbhrS0AmwJLYmAg9+jp/GtksLaJFBuay9ua0vCcrwmm03 sOQRawMp//QnSkC6V0/+sJlNJLJ/NtMN6DFx/FXUQ91UZmeg5mqF5pmT5p/c5dfyBpJ9 7i1A== 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=BwINCSXKFzVd3Fdtc0p7CZerF+oHsP8rzTnRGHaYJCI=; b=RBtLIxyG7F0rsJqySwALx6hnBzWVb0GGYBXsz+/ALffzR/QrR4/4JqV2KKkElc+4Ul QRqjdRFZx+iwXX854gD43KDPVqS+YGRO+QRZ0sRUDZ32xiefB/OhcCbTA2dvseo2HXLd nBScpMnMijfac+spNkeOE3l6y1/yRvI466poplEoyBpV+VZdnejbcmFqYyx0o2pIYOs3 W566Sxb0MGZySyjpMqSse0z7evCvAu90UL/HG+aIltc3dHbc0MVrFa/GsDzzAmab+qEE kZN083fF6vRLU56hlc8f81uh/dvVce8J4Ex8GXS67uwqrkf+rsdIFEKFwkuZUOcZGlzC KWaA== X-Gm-Message-State: AIkVDXKDJF5ra1sIiagMWDfcAW0JTD5ZfJCSBPQ+/yaQqGBDudaRdnUPOo6xwAjpQcGbWA== X-Received: by 10.98.211.141 with SMTP id z13mr5621263pfk.109.1482159800628; Mon, 19 Dec 2016 07:03:20 -0800 (PST) Received: from localhost ([162.211.125.117]) by smtp.gmail.com with ESMTPSA id k67sm32228443pfk.69.2016.12.19.07.03.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Dec 2016 07:03:20 -0800 (PST) From: Geliang Tang To: "Rafael J. Wysocki" , Pavel Machek , Len Brown Cc: Geliang Tang , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PM / Hibernate: use rb_entry instead of container_of Date: Mon, 19 Dec 2016 23:03:11 +0800 Message-Id: X-Mailer: git-send-email 2.9.3 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 To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Signed-off-by: Geliang Tang Acked-by: Pavel Machek --- kernel/power/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 32e0c23..f80fd33 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -201,7 +201,7 @@ void free_all_swap_pages(int swap) struct swsusp_extent *ext; unsigned long offset; - ext = container_of(node, struct swsusp_extent, node); + ext = rb_entry(node, struct swsusp_extent, node); rb_erase(node, &swsusp_extents); for (offset = ext->start; offset <= ext->end; offset++) swap_free(swp_entry(swap, offset));