Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5264145ybi; Tue, 30 Jul 2019 17:22:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6UdYmZe3orpCPh86v2UFE6SefB12YXWZu7Q14pyqquJOcwIIzCXT5u/gMJ9jAZvVdGI9N X-Received: by 2002:a63:30c6:: with SMTP id w189mr107617589pgw.398.1564532551679; Tue, 30 Jul 2019 17:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564532551; cv=none; d=google.com; s=arc-20160816; b=YwMT1xf29BepS4iilrUn1KNfda0GigmVSq0iiB0WEYq6BEby1VPStFp6IPxs+Rbt1I HNLTNTRP3FqlD+2bZ5QEiJ032ww+fBhov4YswUTchh+V6mZbIGphDvbtXpG65Bp5bqCk m8yyHjZ6iY9AJ+NhFtyVLSuX/55gxcEkXXxUzApqQYMPgdoAQjppsKpP8MtCUdqSNBkK k5pzK+183QTDs/y3XWxMsZkPwyCD/dd0BMjcysH/Ihp0BWZQ67FUMIAeQa3mIurK+Mcp TwTIPDtupJZ6LMgOX0h6ZZitze+S1SShK7m/CFFt/5S9JTlMNMAbr2HL85sPDoqOy93Z myJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=VimY03f5aoVN/yYxs3dYpIJvqLgBI3pDDuk5hgLPs/4=; b=JMZ7Z3NvifokjyLWIyzy79ngcUsinTv74/iKYvifkkTysfpKpT2Nd/NMUv1CHEMIWE zr4rEUvHp/h/OcrtcKBeJIl3e4Q44wuFEnT6sYphQDD9/6sDnSbWms7ryvLzweyzlt28 h8KWOAxZ9RNtvWMHWNIC0zu/OEwIZm0vf5kDzrlBFBP1hKBcQSJ7hU3ENEwwJDufezNv z7Re6DjNJ68aXBtqJHAEvGHjil+BFa+E8PF8wkIDQfD9Ry3DUjqoW3eof/DQbfe2mArs v5bVWZ4lG/0nActnsHzn38F4pmUM8HiM4RoW5D3WPDqJ7Z2AnzqDPRjbngKUoiDxJTIe B5Ig== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k22si27762569pll.168.2019.07.30.17.22.16; Tue, 30 Jul 2019 17:22:31 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbfG3XGI (ORCPT + 99 others); Tue, 30 Jul 2019 19:06:08 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:41881 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfG3XGI (ORCPT ); Tue, 30 Jul 2019 19:06:08 -0400 Received: by mail-oi1-f195.google.com with SMTP id g7so49175540oia.8; Tue, 30 Jul 2019 16:06:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VimY03f5aoVN/yYxs3dYpIJvqLgBI3pDDuk5hgLPs/4=; b=ggE7PkpVTs0MSwxu+UtKwqyFOI+j5VUyM6rGPtN96hkLwtGQaTw1SLmjaAI6iLrQ8B YWFyTIWdVaCjZd61L1iBEBNTTe9RSc07ZcGBzYl7XRp6ogOVb11HiIyrARe4Ln3o2umL uEm59U3y3zIrcvPvACUDL5XjhQxNooX1u3qtSTLPOtlwIPmkxquabJXEiU1QMBzq14UI akRHC66KSngkaOQmvmL9rrHwduVLcoyp432/fJxYgSlF6rKn5eNwAn/MtYxQpsgU8/Bq vxVoxdzRDo0mel79GnaZ17ky1e76Eb6pmZVgmgxriDXHcEiM1F4RRl3kywbneMM1DSIB xlHQ== X-Gm-Message-State: APjAAAVPId8t52fXDdImnIuvuhMS7niyFCy6PI0/phj219dpfqIlLR4w yLh0cHPwueLeVKhhpUQEEAMair/2cIpGuaM26nw= X-Received: by 2002:aca:5a41:: with SMTP id o62mr57540516oib.110.1564527966936; Tue, 30 Jul 2019 16:06:06 -0700 (PDT) MIME-Version: 1.0 References: <20190730024309.233728-1-trong@android.com> <5d4090ea.1c69fb81.d5cab.4dcd@mx.google.com> <2085893.cJkfNvi94x@kreacher> <5d40c41f.1c69fb81.ac63f.947f@mx.google.com> In-Reply-To: <5d40c41f.1c69fb81.ac63f.947f@mx.google.com> From: "Rafael J. Wysocki" Date: Wed, 31 Jul 2019 01:05:55 +0200 Message-ID: Subject: Re: [PATCH v5] PM / wakeup: show wakeup sources stats in sysfs To: Stephen Boyd Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Tri Vo , Greg Kroah-Hartman , Viresh Kumar , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , Linux Kernel Mailing List , Linux PM , "Cc: Android Kernel" , kbuild test robot Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 31, 2019 at 12:26 AM Stephen Boyd wrote: > > Quoting Rafael J. Wysocki (2019-07-30 15:17:55) > > On Tuesday, July 30, 2019 8:48:09 PM CEST Stephen Boyd wrote: > > > Quoting Tri Vo (2019-07-30 11:39:34) > > > > On Mon, Jul 29, 2019 at 10:46 PM Rafael J. Wysocki wrote: > > > > > > > > > > On Tue, Jul 30, 2019 at 4:45 AM Tri Vo wrote: > > > > > > - Device registering the wakeup source is now the parent of the wakeup source. > > > > > > Updated wakeup_source_register()'s signature and its callers accordingly. > > > > > > > > > > And I really don't like these changes. Especially having "wakeup" > > > > > twice in the path. > > > > > > > > I can trim it down to /sys/class/wakeup//. Does that sound good? > > > > > > Using the same prefix for the class and the device name is quite common. > > > For example, see the input, regulator, tty, tpm, remoteproc, hwmon, > > > extcon classes. I'd prefer it was left as /sys/class/wakeup/wakeupN. The > > > class name could be changed to wakeup_source perhaps (i.e. > > > /sys/class/wakeup_source/wakeupN)? > > > > Alternatively /sys/class/wakeup/wsN > > > > Or /sys/class/wakeup/eventN? It's your bikeshed to paint. So actually the underlying problem here is that device_wakeup_enable() tries to register a wakeup source and then attach it to the device to avoid calling possibly sleeping functions under a spinlock. However, it should be possible to call wakeup_source_create(name) first, then attach the wakeup source to the device (after checking for presence), and then invoke wakeup_source_add() (after dropping the lock). If the wakeup source virtual device registration is done in wakeup_source_add(), that should avoid the problem altogether without having to introduce extra complexity.