Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6553191ybi; Wed, 31 Jul 2019 16:54:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyaOmNf8gW72Pg4rkdh7xk3bvc6/7/JUCq48gA2KTXWaWms+KF6XyUcFU2t+cPgSaQnRME X-Received: by 2002:a63:d555:: with SMTP id v21mr93068231pgi.179.1564617256110; Wed, 31 Jul 2019 16:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564617256; cv=none; d=google.com; s=arc-20160816; b=zVpvgqy2+4IJdXyvOGSGFcHdfr1KVyM8M6tPxD3+FXsKi9KZd8knQGhRsJIqUyL6qv icAUspmF96xwVQtLaljRv6vmH+onB0E4SlFD8DVgVVLvjpWDhunmIWqUfA+Y5UYKQg2o lYpHvt6QWEs1U6freJP8QxGz032XdEv1xjjBV+0I1Ro28pxZDk8gDrAQrTpD8z5NfotM vZ3JudXyqOCjg3RvuGckp78a+Ze39r7vPVp3JQ9Egey2ZrUiDVVT6ZneAf/JV1Bfaun9 YMRky/G7THkYd+aBG7UykDcaB6RjzuZhmk32gpj0fSLF71gK3ovrFJrfQOR932UPl5zu c47Q== 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=AJSb1DkSFLk8ykMEpIkRtlcE6yXYhCdShWTwNXzy/2o=; b=zceGMfLwjJG/o4CX3YRFjZFamB645vvk1tE5mdwtmFbBqDpfJaamaz8E4hkNP6ndad fTsfPNLNrEhg2oQbS4bqxoS4k1jPUHhGpuzFQIOBy3sAjeg94Wtcd+XUge9GwVVDve5D BDWX1syDK+FQmBsdsSCq0sGfpRomRJdT+xoJoj2xmsIJk1uoP4efwFCVv0hqn507VGig cRTbw3lmZ2+qo1mI83aJMuI/kVpxeU7K+EbGy2PQfmyhbVoGkQA93hhOAgJYAlWJm4VL t2XZ+O/iBCozalpWC4soB1NvWrtwRX7+NeQ5db+JXwNyufS/A9gd81dE0hYSA6rppE7X pqgQ== 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 x12si14956421pgq.220.2019.07.31.16.54.00; Wed, 31 Jul 2019 16:54:16 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729665AbfGaWm2 (ORCPT + 99 others); Wed, 31 Jul 2019 18:42:28 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:47294 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbfGaWm2 (ORCPT ); Wed, 31 Jul 2019 18:42:28 -0400 Received: from 79.184.255.110.ipv4.supernova.orange.pl (79.184.255.110) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.275) id 08c6e24a98894a9b; Thu, 1 Aug 2019 00:42:26 +0200 From: "Rafael J. Wysocki" To: Tri Vo Cc: Stephen Boyd , Greg Kroah-Hartman , Viresh Kumar , "Rafael J. Wysocki" , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , LKML , Linux PM , "Cc: Android Kernel" Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs Date: Thu, 01 Aug 2019 00:42:25 +0200 Message-ID: <6987393.M0uybTKmdI@kreacher> In-Reply-To: References: <20190731215514.212215-1-trong@android.com> <32598586.Mjd66ZhNnG@kreacher> 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 Thursday, August 1, 2019 12:31:16 AM CEST Tri Vo wrote: > On Wed, Jul 31, 2019 at 3:17 PM Rafael J. Wysocki wrote: > > > > On Wednesday, July 31, 2019 11:59:32 PM CEST Stephen Boyd wrote: > > > Quoting Tri Vo (2019-07-31 14:55:14) > > > > +/** > > > > + * wakeup_source_sysfs_add - Add wakeup_source attributes to sysfs. > > > > + * @parent: Device given wakeup source is associated with (or NULL if virtual). > > > > + * @ws: Wakeup source to be added in sysfs. > > > > + */ > > > > +int wakeup_source_sysfs_add(struct device *parent, struct wakeup_source *ws) > > > > +{ > > > > + struct device *dev; > > > > + int id; > > > > + > > > > + id = ida_alloc(&wakeup_ida, GFP_KERNEL); > > > > So can anyone remind me why the IDA thing is needed here at all? > > IDA is used to generate the directory name ("ws%d", ID) that is unique > among wakeup_sources. That is what ends up in > /sys/class/wakeup/ws/* path. That's not my point (see below). > > > > + if (id < 0) > > > > + return id; > > > > + ws->id = id; > > > > + > > > > + dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws, > > > > + wakeup_source_groups, "ws%d", > > > > > > I thought the name was going to still be 'wakeupN'? > > > > So can't we prefix the wakeup source name with something like "wakeup:" or similar here? > > "ws%d" here is the name in the sysfs path rather than the name of the > wakeup source. Wakeup source name is not altered in this patch. > So why wouldn't something like this suffice: dev = device_create_with_groups(wakeup_class, parent, MKDEV(0, 0), ws, wakeup_source_groups, "wakeup:%s", ws->name); ?