Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3710458pxv; Mon, 26 Jul 2021 09:59:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Q4dHeUfpEZn9E6oSsfat/1QRWG34S/EUXNgOo9tqbvB+M9ksyzjGmqpc0VAgxLQ6be91 X-Received: by 2002:a17:907:762d:: with SMTP id jy13mr17675508ejc.211.1627318746884; Mon, 26 Jul 2021 09:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627318746; cv=none; d=google.com; s=arc-20160816; b=rFB4XkoM42vU7PUJW1ZDZOCoj/x6eatzAa7NUlp4UyN2JSljKPRQtc3OXn8I2KblVo NyG7Es0f+cyXzvUerjgtDeqvWR7ALEtQqCWuKC2OyGBwcuqkD64EMSM2ozn7ho1XdhfV 3AxXXnkS8uB25efzyQD8PGrXUZcPOENr0eoMqmMv7zMKTH0FqYPHt7UZnTHTOvEt+IH/ IVyWpasEfkVYXTgh7wx6vARCTO3XOb76HhsNuniCUoxUDqMZoIPe11bUov0m5PmDJwYm J68dGFpnoz2wxb6eA3BM0QPwiKp9QQTBeF5bx7rS3Qu924wPYq8h/oglBxgvOoXbtgQa 02+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yYdsK+PlpnQoxcxZO/IrkHBrQJU3xmzqGd6iHPHikaM=; b=FepO4d7G3ngv8gvnNbc6KtMvQYeES8sFw/Agl/axMgkWddJOTj8WoCMt8a1sbgShqH ssYe77pdsArtyVDf+/Amclgkg0h5CAgmuGX4KkpV7MggxwgkNsucoKWhgpA+CMdBXpsp vz/WBcIEIB/eFKv0aQ+hh3O0uGvr4/PbUQIxrJY8FaNAmdzcP3U9IkJjx/6hf0WQ1wXe S3swyrTwi2PQWe9GEye8WIEBWcRT1QosTFsN8q85lMaSl4w8L8/FPcyqn85KINEWFcdp Hc29MGowjW3cZpyeA86HsGuDj96PopcUoJ3lYe2Ws2e56w/m6jBVXTKzpTR2G4F3zdCc bGbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gqjmQGPn; 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 p18si427011edx.261.2021.07.26.09.58.43; Mon, 26 Jul 2021 09:59:06 -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=gqjmQGPn; 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 S232585AbhGZPdq (ORCPT + 99 others); Mon, 26 Jul 2021 11:33:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236209AbhGZPS5 (ORCPT ); Mon, 26 Jul 2021 11:18:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A557D60F70; Mon, 26 Jul 2021 15:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315163; bh=quEZOqIUPAtFc8NFjSlE/1IWpSUdUQaJ5I2+r4lDNb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqjmQGPnn0ajiLiXezREWlaB9C92piZIpmgJU5SvSb9qplH5xSohqJThRiHPMkOX8 rJ0V8pNM6zyVGNmfbb1bBVe6ktKYiT843t076r2+opqmYshpfokH/ZczUoz8PO+S+C /BMfVe4WlFOKyLVL4tiXrZJZ8wGRVlwmDM3qEjxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sayanta Pattanayak , Andre Przywara , Heiner Kallweit , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 063/108] r8169: Avoid duplicate sysfs entry creation error Date: Mon, 26 Jul 2021 17:39:04 +0200 Message-Id: <20210726153833.711599071@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153831.696295003@linuxfoundation.org> References: <20210726153831.696295003@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sayanta Pattanayak [ Upstream commit e9a72f874d5b95cef0765bafc56005a50f72c5fe ] When registering the MDIO bus for a r8169 device, we use the PCI bus/device specifier as a (seemingly) unique device identifier. However the very same BDF number can be used on another PCI segment, which makes the driver fail probing: [ 27.544136] r8169 0002:07:00.0: enabling device (0000 -> 0003) [ 27.559734] sysfs: cannot create duplicate filename '/class/mdio_bus/r8169-700' .... [ 27.684858] libphy: mii_bus r8169-700 failed to register [ 27.695602] r8169: probe of 0002:07:00.0 failed with error -22 Add the segment number to the device name to make it more unique. This fixes operation on ARM N1SDP boards, with two boards connected together to form an SMP system, and all on-board devices showing up twice, just on different PCI segments. A similar issue would occur on large systems with many PCI slots and multiple RTL8169 NICs. Fixes: f1e911d5d0dfd ("r8169: add basic phylib support") Signed-off-by: Sayanta Pattanayak [Andre: expand commit message, use pci_domain_nr()] Signed-off-by: Andre Przywara Acked-by: Heiner Kallweit Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/realtek/r8169_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 5969f64169e5..fb51548c57e9 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -6850,7 +6850,8 @@ static int r8169_mdio_register(struct rtl8169_private *tp) new_bus->priv = tp; new_bus->parent = &pdev->dev; new_bus->irq[0] = PHY_IGNORE_INTERRUPT; - snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x", pci_dev_id(pdev)); + snprintf(new_bus->id, MII_BUS_ID_SIZE, "r8169-%x-%x", + pci_domain_nr(pdev->bus), pci_dev_id(pdev)); new_bus->read = r8169_mdio_read_reg; new_bus->write = r8169_mdio_write_reg; -- 2.30.2