Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6488241ybi; Wed, 31 Jul 2019 15:32:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDBMneFo1neGke1rp2pXZ/hfeMVvvzvMliu6QYh0ISkxQc872myYMA8m/8LqDeOFxGStJz X-Received: by 2002:a17:90a:2247:: with SMTP id c65mr4954189pje.24.1564612347941; Wed, 31 Jul 2019 15:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564612347; cv=none; d=google.com; s=arc-20160816; b=ks/EtOxfJDRDF4Ugemb/kz2OHecM8v7UlJQhGfDKnEMcDOY5bD+jUrVVwXxyCCyEmx w/OldlxwK12G/kklWrHOz1SdRWiT4azVvnKKZCRL7boTRP3yEUaO3U4RgKNTWTiSIgp3 xUiChf9e8fTf4aDGPYCSivzKGEqavnp2uLRHd8okb0zP2OEGosZ0pYCFheixlLHdr4kL uZhnTnwr77pzRnStO4WD0WGrErsPF5Klzaq84fPcMtccmGRnM6UbqvWClvN9yHZSZvWE PW1IlL48vDw9U1lVv7rOW/io08iCQLVJKDU1etVGJIwEGtAsV6DQVJyX4UYhwdErJZ06 5HBg== 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:dkim-signature; bh=bSadfWcJlLBywRMIXV9mcKywOnO5UwqEGEWSQilvyk4=; b=UdDgsNpDzmXdojzTIqd14yidJ2MY+kOdEq5Kov2werxKZZ3UCHFpwyd70KLQQGnWsE gxBtlhEMP5SFBp7QZl0I8eukF7rxZ5rd+0UA135+4HkZ3ilfnSjwBNGzyWTSbsB5DdQU cn3PkH/JJbesQbq6m+rt6xNSV7s0hI2dVqo/mvk7mbTQqI0BT3CuKU8EBEp/4+HfQSbj qS9YADMfB3t9eoFlYozNUPaXsZQGjYGDkzdGnb1fkFUv/W/W5QsAz7dR3+s11uL3UeUF xrFi1arS+Ez94z6TyGcMvoeQL4ABUuToSurzihhMlt4xvcOsmBIQ3vRuLgip5jTlCiKT p3qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b="LW/2QAVf"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21si28927623plq.91.2019.07.31.15.32.12; Wed, 31 Jul 2019 15:32: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; dkim=pass header.i=@android.com header.s=20161025 header.b="LW/2QAVf"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbfGaWb2 (ORCPT + 99 others); Wed, 31 Jul 2019 18:31:28 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:44999 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbfGaWb2 (ORCPT ); Wed, 31 Jul 2019 18:31:28 -0400 Received: by mail-ot1-f66.google.com with SMTP id b7so21756068otl.11 for ; Wed, 31 Jul 2019 15:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bSadfWcJlLBywRMIXV9mcKywOnO5UwqEGEWSQilvyk4=; b=LW/2QAVfnNW3GEBvxs9wNawPIAoMZk/0kwFSaO1XaizvoejDoLgbxsgsUgY/uGL0dZ yhxvSHeR5lsR+wFWpl/2fj8xc6VbU7TQrZloxL27dMYuF4TDl6mJtaP5h4ZfgvaGVHBK lfnAEQCAxd3LAyWlAgRYCL03Urv2hulKQP7B8BD45BjA+IsG6tM9pBZdB8sRDgDimvMm ge8q0uG4NeM10+6to5axXDi4dnvwesT52peVFmh6Nl95hktoj+XmTwPTujTWmRKUdjIc 2vQE6FJRQoHGe3et+ANR8Lft0SqgQ3GbPTMr6gtNTnVo6ppgvF8+lwff4SsTTLZDuevb MLCw== 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=bSadfWcJlLBywRMIXV9mcKywOnO5UwqEGEWSQilvyk4=; b=ZzKjcQZQJ6USRd+dMcvvdDefHsnThdlt+8Ceny0k3ZaMt1TASbgD3duhZzXNTcPG4h J7gurF3AI3utP+q1gxprYW8y9MxLNKdwBzsl4vV7rhIL8/6CA8Lr5w5UnIDqv7K4H2+y jKATkZjaeTXRyk8QYsc+yXGXoTU02DgrkHmTdDynNwWcONOd+CSHm9jHSBa2lJJ6hkwE QbxckNZ9FUZP/5MHeMVJ+tsVhwMetPPIysOQ/WnHxQzDzrHewUIgI0LROvjbUMZKIgxf X1QevYifLMB+HFyluDlo8K80Vvf0PKIMO4T/vYIc8vFw35099RL8Zihwolo9IhE11hZA 56YA== X-Gm-Message-State: APjAAAVTxkn53y/kTKpWB9n23qHavW7s4t6jOlWxwxvhN+r7a/c1Slnr 9B5coy5+7rZLFSBQtCM9uchsc5L0YzkaY0Zs9SU= X-Received: by 2002:a9d:5911:: with SMTP id t17mr9029675oth.159.1564612287120; Wed, 31 Jul 2019 15:31:27 -0700 (PDT) MIME-Version: 1.0 References: <20190731215514.212215-1-trong@android.com> <5d420f45.1c69fb81.35877.3d86@mx.google.com> <32598586.Mjd66ZhNnG@kreacher> In-Reply-To: <32598586.Mjd66ZhNnG@kreacher> From: Tri Vo Date: Wed, 31 Jul 2019 15:31:16 -0700 Message-ID: Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs To: "Rafael J. Wysocki" 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 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. > > > > + 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.