From patchwork Thu Jan 4 14:00:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511142 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2054.outbound.protection.outlook.com [40.107.249.54]) (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 4FF2422337 for ; Thu, 4 Jan 2024 14:01:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="d9fUdd5L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E4YPXx21DBe4oYyA2WJfOIjGxLYXTDTQppBtVP1UwYtz/kSv9Es3bQsnju4/MZSV+naufy3WLklTkRDNL7rvq+XKi2UztaHyKlA3+4J6St7Gv5zeLFUqDyfIgYzB3wnxEChX+4OlNhUp3U3gB5VTk0UXxAEssA3u8bCVqyfQs05pChPlnAadXXxEu/SE0ic3ScRDYKDYVH3CajAx+bZIooIocN/STkm3HaAXe0vZhlPXFE2iBEvD8XEMH5uCPVTU+czYny24dUO0ZuVOxF9cCQ/sMWBxGYXIR5F4+GSuZwm9jRGVRk1ehuYs7Z6fLHI2a2XTiIg736bRuXp+/8xKCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JRvQQ2Oj4QkBeNR0CqdDSxBz4d9S77nXgw34Uk41Sv0=; b=G+2nhP/nY9iNaxSTWvr1uOfc9sK49IIzIyTAjo2PohWwJtQc3VHcepQzW1ph6th1aZXEpnZ4YXksBNCIRUHzBfdcrFd1/iYpWk9XfX7trpFCab49sgTLspbfWE5KCvzOHuVNQj41IwERoLE+aNB/0ZgbsqazX0r4Gz6Vv5a9DQl9KJZ/lJjX8ACLu9PLcmWRdjEWr854MuG6932aiHg/VlGn8rDLL1j6o5UNhfjx643sVjrwUcItwg7rPKevjSoqbYxddJNFeo+ljoHK4ukJFXACx4OHw+WeoStHx8sZPQKHC1GUwseDnRBbTpa1LU0er7TEQfDyvXTO/CeXTlX1WQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JRvQQ2Oj4QkBeNR0CqdDSxBz4d9S77nXgw34Uk41Sv0=; b=d9fUdd5LJI6eIyn+HbpAZW2mwpZXwscLCTZrWeelW12JVcUn7VzYYH2ufmZIskJhNftFxLf7IHABZz71a9aveeGYDUbumvE4EnYop1qMPBI36dDhFbtFPZTZbkpVZK25EVeJ5U6ZTejoKzhLomVZmPsD/5tcVQYav+egnAgKP7o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:15 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:15 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 01/10] net: dsa: lantiq_gswip: delete irrelevant use of ds->phys_mii_mask Date: Thu, 4 Jan 2024 16:00:28 +0200 Message-Id: <20240104140037.374166-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: d8565ea7-7e9c-48e5-4008-08dc0d2d9d00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ifwsMAnLHfAZtRCaYqjH8u0i410Osno5sepGCOjx89HVaAkB8tDV/qGq4+w6Q9X8+QXhc032TMRDPcaDJwYdxWhliLUswbmw5ilVMGRAIRYSb6AYNSbHo/+LP8nHk5BSOh9kGMXvu1EoEvL7rN23gvROqwLyp34fGduvTK79eSkufLgBHOKqto2fmnw8cTz+bYWB4q29ruIzBvQdufySG0puHeeuU3UPvjRxjVuv3zIgApEKimzZj6I/iMBFnPEgzq9jE/hkJSbn3KDg33EyIOlZwK8+qHRfFwUsjw4LVHafYsmKW4HXik/NO0tewURk5Y1N++iyZiLU8doDgyLwOj4WjQS+SyQHxv4akKtZhMmobyy/Ab9+4mNrmyV3qVRAmNWrHM2/61HoL9M4dzrxLeHv40ZXAJTdLU82l4SPcYcv57CqVTHd5Z4ignCxwaxXWIIYt/bvvNQpaKaXDt0XQI/P7iRtEPt+2BuVUXPT8dyD8AJ/qaJIjoXOuZqcwntQ+6BkBBJzSdu8IovUopOPubCWwfImhBtTLksDkdWU+RIbbf9Mz+pTC+RcO/qlRB5vat1ahPsYifM+2qgB/sTajnUesfFkRpM3OFfQB96DGwLwYQZ3OArf6uHTldcg/HGm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(4744005)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y00J8Hr+WzKV+rVHFF9kZ0dkhnXzSKUCglZOJXE1aFsu4qyD49Bdu9xDghrRsTJHnUy4MyZWKSPy4DhG0CBLj+tB8BJNherH7iqimyRglwrAIE0JOlgJFKo7Z1gYuQSsEWjr5aXJY/jB04czceJ6j7F/lvb6742++bUzZOA670SL6p+MRgiYie4bVsnaetm+yXZggmPmHrZ9K+tHAb6+zbrRNrdl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NvIyFU+BD9z1k9cke4TD+rf9q4jOr234RQNyDP/DnLx7vPpuVw8G6+rE+yHm1J/Gj4nBEuU3O2Zo2sZZ/ka+bh/6NDfOlrdpdyuYHA9lgtU6sQozKOJ1QNFz6Pc46Yjwzt5aypjez3QAMFFnfTT6qAhyfUMQgJCOxYj9hzUU4F4EYdk7OfgCDq1gBKEtmW7OxXASMw33ZYx1WRjrWBArLDVxFx98FDexEYLKTMi2BY5sIltcjITGyUOtC+JCMclPzBx0dftsbexiHFmUeZgc710VQKMEQYMzIWiR5xlvOl+dHW+OrUQJYswpHrvCvsTDBYXJ6tFVWYnNkLDk2iQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8565ea7-7e9c-48e5-4008-08dc0d2d9d00 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:14.0532 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tg3LiPNaHQypAS8EUUP4AdU8SrvmTeISodCaRcYk27M0Q4+mAyiLaZKDts/0iLn+kMYUAFlgwL+zWBgc08OjhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org __of_mdiobus_register(), called right next, overwrites the phy_mask we just configured on the bus, so this is redundant and confusing. Delete it. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli --- drivers/net/dsa/lantiq_gswip.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 05a017c9ef3d..3494ad854cf6 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -521,7 +521,6 @@ static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) snprintf(ds->user_mii_bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(priv->dev)); ds->user_mii_bus->parent = priv->dev; - ds->user_mii_bus->phy_mask = ~ds->phys_mii_mask; err = of_mdiobus_register(ds->user_mii_bus, mdio_np); if (err) From patchwork Thu Jan 4 14:00:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511145 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2042.outbound.protection.outlook.com [40.107.249.42]) (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 4F0D2224E9 for ; Thu, 4 Jan 2024 14:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kKInA4t+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K98VYJ642ZMG2Q+97NcAlzF/Hjs2pB4GbsyHSvAP7ojfX2Wa0gqKt0Avw0yenIWLUxGfG6uj+XyWiwEwms3E2vtuJouQFVpVhbzeZSGFSKWpHWSI563DgeAvNEiHtSRQJRJe6yjJPUVt/chzxhz1RLi/r/Az5GG/N6r45NvLg/PXMoqhN2GnYCnfVVg9DtmD0IhPGPa97M0ZXRkKxTg75dMsXUXrGrxtPitqrQq1coVBCV6r/5lEyGFx4QOZcmzZfQkLNqv8PrBp86wejTunouHGAs/bKeE2SOKg9ykmBFtZuh9ALJbnQ4/1t7bePVNURe+ZBCP3CZAhBRI8+P/Q3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ypm72puS72N6spNMbnAW0xBkNWgd8GMWGxVy4Lpnp+4=; b=ddwA5E8TzHwURslzoTAXOBT/qxGHXy/yarV04SosP0r4deadFG+ojN/nBm0qYhi0tQKZ8TrrqRc2Wjz+3kOn7TbXP7dS0MzqH4laRwzQ97c6GzITOGxvruSdpg1GOnNuOzabNmeKXElrAItGpaBUcmHwXF4W5veAN2vf+6KxRduh+G+5x2q+fptZOMOQFvO7YdMa9yN+/wlfM96HZL6M4Xs7WF8sZ1VJb9xmlbXVFNY8Pd3JOuUVHe+9RjqMZl6jO7vAAA9Z0Z6OYExGajWJWZu4R76NN9+JVFj+dXO5Ck5IUD52AudcqLTkbk/Aco7c9ZKKKcVPzTQ0FFR38DvmeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ypm72puS72N6spNMbnAW0xBkNWgd8GMWGxVy4Lpnp+4=; b=kKInA4t+AeY0Pecrd2RElyalPwjv3LkdVIEjJiBtXt0xl8m4S4OFGhfpH5WXzHQvvLMGPOfw5gtBLeMR6bwVFj8biopFxphq6u1xbNxvFpj8JEuPXzB3lBX4AlQayctS5GXbbUnR9Uv5sS8B2X1PjuvfzdUsyqbXIjkKCY6UHrI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:16 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:15 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 02/10] net: dsa: lantiq_gswip: use devres for internal MDIO bus, not ds->user_mii_bus Date: Thu, 4 Jan 2024 16:00:29 +0200 Message-Id: <20240104140037.374166-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: a499dfeb-9310-4510-da7d-08dc0d2d9d79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pRjGeb3tfPbnBTvQ+A5P48V9O88sFEq+/DbPs4GeeA33wBwFCEo7BOmMUm/6DYvqR3Uni9svSy0khlRdO0mxdQrNZS+V7v1GsZG/lE/eMgD1an471RoZSd514I/oU0EVFrHhykmg+1eEwlvUJHZ3atdlsEsUjbJQKA3Q6Uj2QFjMK7mgrFwLiAVeRk3lZ0vjZnXiNIHgKgcC4u0s4u9eEiaHf+d+gWuUBD+6AiJYjb03Yyk5e7j96CvFt2+dvWEfAxjagGC9II43u8Iip2FyUM1P0UTgptxnzwvWnDgWNVZZlsu9wfSkbmSnuBdyZwOZetfh0NWi8+gaq7+9ThSFcPRxmkUCVGTCr59oWtE4cBmSJ721sSGTfXyM7GCIP8pt49CY5EOkyMbr/sUT9zFCg7S2EiIVn+TsViqekKrlzlkPo6rRXSIpNVJzNRxmEVs+5mjce3MRW2jyB2U/BKHhFkPuRNiVHBeo4fYA5kw1TugeRh/oSoWO7NWxh//ND5DdToJD7oBj2CzoNNA+Hnz+P3cuDRCIEyT0o3jV9jUWjXm3KXZXCQs6NbQEDPQNgOTqIryYUsEsst9U5hQQuhRlPTn6G/iUauEW5eISn+e23cI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(966005)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-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4YJQColrtThwKBUzWsHgMhTe+HF0FX6Qdf9kKf82jELUpk/rLHfmFEHeMbvzK+rKvSa9sUYgqpOANNL+e8DA+Xj2MrzxX72iqULez4G6Og1L/1RJyRO0PhRHurzCYv9NanG3b5VuQ3T/qtptKaruIvdRNlFeRIzG7v/1E1vzdLL10VMcEQSYRSRjkilhwD4dKVZN/ut/iQMbusbllce+iezyGfWOZgquBdbcCEu2nwmJW45+UVCzu2gJnFVlaKBbfVOm3M4wowkwwLNy/0/m30x9mXxMEsPhmo6emPhN8sFuQJvJjdQsaX78XlpVHTfyeKMC7pdHBaqFDfA/VIHZoz0HxCcBxrFi5KIV3z+LtrxozBUhfRoqqXMxcRpLG45PRhCQ27bCC1OmNBLkYKzxAIWSANtY2utc6GnCXUE+Q8ro1iFeq8UGr0UmCapA6Gvl9hUlziI5Fwwi5R7SjO42DaCmZGgHQbZQ59lf3dwXME29pDBiE5hwK98FpfAGVuQA8zBETdQDsj43n3liwyG/RzcO26j/RmzxRr9P/Apk5HoEv9Vy909nMKT6EstkteYJMOfjZs5E5sA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a499dfeb-9310-4510-da7d-08dc0d2d9d79 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:14.8103 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AqaW2ae0T/D4J8MlLVHpsI96xQZ6cQidahakgntTxrAMLHPyTj3mtAYDxdqmJiW+1eathoxr851+4XU6fejjyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org This driver does not need any of the functionalities that make ds->user_mii_bus special. Those use cases are listed here: https://lore.kernel.org/netdev/20231221174746.hylsmr3f7g5byrsi@skbuf/ It just makes use of ds->user_mii_bus only as storage for its own MDIO bus, which otherwise has no connection to the framework. This is because: - the gswip driver only probes on OF: it fails if of_device_get_match_data() returns NULL - when the child OF node of the MDIO bus is absent, no MDIO bus is registered at all, not even by the DSA framework. In order for that to have happened, the gswip driver would have needed to provide ->phy_read() and ->phy_write() in struct dsa_switch_ops, which it does not. We can break the connection between the gswip driver and the DSA framework and still preserve the same functionality. Since commit 3b73a7b8ec38 ("net: mdio_bus: add refcounting for fwnodes to mdiobus"), MDIO buses take ownership of the OF node handled to them, and release it on their own. The gswip driver no longer needs to do this. Combine that with devres, and we no longer need to keep track of anything for teardown purposes. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Reviewed-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/lantiq_gswip.c | 69 +++++++++++++++------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 3494ad854cf6..a514e6c78c38 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -505,26 +505,34 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr, int reg) return gswip_mdio_r(priv, GSWIP_MDIO_READ); } -static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) +static int gswip_mdio(struct gswip_priv *priv) { - struct dsa_switch *ds = priv->ds; + struct device_node *mdio_np, *switch_np = priv->dev->of_node; + struct device *dev = priv->dev; + struct mii_bus *bus; int err; - ds->user_mii_bus = mdiobus_alloc(); - if (!ds->user_mii_bus) - return -ENOMEM; + mdio_np = of_get_compatible_child(switch_np, "lantiq,xrx200-mdio"); + if (!mdio_np) + return 0; - ds->user_mii_bus->priv = priv; - ds->user_mii_bus->read = gswip_mdio_rd; - ds->user_mii_bus->write = gswip_mdio_wr; - ds->user_mii_bus->name = "lantiq,xrx200-mdio"; - snprintf(ds->user_mii_bus->id, MII_BUS_ID_SIZE, "%s-mii", - dev_name(priv->dev)); - ds->user_mii_bus->parent = priv->dev; + bus = devm_mdiobus_alloc(dev); + if (!bus) { + err = -ENOMEM; + goto out_put_node; + } - err = of_mdiobus_register(ds->user_mii_bus, mdio_np); - if (err) - mdiobus_free(ds->user_mii_bus); + bus->priv = priv; + bus->read = gswip_mdio_rd; + bus->write = gswip_mdio_wr; + bus->name = "lantiq,xrx200-mdio"; + snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(priv->dev)); + bus->parent = priv->dev; + + err = devm_of_mdiobus_register(dev, bus, mdio_np); + +out_put_node: + of_node_put(mdio_np); return err; } @@ -2093,9 +2101,9 @@ static int gswip_gphy_fw_list(struct gswip_priv *priv, static int gswip_probe(struct platform_device *pdev) { - struct gswip_priv *priv; - struct device_node *np, *mdio_np, *gphy_fw_np; + struct device_node *np, *gphy_fw_np; struct device *dev = &pdev->dev; + struct gswip_priv *priv; int err; int i; u32 version; @@ -2162,19 +2170,16 @@ static int gswip_probe(struct platform_device *pdev) } /* bring up the mdio bus */ - mdio_np = of_get_compatible_child(dev->of_node, "lantiq,xrx200-mdio"); - if (mdio_np) { - err = gswip_mdio(priv, mdio_np); - if (err) { - dev_err(dev, "mdio probe failed\n"); - goto put_mdio_node; - } + err = gswip_mdio(priv); + if (err) { + dev_err(dev, "mdio probe failed\n"); + goto gphy_fw_remove; } err = dsa_register_switch(priv->ds); if (err) { dev_err(dev, "dsa switch register failed: %i\n", err); - goto mdio_bus; + goto gphy_fw_remove; } if (!dsa_is_cpu_port(priv->ds, priv->hw_info->cpu_port)) { dev_err(dev, "wrong CPU port defined, HW only supports port: %i", @@ -2193,13 +2198,7 @@ static int gswip_probe(struct platform_device *pdev) disable_switch: gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); dsa_unregister_switch(priv->ds); -mdio_bus: - if (mdio_np) { - mdiobus_unregister(priv->ds->user_mii_bus); - mdiobus_free(priv->ds->user_mii_bus); - } -put_mdio_node: - of_node_put(mdio_np); +gphy_fw_remove: for (i = 0; i < priv->num_gphy_fw; i++) gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]); return err; @@ -2218,12 +2217,6 @@ static void gswip_remove(struct platform_device *pdev) dsa_unregister_switch(priv->ds); - if (priv->ds->user_mii_bus) { - mdiobus_unregister(priv->ds->user_mii_bus); - of_node_put(priv->ds->user_mii_bus->dev.of_node); - mdiobus_free(priv->ds->user_mii_bus); - } - for (i = 0; i < priv->num_gphy_fw; i++) gswip_gphy_fw_remove(priv, &priv->gphy_fw[i]); } From patchwork Thu Jan 4 14:00:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511144 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2054.outbound.protection.outlook.com [40.107.249.54]) (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 771A8224DD for ; Thu, 4 Jan 2024 14:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="jdMcgn8Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OV8KwNB+FVQN1G4UnwDlDYxZc8MlhWfEjY//7o5w/5aqI41Yaiur+BHf16rZjH05OEh40jpKi8HQgLB706lwDtEtFiYrRwGYMceee/sX5avL4vCOXvr48EZCMVimH+brrVJ8kWtWmcBuOdS+UnDF9omtifQgBp3zAXss4EpiGizAw/nwBUrg4p2WYxTKzEus8TExsoFIqSvs2l7TEIwYfabgJ/ZiK9A7IkblJ4kOQ6kmfQU03fu8XiEP3NDkILgh/+AlZa8ctHPLDB9gDIdg1O1a+712ZNqu5aBPzoX7Pmeqvarkddf4jQB9/tIQR+hopcbmHqsNpWtL66Me35/Nog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sd5dCSsY2lxoWH8zAZsSKuKMTTUgYCtJh0AAJS7CHzA=; b=OYKfg+3L7Afhih4yJASlTAJFi2/D7bYqLErPrK7NN0dEIxEUpruB+VA+Yt9CtpR5uF+Ua3DJ8ILn3P2rJy+aPqSBmArTP6PdIjQ8eKHc1zjwymKLqeELfFKS56oPGif/efZjubBgwbGduuQDY7G01YjP8XRSSUmk9kupUqdDZbOc4ygPcnkKsn3Z8kmSenZrAp3AyhpPlJXIs5NjxAJQEnaWtEhbhimJ9cdMlkrt1x8cZcMYv9Te0lskpIX5nHhu62E1wrkm1nQGtDbOn82tsFjRl3UVSbod4aPRw0UyQK6wj8cah9ybopWRuzNu0INBSukBprEMADBW+vFq/KcPTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sd5dCSsY2lxoWH8zAZsSKuKMTTUgYCtJh0AAJS7CHzA=; b=jdMcgn8QV9XdZpE64i1t3QnjKN9gnWKbUsKPwktsbAV9JLr+UcPhiwJ5a7F6ZT8aOFsq4SyhSp1dTXGUajkXyA7JZYhwyIYBqTaAHCViiHmE9a3zVCXG5rzGPi2iYf/UlI8srSWqDp3Dpa/V6RX5awBo5o8MwYGonx3XU0RoVT4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:16 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:16 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 03/10] net: dsa: lantiq_gswip: ignore MDIO buses disabled in OF Date: Thu, 4 Jan 2024 16:00:30 +0200 Message-Id: <20240104140037.374166-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: 48c85fd4-4eb5-4100-afd8-08dc0d2d9dee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DXqDpVL83mZ+BKbNvjDhDVUdY4IQom/LM7Mhaz59hmNT4Bx1+7UbuStbDwV/dQv31tnxFcgxhUInQ3GZQW8qNpV16KmXQuMp0+Zt20WBxO2P24qhCojE112D96HCLQlC66Th49A2kK2fOybnQr6hJ6L+m1O/aUb6hudZIiv68wRhd+W2xIQLJew8bm9LFcjxAAzzevM26dKZoGbSn7tVLArmTlRf1e/kXtMDdWLUN8mo5z4C0He4EBQrwHvTLcVGExXUu1MOoxySdyarxJIvmwpIMxVnL48x1Ap+9FiJHZkKjKwhxap0myxRsghsDMCZWCtyn7k9wLFbZizhtS/Mgf10OId41kaQ1JC/l+DEii/5aPpQw/pAX/qKrO/o7fAIVAM2BlymVsoTXKFE0fmyuHsBhxnpHzOnCnrPdh78MrDVbi4O2+OzcLWUYJurkpVSLoT/we3BvcwdlxUwrvreIrxP/UIaquvic3HbnDFYZj2+FJX/2y/Jqe7BlV4jgQdHPKcfx4dxGdZP3plC1mZAu/1G34t9T5YCQO1MaS/mGV0qByOYDZzD47fyBVP6DrULDOW6sxMNE9jKYkUMvup+LJ0YZ4BWsQf4l+vB64DthOHsIbTYHGReKB88S18AD2yz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WnlFjnexvcGsDgoWc74EO1+OKqZn1ztmoLsgv3EbygpvW8jj6m3H3j93A1vAsK15tszsQzfIJHyzybjuwbfI1nfcGQkF5HXJ942F4EeGR5JaA8Z0UfT4Y4eJ9gk6Xsd0NuXUCRrpG+noqrcW2inNfaKT5Ys7j+Qz/s8dd+QvlvBKg5zywLViseZ2XFELYgERn7X9dr0xt5LIp6Ck3nskkC8oA+5OH5cxXQ/tdVu6wG/m5fOLX5TV1FutUWNZ2DBZgqs1OD7aWs+ftQUwqU4EqWux92bvcHRvkMgCw6VglkRAceTOm9BhV0lZCCCP49EBGOVkaj1tPIHk7H/FGl9LNzBB1MIK4dr5HUYxkS5k82QFAFZLgt/xaXeT2C7i5UfcxVXV3pjzaal/DkgT9EnoKsSN9XJNyPJllfgwWCBOtDiTt2vgsHqFovvKjgeJq2ZG4RMXQ3fRU8c0sjdhTZJv9rWQQLmRPmXwPd6cdb/InQ7ycFp4Som1oHxvoOagO1vy76F2F8uMX9fqxCPMqSc8QkXgUrB7XEU4AyJOIOxQrJBzdKbXGacuirB+7dexJAmSxmdS0EOY9s/EW1EvX0FGzsV79Gazc4EiOMtpkYsIDxkVHlGSZDT8YINaKhx+ArovvCnoFrhVtAE5rWH3K+3HZ9PM4m3YSOS9RY6Fco8srin23YUbosH3jUdlheP6q6FTrBHkjX14xJCq14CKL0jtJ3RQblFqxch/d2w4Fs4St7TpC0akjAftO+z9jYOTU979vb1rQnOkk0oZ9kRxio6dQZX6fLPw/InyebBH8Pd4urQIu1n7vqN9VWNlW7lwME9nz/n+QIbLzQ0Mq5IJcNHlSKtTlHAXi8k7UzeNmAQJ/Icvm9f3YjMqBjsVrkyLSijQEMNW3vPEEcNHz6pqGBkSfa/4K09fTLbsoiMXwx50iDdCzvyaK80bohMus/T5dOH5B5bjBVBc9ZKd9yk78XYnLgrxIE6Vr9w/uPOw5kOIZOU0VxfcS6DWit87cSmAoSBrE3bPXfF+T0k3eqzxfLowUlNBGoB4jJ7CXZCdw/knOGgswwIOpORBYfaM+w9a/oW2UNL2K7l9TqucQtwrV4okiVcU4lEtsUstiWC8ROccDtlAx506weX85yPY+6kEC6hG1drXqTJWhx+lwubVrnZlU+HkpIbkT3dHPLQhKsHtTyy3Qk0YBH0o4RsLHmlyb77vnRvbimSapwnLk4xGRXP7Kx3e7b01OiEcxWWUI0prNobK+7HYCv6v7Dk+ey8b61v6V11FdaOWNSzmg3GcWL4Jl+ZRBsd8gHT7WGlRh9Vz5y9HdlYMH9KRU39blmOfE9V5KUzS7tKfFcLyugNG0my+8NnH481x3t4Or23tmS1V7VEa11R3qt+xWndMNPgcw32d+8qDyxsOHEiPHcUSJQ9m6t1e4TOLz2R3in4H90WyN7Z3lcWw+pUHAn5/qhH5KzDVzlAjab/oYBJ/gk5KI+Wx9tltvWg7cGE+Y+SSKQZUUza87/hrAnnzB41dmyD7BLcgVPqekdimWbY2I2xxHmntbuFsF2YxdXKpct/eDZrHP0GIoVqwtWwLYZBbfUVHiaYxWf6kKwSDFe5C3lZrwOO4wQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48c85fd4-4eb5-4100-afd8-08dc0d2d9dee X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:15.5777 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GOkHVZ1YhE9/aJLMtDXznhsTdNBdW4+4iRPzesNrh8v656Tj88Q/dlT2TUAROQAyiuelrBlkAY6m1pLB4n2YMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org If the "lantiq,xrx200-mdio" child has status = "disabled", the MDIO bus creation should be avoided. Use of_device_is_available() to check for that, and take advantage of 2 facts: - of_device_is_available(NULL) returns false - of_node_put(NULL) is a no-op Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli --- drivers/net/dsa/lantiq_gswip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index a514e6c78c38..de48b194048f 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -510,11 +510,11 @@ static int gswip_mdio(struct gswip_priv *priv) struct device_node *mdio_np, *switch_np = priv->dev->of_node; struct device *dev = priv->dev; struct mii_bus *bus; - int err; + int err = 0; mdio_np = of_get_compatible_child(switch_np, "lantiq,xrx200-mdio"); - if (!mdio_np) - return 0; + if (!of_device_is_available(mdio_np)) + goto out_put_node; bus = devm_mdiobus_alloc(dev); if (!bus) { From patchwork Thu Jan 4 14:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511147 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2054.outbound.protection.outlook.com [40.107.249.54]) (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 64017224FC for ; Thu, 4 Jan 2024 14:01:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="JD2PxS3I" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnZHsv4a4E0MCbqxL09+8PJRNI8lZ4EUm/rjt/+ujzYOgTgNrhBeOHiY8zKTWBkzaPImhKbzv1+beRaC7nMgcFKiUxcNere9SoS8D3a9qqN93HxZpMeRL/J4OgSOOEOai2SPyKe0TWdCwdGXmaqa4/XwuGz2FxVkCfPA3QQXyl8kP3JNt1jMYazrmek4W4U2ex1ivUckLykgHKGhN34RcaNBC48HF/ARQcRjLrpf45OJMIT3BdwEm5KfXHJLyJ2yx61IH51JHwHTGujOrRlrL0wdIjyouj04VhLLYEoGio1lXvMYC7InYGN3W64e73W3obDogcQaofixxnvudiqFcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qGx6fn/0A6YOv5ng/hkM9VfdKqmtgJMqN6zcwvWmpiU=; b=CYpvWOcvWUYpeUE1wD0McIyN0zsptFCeLWzUTKcwAUwqw/nwzpbh5NlLIww8LUW7jL/54/TiD8VZ1ML/0ywgka7MRMSSMWyTuOqDbePCI0k03oV9oqId85VMl0feTdwPklsVLChYEU+0FfQcHGIWVklHalVoSLimAUS3j7hc6SqAJ6rz1GWfVMMXJ3NNMHFpopIZ8AnSLsNzQXVmthbhkC5mWNsu1SoIk7pNxOVvj+LUA3lR6AwAKAgDXXelq37sAgyQ7vwyfB//IpMBUvwHCBGEs6oHzBcvl46BWHvhYv14dwYop/CmbHbnTwgFlY8nfv6ZqKnIlVT8b5n3RYKwBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qGx6fn/0A6YOv5ng/hkM9VfdKqmtgJMqN6zcwvWmpiU=; b=JD2PxS3IZLu2EkZVh3mZ0Fx27X2tzc+D4JMWI37O++s8R2+A1abEeFoRJISudiLuv0wjxLaWGtgxvfzwjnlwmplYKv3QA5JCWkOPLzWSx2Byp5ZNn1btAMoSpVAu73yte2yvPbQwZkU12HSmhIAaAAjhMJC8tB138Fzz3tNprOw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:16 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:16 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 04/10] net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure Date: Thu, 4 Jan 2024 16:00:31 +0200 Message-Id: <20240104140037.374166-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: aa60a95c-78c9-465a-c0c6-08dc0d2d9e5e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gqU8n/oTmwoY1QmLfFja8kH43BD3pJpWe7Gywe9ycou0GM0hizMsTr9RU8j3CAk1gwifH9c5X44pSZW1hul4vQPb0U+lV8ifZ/LhF0m3u6VRtDGBziaKPBQK8XvXnHXaPA69mrN9QYE0F3x0xb/qeU/T2qpw4/gwgiq81ikZhljiIVXSkCh/f9uGMSup6/6frp8BQa0Gz0Bk6U5dW8BTeiGqdetrMHRSdfbdza+nuYmnZWhc+4kclc39H4cLtexZtncB6HuwC5QEYHnaDODtKHXRHsDP4ppUYOSEHEnDB1mT3iam8Zw82Y+HXOyWv3PDkhpFgcW8jDG2aRRkgGh8bXe6UAos8lfGFcQ1U7GQi1isaRxG0c9biHIN//g4pWaEMA9f0KYzUvuS1rx/S3asYQ/FqoxkuXEnz3QRns2WhdgEp63I+K4cHpCMnR+qoJ+UCckR17hCHDCgWExFryhhPGibBNZzZw9w9EBJIN2KloCRaat5vj1WpP2hGefHBQNSEIRNULcF4fhTee541DuZBkm7KLXvxMYnd392AqNvaUSOZrcPl+cYu+onNWy58AYR5SPilDY8ZKCpsC77GKHUkHOOtFBGIFp01H2naoQfGOFy8rjzDVK/zmFjujIRH3iV1TXbYqc5ySJhIGTEQ+pnSQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z4NwbrEaaNAFfQ6GqFn4eG5rAIhFEcAaT/c3KMhSfoVpUuZ4Dhw5rSKgOvWoJnnQ0DN8kTk1QzrsWF79Vha5sIYXE/lL6anmkzGwN5WJ4XjqPZBJLcFz//pf9F/Hx500ZVV4cy+CvobxvX5S9btV2Jnt3inYKaonjGhiFb/mxMFsZEXZE3MdIcCoylZhsvbihlk5IUDGZAeGusGhi/lda7UmHlDMI8pv7etmsx4lKaOXZgJET2lpgLxu8B3ZwI0ORLRbLyAwykWBGW+k9SgggWdXU0mDKc8rjTfq39uYbCO017UpsUZauMbtrebEIRnH065CpdTPX0ffq2IxO2Js7r8HKpTQnM8HWiTV0ihMtWptbDGOrtjH6zzoDx+XQu3/qNlwOQVw5wGExBE+C5DLNl7mgr2rBrGT107ZtVTtdrP3CtNAirLN44AMat5BHdMHpkaiZlANOo3Rw58ukvi3anTj8P3ccCzyVc6g7qx6qxmyfNvPYi3mBnju6qymzIuKoF7PxZkvQYM3+AMSmg4Uhx33FqrzdCPe/d/CzvAqS5mmIAJmkt3C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-Network-Message-Id: aa60a95c-78c9-465a-c0c6-08dc0d2d9e5e X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:16.4549 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /XxOGPP6F9rUrQ0iGpxIskNWy60vGy5XewFkCj0cQvUvbfaXOEQujd25ICMI6wf6JHudrWH4FZlFuns8C4cdbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org of_get_child_by_name() gives us an OF node with an elevated refcount, which should be dropped when we're done with it. This is so that, if (of_node_check_flag(node, OF_DYNAMIC)) is true, the node's memory can eventually be freed. There are 2 distinct paths to be considered in qca8k_mdio_register(): - devm_of_mdiobus_register() succeeds: since commit 3b73a7b8ec38 ("net: mdio_bus: add refcounting for fwnodes to mdiobus"), the MDIO core treats this well. - devm_of_mdiobus_register() or anything up to that point fails: it is the duty of the qca8k driver to release the OF node. This change addresses the second case by making sure that the OF node reference is not leaked. The "mdio" node may be NULL, but of_node_put(NULL) is safe. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli --- drivers/net/dsa/qca/qca8k-8xxx.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index ec57d9d52072..5f47a290bd6e 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -949,10 +949,15 @@ qca8k_mdio_register(struct qca8k_priv *priv) struct dsa_switch *ds = priv->ds; struct device_node *mdio; struct mii_bus *bus; + int err; + + mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); bus = devm_mdiobus_alloc(ds->dev); - if (!bus) - return -ENOMEM; + if (!bus) { + err = -ENOMEM; + goto out_put_node; + } bus->priv = (void *)priv; snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", @@ -962,12 +967,12 @@ qca8k_mdio_register(struct qca8k_priv *priv) ds->user_mii_bus = bus; /* Check if the devicetree declare the port:phy mapping */ - mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); if (of_device_is_available(mdio)) { bus->name = "qca8k user mii"; bus->read = qca8k_internal_mdio_read; bus->write = qca8k_internal_mdio_write; - return devm_of_mdiobus_register(priv->dev, bus, mdio); + err = devm_of_mdiobus_register(priv->dev, bus, mdio); + goto out_put_node; } /* If a mapping can't be found the legacy mapping is used, @@ -976,7 +981,13 @@ qca8k_mdio_register(struct qca8k_priv *priv) bus->name = "qca8k-legacy user mii"; bus->read = qca8k_legacy_mdio_read; bus->write = qca8k_legacy_mdio_write; - return devm_mdiobus_register(priv->dev, bus); + + err = devm_mdiobus_register(priv->dev, bus); + +out_put_node: + of_node_put(mdio); + + return err; } static int From patchwork Thu Jan 4 14:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511148 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2042.outbound.protection.outlook.com [40.107.249.42]) (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 A738C2232E for ; Thu, 4 Jan 2024 14:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="RFSYr2hP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJslLxxPRqFsCZuDKxr1hZ8kCxd/tf8bLb959ANTf66hRdaT2miShKFAtgES8XmxDy0xqfnWciRfq8XLxU5v1toOu+tsdLa+Pgz+S0PJtFN3KvBaf4zN53qEnvvunfXLtN8baakh6w4iskPrV4MwtdiXO32dPPoVAggFNz+lkqooh2DoWfU68ELGKtSxYD4PF+8saZbiuBzDf/KUDD6cDVBmdtM8TS383U8mJ3b+N5iNXK7S3Ewkp/u5yRKjfbYLYQSRH8c9OZccTXUTG3w0D2VyRs8Na1FcoWrayfmUvfQ2dAarpYP6g+rKoCcQON2waCoyYl+8vk99rmX2J5vM9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9mxt9j3PpfXE9XA9fMVohhl2144RJTCkgGVJJkRRClg=; b=DG/HqpiXgIKFJMo9YPJeEzivfzTZSW6+VNS/ydHmmHnBSTl3Ngf8PXYJWZ9Lnc1tjr+ljYDhbgFT0xjkobXvw+jXbqx1Zdm0KXp5MH1rVrAMWJpJqTkRcPd0hiTikEGNvUC4Pn0Y0uK6dploBQ5iTZ978z4ebNJc1ghEsKudWEml8LWNkf7IaneA2pNJSbSpVpTekohsqMtmcU+hjghP+hO8+4KbcaeQHZW2EsdfhZaan8SIpAXVZzqf4j+uu6++UCJsC60QbKbpxIDXjZirESVrD/2IAz8c2kErL1f684iYoBSQLnQkxZZhSK8dYMobaacZsX/bTE7GurEp32d1pQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9mxt9j3PpfXE9XA9fMVohhl2144RJTCkgGVJJkRRClg=; b=RFSYr2hPVqVpytl/ERN/HmYcl3zSe0kdTL1qPK9zfstto1W6jsGizNLUvPFlKh0JI41/leM2L8gvKKhflU6bG5e5GB8jchGFjX9UbvEapKR19IPAvTcNmWH1kNPSaYHanaA5C1X8v3h5dBmOiHR+OZVbPPnGevgu5+g2yYDu1EA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:17 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:17 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 05/10] net: dsa: qca8k: skip MDIO bus creation if its OF node has status = "disabled" Date: Thu, 4 Jan 2024 16:00:32 +0200 Message-Id: <20240104140037.374166-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: 6944ada6-7e35-4575-6e29-08dc0d2d9eeb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4SjleXU5DA2xxb9ubLoJujKqDD//FbFzqBoXd6TLzYJ60znniFBDpwPBRlFamC5ahygz9+AlVegp1BRYCP7SjqkEXOE1lpBvLLBZsjnmAvi9ydIBkL6TNs4cb5VRrwPvNY+ovaYtZ+yWCZjBkWPwxzj0Xef1ErfVCHa9pSd761poB7DlbB4FFZXg56phpw4dKveoMq3CwCRVTrJR3Dhm6A6wXwNFLwoVRvFwIJ4iTffgCjJLX7S+6AOTx6P8Xo5nv8bgqgTH4BTrzbn2c6/wvZ+cxvG4StvInm4Ac6GPWrqoJzsq8KmyWaZhu6Am+f+uQFX43PjT02mfOOk8OmAp77Laso5lU5VzZpnfd4yR6eY1cOahwt1UWOlLJy/HEHKP2Erut4ov0dfKEi/Q7d2tMWX18OxY1IE/c8Md8vDhE/leWlXvMTMImwqCJqfcSi3+yuMJHiTsezJ7PcgfaPkdq+GRzrp0ZuLGW41jKmtrg9EHK/Wm4ptZDFXWLLggay6nX9Yd0f+rDTYdS8oL/l+kE4xEp8dVzYq6HXXIeqbtJBkt3bjkMPplg32yXhYaGjO9RQ6OM1tgD4CaMhymCEjPlJCjMICgxPeKJLM6JAKxTPKV1kZm7G5hIVZXChsv+IdBalu3hfcTUmnmc8TTFqCnZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mKf/1+HJwEInUIZ5HJ6rU6B6FP+jbpz18uPFCZBiKkDtq6XIvm2AxIXb/9e54ukpuMxKMnFVXsNYOu0Hwd/6kOfIB1+2lGwFB38mK39nbLdzK7sdlK9LaWN1dmbSSqQZWK3muYweZczGJ1kaRsbY4JA0nCJOwjMsW8W2Q1l3suKep8H5+NahcV66JfoUdGt7334PLFX1cOBF7n9R1jT2IE1NuwNzmzd7ZlCqfwFy+3WAj4tYW8L/NhH3LMO+S25dmVCFS0W5f7VRATl0IzeaufG7pvjQyotPHLDlTtuq0Hy/S2YbUASnjvCe9Xxfjnzrz150dksJnQXZHxYyMZ/mUNHXSARb4ahl0VqVvp/V0CiENA3vD1vlyIncD8TmEVYuuUyXy0zAVnJqQzzZ6SvfaAF3JchPwrG3m4iXZiIlorkn+3phaMONPigNGrughNOuQzVh+I23wEVs5SzRJwgD5PRxMU+5zzLlY0nlSEyv0sE0xGTyNCrDfTyOIoeylyIvLGNh23OFJa6r+EQnlB8UEH0Ms2lzcntmlfxfEo18921vpM+ON4740Ec5EioYDGZhoizCFtrRWDiMaUjkWt8Z5u4BfznDuoIJl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2d9eeb X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:17.2058 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s8fKm+SI7A9wVBggJgtmbDddRkI58/2qEyGtQALZJnp1lhqNWJj6zUjQVsDp9W+ZZndwMi3yuozN2GqXjciXHQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org Currently the driver calls the non-OF devm_mdiobus_register() rather than devm_of_mdiobus_register() for this case, but it seems to rather be a confusing coincidence, and not a real use case that needs to be supported. If the device tree says status = "disabled" for the MDIO bus, we shouldn't need an MDIO bus at all. Instead, just exit as early as possible and do not call any MDIO API. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli --- drivers/net/dsa/qca/qca8k-8xxx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 5f47a290bd6e..21e36bc3c015 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -949,9 +949,11 @@ qca8k_mdio_register(struct qca8k_priv *priv) struct dsa_switch *ds = priv->ds; struct device_node *mdio; struct mii_bus *bus; - int err; + int err = 0; mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + if (mdio && !of_device_is_available(mdio)) + goto out; bus = devm_mdiobus_alloc(ds->dev); if (!bus) { @@ -967,7 +969,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) ds->user_mii_bus = bus; /* Check if the devicetree declare the port:phy mapping */ - if (of_device_is_available(mdio)) { + if (mdio) { bus->name = "qca8k user mii"; bus->read = qca8k_internal_mdio_read; bus->write = qca8k_internal_mdio_write; @@ -986,7 +988,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) out_put_node: of_node_put(mdio); - +out: return err; } From patchwork Thu Jan 4 14:00:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511150 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2054.outbound.protection.outlook.com [40.107.249.54]) (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 6559122EE2 for ; Thu, 4 Jan 2024 14:01:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="aLI1ZOLD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dd2+o7KmXhQ0uZPKrJUBTChLICVFv/kKD2t6zrYuFbsG2tQ/MFomJllk0GvY2oOnL3VEKWVM+iSi9+jE3nSmrjQweOSJf9vqpWU074WsOENPVOF3fsV3iB5gdEadNyIqqBfHlFGgcgtLAXIFNbyW1B7dsYud6Kso3wLiza4Okgo90d9owpcMsTZ/BID0+zShONmriHV1L/YuORWvd1f9XKXjQRRtMZOjZWp9QHDaXG0Ypope0xJhBo9XWVopFfF7CJ4+4F+s49AcijybBFknjbcnVV/cKddKYksefvF1ogl/4j0kmLMAKNWSy+wS2SEtRK/LOCW2SfDIhEFlzAkHtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+7FGLUqTvq3wN+++jNFoghG6w8rdFLx9O77G4azmj70=; b=T9euQquCqRxkv1ZASA0L3gnxkVQSIiA0hbUqz3wTY8tTMkutL5lP1DmGo/Re4bhEMyI24CfzRRhjCTll6cZdeaXw/J29sHO2w7TugwT2jU1sKp8zqb0GaL8CKN/tOTGII7Cbyhm/xJzJo4jLrA2ON4zga/NnvZhVqvxYpTon4U8Jm+QmL4oiru4L2zxJjYFRXpSN3iWKO3I9dlIIAoa3WG+bUTvEcgEcnk6+Mj0B0LtiLM0omOOqzX6kzPx0jPnKVddo/p389lRpMcHU2flOicwYc7PpzU9KU2wpaRsvducoRwhi3AM3uC3f2f/JyMLmXtw/373sN1o+oqC089aUxQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+7FGLUqTvq3wN+++jNFoghG6w8rdFLx9O77G4azmj70=; b=aLI1ZOLD/EGl8MMRTqxj3Aax2R42fq3M9zBMsh4l/G8lIuT/2pTJwEIF698b2duKr9+0iZ7htPnQ/7ZidSU3QiA4oUgcGHQdaAIc6T+fzFMxBE9NnZvsNQXMk9eacg9QMxx/iP9ou/rbCq/zX6MZGO+yd4du1ESZihzl2yHY2kA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by PAXPR04MB8176.eurprd04.prod.outlook.com (2603:10a6:102:1c9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14; Thu, 4 Jan 2024 14:01:18 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:18 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 06/10] net: dsa: qca8k: assign ds->user_mii_bus only for the non-OF case Date: Thu, 4 Jan 2024 16:00:33 +0200 Message-Id: <20240104140037.374166-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|PAXPR04MB8176:EE_ X-MS-Office365-Filtering-Correlation-Id: 19941aa2-b488-40c2-43cf-08dc0d2d9f60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ju/3tlxdnq8vTaiu9tmBJsUBAz7P4DXS0dcLCJBUPcqCsovcsmwUux3b33FlVG9OYbMP5BOqLnYHUfcJJq5j5wPkf89D826Tw/E0kx5SAd5a+5hNWNv6Kx+vk/Mqzw5oUWsp1RTdhRo0itGsweyy75kE2hPuMvabKFV+0Fhc5t90bLDTYEmp4GPyBbGA6mfH3J5MdqBcN5uPcULaRTa6gOig40ol1XXfQ/B/56/BOu52X2yPH9Kv3SGwSsio4tNDoK1giSXIsOfdAKNib4s/JEdEs83Q7A5lLqb1esu5oSFXd7/eRGK0biLPgzW4FUgUSFe1H28wFT4wr6WSY1fQNfwG/Mr16tyani/oNSyBwT5xopMo2NnoRL4fkDn6koImD9FIl2lN0fM4l19usshzH+mi1liSkK5/fe+M4/sIeahzBwgvlKUU5XRV++2fsQNNxaX2VOLoAvH+f59b/i34f+EhrInYaG1ATo/Qdy4P3Rg867wZyHB92Oi4USolbWdJ4q8k1cfhS1xrvrsPWLHGcZJvWIjkbm5WkIZjFyXlzXIlQ2/ky+bvUNEIG/YXjksi10D/wQHV7AYuLTltBn1fYVHsqSYM5Wrs2bP3BrR4FD8wuW6HmXMjFysuJWsvJpTijKho4+F+SKsePaGwO3mU7A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(346002)(376002)(366004)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(7416002)(41300700001)(26005)(2616005)(83380400001)(38100700002)(1076003)(8936002)(8676002)(54906003)(316002)(4326008)(6916009)(2906002)(5660300002)(44832011)(6666004)(66476007)(6506007)(6512007)(52116002)(66946007)(478600001)(66556008)(6486002)(86362001)(38350700005)(36756003)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Bnsd7klnhZS9yl8OcnmwJbW+6qyYTW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KZpbuomMByf0FoKMNaPV2js9SGOb/e7/M8PyxPG4VBWXVd6b9i3zgedi2h+U0bz5V4pC5O0HWUIdjbQQqkBQn5cq/ivx1//pe3TnHORC/RnWlZ62uOQ+eRqw0JvousX36nf/buqNCvrjwK4PON+ZzjYoawov/Jj+ZwfeSwGlFPOcnULZLN4xIyK3zV3fSj7Hq8uXk+bav0CcseMxNfVEhm79uxW5+8VC2cLTVQIW+gmBoo220OOdGhDOwcAFRqunBdHuELBrqGazln6Kr1cLRoHMuWbVsHUr7KbJeYUXqt+FAC5uZF9313C7Lf+Xpl2o1Kz2LQwY5uLMdOIozIOeAKNMMaqp4UTmqEzU2Gd6D9bNtVHCs2t6C1f304pQgnaFaUhIllmHL0B+3tWtpJ+Rr1qc0evwXYcRyBApiOt/tkXMT3T17J78njV4oOB8TG6YfgGzj2XkhbMAe+vNIIDQfVFWXRzK3YKvfgRrJuhW+4q9VWtl9Sq97+CxUQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19941aa2-b488-40c2-43cf-08dc0d2d9f60 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:18.0051 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ozvv/tx4t9+fv3aJgeAl5/G+NS4deipy+QIJUCwnUzG8SQWlUg2oE4oLKTu52LQTwoQJ0ookKMDp3G7Nm/YV8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8176 X-Patchwork-Delegate: kuba@kernel.org To simplify reasoning about why the DSA framework provides the ds->user_mii_bus functionality, drivers should only use it if they need to. The qca8k driver appears to also use it simply as storage for a pointer, which is not a good enough reason to make the core much more difficult to follow. ds->user_mii_bus is useful for only 2 cases: 1. The driver probes on platform_data (no OF) 2. The driver probes on OF, but there is no OF node for the MDIO bus. It is unclear if case (1) is supported with qca8k. It might not be: the driver might crash when of_device_get_match_data() returns NULL and then it dereferences priv->info without NULL checking. Anyway, let us limit the ds->user_mii_bus usage only to the above cases, and not assign it when an OF node is present. The bus->phy_mask assignment follows along with the movement, because __of_mdiobus_register() overwrites this bus field anyway. The value set by the driver only matters for the non-OF code path. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Reviewed-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/qca/qca8k-8xxx.c | 5 +++-- drivers/net/dsa/qca/qca8k-leds.c | 4 ++-- drivers/net/dsa/qca/qca8k.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 21e36bc3c015..8f69b95c894d 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -961,12 +961,11 @@ qca8k_mdio_register(struct qca8k_priv *priv) goto out_put_node; } + priv->internal_mdio_bus = bus; bus->priv = (void *)priv; snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", ds->dst->index, ds->index); bus->parent = ds->dev; - bus->phy_mask = ~ds->phys_mii_mask; - ds->user_mii_bus = bus; /* Check if the devicetree declare the port:phy mapping */ if (mdio) { @@ -980,6 +979,8 @@ qca8k_mdio_register(struct qca8k_priv *priv) /* If a mapping can't be found the legacy mapping is used, * using the qca8k_port_to_phy function */ + ds->user_mii_bus = bus; + bus->phy_mask = ~ds->phys_mii_mask; bus->name = "qca8k-legacy user mii"; bus->read = qca8k_legacy_mdio_read; bus->write = qca8k_legacy_mdio_write; diff --git a/drivers/net/dsa/qca/qca8k-leds.c b/drivers/net/dsa/qca/qca8k-leds.c index 90e30c2909e4..811ebeeff4ed 100644 --- a/drivers/net/dsa/qca/qca8k-leds.c +++ b/drivers/net/dsa/qca/qca8k-leds.c @@ -366,7 +366,6 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p { struct fwnode_handle *led = NULL, *leds = NULL; struct led_init_data init_data = { }; - struct dsa_switch *ds = priv->ds; enum led_default_state state; struct qca8k_led *port_led; int led_num, led_index; @@ -429,7 +428,8 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p init_data.default_label = ":port"; init_data.fwnode = led; init_data.devname_mandatory = true; - init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d", ds->user_mii_bus->id, + init_data.devicename = kasprintf(GFP_KERNEL, "%s:0%d", + priv->internal_mdio_bus->id, port_num); if (!init_data.devicename) return -ENOMEM; diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h index 2ac7e88f8da5..c8785c36c54e 100644 --- a/drivers/net/dsa/qca/qca8k.h +++ b/drivers/net/dsa/qca/qca8k.h @@ -454,6 +454,7 @@ struct qca8k_priv { struct qca8k_ports_config ports_config; struct regmap *regmap; struct mii_bus *bus; + struct mii_bus *internal_mdio_bus; struct dsa_switch *ds; struct mutex reg_mutex; struct device *dev; From patchwork Thu Jan 4 14:00:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511143 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2050.outbound.protection.outlook.com [40.107.8.50]) (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 DD6AC224C2 for ; Thu, 4 Jan 2024 14:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mx82tINq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vf9tpoyGWNZzjPUMjaWoNA8RX1Qc0eACPW2e/j6x8L+LrjWjqFZkaiuH80lHDmWaFvd22j+8E9LkAfGF4sNhQBz519lzZBvDVqZWu6MHIPagIf+4xDXbEJYUJNtAy75MmEXVA7TJNNLhmKS3kWxBpeJKCYAYN1BZca6FAyTElKOBJUXFh7WFJb/VUhPiCeHhNo65nm7vc5KLMs/avebj9yS11ivGTBONWD0UpfMuYHDeakNN3xqTs3If11gfLqhIn0xVT+74kvowRF83IsD2z2IX6WO48zASTGKxRhEjmHhEIQ4t7QxoEtvjBIBgwi3Pyjf7NtpPOatcen5MqGi28A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OjnYumGemBtjBaHxobK1gNXHwnIIHINEFoaLE5aCFlE=; b=kFgEtk3Yt3RfAE2n+Fw2FmEq0ZfCLszqtRTC9IXh0lHZ3i4X2AWrBOXRL3mCVcztYSzSHoe52Dhr3OIwCXfvFr6o1onYCjvruStBGZJqJpRq3xYYLaLKZRlbSDqXEMrq3JDr1Npu9T8DRghIoM5mtMHSSIiWDSg73Y7tlnXKY/HcaYJEKNU6vRXx6gxAgYyYAMj+G3F6MIcVz6snxSaBy7ff1EqpEOxML1Odl+K28G7WwTxSNQL47Hev+5AmeL0LcCB474Zylv6yn875hRvvFk+Oy4/Q867LLn4KCSuiaOgJfs6ETs98kPcSbP1eK+NC6gEDHexrzVhhsgJCJAkXHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OjnYumGemBtjBaHxobK1gNXHwnIIHINEFoaLE5aCFlE=; b=mx82tINqrtpBPOR17lxso9TU7mt0oHxv7RTDoeD9YJBUkIKk1/h3k64BnuymVLw7ogX1ZjXm5CDxQhyvwHtnIMEv0M72rJJzrcdNaTkhZD1Kjxy57VasDt8rMX53Me1Fk7QBoHbaWFA/TnZtQ8skDbb6CzHstuUf9ORVqYTaS6c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by AS8PR04MB8579.eurprd04.prod.outlook.com (2603:10a6:20b:426::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 14:01:18 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:18 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 07/10] net: dsa: qca8k: consolidate calls to a single devm_of_mdiobus_register() Date: Thu, 4 Jan 2024 16:00:34 +0200 Message-Id: <20240104140037.374166-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|AS8PR04MB8579:EE_ X-MS-Office365-Filtering-Correlation-Id: 48549e59-8f89-424e-7b9c-08dc0d2d9fd7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v1XmX8WgPqfTGBzm89zcgzuBG0atIsmatdCyjWpnOK0DfJ2d63BvrBK/ouodLn094/LCprAcux+eB6+PzXqmMjKQvebfIIIzeIim75xDE5DjpDenVc2gS5VPC9MvuWEjBQXh2SsHuHcLyI9G79e/FKi5+WakskY1JKrNz5i8YNSn8YhWovX/AM8bl0O4VprC8igl0jakZ5dOwwJyCsTz5g774FkFst2VUfWLrEETLjovCJy/A/PHULrK1HyjHQ4q7/lfXg162GoesJYmVKbeJ/KNjHExDKmr6TWOEBSAWwHOI3vvPZI0uAG4qh6r51uThXd4aeGkKkcK5efGH+MvUOxnuqtjhQwg03cOP22N1AK7WcH4Xy+KInwRunGRgAI6DzqcX0/aGGNkk0L4nTJmrAZmr9mbZ1m2b/MIjLMquwtfBKgd88D5oJFZywwc5BZo8eLHRgGwZbGju6yo3ukHLg0MgGPEAHLykgzln2Cf45pVqV7ZQ7a9ZVjREnDinWGNIfAnXQmsnxzm7d1f8878MoffJfOPTFd2SOfUZd9R3PAVwvAWsJvPmHLxvdNQFOsajRFSOuFXJhB4F/wfeUEQc/TUqO8lBmiMaemabuqW8ote6m6Z/DvK/ndIBtkzUDBSlnbJEQUDUyHLIPQuzWKc9g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(346002)(39860400002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(6666004)(52116002)(26005)(1076003)(2616005)(478600001)(6506007)(6486002)(6512007)(83380400001)(41300700001)(7416002)(2906002)(66476007)(66556008)(66946007)(6916009)(316002)(54906003)(4326008)(44832011)(8676002)(8936002)(5660300002)(86362001)(38100700002)(36756003)(38350700005)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HB10nBEg81nFjw4u1he1Eh9nkvGkLzNB85PSpydHGqeWpl34eup4yDDzpVLKiRZFQ4qRASCwF+uxK7GH4cjzNk96OMAroc5tSIsUItqIAp6VL2jDOoC/iRSeuhmmBvYeT+pwiLPk1yLgrjBgbUF8j4xCwqLbydg+ckuVTK6A8YrZz4IDN5GGt8hZRy9++LZVmd1q5YfFCSbsStclLdvIelqdOVbEkC3PLjWyU+8ML+Pj2htTTxwhLTSBzx0UXLYrPc5rdHRitJFgY5XBSFn8pKwP7reiycWQoBrW9ZNxte0BS/CHb5IUWIm3p5ds/tnAovGpDeN1zrTOBwGZy5VH2Io5gKob29meD+Nuz61Oi0oCJes7ZXvDej1N7BdxC7dowgUE7nscRq58POadHxL+c6Ifp94l+/i1Fl0T9bitHpt46flPl1zjykFxBdQorTATrA9V+AZo9iKoKX8CHzk2OqipVOorKLyJsEXDXeLuosbHYCd1Fw9/1Yxb/1Md+8WDz9zZeGOvndff3YUnIL9Mv/TgX1epPzeuYFcjJmq1JjbRjP4Wp19bSKijANhwNakxpgC1Gph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ossTenant-Network-Message-Id: 48549e59-8f89-424e-7b9c-08dc0d2d9fd7 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:18.7912 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ve6ERlq2q5rolXuzzj4KlJBGMX9yOnTdpfhdCmayaHhzk6yEqWyQIISKVdpFjJE80o7sn4AE2rrWtrSrhFmUWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8579 X-Patchwork-Delegate: kuba@kernel.org __of_mdiobus_register() already calls __mdiobus_register() if the OF node provided as argument is NULL. We can take advantage of that and simplify the 2 code path, calling devm_of_mdiobus_register() only once for both cases. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Reviewed-by: Christian Marangi Reviewed-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/qca/qca8k-8xxx.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 8f69b95c894d..f12bdb30796f 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -967,25 +967,23 @@ qca8k_mdio_register(struct qca8k_priv *priv) ds->dst->index, ds->index); bus->parent = ds->dev; - /* Check if the devicetree declare the port:phy mapping */ if (mdio) { + /* Check if the device tree declares the port:phy mapping */ bus->name = "qca8k user mii"; bus->read = qca8k_internal_mdio_read; bus->write = qca8k_internal_mdio_write; - err = devm_of_mdiobus_register(priv->dev, bus, mdio); - goto out_put_node; + } else { + /* If a mapping can't be found, the legacy mapping is used, + * using qca8k_port_to_phy() + */ + ds->user_mii_bus = bus; + bus->phy_mask = ~ds->phys_mii_mask; + bus->name = "qca8k-legacy user mii"; + bus->read = qca8k_legacy_mdio_read; + bus->write = qca8k_legacy_mdio_write; } - /* If a mapping can't be found the legacy mapping is used, - * using the qca8k_port_to_phy function - */ - ds->user_mii_bus = bus; - bus->phy_mask = ~ds->phys_mii_mask; - bus->name = "qca8k-legacy user mii"; - bus->read = qca8k_legacy_mdio_read; - bus->write = qca8k_legacy_mdio_write; - - err = devm_mdiobus_register(priv->dev, bus); + err = devm_of_mdiobus_register(priv->dev, bus, mdio); out_put_node: of_node_put(mdio); From patchwork Thu Jan 4 14:00:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511146 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2050.outbound.protection.outlook.com [40.107.8.50]) (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 EEC08224EF for ; Thu, 4 Jan 2024 14:01:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="GdIQj3c3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FQpZwTK6IYElWf+L2n32K+f7vd72asr2sV4hEoeCHm3fONwjXj5z7KHSoukFIpk2+oibwLY1GhP6bDsSXSRF54Y1V6WOncOa8NCWhZnJpSGBu+XjQm9bRk4Wxrka9Q4+GVrKJgXHaI2KIZRUTP6ZrfAUbwce/MaFb1pNJyzBWNO3QJZIzxjirdAkJz1Vps7SQ3/ujqHhE4xaLfc/x8sN+bW5pYZeRdDGCP7hFu0DZXqAXZvYXyIkjc+REJU0ld6EP+DD/M6OKqIfd1oFcOBnmJ1QdTYBVVm+Gv8znRP3zAVo6uxjMB0ez9022/3go8N94D2HSh0o2zKN0DxRhZOTCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E21JpZq8u+HeuqNAzmt0s9z5fkAV6yBPpvD0VoJPRK4=; b=KKSaWsam9Vqug+fgBpw9i3mT1eQ79V/JHkeNnN07vnYRqd7BsgVlnxLLzSDhhKWyc82z4mpBXK3nJD/hoHOSr2UtYKNcE1oKyC+eMcMnIR5UXTRiHtp9mfNpkwL4n98Eka+kSfQJCaDWozqee4pvcdXWeSiGfevu3otT/fn+R7TcLctlHePKVzfMIHc5AHWMfFgSQ+Y+J/9ygZWvNbI0IIC3MoOaY84qW3datM8a1dMF6D7OCMxvk7YeMNFFZLBKHqD7gefbxbJ2oFVtv9JH7UUnaLfYebJiu5M45sZsBKvExFcWUrXsw0j2TeA9cDGQaGMcfdJrLHx00FdWLBKYdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E21JpZq8u+HeuqNAzmt0s9z5fkAV6yBPpvD0VoJPRK4=; b=GdIQj3c3rVkVqtOhBexAkp9jNk/aJ7bAugtmjm2+xUGizyrYo+l7rq+9RMhlootq9UqqFbChD/YBAEYQywgWrdt0WZ8+9iiSb44Wip8AsABYjO4K4XindGF38VSsLAR89LsJC8/qECSOy9bNEI+KsdVjADIf+/5ViPnniCdH/2Q= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by AS8PR04MB8579.eurprd04.prod.outlook.com (2603:10a6:20b:426::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 14:01:19 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:19 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 08/10] net: dsa: qca8k: use "dev" consistently within qca8k_mdio_register() Date: Thu, 4 Jan 2024 16:00:35 +0200 Message-Id: <20240104140037.374166-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|AS8PR04MB8579:EE_ X-MS-Office365-Filtering-Correlation-Id: e63039d0-1c4c-4afd-15c7-08dc0d2da051 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: keVsx82efty3F0LZRJsnTVGpwd7F+QKgKpwkVa2U5MRGJqhvRf02Gf9lKx/5sexwZkFScVilamT/qWfLpGZqalkWPpWZ2T6DwdT4nvBKX1A0yOIlCIaw99kg+5xqzP/nbNJCwH7dGZ4HUJ5ZTl1PQiw1YbLCtA2NHQ3A5kHuV9iigBhTQxmb2dVEWmAgxbCyeCwMQn0HRXtNhlkGCW7BfeDmpkWPW2qBXdLFR/TNhVhNl3SlGtRjLqMWi+Epi9zW9QJGw9zaq0kSGDeW42b+LcRTEdlrB5iz8YVryXops4a+MrC1TlkBib2OhL79h+AIbdowOamiyY3lDeWme62oRIRatZvo7ZalVgdlddjaD0BG+b0kRQp8/UE4B8jfUWhUPnk9GKuHo7S+MJiFHD6y2wjcGU70jtCVHiLSfvzfuTMv5plny+vXSlxNXGW9gKhYTSjW7q6qMrP1dYxLZBihslCl5Z9INVbY6Xr1p9g/1/4UuhaAbg6CcXZznWOK+MGiFy2Yi/LOEIz37iP4xT1lqKPm7CjvYqb3XS6TAffWmjYR9TnA17xt8qvSEzIkcT6ZPSpXMULXmB8d3ae4lPdm727kJFc2pXipLmwGWVtKdw73ha85Dob64YyvtvsnpaRw7vcqoRG3QTjC4YKIwtoDuw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(346002)(39860400002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(6666004)(52116002)(26005)(1076003)(2616005)(478600001)(6506007)(6486002)(6512007)(83380400001)(41300700001)(7416002)(2906002)(66476007)(66556008)(66946007)(6916009)(316002)(54906003)(4326008)(44832011)(8676002)(8936002)(5660300002)(86362001)(38100700002)(36756003)(38350700005)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4joVPpNu7ClutSZQeo4EGmwBp1KcMPesLbm49lInNdYD3/8YvXzJDS/J0OCpOxQjtjbexMKlEi+tAKuvfyjR9x8QGLVwTY6K/RVBSIUUr7N/nOyYijCMh29ddfqnWRckgMXjbjvtKSu0RwqdhhmGrGnW0DP8FpGvANeRapmqhGmxrBhBqU9fGFZYLvFS+Iqh049aBeUq6qux/vRBv2f/Lm91juOYY3Dy1NL6bMxiTAE0brvi1YAzU/gw7rysI3VqtDn7xTmNLVNl00TGFzHNgMJkcakAw+sIS4hbATSw+DegXdgV1frfa36smBxqHG24nC3ro2mfUOlfbp63Nbeg1PX5zkFo2/XF/qX04rl+/FRd5phRLEuSMA2i51iW/L5Bm8ZOgnCgjNT6D7/OvYQl8rM6LT8hhMNIvH84sUzSRH7guzM9PdTNTtIAio+87qZKXWTr6QKM1w0CSAW+voLna4dyYvKeggY3GsQTC4N69AIN9gp9fYvvLvNdNcyU2eIIMak4tBDaaHGcRkeO71c4nspK4rmCS88t9jitvv+hz8tVZ8QgyPUn+lLerM36CN2ivTI/yXAU22uqhY/F/4XySmanCKsCsrkNwFnScyg0ICt+X52XEOcvNTqPTsXOy6lva1Z191x+mx8d6bAIs7IbVIJFTemg5HaC3quh0YsxtavU9QABp5VwSbTCPAI0TeoryjTZYCTRgFrKf1bcS19azF6+BoqA/aJ7Ui2lS8bGlswnzRI5ke7la6ZDgavfE8S5QlOMGKnsCU+PcESYIbSKNCO3a461XI9fVgl8LWQHGaFUmCwyb7lAGbAo89fLmW/fE9QRHxz6SyO3frEa8EEsSsrxzYPWYARiC/xrxeU1++PHUGd8ore1LwLCXW4is3xvIa1Af9ju2P3YhdhJpaxgjKmGdCIRi5EPk7NxdA+PT2SsiBKszPcHEKX4JX/65FfO94n0RJkWaMe9l4bLP4RgLujX7jv5xklN/ZMLyJr0sCOZvogZHXM8Lm38tbO+vo8MaMEkJ3Ood9tFYa5fNgFnn6cfA8gSk12ojohwquNqth8D0R0dz7xcca6lhZV4SxcUS7hBJDl6DjQ349XLKnAMLIeY3Q7UZg239hT+2ZEHquaYjg1YDXT+GLeJQykPXmHORELl03U7qlPl2Mj4Q0wx2rLJJxm8vROdz6+VnTzCbde3to6Ig6peCM1p8DMNt6ZatdAlNpUCKUUDOAyzPBGsF6RAbjYYE0MODA2slsPZoWMtByAoZlfAaaBSWgCrg+DK6VGhwnCaLX+wEIVnkAOREwS7LcWpb3GCCJt/CZtaBdQVaQeITnZ9rdHWNfzZuGVbXUjzblQG7QchFNkmm4Z1UqKWEhqABx0yQfKv7aNXysjKSNwdpUqpTpNQYvvVKsXa4Df7EMJ+17N3Yt+l0kBLCxththEnd2Wl1C/43d9paOLkHSPWaDiHvrWqmhfwKk0O5xUQxI2keBOpMwIOLg6Ubq7X5cgdeDQo4AI3e88kE2IsAOmakkJlAkjDdF1xOQ7C0VP4HvIC0yCRFNMkAnmF3zDbKbr6wkIaufzyrAKzsARKPEAf+SIF2DqrhbYBCJxrXC1PHcXmoVPrzpvMG+hi1A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e63039d0-1c4c-4afd-15c7-08dc0d2da051 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:19.5484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Si19bEu9Ds304+N5NXkRcloovV+vqGKq3pFl3/IQGfBIyJtWWMjJ2s3wtJJjAftepbuHB/FoMSNmMEL8IutEYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8579 X-Patchwork-Delegate: kuba@kernel.org Accessed either through priv->dev or ds->dev, it is the same device structure. Keep a single variable which holds a reference to it, and use it consistently. Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Reviewed-by: Christian Marangi Reviewed-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/qca/qca8k-8xxx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index f12bdb30796f..c51f40960961 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -947,15 +947,16 @@ static int qca8k_mdio_register(struct qca8k_priv *priv) { struct dsa_switch *ds = priv->ds; + struct device *dev = ds->dev; struct device_node *mdio; struct mii_bus *bus; int err = 0; - mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + mdio = of_get_child_by_name(dev->of_node, "mdio"); if (mdio && !of_device_is_available(mdio)) goto out; - bus = devm_mdiobus_alloc(ds->dev); + bus = devm_mdiobus_alloc(dev); if (!bus) { err = -ENOMEM; goto out_put_node; @@ -965,7 +966,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) bus->priv = (void *)priv; snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", ds->dst->index, ds->index); - bus->parent = ds->dev; + bus->parent = dev; if (mdio) { /* Check if the device tree declares the port:phy mapping */ @@ -983,7 +984,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) bus->write = qca8k_legacy_mdio_write; } - err = devm_of_mdiobus_register(priv->dev, bus, mdio); + err = devm_of_mdiobus_register(dev, bus, mdio); out_put_node: of_node_put(mdio); From patchwork Thu Jan 4 14:00:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511149 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2050.outbound.protection.outlook.com [40.107.8.50]) (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 E1DF9225D3 for ; Thu, 4 Jan 2024 14:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kdA3C/sT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLfx9bo8aakmkXHDwbSGLdK7zpcY0ljRpFhKhxtIqG4ucb6JSXU+XTYcKE8zqQU/Eco98GdmB9O7/mCdLOPdYd9qrEPDnisfy3lC6iPX+KTxio1S+lBLYKdv4Q58dfEnNHg3wGZcq8G9wwzL/ekNd4QcU5Kqk6TGfo3SLrC/Mf2qcCXtSb2wpzP5tf9Rk6wstgvgiKIRTOkSu4iFPpcQIt/7PkVQAprixDRu2C7tNK+froEOwWn8utE8EfbY69n4XPVbXQM4iacG+Flb7cRgB0ND1fHfHhy/nJXnUn0SFHgkEcq0EHOgKXkUgEmwNrChK2Mq/OzHXUhZmR3+1yZV/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=arHWusFAC8VRAneVBfah6QXECy+7pGPkT6gNclO/gk0=; b=YOiiIaqpCuR6ZZ+0uV9Gy85TOx/SGmXtNZy6eiWxzrP5jaUiFuuz1lGhJMQd6KxX8Ag0PzutVyfTeMhB+/Eiyx3W9CsG0oBD9mIOhOd8te8CCO4bFbsu+ip2VdJ6gJGB+UrDG9LqbqePYtAIpPVK6F9VeExmWjjNhBXUt15cwRFIEfgQ7g63hPKxb68Nj56BXSRgiW3QXhLhJbuFT0927E3/b0O2/lLt6GsYYR3FIk3n+PCKpfvlseUOjrbDUH47amPUFducbZNetaDfLz4fzhR/UAIecieCenZZ0mZKkaBqJgV7UdOVOJy12DD5EyRhWuspgQWUQoWTwCiajrTlgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=arHWusFAC8VRAneVBfah6QXECy+7pGPkT6gNclO/gk0=; b=kdA3C/sTK2sAL+j4DS1tLTlzsLBg/ytnVm6ESiZryKUjOY4ezrk/PzVYdu8VzFRjtVFrrzx9k9bA9K21YOBjH0XaF3gKttzt0CfjaNVuUd05BcMvkOUORyCnWwAdsnmN9BStixGiFkrHIAdliOxqGRhKpP1Tw8U7Jx2u5fgEXeM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by AS8PR04MB8579.eurprd04.prod.outlook.com (2603:10a6:20b:426::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 14:01:20 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:20 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 09/10] net: dsa: bcm_sf2: stop assigning an OF node to the ds->user_mii_bus Date: Thu, 4 Jan 2024 16:00:36 +0200 Message-Id: <20240104140037.374166-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|AS8PR04MB8579:EE_ X-MS-Office365-Filtering-Correlation-Id: 87d1c76c-f153-4f13-c471-08dc0d2da0be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vGIi+RyBvPHTQNGWf+sRB7fFmymK8ZIGns94kRl4nxFf5IQlhIJR3lO7c6NGfzf6AeBqzujE/a+NkIvltJHF05CwCOMzeNbgsW5l4tPeOURV3irbtRRoRx3wnt0AqGA6IZokg5i4RaooSpL4aOJT70MIcaCOirS71tjdlq+lSS/BfjDRzmup3f5XSFBsAeudEYvAsNHcR6D8Ag1JxVTB9bl5G80qlka4Uk/pDFXY/nGODLyi5zOYHXHM7CbK+/0Kkm0SCaljDhriiHC+QeNLhwBeLQsllpeU+x553ZknEvFz+Ar8a+52/TWVlUGANIJvgyBSaFYg6r8vr40WK/2ePsev/SZSAB5AyOFDz9SRPBbBZiu4iS44csvgxWvCJO1rJTkV1HkKw3CG/755mT8uFsfeXWn4v+rDBpST9gu2yS/M9HZFq50hn59NIgNsTRWb89n2ekiSBzBy0PO6eOAijzhb8/W3fZm7B5yi/8sV4s96IWo8Fh4KFuXFd9acC1oFBtlosyj2GZEtHTM8Cnc1hCLrYIc1WbC9+G7sYGdBeW0ILxIEbkao6Wg+NMOOhohubPthZir3+9uW1HcEwueMK7STYKY++CisfsIciRn9Ufl0iHYxwPBxEP+wKLa6Lzfm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(346002)(39860400002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(6666004)(52116002)(26005)(1076003)(2616005)(478600001)(6506007)(6486002)(6512007)(83380400001)(41300700001)(7416002)(2906002)(66476007)(66556008)(66946007)(6916009)(316002)(54906003)(4326008)(44832011)(8676002)(8936002)(5660300002)(86362001)(38100700002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KKwhqxFX5IQkXPagez5HktMyc4Xi1izmvli4CBBT8M0Xh1GJE67+5cCTN+IlNfqmNf0I2bSaS+yzTDNwS/M7aIPCeqyOGaRtv+p7UH/n/5Wf2oxWXIJQ2wx7EFYl+3EPu12NqDsOek5bXNHjAeCofoiiik165RN7vzXoLeUSRSWV37kotykwCdlyVgds0XBUZEwxVQAQK6RaJ3CNVBRNFFODbZqbdqt2k/RGRv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pd1Pr4nhGNBUOeLPAF5qRTMDXbLyukO36y+Xxk/3VEhHXof7ScmouRNWS5QTnz+ESTW6EuQM6w8UYtgS9fgviW/0ZI678a2W98QFxtTFAynHl4TgtNtR523URPCudnO/UJBFNSEoUgl/G5AvkKsdc+I51Zjq9YB55D/ypHIQbKMzfnSH5dbHAHC2i025f5YNVf7mX2p9bkV9lyReiY0GwiGHLnUMzT1kVprtV6kkntAPFkFWXPr3OsR9K7AiRPwKxXbM4repl1g2exVFHpIF1LLGvj9DDGbGMtQpU46wT6xTCXGjg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87d1c76c-f153-4f13-c471-08dc0d2da0be X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:20.2947 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vxtDXckbYNnJV5NhYdWKHqSFwe4J2chlHh8miZSwuKZDh7QzID8pUE8oxofSdXfmzjp3r9yJSRm9NALOw8SlXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8579 X-Patchwork-Delegate: kuba@kernel.org The bcm_sf2 driver does something strange. Instead of calling of_mdiobus_register() with an OF node argument, it manually assigns the bus->dev->of_node and then calls the non-OF mdiobus_register(). This circumvents some code from __of_mdiobus_register() from running, which sets the auto-scan mask, parses some device tree properties, etc. I'm going to go out on a limb and say that the OF node isn't, in fact, needed at all, and can be removed. The MDIO diversion as initially implemented in commit 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus") looked quite different than it is now, after commit 771089c2a485 ("net: dsa: bcm_sf2: Ensure that MDIO diversion is used"). Initially, it made sense, as bcm_sf2 was registering another set of driver ops for the "brcm,unimac-mdio" OF node. But now, it deletes all phandles, which makes "phy-handle"s unable to find PHYs, which means that it always goes through the OF-unaware dsa_user_phy_connect(). Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index cadee5505c29..19b325fa5a27 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -635,7 +635,6 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) priv->user_mii_bus->write = bcm_sf2_sw_mdio_write; snprintf(priv->user_mii_bus->id, MII_BUS_ID_SIZE, "sf2-%d", index++); - priv->user_mii_bus->dev.of_node = dn; /* Include the pseudo-PHY address to divert reads towards our * workaround. This is only required for 7445D0, since 7445E0 From patchwork Thu Jan 4 14:00:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13511151 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2050.outbound.protection.outlook.com [40.107.8.50]) (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 F0C5922EFB for ; Thu, 4 Jan 2024 14:01:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="hKEIo2y6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=etH0JdGPpXH4ULmu0c4Sjng4e5YFEbthzx4EYywauZ0NfckYIs84jDskDIod5oLBIsXEeNWk8pUzSJ1+rX7MW5pVv6QeZLGI7rLvlpGOUQ+mU7F12igG2s1WRYJwF8JaAYxC1DF6KHlBMkQCbQzgglXcuuYL723tJHMwQVoJq9fljpvH+yz1QJZveOkhunJX4DWj8q/n7xzngse3uFQC2wMZ2KLsI9jgsNWRBE8CYSxXpQlM81En5VZ3f3gPZx21JmqAKWkH9qZlx39NAelWM7w+mOLlVwa4qjixmqVPxJk2AA7S21Mq8jVLiCgwWpQsr/rtnhTSyE7CdVxx90GhRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jzr5gT1LVGPzvtI0OgsAoDbufboqIOjyypggs+qasc0=; b=FkwGyu8LVIuRMFb35qRDMbWe91fDBAEhSX3UV57mMHQVY7cehBaLfHEhiQWlMX9HV+xBjFyd5ml260FsFNjCbi4p9Zccv5OXXrFbhH+/MB7bbXbunvhdy/Ph5yqTJbc+LPmvBgpcaEu1cRBTwrYbY70vXV5PhMj9HY2PVNQMFHq0CShkx9UhqjVqwV3cOUFcsTMrQMWRiq+TD/AQGp+Z1H/ieJToTYcLrRiJ6zOxEr60gaJ+CxWGT+T6CwqF8WXKZ6O0/GEFrDHLY8lpCKW7Znthn1GdmP6G/vbxIjvVyh/GTFRB05cJcD+6nmlDMrS4NHMHleI7m4qZIApaFnoUDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jzr5gT1LVGPzvtI0OgsAoDbufboqIOjyypggs+qasc0=; b=hKEIo2y6r60onQVkcUxCfpQxNPg69Eg2Udw10cRPzt4TFuxW6LxeziBQqgGza8HGJinVACIp6l8kKb0UwgfEaAekKSSgueI5nHL9kPlbEuMpqY+OGtce+dTcFiSKn076FCYFeHZKVkpSDWuITl627PexKpJ52mwoNXAtMX0YHqk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) by AS8PR04MB8579.eurprd04.prod.outlook.com (2603:10a6:20b:426::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Thu, 4 Jan 2024 14:01:21 +0000 Received: from VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976]) by VE1PR04MB7374.eurprd04.prod.outlook.com ([fe80::901f:7d8d:f07c:e976%3]) with mapi id 15.20.7159.013; Thu, 4 Jan 2024 14:01:21 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Florian Fainelli , Luiz Angelo Daros de Luca , =?utf-8?q?Alvin_=C5=A0iprag?= =?utf-8?q?a?= , Linus Walleij , Florian Fainelli , Hauke Mehrtens , Christian Marangi , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Subject: [PATCH net-next 10/10] net: dsa: bcm_sf2: drop priv->master_mii_dn Date: Thu, 4 Jan 2024 16:00:37 +0200 Message-Id: <20240104140037.374166-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240104140037.374166-1-vladimir.oltean@nxp.com> References: <20240104140037.374166-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR04MB7374.eurprd04.prod.outlook.com (2603:10a6:800:1ac::11) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7374:EE_|AS8PR04MB8579:EE_ X-MS-Office365-Filtering-Correlation-Id: d047daec-1d85-4638-5dbc-08dc0d2da157 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lCl/CB4Zs30cs0S/sH2BMzuowYPU4HH6+oRfG13YABICyrc05OFeN98J1rYU1hr5f6vWEwFz0hzzn6OKBr63aH53XAhICt0GcLh83Qfu4d/TZ282CyQ8UaX6p4kqnECN4AFCGbgpe9exV2hHxXiJnDAO3JOpqLhHlMj4zv24f49uL6qJe8NyC+0LhlBbxr4jBa9SioUcOOxeue52JnmgKhnbjTWbip38+65HuAfzimE5lprMVypjjt7UhsPA7H5zn+sNYWuiXZL2zeMwlfx+2Lf1Yap10lovkVNGfmryO7S6kM8tHfeHd3JvdQM5LypvtjQE4o13NNNPilCPTxVBoZWPHCeZb+BrQRf+RLvrFGuBBaJ8pM78tjiBuF+v+2VTy6S8bAB6TgME1wDM0upCmiaHPWm5czoNYLKMLxxQwa3EKQYijHj9x4HpASWrOS6qqqSvrdamHRq83w/ijFxdAdFsgiUFO7uYswUN9SYHlB8heGBjihbOCN9K8raV8nNEOKgUz3oZ43MuDGuAP3KnrlqU3aeoCTuuiH+fYm1mh9c7gnO/p4pyFc9gdpOFwI6p1f44fX63YE4v0odaIe4Y1mV1vrbWAp5pkd8jH21zLGRBaWE6oQr1hhZVTfkbuii1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7374.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(136003)(346002)(39860400002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(6666004)(52116002)(26005)(1076003)(2616005)(478600001)(6506007)(6486002)(6512007)(83380400001)(41300700001)(7416002)(2906002)(66476007)(66556008)(66946007)(6916009)(316002)(54906003)(4326008)(44832011)(8676002)(8936002)(5660300002)(86362001)(38100700002)(36756003)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F/4s7Ks+a9n5WqBzTfq+HxSRzATNDO7QQh6Rl8ouvUZLw7viyVSNmf5ICjNVfkDxtDgTu/UGxBvNuQjY8XBNKvcPLoCZXvKfi0v7znfbkytLpS5LhP6KxCDyTUhMtbfhuY1/1x1TJAV3qRE8HT7MTvxmVgFRJt5uDCrV7XkbxuBNwyXOOqq++lIPYcHlh8tQvEHzokyvlWG+WlbAJMVQjQqjY5U8YKduI9Kkexq10c2r6525n7MMoO7mT+ZYd+u/Gkd527ykS4ZW0wFO3Myr36yE2tvTlpr72ecF6O8ceZ9FxF4F115VUhZN9ciXQkfckKlusYKFrvsFjfVAa6tNrx1iASdkgTSSQgUlgooUNmc39wsr0+op++NhCvcpgXrd8iOwUwSghHOr2Dsr670qfj4ClGoVgvvn8QXI38YhgPb4XwCXSsZSKVPl6w+TDoGeuRcdIbPsR1LUOACCl7/HWqohKtfZOMp86hm9NEC87mVc2njZrXv2YSef8S6Zpf1yrk8Ej4VVtUMz9lJpmh7RqnP3M0jNjEa059Kvxsbj1dhTd1XGQI56r7YxcDs9NTMSoFRqrzQPPtBL6CZt4GwnUVN/dBtIiC0DXuOVBtZ8TjofdUztXswYSkQt9aznI28pO73b+lI+Qrkx0yy/eRskaSdTKTec0HphyLOPtKdfrjndSzQNYz5XA1Un7Bh/1SbNDcV6kT+tmfmSJUOw8OliaTo9GrhyjorLPvZXF6oMEk8eNFGPuhVUVyZu4Q/UFrM17qhjORiFR5Ki/werx0pv2P2ty3mRWgLsmEuYb6krdK4MDLTUACMDMdnHFpi+zOobMdN0qtVuMOkFBY2e+SUZTpSgwLqf8i+nCbQr/ffRr45aTxB0X1SkWaKaCNL05Jt8bZ18fsMtJKRJztvCQOzheHXIfvrBa0u2/rUpOjYYRbO9QlYeJnlijRdrcly36+vktJIBeCuFPH64pLJnx6utYISYOnAg/WZepFzFab/vOTa9fc4lwLXMGE0+3GAi9th3/gV2XT4C0jvjlj80en60lTZlwWm1RyQ90zt9s+0z/QCtSfeLkv7HuYAOReKV+9NkDdy0k1FolEBnevDrLBJEiOghzMhDfxOqHsSphIxPkGYK2ej7iaBwoQFql/6+xLzjGu4QNaxDQqK+maMdjwBgV69WAT5uG1i85oaZC7rK0GCTsy5hykUty6TcLhf57fIB93VNtHTQF6HMi2MFycIIGW0jKhnicBidfZRjh9wYeVJOdqEmrrpvaKcfgJN+2GqY6wJ4OZS+KDxSd/4Lc97/yxuaJY2nuaciz+TPtl7aOOG31UFF5BGDHLK8eClHRn91gxT03/o/Xby7lJp42SbBOpdOgh/86GIr9umfEjDlLBo9ZrrvrzmT5Gnh2z8U4EMD30Za7bnjMv+BFMM34rrkrpEFkkOEFC0LI76r7l74LrrVAzckQlCcgIvkzRMYdFsnn7mh5TntkU2XoK6ZowKEQBazUJ40uCF0QgGtJzH8vMtQI9Ypr/ouL/7T0IJKllenUX6rggbecJfHrNrC6wMbgHcFdV9oywylmNtX2k61HOAOeJyNj3P7l9qfFvrn9S1/pZOloqfwus6W0dQBqPYRRQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d047daec-1d85-4638-5dbc-08dc0d2da157 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7374.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 14:01:21.2670 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oMzJ71jJArbNoNMsTV/SiFiAouznzAIycnpONtQeglSFCGtRBQKlqvUc9SECN2hs4MPyZRn/D5GCZpd5eMgQSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8579 X-Patchwork-Delegate: kuba@kernel.org There used to be a of_node_put(priv->master_mii_dn) call in bcm_sf2_mdio_unregister(), which was accidentally deleted in commit 6ca80638b90c ("net: dsa: Use conduit and user terms"). But it's not needed - we don't need to hold a reference on the "brcm,unimac-mdio" OF node for that long, since we don't do anything with it. We can release it as soon as we finish bcm_sf2_mdio_register(). Also reduce "if (err && dn)" to just "if (err)". We know "dn", aka the former priv->master_mii_dn, is non-NULL. Otherwise, of_mdio_find_bus(dn) would not have been able to find the bus behind "brcm,unimac-mdio". Signed-off-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli Reviewed-by: Luiz Angelo Daros de Luca --- drivers/net/dsa/bcm_sf2.c | 6 +++--- drivers/net/dsa/bcm_sf2.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 19b325fa5a27..4a52ccbe393f 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -621,8 +621,6 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) goto err_of_node_put; } - priv->master_mii_dn = dn; - priv->user_mii_bus = mdiobus_alloc(); if (!priv->user_mii_bus) { err = -ENOMEM; @@ -682,9 +680,11 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) } err = mdiobus_register(priv->user_mii_bus); - if (err && dn) + if (err) goto err_free_user_mii_bus; + of_node_put(dn); + return 0; err_free_user_mii_bus: diff --git a/drivers/net/dsa/bcm_sf2.h b/drivers/net/dsa/bcm_sf2.h index 424f896b5a6f..f95f4880b69e 100644 --- a/drivers/net/dsa/bcm_sf2.h +++ b/drivers/net/dsa/bcm_sf2.h @@ -107,7 +107,6 @@ struct bcm_sf2_priv { /* Master and slave MDIO bus controller */ unsigned int indir_phy_mask; - struct device_node *master_mii_dn; struct mii_bus *user_mii_bus; struct mii_bus *master_mii_bus;