Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1395845ybd; Wed, 26 Jun 2019 17:05:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqtp5yf3LE6lwTyucZb7otD7Nbw0nobhJ0nJ9IWELMmN+1zgz2sheRMXOARuOftttOmLsS X-Received: by 2002:a63:ee0c:: with SMTP id e12mr722981pgi.184.1561593949840; Wed, 26 Jun 2019 17:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561593949; cv=none; d=google.com; s=arc-20160816; b=lXP5BqKSJq19YGM742yXL6Nw5cCYXSwHACSX16Kqt/kN8MmkbvdBLGWN/f3ULMoIrB 2yOduxYNVMdV/z9leKjjZfwrcmTUdHf5X3WV5PpGTsDBVpWcMo2vhcHvWwit8LbILDJi STq6okkx3H89YnKuk5EeIjr3bzTcgcASpo79GxAdgzcoSZR4iFcWMg0G7+WMf4hLDho2 YV8zyAwj7tj4H/8ma7naIkmZTuTIhI4egKw9W4mss+OLb5Mcms6jKJEXgmm4ELz8XfuM MGVso/vh97VoZvsAtBGR6MGJ2djEBlFj7swQmmwhlpKyQMpnLgnMK02Qmo+LbCqnej7W X6gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=R+JTO5r1JS+SfN3/wbLjWVbdIGPYpRhI3v3348/aAkM=; b=lA3/p52q6QSOVICXGAIpsDK8NWA/hTvf0QrcWaow3+rpZuy3oFA2B4q00/UG1R08Vq bI0ldgAMJehzG8X2hW8yrr3dQrXxR5/1lGvm3QcPtR32ssILpidKA7PzIqMsr3M27lEr wn5FXjEwmoPdW+SNh8/uZIMWQbFu3i4bQEpnqucExsR0KxuhEgJrQoCOZOoOfpgRiCqg 11e/x5A7MxuVCPvrjuTBu5+sAi9o5+j77J9jOlOE25cTaTTpwqISJi80EGTTxYZjcK0Q tkASqdjiGxPeD5U36f+J7E4REXeo6weg/WA3ff/8VJopah3Y9nyNnF5PMMVYIgSBBd09 IsYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VzyzHxb7; 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 c7si406270pgn.464.2019.06.26.17.05.32; Wed, 26 Jun 2019 17:05:49 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=VzyzHxb7; 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 S1726618AbfF0AER (ORCPT + 99 others); Wed, 26 Jun 2019 20:04:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:54014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbfF0AEQ (ORCPT ); Wed, 26 Jun 2019 20:04:16 -0400 Received: from localhost (unknown [116.247.127.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 276C820815; Thu, 27 Jun 2019 00:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561593855; bh=Bt+LbiO4eQLo4bJM3VadGjoo2T9a8a0o1bzVcKWRMuk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VzyzHxb7jptUrCqs9F7o8V75HSXapfrjCLgkMKDWUGrVq57XGIiKbpkNItkDvwrjY aTb2u6QVihtcKKDFmAICkxiWbwv6Apl8u5RbWQ6JNPOgR/axmdSOU/2FmAh2g9c2zt n7cr0tuD6dFWMdKHsSXc8CBGBlH1vXb2uGgIQ1vY= Date: Thu, 27 Jun 2019 08:04:12 +0800 From: Greg KH To: Tri Vo Cc: "Rafael J. Wysocki" , Viresh Kumar , "Rafael J. Wysocki" , Hridya Valsaraju , Sandeep Patil , LKML , Linux PM , "Cc: Android Kernel" Subject: Re: [PATCH] PM / wakeup: show wakeup sources stats in sysfs Message-ID: <20190627000412.GA527@kroah.com> References: <20190626005449.225796-1-trong@android.com> <20190626011221.GB22454@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 26, 2019 at 03:48:58PM -0700, Tri Vo wrote: > On Tue, Jun 25, 2019 at 6:33 PM Tri Vo wrote: > > > > On Tue, Jun 25, 2019 at 6:12 PM Greg KH wrote: > > > > > > On Tue, Jun 25, 2019 at 05:54:49PM -0700, Tri Vo wrote: > > > > Embedding a struct kobject into struct wakeup_source changes lifetime > > > > requirements on the latter. To that end, change deallocation of struct > > > > wakeup_source using kfree to kobject_put(). > > > > > > Ick, are you sure you need a new kobject here? Why wouldn't a named > > > attribute group work instead? That should keep this patch much smaller > > > and simpler. > > > > Yeah, named attribute groups might be a much cleaner way to do this. > > Let me investigate. > > Say, we read /sys/power/wakeup_sources/foo/active_count. What is "foo" here? You didn't include Documentation of the sysfs files so it was pretty impossible to say what exactly your heirachy was going to be in order to determine this :) > This > attribute's show function needs to find wakeup_source struct of "foo". > I'm not sure how to do that without embedding a kobject inside of > wakeup_source. Again, without knowing what "foo" is, I can't really answer this. Surely "foo" is not a flat namespace of all 'struct device' in the kernel, right? thanks, greg k-h