Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1779281rdb; Tue, 20 Feb 2024 06:54:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEL7lNcvMmvHqCo8DRMmWUiTM9LABkm63bdhXKonnmmZUuCt7Wd2NGYQd6OTzIMXAn3/t5yAkofqtws7SGoPmZp8a7TkQ7Va2fuxsqlQ== X-Google-Smtp-Source: AGHT+IGgDTZI+ctE6Q8W2Eek+2Nj1c1+InrrXKPacYlJz56iOcWsrxNqYq9Do7qZaJ/ukXuA1VHl X-Received: by 2002:a05:6358:7f0d:b0:178:fac8:da7c with SMTP id p13-20020a0563587f0d00b00178fac8da7cmr10309236rwn.21.1708440843682; Tue, 20 Feb 2024 06:54:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708440843; cv=pass; d=google.com; s=arc-20160816; b=iqLi9eTqr3zMI8eTLwoR7IPNY6AOvoO98v4FbcQaofPDSsxe3rALM7lxBqnmWrLYbB hkR03mrzGmFPVygY6j5kPhUF2RpEvDRGvEXzNoHllhwE3YH0jj50QzsBqjsM12UTSAdU 8EisJTue02dZpHnbI/WOqZPtbxklwMx3GUIUB99SPn0rEstea8SUh16YJxHj4nxa9qkZ MiPVceSOirB0ibY68bQVSb33RC1Jnim0s1enxPYJRNhZRidlF8MLbZuKavXZViiakmk6 6SXUA3oH4v/UJeCaQDz8Y7kTG4D19X9Pd+nRulVZ/g4U+S0neQu20SVh9GR33EAliEUj Os/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=xISkpa9Luec/jOP2bZPSmTe0UClACPSRWqJ7CnqNu3A=; fh=sT5ATr5aaP5KE/nUPACoft5w1dczHSrICqxHIrG9Tpg=; b=IxRbD7YDGeZyMw8hhKGzuTK21VhrQP8WalYwHJ3TaR+zwnZwAqyI50NM5qiKEDV5PS uiSCW/fw2GYGGHpqzjFin3xR30gyUYsbx/1cgUSRoqhQXon9dkGZbLq5J4cgQmTBVbsy /+b1vRq5qUvDc1AHrR3xwtw0BIpVG+1loNBpl4I0yMcFKADkpcIyAv1/spxqG5wj7wJs u5HcyAX4PhyeogGSB1dEvUof8MqWqSOADaq80MlR522eNGn5AIj70k6uJhzwxUuMeA2E OnXXtrmEfHY04svB5qOaSey+D62ZrJv8sY1FmliCPbdlnGtp4ehnShdiYa3Tr07xCVQb h/Ng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TPJr3gRv; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-73199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b129-20020a633487000000b005dc7f609bb8si6305852pga.644.2024.02.20.06.54.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 06:54:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TPJr3gRv; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-73199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 02FC3284B1E for ; Tue, 20 Feb 2024 14:54:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A94EE71B57; Tue, 20 Feb 2024 14:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TPJr3gRv" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A7FE6DCE4; Tue, 20 Feb 2024 14:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708440832; cv=none; b=s8WCre957v0/p9WeXoiIB4Ra5TW8CcBVShX+PXLWPvvZNhmdAjcIgZPgVEZ3ViDSZo4c4I9i1+JhtQsU1UF0TscWhY8YNW7OKZitWGFwM3ooDi+z0aUnLN7CKMi8sJxlp+qMrMdog3vmzeCTtG2MxjruhHo9ENO4zdOvQbMgqrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708440832; c=relaxed/simple; bh=itDAo79625wqrXYRJyMiUGlWUNZEtxI7Ja1FRFv4+J8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OPPJgt7QUcW5ZHq8QdKo/UTqjRpY438uQaSm9UckH4FdetFOqvwstcYuFGXZ5zWuFtBhCAykCg7K0Z+NCG0JcwRhPf7UbwPXZGkFqhAjgFmG+VmNHlPGYyzvlcSGNkKhF4jbSrfYwbHINQJqNGbzLpE3bBIlGV2DTqb58bQH6Nc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=TPJr3gRv; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 03AEDE0005; Tue, 20 Feb 2024 14:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708440828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xISkpa9Luec/jOP2bZPSmTe0UClACPSRWqJ7CnqNu3A=; b=TPJr3gRvQ4WVsBd4bTT4RMKt8vRtZRB+PcgJ8krMPE0XC8TgXWchXlmKEsrb/JYIL9KJqI rAuNGDf9z58I3bbYSM4vuv/Ghbas0HxE27JuRClGmZ/nHHuKlhxC/MDa7d73hlW0dOetq1 9DI6zgL67wEg7m61Zfng3KhvMRInBAf6DgLsUoLpQBr11qx4WodgoGxDrd988SpCF5ALQU aW5WF6Cs2MBDImjxj/enwtoHj4fl0Db+am4OcFcPT0KgazB9nOdvt6gRnu5urEWeh4EBSM yAIBcZKIIQYFK4XgP+F0vXXTDQNsmvIROjEqFRHYcNOyoATrHIZZgpsyPOo9zQ== Date: Tue, 20 Feb 2024 15:53:47 +0100 From: Herve Codina To: Bartosz Golaszewski Cc: Linus Walleij , Pavel Machek , Lee Jones , Saravana Kannan , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Luca Ceresoli , Thomas Petazzoni Subject: Re: [PATCH RESEND 0/2] leds: gpio: Add devlink between the leds-gpio device and the gpio used. Message-ID: <20240220155347.693e46e1@bootlin.com> In-Reply-To: References: <20240220133950.138452-1-herve.codina@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com On Tue, 20 Feb 2024 15:19:57 +0100 Bartosz Golaszewski wrote: > On Tue, Feb 20, 2024 at 2:39 PM Herve Codina wrote: > > > > Hi, > > > > Note: Resent this series with Saravana added in Cc. > > > > When a gpio used by the leds-gpio device is removed, the leds-gpio > > device continues to use this gpio. Also, when the gpio is back, the > > leds-gpio still uses the old removed gpio. > > > > A consumer/supplier relationship is missing between the leds-gpio device > > (consumer) and the gpio used (supplier). > > > > This series adds an addionnal devlink between this two device. > > With this link when the gpio is removed, the leds-gpio device is also > > removed. > > > > Best regards, > > Hervé Codina > > > > Herve Codina (2): > > gpiolib: Introduce gpiod_device_add_link() > > leds: gpio: Add devlinks between the gpio consumed and the gpio leds > > device > > > > drivers/gpio/gpiolib.c | 32 ++++++++++++++++++++++++++++++++ > > drivers/leds/leds-gpio.c | 15 +++++++++++++++ > > include/linux/gpio/consumer.h | 5 +++++ > > 3 files changed, 52 insertions(+) > > > > -- > > 2.43.0 > > > > Can you add some more context here in the form of DT snippets that > lead to this being needed? / { leds-dock { compatible = "gpio-leds"; led-5 { label = "dock:alarm:red"; gpios = <&tca6424_dock_2 12 GPIO_ACTIVE_HIGH>; }; led-6 { label = "dock:alarm:yellow"; gpios = <&tca6424_dock_2 13 GPIO_ACTIVE_HIGH>; }; led-7 { label = "dock:alarm:blue"; gpios = <&tca6424_dock_2 14 GPIO_ACTIVE_HIGH>; }; }; ... i2c5 { ... tca6424_dock_2: gpio@23 { compatible = "ti,tca6424"; reg = <0x23>; gpio-controller; #gpio-cells = <2>; interrupt-parent = <&tca6424_dock_1>; interrupts = <23 IRQ_TYPE_EDGE_FALLING>; interrupt-controller; #interrupt-cells = <2>; vcc-supply = <®_dock_ctrl_3v3>; }; tca6424_dock_1: gpio@22 { compatible = "ti,tca6424"; reg = <0x22>; gpio-controller; #gpio-cells = <2>; interrupt-parent = <&gpio4>; interrupts = <1 IRQ_TYPE_EDGE_FALLING>; interrupt-controller; #interrupt-cells = <2>; vcc-supply = <®_dock_ctrl_3v3>; }; }; }; Also, had the exact same issue if I use a SoC gpio chip instead of an i2c gpio expander. Best regards, Hervé