From patchwork Wed Dec 13 15:27:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13491327 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="X9ahzl4z" Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2079.outbound.protection.outlook.com [40.107.20.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C4C131 for ; Wed, 13 Dec 2023 07:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQG4lh1olC4CylL6Z52SiBxPBG8sxt5AthZuqoNynhKO77w32XLFRkYzsA9xnLuZZm6Ys7MgpKu1loaVvEizOG2pkd7LM4C7uys/Fq3pxLne0W+waY2wOaJ+QgT04yG4i1TTccgtzUOIYiIjR9fcQkGlxicmyhicdTYH3Z+DTFxceNzE+QJTLOa6LT/aTV8VfNGP7ZpcSk9WWc7ltc0FXNv5+x/P0uOveE9WpbFkKO28FT7ESyGRwsenjFFMQQVNu9jd1cRIKY2TACQi3HThcgVvjHyPBGwB6HXz1DzVs6hjP75u+x8DuDxH89WJDDPCgfYNF9I5dPKTH3MCn9A3/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=FyJuUbafyMd++tfzLzW7KomKI6jfjxHuz5HIQRtG9z4=; b=kN68nVsvYynL/xIA6R6OSlRpKL442NbdEL5rbL5D1X8e+K0x8qx5UqGzsCELh8alVshTL+QtstR3Gg9IswaKhdwFMLr4VYLQhSu6TpNL2mhgD/zyqY30gyz1x6YyVKnrkvX3Vua00xFgQsJ6wBqhhBGULq7mXTydysKQ8qNJPPKPmEVY9L//DXpjeBcxOn9HMpWplbWDCijGu322m2+h8r/xxgcACC/g1lMZvXCmt97B+hoRfeTFqCMZvgxoHB77RM7eNUZWA+HmPAiQTPP1cTrCeBa0+FzVChm5ntVvabxzWn+nMRe9nGX/QrJ490Vue/V5unaXGOoJ5UbfOw1Rsw== 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=FyJuUbafyMd++tfzLzW7KomKI6jfjxHuz5HIQRtG9z4=; b=X9ahzl4zkZyefqrh03XbBg49L47alYzSzVo8/7lanj/bhkB+rHmLuSS1+UizAXI+ew4hTtGF308ArYkuny43oaWCZOASaBJTLMwtDp6XC0l4xqEIKH6+ZhqSSkH0b4QOIA58WCKLuq05xwQu+sE0TRadk4iMevdaz0+PmeiVpb0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DU0PR04MB9273.eurprd04.prod.outlook.com (2603:10a6:10:354::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Wed, 13 Dec 2023 15:27:31 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dd33:f07:7cfd:afa4]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::dd33:f07:7cfd:afa4%7]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 15:27:31 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Heiner Kallweit , Russell King Subject: [PATCH net-next 2/2] net: mdio-mux: be compatible with parent buses which only support C45 Date: Wed, 13 Dec 2023 17:27:12 +0200 Message-Id: <20231213152712.320842-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213152712.320842-1-vladimir.oltean@nxp.com> References: <20231213152712.320842-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4PR09CA0015.eurprd09.prod.outlook.com (2603:10a6:20b:5e0::20) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) 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: AM0PR04MB6452:EE_|DU0PR04MB9273:EE_ X-MS-Office365-Filtering-Correlation-Id: 83fc297d-8b5c-4d4b-7ba4-08dbfbf00603 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VS7ydzxE6rg5qizn/tfuGt66VTbSfynpL8GTK3/ONvA32XyGXbCum3G0nKUXcPdiQSDbblOXmwD7WGdkwC5Aok1kQbfMoODxtYDBkHQ280XTzTl5tXv3lfxmagcLren3l+QWw0lWwaU/1UHt1Xru5clFBbnBzTqnf7ZUUd1zGN12ZMGnWFunlMG3SX1Wj+MYYbYPDYFzk1PiVPL2ibOcBSlw7tR1oBeSsgm+aSoCHJpsxv/sNO2SjKUpSO+1z3nOtW/NzR5AvagogUKTjtEHEUUg1vcoEtAvxwCkrN+kMeb0Y6YBsktQvzDsQ1nU9BuwUkv52BRlU/5Nv9hyxGycrVNjV1Gls0JXTYaUo6hHdEXTrmeqwqclkggJXlc7sH03p+APxype7IZevAbzmPqBdYUeRPMOyLiezbPSkU4Kt3MXqNA56Uhg7aNsY/yUPWwLoEM8rYvkPk/ZjcboNs17GwGO8/n35tdknfWlN4kLc2DphOh7EJTvmx+u3BYoJqSnS/mpq/TrPO48GDRJETXhygBVEgFtoPJZ4isfofiZd9dDQP9c9+BxxfrmhTqWS4OjcNRwSBoL0CBIuQPqRRrf3tS1GdwJ0DEGdVzSartgz9Q= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(396003)(39860400002)(346002)(366004)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(5660300002)(2906002)(44832011)(8936002)(4326008)(8676002)(38350700005)(36756003)(41300700001)(86362001)(1076003)(26005)(2616005)(38100700002)(83380400001)(316002)(66946007)(66476007)(66556008)(6916009)(54906003)(6506007)(52116002)(6512007)(478600001)(6486002)(966005)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6RJUZ+O5j+aLbS+BE4NxCxaB0URxN3uI8TVAXppwobt/mYy3ArfHESOm2EvvEmwl+Lz+TVA0ucFf3/6fd05g1obdl7m3rxBkC138lhDEsKig1P/xJYb7x3i9q/+2Ylpk9LFv8muo4AoYRg9l/E/7vENkPoRyqr5ktCuzidL2xQZTQm09V2bzDMulIoQXsXjwvEkgX9ZVW+o5rAxl0XbAtdPtNxBPc4zUxhuGBYXh+0XlSrkT1ADfh733hgYTiuD2iXizg6KSSt+CECxZvrqqSqKK0weBe1l169GnWHs1G9czjlHhmDzLI4cOAXzOWqlMHYrUsPr4F1CGDXkhhO3fni9l/MSBlS2QQ4cWZ7gzycJNNo9bk0xCFyW+LlA+YFiMh9f/MGSV7k0XJFmnSK8LgYHTFCOtaH8Aa2613yfIde8Nt89DRRPXiOskpekMYWXNcO+W1Mbhjs9z4LVQ2uFPiBiKFSKKqK3ABhq28uS9ZkoagsrJE3/SLDVNIH+v4Cs0yoOLbYQx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ffdUNMhQe9EdQeTMXgz2/K6PRQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83fc297d-8b5c-4d4b-7ba4-08dbfbf00603 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 15:27:31.6540 (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: Z4MIXxGfOA721vGjHfVY+bXn/sUPI1mwR2lrwYxDpmmVq0jcuDxf0KhxKc9ZZW0hm3KnT0ykIaBC9BfWiZEdvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9273 X-Patchwork-Delegate: kuba@kernel.org After the mii_bus API conversion to a split read() / read_c45(), there might be MDIO parent buses which only populate the read_c45() and write_c45() function pointers but not the C22 variants. We haven't seen these in the wild paired with MDIO multiplexers, but Andrew points out we should treat the corner case. Link: https://lore.kernel.org/netdev/4ccd7dc9-b611-48aa-865f-68d3a1327ce8@lunn.ch/ Signed-off-by: Vladimir Oltean Reviewed-by: Andrew Lunn --- drivers/net/mdio/mdio-mux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c index e5dee7ad7c09..fe0e46bd7964 100644 --- a/drivers/net/mdio/mdio-mux.c +++ b/drivers/net/mdio/mdio-mux.c @@ -214,8 +214,10 @@ int mdio_mux_init(struct device *dev, snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x.%x", cb->mii_bus->name, pb->parent_id, v); cb->mii_bus->parent = dev; - cb->mii_bus->read = mdio_mux_read; - cb->mii_bus->write = mdio_mux_write; + if (parent_bus->read) + cb->mii_bus->read = mdio_mux_read; + if (parent_bus->write) + cb->mii_bus->write = mdio_mux_write; if (parent_bus->read_c45) cb->mii_bus->read_c45 = mdio_mux_read_c45; if (parent_bus->write_c45)