Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2382420ybx; Fri, 8 Nov 2019 03:35:53 -0800 (PST) X-Google-Smtp-Source: APXvYqymZN0J74XLwyuZUPCtrtXmj1XcNkZ4UeKYIa750dk+sxMOw344TfJ1GCzmZye1MtS3KhSD X-Received: by 2002:a05:6402:602:: with SMTP id n2mr9783852edv.23.1573212953500; Fri, 08 Nov 2019 03:35:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573212953; cv=none; d=google.com; s=arc-20160816; b=ER2yiip3VKt/4rHIX7tFzRijKbNkI7wgzD1rEudDDUVwsMy+N5dmH0ylvKCwHJ1Yx5 SkleWOdKzyLObHclzwglvTQqO1mL6Im4BdxgiNC6sBkJ/vWVGJt7KuJYVo3XVg5Ers6c oAgcGz7cz6tSpYrWc/vhtwmPrqu48nqObFN6SbT0cU6QCZGzm8soQ0PMtD1yemcedtxP x5mqKKC/rR+Bk+5sm1dFKEPOBstqh3EAhA3LXjqbvt/DWVkgvbxVUACaI9i3hpAc2q+K 1zqhGIJbN3EKJHst1pa0qz4q9Z+ntlFRUH/w7PfilnHWLNHiHN4tqwSOdXzdRuKY9itN yRfQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6uUHQwZkM6iMXxT/qlh8gea8i+tnqaxnzFZzoJ3LFg0=; b=MH3VZpvZUaLc2AIEejChihXocwwp7N9PcwhupH6kfNPJtGjpkqHq+I19d/8fA2beis EIMepVRLr7pSfF4eRHOsOAUghg/2xZ2yc3yudlNQCOVnlpUjJw2PAbPAA70Xkj7VMKYZ qZCLvtx2EjUr96RK72o6yf7WWK2VoltqpqxTMdApRtITHyCD/qVck/WH3054x+xU8Eu0 vI5UjaDgVQgyIxjlkpFvboMo/BwUty2GXd9o39go2hyAIpFJH7JYAnLfAAEv4faGPz1r CAJcqkmxi//ISDKxuuQAcoueqZ2E8rmfe1CW1PFgC31saKumyHE1bUE+3O7xOavKKpMf 9bMA== 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 b15si3441945eju.362.2019.11.08.03.35.29; Fri, 08 Nov 2019 03:35:53 -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 S1731978AbfKHLe0 (ORCPT + 99 others); Fri, 8 Nov 2019 06:34:26 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:57883 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbfKHLeZ (ORCPT ); Fri, 8 Nov 2019 06:34:25 -0500 Received: from 79.184.254.83.ipv4.supernova.orange.pl (79.184.254.83) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.292) id 2cb5217da455c9c5; Fri, 8 Nov 2019 12:34:23 +0100 From: "Rafael J. Wysocki" To: zhuguangqing83@gmail.com Cc: gregkh@linuxfoundation.org, pavel@ucw.cz, len.brown@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, zhuguangqing Subject: Re: [PATCH] PM/wakeup: Add print_wakeup_sour_stats(m, &deleted_ws) Date: Fri, 08 Nov 2019 12:34:23 +0100 Message-ID: <2538968.KVf98yYfh7@kreacher> In-Reply-To: <20191021085140.14030-1-zhuguangqing83@gmail.com> References: <20191021085140.14030-1-zhuguangqing83@gmail.com> 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 On Monday, October 21, 2019 10:51:40 AM CET zhuguangqing83@gmail.com wrote: > From: zhuguangqing > > After commit 00ee22c28915 (PM / wakeup: Use seq_open() > to show wakeup stats), print_wakeup_source_stats(m, &deleted_ws) > is deleted in function wakeup_sources_stats_seq_show(). > > Because deleted_ws is one of wakeup sources, so it should > also be showed. This patch add it to the end of all other > wakeup sources. > > Signed-off-by: zhuguangqing > --- > drivers/base/power/wakeup.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c > index 5817b51d2b15..29e9434ccaaa 100644 > --- a/drivers/base/power/wakeup.c > +++ b/drivers/base/power/wakeup.c > @@ -1071,6 +1071,9 @@ static void *wakeup_sources_stats_seq_next(struct seq_file *m, > break; > } > > + if (&ws->entry == &wakeup_sources) > + print_wakeup_source_stats(m, &deleted_ws); > + That would be when NULL is about to be returned, right? Why not to check for !next_ws instead, then? Moreover, why to call print_wakeup_source_stats() directly instead of returning &deleted_ws? Also it looks like you need a similar change in wakeup_sources_stats_seq_start(), in case n is greater than the number of list entries, don't you? > return next_ws; > } > >