From patchwork Thu Apr 27 14:34:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1774480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=0BlNSQfa; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=0SjKdNA3; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6ddn0qt6z23v8 for ; Fri, 28 Apr 2023 00:38:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wxs27dYBexkjj+2BK/hjtzBe08LD9ovuK5EMxLnwNg8=; b=0BlNSQfad754bK P4LLxaFWaFrbAp3n2Cx1IvYA0baD/4w7wbW2OIt6Xvj3ZvQWhFYsYQEOnE8BSpwvU2GMa9waPHEYR V64j0l2qExcg48MRnX6uoNRT6lTouQEJM9oLPW6c432bryp8I1P3Qja2V3dvw1T+HY2zOJfm3Rcxp 7S6zwdRk37P6VpunAXimlzOIUPoI0qntNxK9z317S2ZqhaJCoca6m0Cy6XtMWj2zGhLR3s3LUO/IO mlUgv4382XuNSeJLK2V/5RKlpnmEd27dvYnWOND46oyPGeZpEJBAJXLMHLcUJaXx9bVcXSFcVtZnO sKCCnVbW4GC7g/3Hkkug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ps2kC-006mmD-0n; Thu, 27 Apr 2023 14:37:12 +0000 Received: from mail.terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ps2k9-006m8m-3B for openwrt-devel@lists.openwrt.org; Thu, 27 Apr 2023 14:37:11 +0000 Received: from localhost.localdomain (unknown [212.106.161.80]) by mail.terefe.re (Postfix) with ESMTPSA id B0B47200BC; Thu, 27 Apr 2023 16:35:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1682606104; bh=gD67nvkmycSzWWZlReWLUBLtiAq+xAvADPJoSM0aREE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0SjKdNA3l9c95nQx0QjY5R9dYBiU37GMmgDyGfVCkqBuZL7nEMd3T0PgefpyaWxTR 2skxbPaqkUXwwx2vSNsROqCozfZP3/ij3aUo8bqiuzObchyYI3TOFmpF0w3jiY0L9Q UIVn+v1zbyZZo4FcALkhJO8dM25xK4A/9XOELWKu6w1Ako++ikdcSVmHlgercKZqP4 fLXhV0NLq4akprTq+7kb0Z2ASZsD5r+/gn/AqRWMKFk7cfI24ZuW3TR7YcBUYv8ynk i/e7Lb9MWYacFbwzVl2ODYfyVvE4lIHfCR7bssTAiPMnJ0GT8d8ZFQtb9ACeA025LE MAqbw2B6sUprA== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Christian Marangi Subject: [PATCH 3/6] kernel: refresh swconfig_leds to handle new trigger locking Date: Thu, 27 Apr 2023 16:34:46 +0200 Message-Id: <20230427143449.8286-4-tmn505@terefe.re> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230427143449.8286-1-tmn505@terefe.re> References: <20230427143449.8286-1-tmn505@terefe.re> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230427_073710_163849_CF4F0A19 X-CRM114-Status: UNSURE ( 5.38 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Christian Marangi Refresh swconfig_leds source to handle new trigger locking that is now a spinlock. Signed-off-by: Christian Marangi --- .../files/drivers/net/phy/swconfig_leds.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Christian Marangi Refresh swconfig_leds source to handle new trigger locking that is now a spinlock. Signed-off-by: Christian Marangi --- .../files/drivers/net/phy/swconfig_leds.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c index df53e5cd4a21..1d309c046c8d 100644 --- a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c +++ b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c @@ -85,7 +85,11 @@ swconfig_trig_update_port_mask(struct led_trigger *trigger) sw_trig = (void *) trigger; port_mask = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) + spin_lock(&trigger->leddev_list_lock); +#else read_lock(&trigger->leddev_list_lock); +#endif list_for_each(entry, &trigger->led_cdevs) { struct led_classdev *led_cdev; struct swconfig_trig_data *trig_data; @@ -98,7 +102,11 @@ swconfig_trig_update_port_mask(struct led_trigger *trigger) read_unlock(&trig_data->lock); } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) + spin_unlock(&trigger->leddev_list_lock); +#else read_unlock(&trigger->leddev_list_lock); +#endif sw_trig->port_mask = port_mask; @@ -418,14 +426,22 @@ swconfig_trig_update_leds(struct switch_led_trigger *sw_trig) struct led_trigger *trigger; trigger = &sw_trig->trig; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) + spin_lock(&trigger->leddev_list_lock); +#else read_lock(&trigger->leddev_list_lock); +#endif list_for_each(entry, &trigger->led_cdevs) { struct led_classdev *led_cdev; led_cdev = list_entry(entry, struct led_classdev, trig_list); swconfig_trig_led_event(sw_trig, led_cdev); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0) + spin_unlock(&trigger->leddev_list_lock); +#else read_unlock(&trigger->leddev_list_lock); +#endif } static void