Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp992006ybn; Wed, 2 Oct 2019 09:14:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSbstSjB9W0Y190+N3rkaVtwGTnN+UVwycr38wFUtJX6qtAYu++GRftKNzb80Il7fOXF3y X-Received: by 2002:a17:906:5584:: with SMTP id y4mr3756849ejp.89.1570032853847; Wed, 02 Oct 2019 09:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570032853; cv=none; d=google.com; s=arc-20160816; b=CtWsytIKZR+GAdeii8aWrVFTBBkrLKfGVtBSYLYrg1csvxgF0U5gB+3tsQUMwacH// MBg9Iig7l8qfsS/EuZZFJ9soobWkxwu+K9Xh4xHCG8FHcw4nFiPJ6RH73tff4BKmHh67 0NN6ZjmXzvbDO6ZaE5tj2BQHIbJDsDL9t2XuA5JmThhxzSRElkOprCYOH1JLR/CM372Z JdeX7TisWi5/r0Hc3P8t1y/c3W791ynXglaOzD2XlGjcKtUT3LmQOL/aKwJsoOxhb2vL 5h0pPGRP0AKqF0xfclkAhSy2vdRmkZWA9za1Wz9+8nuTmYTgPoAp6uPTcijonlAGP/9v /0dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=YVeTV9cmDVrXESTQYp7X2KJW0tWZijQIkQxHlYFki2o=; b=FD2mbMpMXEVi1kvFXEwBs0Yszfsi5kZFxhRhJhQf9rem1dAysH20pmdPWN+NRu9dLR CX9x9C8Ta+csEbz66dE7h0gzZ4EM/uGv91PcQsGYoQWFR+lUE9zx1DRERPkW4gyCSDHp poaraqZnoAukxcmzRsdena8P6Y4plp0i2aPK43sFuzJumAjEHiXim7VW/AZcwF/WuTYR jlr6uZJ+oVAyrKRR5bQeE7x/Jy2W9CKonJXNoBdo4yVpDldxB8qAyQq2HeAD9Xn0xscz SaBQjpj8NrHNyzsBSF6S0LmTrL47MzzhR+3Y1hpPPXYJC38Q2KA3kJXP3GfUGhiOMNZc ZK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tmLUteC6; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13si11530578edx.156.2019.10.02.09.13.49; Wed, 02 Oct 2019 09:14:13 -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=@ti.com header.s=ti-com-17Q1 header.b=tmLUteC6; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728946AbfJBPq1 (ORCPT + 99 others); Wed, 2 Oct 2019 11:46:27 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:56298 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726178AbfJBPq1 (ORCPT ); Wed, 2 Oct 2019 11:46:27 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x92FkLb9129661; Wed, 2 Oct 2019 10:46:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1570031181; bh=YVeTV9cmDVrXESTQYp7X2KJW0tWZijQIkQxHlYFki2o=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=tmLUteC6HXcSIkaaWWDJ29NpTMJeUbiE66E3XT+x0vSt7UdrHYDhNLw5sQ4P07iSR aIvXeywvYbAEUEODufwO5//U+PfaaoXfIhglrwJKQL4SzOYimzh3ZW1dfvPUUMQrjt yyELwaoeW4ItcH5gvTBe5h/vdPQVHqZfRL75KfgE= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x92FkLII107830; Wed, 2 Oct 2019 10:46:21 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 2 Oct 2019 10:46:20 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 2 Oct 2019 10:46:21 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x92FkKgo039310; Wed, 2 Oct 2019 10:46:20 -0500 Subject: Re: [PATCH -next 2/2] leds: add /sys/class/leds//current-trigger To: Akinobu Mita , , CC: Greg Kroah-Hartman , "Rafael J. Wysocki" , Jacek Anaszewski , Pavel Machek References: <1570029181-11102-1-git-send-email-akinobu.mita@gmail.com> <1570029181-11102-3-git-send-email-akinobu.mita@gmail.com> From: Dan Murphy Message-ID: Date: Wed, 2 Oct 2019 10:47:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1570029181-11102-3-git-send-email-akinobu.mita@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Akinobu On 10/2/19 10:13 AM, Akinobu Mita wrote: > Reading /sys/class/leds//trigger returns all available LED triggers. > However, this violates the "one value per file" rule of sysfs. > > This provides /sys/class/leds//current-trigger which is almost > identical to /sys/class/leds//trigger. The only difference is that > 'current-trigger' only shows the current trigger name. > > This new file follows the "one value per file" rule of sysfs. > We can find all available LED triggers by listing the > /sys/devices/virtual/led-trigger/ directory. > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: Jacek Anaszewski > Cc: Pavel Machek > Cc: Dan Murphy > Signed-off-by: Akinobu Mita > --- > Documentation/ABI/testing/sysfs-class-led | 13 +++++++++++ > drivers/leds/led-class.c | 10 ++++++++ > drivers/leds/led-triggers.c | 38 +++++++++++++++++++++++++++---- > drivers/leds/leds.h | 5 ++++ > 4 files changed, 62 insertions(+), 4 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-class-led b/Documentation/ABI/testing/sysfs-class-led > index 5f67f7a..fdfed3f 100644 > --- a/Documentation/ABI/testing/sysfs-class-led > +++ b/Documentation/ABI/testing/sysfs-class-led > @@ -61,3 +61,16 @@ Description: > gpio and backlight triggers. In case of the backlight trigger, > it is useful when driving a LED which is intended to indicate > a device in a standby like state. > + > +What: /sys/class/leds//current-trigger > +Date: September 2019 > +KernelVersion: 5.5 > +Contact: linux-leds@vger.kernel.org > +Description: > + Set the trigger for this LED. A trigger is a kernel based source > + of LED events. > + Writing the trigger name to this file will change the current > + trigger. Trigger specific parameters can appear in > + /sys/class/leds/ once a given trigger is selected. For > + their documentation see sysfs-class-led-trigger-*. > + Reading this file will return the current LED trigger name. Why do we need this new file can't we just update the current trigger file implementation? I don't see any documentation that states that the read of the trigger file will print a list of known triggers. And writing to the trigger file still works so I would think the _show just needs to be fixed. Besides this patch does not fix the issue in the commit message that the trigger file still violates the one value per file rule. Dan