From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E6B7C19759 for ; Thu, 1 Aug 2019 20:23:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 045F72080C for ; Thu, 1 Aug 2019 20:23:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lxWCa9qR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729747AbfHAUXB (ORCPT ); Thu, 1 Aug 2019 16:23:01 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33350 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbfHAUXA (ORCPT ); Thu, 1 Aug 2019 16:23:00 -0400 Received: by mail-pf1-f195.google.com with SMTP id g2so34709785pfq.0 for ; Thu, 01 Aug 2019 13:23:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=message-id:mime-version:content-transfer-encoding:in-reply-to :references:cc:from:to:subject:user-agent:date; bh=fTIZJQikQI8w/BKVVJZ33osEkUPhfPGMi+gSFP68ip4=; b=lxWCa9qRPtHhH2oHKBdo2XyMWrk9vqfYVYeT6QPsAjlAmS0/cIk+KAOcG/75md+Br0 5dFST6qO2H9lshNgpnQ8B3ElPqmBbyqzytFI8DolFwaGRugcmEpie+aWP7RcXWEgEW+Q hGHe//H9rh8Uive6cfcspibky09EEiirl8w+Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version :content-transfer-encoding:in-reply-to:references:cc:from:to:subject :user-agent:date; bh=fTIZJQikQI8w/BKVVJZ33osEkUPhfPGMi+gSFP68ip4=; b=XvVN54ejUINUOrHIhSNncX8AWbWIXr29NDEp4XRRFVGjyWl3ytd5ttNuDhRzrAGtp5 HlnKBjm6+kxkPJJf+EYoT62Fu0NPs0Gq7BX4M12EvlgbmzFAzCbh7wcM556QOCM59o5R VaPVUOHpi31kYkfUYu1coz5n19v/vR7c5l33RoL/S24hy3nuThvNVj5VFAok+85T3lno OvIVt0Qhdz+qe2xS8daKnqld8zGd3yYLhKXwbr42tnY04mgnPTeyYJ/FhdQ9HnydAEK8 4Bmo7w2vxSxz2nV3ZvrQRYyu6TCZE2XGgMxpbyz4pzndIyBDOSt6ZjKbpGcU2gFCLI4o I9JA== X-Gm-Message-State: APjAAAUfZbxkGEMyP+GjxyR55IiL6j3A5TXucD8f9l6qsLymP7Os+TUF kQyO7ylVK6amQkhupDJUZSkQSQ== X-Google-Smtp-Source: APXvYqzOdAoaZaiqO2EChiR593oybTXQTEM78AmeRaPQ7zZ2jslmJrWVVU4RARZJaB1u8UqhhQ/+uw== X-Received: by 2002:a63:5b52:: with SMTP id l18mr121210400pgm.21.1564690979818; Thu, 01 Aug 2019 13:22:59 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id l1sm94261462pfl.9.2019.08.01.13.22.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 13:22:59 -0700 (PDT) Message-ID: <5d434a23.1c69fb81.c4201.c65b@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190731215514.212215-1-trong@android.com> <32598586.Mjd66ZhNnG@kreacher> <6987393.M0uybTKmdI@kreacher> <5d42281c.1c69fb81.bcda1.71f5@mx.google.com> Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Greg Kroah-Hartman , Viresh Kumar , Hridya Valsaraju , Sandeep Patil , Kalesh Singh , Ravi Chandra Sadineni , LKML , Linux PM , "Cc: Android Kernel" From: Stephen Boyd To: Tri Vo Subject: Re: [PATCH v6] PM / wakeup: show wakeup sources stats in sysfs User-Agent: alot/0.8.1 Date: Thu, 01 Aug 2019 13:22:58 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Tri Vo (2019-08-01 12:50:25) > On Wed, Jul 31, 2019 at 4:45 PM Stephen Boyd wrote: > > > > Quoting Rafael J. Wysocki (2019-07-31 16:10:38) > > > On Thu, Aug 1, 2019 at 12:59 AM Tri Vo wrote: > > > > > > > > > > > > > > So why wouldn't something like this suffice: > > > > > > > > > > dev =3D device_create_with_groups(wakeup_class, parent, MKDEV(0, = 0), ws, > > > > > wakeup_source_groups, "wakeup:%s"= , ws->name); > > > > > > > > > > ? > > > > > > > > ws->name is inherited from the device name. IIUC device names are n= ot > > > > guaranteed to be unique. So if different devices with the same name > > > > register wakeup sources, there is an error. > > > > > > OK > > > > > > So I guess the names are retained for backwards compatibility with > > > existing user space that may be using them? > > > > > > That's kind of fair enough, but having two different identification > > > schemes for wakeup sources will end up confusing. > > > > I understand your concern about the IDA now. Thanks for clarifying. > > > > How about we name the devices 'wakeupN' with the IDA when they're > > registered with a non-NULL device pointer and then name them whatever > > the name argument is when the device pointer is NULL. If we have this, > > we should be able to drop the name attribute in sysfs and figure out the > > name either by looking at the device name in /sys/class/wakeup/ if it > > isn't 'wakeupN', or follow the symlink to the device in /sys/devices/ > > and look at the parent device name there. >=20 > This makes it difficult for userspace to query the name a wakeup > source, as it now has to first figure out if a wakeup source is > associated with a device or not. The criteria for that is also > awkward, userspase has to check if directory path contains "wakeupN", > then it's a virtual wakeup source. I think you mean if it doesn't match wakeupN then it's a virtual wakeup source? >=20 > IMO it's cleaner to consistently have /sys/class/wakeup/wakeupN/name > for every wakeup source. I don't find it awkward or difficult. Just know what the name of the /sys/class/wakeup/ path is and then extract the name from there if it doesn't match wakeupN, otherwise read the 'device' symlink and run it through basename.