Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3368887pxb; Mon, 4 Oct 2021 00:20:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj0WM+dj+zwJaBvALyCD+vYtU3mrP3EK0IvBALPqtmZ8sxfiqBnaP0y7AG4aJXLN3gaaHX X-Received: by 2002:a50:bb09:: with SMTP id y9mr16112811ede.89.1633332023579; Mon, 04 Oct 2021 00:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633332023; cv=none; d=google.com; s=arc-20160816; b=OHZlYP7Yu4X0+kJCmvzzNqVF/++D6TW8fdQlUXCWGiJlJJ7iKc7XFgiFomzQ+pQYsQ hOlsvMQZ5OszM+S0Jo9bQnvnThpDVCA74wTKLRp226eTVP/kuhvGT4mkr+0oF9WVoUO4 Y8zg8NRkhAkWD/8J+K5XZ4VGLO2xmJfx3ZgeLiDqpTg9Jn9dx7bvuGLL60u9fm7q71oj h159ykKmDZX50vybqsYKUzI9TIx2YgXSE/gfNtgatLW9ab9/Lcb3IgOq/hmVFJX6jOY8 0E8XGt7DFIrTi3geSRXOBT5BHqKIuaAFg3k+sgvA4Mm2qAfa6N8fZiWgBAHEpNAErW3T PxsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bsCd3YoMJ22GypsUIL/LBF9OkDaemjVN85j79qSotFk=; b=aMBNz34cng/LSgcnf0WynVD6uC555kH9664JCWcX/9mcgDitgqfYa8Y/ZP2pw/jpAS v3d7bu3BhP03F5nGmUydcIK1QdwHDbet1iJDBStzlzMK/XH745Hr8U4GfNgOoSFdtdsq 70caMefyd42W4h8iosl18gNYnDHriNLUlDyQMeh6oJl9nRG5uIFU6ncbNyVFzX4nOuA0 K3tov+QtXcro6y0ZD0AgHDrCwcHQxCJrCXlbevzLwtokQRrl/rSwv+ysp3mpSo9EK6uQ BVtjSZT9M4RKrO5rKZS3nqe2rvnczYQFzbI0vOnZV+XYTbcp8aK7yPdQ4MyrT0ZSe6QZ ceXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gsfN3cob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si16825260ejc.100.2021.10.04.00.19.57; Mon, 04 Oct 2021 00:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gsfN3cob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbhJDHM1 (ORCPT + 99 others); Mon, 4 Oct 2021 03:12:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbhJDHM1 (ORCPT ); Mon, 4 Oct 2021 03:12:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B6126124D; Mon, 4 Oct 2021 07:10:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633331438; bh=wxQMgh47EITAIUhAsP0hL+YuY3VdMgjXAZPx4dZXs/A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gsfN3cobrt55Lq7+W4abDXGNrYMXTDWaW97vyAt0bwKFTpi1MbVGD8rK5tLcR5P5t p3MUlmtdldOGo37jvwx/46u6VqXgnHhtygxp6DEu4qWn+/VE/i0NBMp5kAuPmtTkHt psdFPQMjGfSvZf8WjJPFS+PEQ+3TQg8StP9BGqSg= Date: Mon, 4 Oct 2021 09:10:35 +0200 From: Greg Kroah-Hartman To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Andrew Lunn , Pavel Machek , "linux-leds@vger.kernel.org" , netdev@vger.kernel.org, Jacek Anaszewski , linux-kernel@vger.kernel.org Subject: Re: are device names part of sysfs ABI? (was Re: devicename part of LEDs under ethernet MAC / PHY) Message-ID: References: <20211001133057.5287f150@thinkpad> <20211001144053.3952474a@thinkpad> <20211003225338.76092ec3@thinkpad> <20211004090438.588a8a89@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211004090438.588a8a89@thinkpad> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 04, 2021 at 09:04:38AM +0200, Marek Beh?n wrote: > Hi Greg, > > On Mon, 4 Oct 2021 08:37:37 +0200 > Greg Kroah-Hartman wrote: > > > On Sun, Oct 03, 2021 at 10:53:38PM +0200, Marek Beh?n wrote: > > > Hello Greg, > > > > > > could you give your opinion on this discussion? > > > > What discussion? Top posting ruins that :( > > Sorry, the discussion is here > https://lore.kernel.org/linux-leds/20211001144053.3952474a@thinkpad/T/ > But the basic question is below, so you don't need to read the > discussion. > > > > Are device names (as returned by dev_name() function) also part of > > > sysfs ABI? Should these names be stable across reboots / kernel > > > upgrades? > > > > Stable in what exact way? > > Example: > - Board has an ethernet PHYs that is described in DT, and therefore > has stable sysfs path (derived from DT path), something like > /sys/devices/.../mdio_bus/f1072004.mdio-mii/f1072004.mdio-mii:01 None of the numbers there are "stable", right? > - The PHY has a subnode describing a LED. > The LED subsystem has a different naming scheme (it uses DT node name > as a last resort). When everything is okay, the dev_name() of the LED > will be something like > ethphy42:green:link Wonderful, but the "42" means nothing. > - Now suppose that the PHY driver is unloaded and loaded again. The PHY > sysfs path is unchanged, but the LED will now be named > ethphy43:green:link > > Is this OK? Yup! The "link" should point to the device it is associated with, right? You need to have some way to refer to the device. > > Numbering of devices (where a dynamic value is part of a name, like the > > "42" in "usb42"), is never guaranteed to be stable, but the non-number > > part of the name (like "usb" is in "usb42") is stable, as that is what > > you have properly documented in the Documentation/ABI/ files defining > > the bus and class devices, right? > > It does make sense for removable devices like USB. What I am asking > is whether it is also OK for devices that have stable DT nodes. Any device can be "removed" from the system and added back thanks to the joy of the driver model :) Also, what prevents your DT from renumbering things in an update to it in the future? The kernel doesn't care, and userspace should be able to handle it. Again, any numbering scheme is NEVER stable, just because it feels like it is at the moment for your device, you should NEVER rely on that, but instead rely on the attributes of the device to determine what it is and where it is in the device hierarchy (serial number, position location, partition name, etc.) in order to know what it associated with. And again, this is 1/2 of the whole reason _why_ we created the unified driver model in the kernel. Don't try to go back to the nightmare that we had in the 2.4 and earlier kernel days please. thanks, greg k-h