Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp235460rwb; Wed, 14 Dec 2022 16:38:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JGK7ENMGrCgrrr/eTzV3sowLgYXzgTUv5Ivil6olu8mCijqAxYoLSse28QzruMZtEkhEf X-Received: by 2002:a05:6a00:e14:b0:573:d183:4218 with SMTP id bq20-20020a056a000e1400b00573d1834218mr26123410pfb.10.1671064733445; Wed, 14 Dec 2022 16:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671064733; cv=none; d=google.com; s=arc-20160816; b=qKvyaAIU0QmapA4GkaYaRgeuh4pZOONr4A8ZJkknHsRV7Ewo7yrxoM+MdiIfJyE80p Tx4REwrccmwU2hUhNb0iJ/5xVY6xIzWYAvifK1M+QsCiFs+dLldem5gL1HivqPmhs7+5 c8SnAuzrqrSuzbdvPpgmelbt9rOJqZIt0T7d7hewWjs0Mo1a29PK2MD/ynrcGsSsPaSB Eem18ahf+I7/be8zT9D981rAqGasBIpIXmt+8VAcPShDUDjpvknSWNRoivK/De80U+JV CY/f1Sp0MVzAmzahOGw3U4heA1ViWsZG995eLrCUZvXw3u9BNTKsDuZqJNCG92OJIN4Z ozmA== 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=AM6Sy+u27cRKYcUzXWKt9kLEw6zGEH9U/Yts/6M0SW0=; b=Y6Cah61ed39Gktzyau4RutKnPJG5hN7eybnHem1gscwIG3qxAD7L18bvZj0y4IOfUl UKhpyI58ZX52iW4RZAjZrZ7JeMeNEnqb/5SmE1jnpWLJmNGmp7/G+rJTAi33CAaSWJOt pSrgcMQXCX2JYSSaZVGeoWZb41Usv27F4ioi3N3xHzrKXXp8JJRwRz7sEO3rYrR63hMI 7Qr5h6vx1M4yT5TR69QZNY4OqcQ0cX6E+98fJFqhhSxdcycBbRQLpKY8pdobpwsTyevL r71BpWwFEuKFh/G7zpTWGEeYNHNFoFTxPmPMG05OwvbK73zyN/wx9ZztWAGFia4UKSyj TbsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DxxSA8R1; 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 u20-20020aa78394000000b005731d316830si1124411pfm.23.2022.12.14.16.38.44; Wed, 14 Dec 2022 16:38:53 -0800 (PST) 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=20210112 header.b=DxxSA8R1; 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 S230222AbiLNX7f (ORCPT + 70 others); Wed, 14 Dec 2022 18:59:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229724AbiLNX6n (ORCPT ); Wed, 14 Dec 2022 18:58:43 -0500 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 6B4725D695; Wed, 14 Dec 2022 15:55:43 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id o5so1477939wrm.1; Wed, 14 Dec 2022 15:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=AM6Sy+u27cRKYcUzXWKt9kLEw6zGEH9U/Yts/6M0SW0=; b=DxxSA8R18AgPUYSN71xPuAxxUi18sylXJl5SnQO65+6qhmYsAJdaEHI12mlMqzT3rE u1KLSnYpirb0+3AQI3m++t36S6DCth/0DbvdfJfwLnDUi+ONwHIBhUhNBx3bCuIVli7M dVounvqZRHn/eP6BXkKo0E7FODkoXVmy2b+SrLSIwOVyh36UpGL6zSJysjHeF9A8ds3m riLKuh9D6apfTVO8hiKUcAN7URzzVMeZDVRc7Y726Cgh3IVS1gydxwgZ5TyCgCgdmLO1 x6zi9wNM77V/TC860cfkct/XU5/VEYU2nKm4ynImYKndlFujNkh9DGo3kZ7ZNsp1gYO3 ltGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=AM6Sy+u27cRKYcUzXWKt9kLEw6zGEH9U/Yts/6M0SW0=; b=QkrZ0WKodYW6KS+1IpwLWCUKVONpABgq3vBhERq4EvJErKDP5whG8kHUI6kva6bzdZ WlAvX3so3mvH9PDdU59zOnpqSdAhd9QDv8Mj8k97XEuCY4cfdEzg6PrBWVjtXZTqydgy H3e2fZ1XWxZpVz7beeowlduQ1E7qIv6KjtZaPTkw8kdJzKBnkLJN+yw7vYy6QIvLfvyb J5rXZ7UuI6H+FAX/f2fDYbVEjH0WIHTsdyRrbl6BWnkB8D2w+uyVlz+kP/JGAHrdlfiE wB0NYq7Hj9UvQXETaTqwpcz6X8C05xkdzKZW9j13kKIthptPo7swgJiBSpGbDBIuE0C+ Uq3g== X-Gm-Message-State: ANoB5pl00MPKBT+5oLugOovfb3MR5W6jcnbIJ26atT/gbnuIFJO27J43 Y7COo5UyJalTHktr6MjOXhw= X-Received: by 2002:a5d:654c:0:b0:242:65d:c401 with SMTP id z12-20020a5d654c000000b00242065dc401mr17724702wrv.6.1671062111732; Wed, 14 Dec 2022 15:55:11 -0800 (PST) Received: from localhost.localdomain (93-42-71-18.ip85.fastwebnet.it. [93.42.71.18]) by smtp.googlemail.com with ESMTPSA id u2-20020adff882000000b00241d21d4652sm4163549wrp.21.2022.12.14.15.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 15:55:11 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Pavel Machek , Christian Marangi , "Russell King (Oracle)" , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-leds@vger.kernel.org, Tim Harvey , Alexander Stein , Rasmus Villemoes Subject: [PATCH v7 03/11] leds: trigger: netdev: drop NETDEV_LED_MODE_LINKUP from mode Date: Thu, 15 Dec 2022 00:54:30 +0100 Message-Id: <20221214235438.30271-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221214235438.30271-1-ansuelsmth@gmail.com> References: <20221214235438.30271-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 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 Drop NETDEV_LED_MODE_LINKUP from mode list and convert to a simple bool that will be true or false based on the carrier link. No functional change intended. Signed-off-by: Christian Marangi --- drivers/leds/trigger/ledtrig-netdev.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index d5e774d83021..66a81cc9b64d 100644 --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c @@ -50,10 +50,10 @@ struct led_netdev_data { unsigned int last_activity; unsigned long mode; + bool carrier_link_up; #define NETDEV_LED_LINK 0 #define NETDEV_LED_TX 1 #define NETDEV_LED_RX 2 -#define NETDEV_LED_MODE_LINKUP 3 }; enum netdev_led_attr { @@ -73,9 +73,9 @@ static void set_baseline_state(struct led_netdev_data *trigger_data) if (!led_cdev->blink_brightness) led_cdev->blink_brightness = led_cdev->max_brightness; - if (!test_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode)) + if (!trigger_data->carrier_link_up) { led_set_brightness(led_cdev, LED_OFF); - else { + } else { if (test_bit(NETDEV_LED_LINK, &trigger_data->mode)) led_set_brightness(led_cdev, led_cdev->blink_brightness); @@ -131,10 +131,9 @@ static ssize_t device_name_store(struct device *dev, trigger_data->net_dev = dev_get_by_name(&init_net, trigger_data->device_name); - clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); + trigger_data->carrier_link_up = false; if (trigger_data->net_dev != NULL) - if (netif_carrier_ok(trigger_data->net_dev)) - set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); + trigger_data->carrier_link_up = netif_carrier_ok(trigger_data->net_dev); trigger_data->last_activity = 0; @@ -315,7 +314,7 @@ static int netdev_trig_notify(struct notifier_block *nb, spin_lock_bh(&trigger_data->lock); - clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); + trigger_data->carrier_link_up = false; switch (evt) { case NETDEV_CHANGENAME: case NETDEV_REGISTER: @@ -330,8 +329,7 @@ static int netdev_trig_notify(struct notifier_block *nb, break; case NETDEV_UP: case NETDEV_CHANGE: - if (netif_carrier_ok(dev)) - set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode); + trigger_data->carrier_link_up = netif_carrier_ok(dev); break; } -- 2.37.2