Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753058AbbBRAxI (ORCPT ); Tue, 17 Feb 2015 19:53:08 -0500 Received: from mail-ig0-f169.google.com ([209.85.213.169]:63815 "EHLO mail-ig0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942AbbBRAxG (ORCPT ); Tue, 17 Feb 2015 19:53:06 -0500 MIME-Version: 1.0 In-Reply-To: References: <1423657572-22299-1-git-send-email-ricardo.ribalda@gmail.com> From: Bryan Wu Date: Tue, 17 Feb 2015 16:52:45 -0800 Message-ID: Subject: Re: [PATCH] led/led-class: Handle LEDs with the same name To: Ricardo Ribalda Delgado , Rob Herring Cc: Richard Purdie , Linux LED Subsystem , lkml Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2646 Lines: 92 On Tue, Feb 17, 2015 at 4:32 PM, Ricardo Ribalda Delgado wrote: > Hello Bryan > > On Wed, Feb 18, 2015 at 12:59 AM, Bryan Wu wrote: >> >> DT just describe the hardware, so if it's a different hardware, they >> should have different name. >> red0 for GPIO 0, red1 for GPIO 1 or choose other good name instead of 0 and 1. > > I think I have not managed to explain myself properly. > > We have a host computer. with 2 pcie slots. The host is described with > a DT that looks like: > > &axi1 { > > pci0{ > reg = < 0x20000000 0x10000000 > > } > > pci1{ > reg = < 0x30000000 0x10000000 > > } > } > > The user can connect anything to the pci slots. (pci0 and pci1) > > > Lets say that we have a type of add-on card. Described by this DT > overlay (card.dtb): > I think who write this card.dtb should understand this issue. And choose the right name. > &pci { > > gpio_0: gpio_0 { What happen if you just use name 'gpio: gpio {' here.? Any conflicts or kernel oops? > #gpio-cells = <2>; > compatible = "xlnx,xps-gpio-1.00.a"; > reg = < 0x30040000 010000 >; > }; > > > /*Leds*/ > leds { > reg = < 0x30040000 010000 >; > compatible = "gpio-leds"; > red { > gpios = <&gpio_0 0 0>; > linux,default-trigger = "drop-qt5023_video0"; > }; > } > > } > > The user connects two of those cards to the system (at locations pci0 and pci1). > > Then we have TWO gpios chip. Each of them have a led named red. When > the second gpio-led is probed we have an error. Everything else > (address offset, phandle, device renaming) is handled properly already > by the kernel. > > On this system I cannot control card.dtb, or which type of cards will > the user connect to the system. The DT is generated in run-time based > on the hardware connected to the pci slots. > So you're supposed to get 2 card.dtb files for 2 PCI cards, right? They should be different and you need to choose different name for the hardware. > I humbly believe that the issue here is that the subsystem does not > protect ourselves against name collisions, because a month ago a > device tree was considered immutable and in full control of the system > designer, unfortunately this is not the case anymore. > >From device tree point of view, I believe different device should got different name although they can match to same compatible string. Let me invite DT folks for help. Thanks, -Bryan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/