Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6864750rwd; Mon, 19 Jun 2023 13:50:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QfP4HiAJ3NxXvNpSem3mppLxPybyjUisH22kAyLAJjAN2c5MWToy1s3/vK+VjZpB0lSgM X-Received: by 2002:a05:6a00:2d82:b0:668:715a:6fcd with SMTP id fb2-20020a056a002d8200b00668715a6fcdmr3522601pfb.5.1687207821018; Mon, 19 Jun 2023 13:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687207820; cv=none; d=google.com; s=arc-20160816; b=V9r/jYzz56kG+ai6gNduvCdzBc+TWHWUd3RB93FrNyuimoRtEqdRa7ZWmlUlu3Vg2F L5G7MXEAHfTobjAoY0JLCmXcf/gbSENuQ+iQ3B/V+KQXwWKv+YikZu05keAZrHIDka6/ Co/sOMDjoQKsaePyHvNiUzfKiVsZvvSBvszbw4F6pLsGIMjl2WIjroexRTwrq2jrFe11 eawDzspqzDtGQ1IGnMMstNunIkWFkU+q+V9bQIeuhowkz5agQTvacHCQvRWf/e8bOJVr OtQTLJXE2KGr6i4bdx3wKY2ZUV76VtK95MxvDFvvIqtH4ed2RysHOXG2BZQwxYHQdb+C U53A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ccjdX+IZqQAhgyk6xPOcJY+ngvdDgr2cEw+3he/cnkM=; b=lDr45bL3ZmVf2vWksnAYeDg14U+zIRmNgwD7v5idDi35GOg2JdlA7dVnjesqTVg+YF GMDP5cYtOzmMNdMJpf6sAFY5YTcCWlYZZeaMOkxNTLy79LMgGcoAlR7FhoJRFqB1ldis cOllmDk2o2rKGPR9h0aURENa1QjJo5WLNM9x1QxKOk9mlZmD+zE9gQ2fz6mPTQEG+SAC rliROy/6ObD3/z/fZXGfmD67+VBfaueIS+x3rdm0KobfpXd2LZ4vKlKEsq5swDTl/IsV KA6nW+2780zZ8lXoUQm/8cn1DVQjHlOV1mJxvo0VZmuNEyeLJvSBZLtwajJlFaoG/pp1 rbpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jHYqsvXA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020aa7988c000000b0066874556a58si189901pfl.213.2023.06.19.13.50.05; Mon, 19 Jun 2023 13:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jHYqsvXA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbjFSUrd (ORCPT + 99 others); Mon, 19 Jun 2023 16:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjFSUr1 (ORCPT ); Mon, 19 Jun 2023 16:47:27 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D57F1A3; Mon, 19 Jun 2023 13:47:24 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31272fcedf6so1056097f8f.2; Mon, 19 Jun 2023 13:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687207643; x=1689799643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ccjdX+IZqQAhgyk6xPOcJY+ngvdDgr2cEw+3he/cnkM=; b=jHYqsvXA6NiTfeCcqKVcOiRIKTt+m2BZuSNb260ylv7/IACNKLfLYiqzemybP73R7r E/cN0oKUQtbleX04sIgx0XWdlndkVtGIgOtq1JGz3fBggnfoZzhCzPobJVyvq78WBhi3 Jv5wWJaHtzIVPu98JdDMdLI7YpEwnmQ2fb+TzOU/533Ypi+Kh40R9a0BcOEuH+k/tyzk lKdHnqhkGNit4/GxpXJgLxQ9Bqh3oIY5iLMPn0DUmvdd4c4EtqssVw0tDoDaIGZHumqe LJvTUul00cc/6PGucXfyjJtbtveK2sex0Z8cZsyyD9IROs71j3KltUJxgSdzBn22EkKs jr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687207643; x=1689799643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ccjdX+IZqQAhgyk6xPOcJY+ngvdDgr2cEw+3he/cnkM=; b=iQ4iNkmWuXmo/LfzyjT2dcexZcd2rNabGJAFYaVzqMYi1cEGT0pXJHw1pfvRG0/LCq k98plSkvUiFIrGOs7W4+H+K6gN2xPOP7xIJjzkzqVJ8G5EQZvzeNhAyEM+MGTm0BasRF HN1Qnhh8/THdGO5b+R5sLgotIpdndqdyc1pPZ5tsDDNx/MYRY5YuMJPm1ELC+w4RyJM1 FUt/2+iR8k0YYv3e5UnFvJXRNU3G3g/vDWYb70K1Juvmw7hw+C1HxGAHThFI8FGDld8q HdDfD0icU1zsQx6suYs2bUIl0EkOutT7a7H98O8VouhWACW7P/smfn3nG1bCAc5JkkFS rvYg== X-Gm-Message-State: AC+VfDwdv37asNIHY5OMtI/GguNBczFe0hEcD4udRqvE7hIAp5qKx3ur 1x8sxJZKasgYLoU1EYStvWg= X-Received: by 2002:a5d:6292:0:b0:30f:cf67:564e with SMTP id k18-20020a5d6292000000b0030fcf67564emr7527330wru.62.1687207642690; Mon, 19 Jun 2023 13:47:22 -0700 (PDT) Received: from localhost.localdomain (93-34-93-173.ip49.fastwebnet.it. [93.34.93.173]) by smtp.googlemail.com with ESMTPSA id k10-20020adff5ca000000b0030ae87bd3e3sm434043wrp.18.2023.06.19.13.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 13:47:22 -0700 (PDT) From: Christian Marangi To: Pavel Machek , Lee Jones , Andrew Lunn , Christian Marangi , "David S. Miller" , Dan Carpenter , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [net-next PATCH v5 3/3] leds: trigger: netdev: expose hw_control status via sysfs Date: Mon, 19 Jun 2023 22:47:00 +0200 Message-Id: <20230619204700.6665-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619204700.6665-1-ansuelsmth@gmail.com> References: <20230619204700.6665-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Expose hw_control status via sysfs for the netdev trigger to give userspace better understanding of the current state of the trigger and the LED. Signed-off-by: Christian Marangi Reviewed-by: Andrew Lunn --- drivers/leds/trigger/ledtrig-netdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index 2c1c9e95860e..32b66703068a 100644 --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c @@ -406,6 +406,16 @@ static ssize_t interval_store(struct device *dev, static DEVICE_ATTR_RW(interval); +static ssize_t hw_control_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev); + + return sprintf(buf, "%d\n", trigger_data->hw_control); +} + +static DEVICE_ATTR_RO(hw_control); + static struct attribute *netdev_trig_attrs[] = { &dev_attr_device_name.attr, &dev_attr_link.attr, @@ -417,6 +427,7 @@ static struct attribute *netdev_trig_attrs[] = { &dev_attr_rx.attr, &dev_attr_tx.attr, &dev_attr_interval.attr, + &dev_attr_hw_control.attr, NULL }; ATTRIBUTE_GROUPS(netdev_trig); -- 2.40.1