Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp77945lqp; Thu, 4 Apr 2024 07:32:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtYYHcWV3mdEZfduOh3wvesgaJuLg5hGhIAKReu2b+sO7fA8+3EKv6am294We3payYAMNS5mrW5I6xUrghGODeVKWvM1PrjaHDhbzO7w== X-Google-Smtp-Source: AGHT+IFscrLUMF2+4YwLwD/5FWWUSM1XSNjjngBy6n6SW5GWKgFk3ZaFZkC67Zo4L/9x2PNVyVeM X-Received: by 2002:a17:903:1205:b0:1e2:6165:8088 with SMTP id l5-20020a170903120500b001e261658088mr3152885plh.11.1712241159126; Thu, 04 Apr 2024 07:32:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712241159; cv=pass; d=google.com; s=arc-20160816; b=vHkP/1x5HjUGW53+3aSFe19GF5jscO7nJpPlJ2GgFdNshy+foQ8FeX7yHrtdN30k3Y JRPX213y8rqHmkB4c2kzSb55ppiijL2V5/pUL7cCn+CWYV1DeFoVAWYPwGrLgT4OCwKv D6hg0yjkfHa9cYNUMtF+AN7bFPsiLpPTLg32be6C/B4qcF0iYYXhoMBeYV+sXtwkihSz niHJobRe7rSPvAWCsL1rIK9Iivyu7G4JSL9d9H2Jn2UfJ6HwXMmm08TX1uwvwLD+TVsq Ke8zXiCnrRC2b1LnpGbxcCktdkKA2VJCHa7ET11F3JKfFY7ztIf/5jzSi4wREkuaIjt8 DoQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BDfFkZXbPaRRoHXv5I3wj3Y0/s85fQUp7KkdnH3y+fw=; fh=+FzEg6Ixf6NvmW3gQ1WNaT1tbNpiKN035Vqr3FiMT5A=; b=Kh9L/4zR/0kI6lMBX7txwS7qcdf8mnexF5TssejGpaILnwMbcVIDcjmQlpG7rwgwag L/9tB0OJa505X0dj/96j25vcGhTXsjrEVcXc5o/hTm0O1NJSMCVyMQy9fg8Yvm56Tu/l GfJVa+SjF4kvbPIRSGPVFixR+yCitNfX+QPXfvcrGle2il+5cDnQXyuJr75C9u4K2Zgl MhdFZZzzvQKEDfFN028/kuYIm6lIaBjhdjf5LYVNC5KWmUk3171Myk1wijczNl610lpw 3kkbnhXvBF+DwK6zKZP4cicXtMHXe5qNfP/xwfQE0YYgw87zxECg06gJz1U7su7Wdfpm EkZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=gREY8H90; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-131616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q6-20020a170902a3c600b001debbbba48dsi985837plb.197.2024.04.04.07.32.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 07:32:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=gREY8H90; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-131616-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 A3520284752 for ; Thu, 4 Apr 2024 14:30:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1A6612A170; Thu, 4 Apr 2024 14:29:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="gREY8H90" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 BB412129E7A; Thu, 4 Apr 2024 14:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712240997; cv=none; b=YaY9PpeEAK+fnByZ/aai/Kuj1rmRcqtKtMhJwmxU0itKZuGgskn6BRdxelTm16da5EhIkweRfOJYsW+j7cU5szVVg3Ifjit6E/zw0BwakR8qHlSh/ZB3xipwkLfsqUH3kDM6CO+tx4lau515BM160TpekPjbcIvbjrRLatCQ1KM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712240997; c=relaxed/simple; bh=f831aytugWfSJLv8/vfupSjvp+1G04SDk23IqBQlRGw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oHJst7ypCnfXmqZknCMX2BNOvc0ejOBFMxl61LdM0T9+H/+JSlftZOcz1C9iD29XeMsi16+BBV3bbKIjPMBg8mPPc4TJqyVbx996qh2Unl6fDBwvsBwzI/s8ogny7Cjxo0BH+mht1K/LKi0RwXg6dwmFjNHgBKPttgnuKOJ6zUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=gREY8H90; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=BDfFkZXbPaRRoHXv5I3wj3Y0/s85fQUp7KkdnH3y+fw=; b=gREY8H90oNDzwCqzRhJ8fieRSV yZx+sv696SWIBlbouHkdFUqLZ9RLQXx+zfNSXIn3OZGhy4idEaxbkYHwaAQPG6a+s3nduo3pJJQYN wsvfO2WHjp0OtVsgCYFvLWiiado6GdUR7qm3v1fyTXGetRrQClQWKTu2BT/WNITanrbc=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rsO66-00CBvQ-Qg; Thu, 04 Apr 2024 16:29:46 +0200 Date: Thu, 4 Apr 2024 16:29:46 +0200 From: Andrew Lunn To: Josua Mayer Cc: Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Mor Nagli Subject: Re: [PATCH net-next v2] net: dsa: mv88e6xxx: control mdio bus-id truncation for long paths Message-ID: <1692b2fc-9c62-42ac-a9e8-d843ec932722@lunn.ch> References: <20240404-mv88e6xxx-truncate-busid-v2-1-69683f67008b@solid-run.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240404-mv88e6xxx-truncate-busid-v2-1-69683f67008b@solid-run.com> > + } else if (err >= MII_BUS_ID_SIZE) { > + /* If generated bus id is truncated, names in sysfs > + * may collide. Insert a special numeric suffix to mark > + * truncation and avoid name collisions. > + */ > + err = snprintf(NULL, 0, "...!-%d", trunc); > + if (err < 0) > + return err; It took me a while to figure out what this was doing. Rather than err, maybe add a new variable postfix_len, to give a clue that this is used to determine how long the post fix is, and so how much needs to be truncated from the end of the string to make room for it. Andrew