Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6565689ybi; Wed, 31 Jul 2019 17:07:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqylJaZ4Ed96qW0wCQuvw/i+57KAGrn1wMdIrLumfeT2rlMq/vGLYJE1m2zfWH0QmlXiwK4T X-Received: by 2002:a63:1723:: with SMTP id x35mr18333369pgl.442.1564618047984; Wed, 31 Jul 2019 17:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564618047; cv=none; d=google.com; s=arc-20160816; b=QiCIiVLVN81ApvLBUDQ87g+LNyL6o7pjaJEaycfyH+GxaqEJhh6AVtyJ2SMUAG1t3R g/aZutyL+byfWYz/w9GaJq8r6pX37qiKL0YUwSd5IIB/Bl+ZYhtT8BjdqIox83AgCJri 8MUF0ybWBJdT3WIztN89iMw2nWuwiD9Kj5Vv8lEdGDCJf2h3QladwLrSmdO9byOHsYMt sWsfYDLbxZBIfrXcO0g4QK7+BKC7J6AxCGXgddBJbO8AwwaPp8tqh2bih2IARhUbhqtB GrpH3I0JyMZGk69gAjzuhZ+5srcxxZNBgWNr4KKRdJikhqYwXHjnkLi+szR4tnu4RPFY Agqg== 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=g1XGA7+OOT5M94yaSPtFGkRyMp9RBaIxbFA4iWh0TPU=; b=Ac/kdN1Vvr1imXACdx0Y0K4mKU3gs60exn7nlBo76OcpZtY+0M26Uohp6wIbXN2LpE QGCrf5hhsjUvRtMaRyuJ8c1/jKg5lxvz0bCxbmyy4vlGZcwmMstfWxrWpssoFrW/aukS cAbUndOpDG4rV2Pjy5qPGtsqqqKIAm95ZfpvVkjVmrPbCGPDtxQIJ5M7UkMJKLYr9pK+ mL/26XnF3EWVi2zntJMg78CiwHY55BkLqjdhtt6ehu1uUG12OJ5TWbysEivHuEBts2iN 699MYSncPwyE/W9Fw9mMRfeTqqvpFAxkuULEqwVgpfu53ugGHAS3LQt2ZwMG99vFgi5d QaJA== 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 s6si21912670plq.213.2019.07.31.17.07.12; Wed, 31 Jul 2019 17:07:27 -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 S1730510AbfGaXAQ (ORCPT + 99 others); Wed, 31 Jul 2019 19:00:16 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:38532 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGaXAQ (ORCPT ); Wed, 31 Jul 2019 19:00:16 -0400 Received: by mail-oi1-f193.google.com with SMTP id v186so52076112oie.5; Wed, 31 Jul 2019 16:00:15 -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=g1XGA7+OOT5M94yaSPtFGkRyMp9RBaIxbFA4iWh0TPU=; b=oir4h7Qbwxjou/TsIYiSWBpO5s7T+pl0WM4ye2uPEBT2APk0dqegCcdXBNm3ZY1/JY z18bACf5lRlOVW/HkHXdsV5v8xGNImn4mE55pWayZqNdZdQcfQ8bMfJ4KyMYfamsi4fN 0uyoPCc72Ma413Xcn1MPqam5mupMLmTE5CT8dtsE3vb/kivq0blfH5Y0+H4pyRq+6+9x rpKsSHfBqg79VuF2Jg0Qsh1peZYek3236uvn8YacjjTS/Yz9J7golr9GP2rSVzy4ldaM 7cO33hL+wE6W1F79Ymco7Z12VCmDKON9ar0twI2pyWzjr1A3TPzdUB6ovQGBBZcl5YJm sQ+Q== X-Gm-Message-State: APjAAAU1GHDRncXHbjoQamqbh7E+/Ev4ZqaK5urI8DYPC8eneIB/2jG6 HeKVenYBryt6kqofnRt4M/vOhixhDfNp3wXLCYg= X-Received: by 2002:aca:edc8:: with SMTP id l191mr60392932oih.103.1564614015358; Wed, 31 Jul 2019 16:00:15 -0700 (PDT) MIME-Version: 1.0 References: <20190731215514.212215-1-trong@android.com> <32598586.Mjd66ZhNnG@kreacher> <6987393.M0uybTKmdI@kreacher> In-Reply-To: <6987393.M0uybTKmdI@kreacher> From: "Rafael J. Wysocki" Date: Thu, 1 Aug 2019 01:00:03 +0200 Message-ID: Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs 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" 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 Thu, Aug 1, 2019 at 12:42 AM Rafael J. Wysocki wrote: > > 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); > > ? And more generally speaking, we are adding another way to identify wakeup sources (by id), which is not related to the one we already have (by name). Why do we need both of them?