From patchwork Fri Jul 29 13:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12932454 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0092DC00144 for ; Fri, 29 Jul 2022 13:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236247AbiG2NVo (ORCPT ); Fri, 29 Jul 2022 09:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235982AbiG2NVl (ORCPT ); Fri, 29 Jul 2022 09:21:41 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70087.outbound.protection.outlook.com [40.107.7.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95A8561B30 for ; Fri, 29 Jul 2022 06:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EuR/Be2tEmdyLjlbmbn421uPeNU2Sgd6u/RQUD9xDtNC4DvNXcfwo5Hf0xwHHvWpoUR1iqZN9KYZ9BJkFzfvh5GsQ9p+XAN4lP4FKc9wN3tatYohYZPW4eLydajO0ND/UkyYRfBg3/F1zRGRi5QHXUWHh1qHSRbgxS7bV6jyrA9eOZfwDbzCpdYOkAeIsr/IO9qjfKCtDdsrf6pU4cEPIpYmbzd1Qd6JcxMKp2/bY/iyq+FTLW0FtFnyrmGM70Zgk0BTxjnFXStKQ9Ebja3YZNDkp9UrA7wgBIK8Eq3ddWgtxH3ify2wFyh5geiWMLnpChZcUUaf1j6kt4h1LC7fbg== 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=SH7mmonBAttINeVIGF9rBmi+XI6Zc+A+eiB+aZEFWUI=; b=Ed6IPOg7kq2Fb6+rfMvQJOgNBWWe7/d0pTtJV6bjjK5+aaQIIPnOnj8zoT6c8NlBTYFcUjNbdMSG0lvvAsYgkV1HVByVlCpxX5VL1RRHdInNex+5sfQiZ88P0jCbbXUqPM5x6jEEooQiJTVvqfoPBs1AM5FAUQql2dXoxk0rJBFK2IhA9YRoTcoRld+PF4IXp/QflIgMLf0RR9pK5gHQqze/0wlZjGsBg5AYTL2uT3sH4HIMMn9jnZLRaDa2ZcBkHWleZUUQLXooCBKzOnQHpVz5544XZYCWtfYRSlryIE+MRzRiDuYg51l5lcPr3q0PBj0m9Qdo+T6Y3prv22++lA== 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=SH7mmonBAttINeVIGF9rBmi+XI6Zc+A+eiB+aZEFWUI=; b=ZELg2p0s9zUW2eCY7jji5Edm5310sSvqJy/fnYaOD50i0nXUDOmTlDzRfNcc9BRCnGJ1k7I19lktYjrOloJrzrBdp/7oF36CJsAzctUTF9NszBAsYRqPdmP+Xhe4fTmMsSOeAQFwJyPLJoGGgdQ4I5a/8F2Vt6JsCa69fwOj2dw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DBBPR04MB7497.eurprd04.prod.outlook.com (2603:10a6:10:204::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 13:21:37 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857%4]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 13:21:37 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , Oleksij Rempel , Christian Marangi , John Crispin , Kurt Kanzenbach , Mans Rullgard , Arun Ramadoss , Woojung Huh , UNGLinuxDriver@microchip.com, Claudiu Manoil , Alexandre Belloni , George McCollister , DENG Qingfang , Sean Wang , Landen Chao , Matthias Brugger , Hauke Mehrtens , Martin Blumenstingl , Aleksander Jan Bajkowski , =?utf-8?q?Alvin_=C5=A0ipraga?= , Luiz Angelo Daros de Luca , Linus Walleij , Pawel Dembicki , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Geert Uytterhoeven , Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Marcin Wojtas , Rob Herring , Frank Rowand Subject: [PATCH v2 net-next 1/4] of: base: export of_device_compatible_match() for use in modules Date: Fri, 29 Jul 2022 16:21:16 +0300 Message-Id: <20220729132119.1191227-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220729132119.1191227-1-vladimir.oltean@nxp.com> References: <20220729132119.1191227-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM8P251CA0022.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::27) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10d01817-ae3a-4610-e4e8-08da716543c5 X-MS-TrafficTypeDiagnostic: DBBPR04MB7497:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dZW48RFHTOAjg8bAtY6XQU7vEnGzBz0GSA+N4ylkTJaAkf8yrX4Pr8HULVh9SSErAnYWX8srOe3kFIAS2ELxpSyVeQLnz4ou28NlzThGOUq3yedEnbC1h60gWZKwZ5y0Swroh3/Ti8O6VKG7JlxoMQR0WJjAmP9VgPOxpuDcQhncYZ2Ogc8MABl53x0F0rz50TRIEQNiMFRjVpnsbt5SjTkOc1mOfSMEO/nsttp5ZJzSk92tiz0tz460oktQDyRuvAPdIdJyHy/illCYdvUUF5HCGoV4E8KjcSiyL28Az9iacfBr/Feh6PtCnQOnb1yn+FJmWmfWGY4i3R9UtCgw/+Z2JTF8ktC9fEbV6xwunF/SG9k+aBf9aPv3+ZWJj0p5UbOtX2DVtQOvGKj+p3k8o+wfjUnRhuXu3lKuR6jtUx+0N9FPWHLJ35Be1Soj1ZHGjhCuEKEBbEf8o+7tPdlaPwRqo0DevcfJNqVymHwFGQPXbliKY6e60R5cUipO38LV0i+ddqzpUR0nfsAFJ6ReGaH1odhgxcgXSccR4ODDvF63bbFvNKOjj1aOK/9eKOHQf1W3HZHJsVFXzHfmN1QJdvXb1ajKywAAnU29K748//EyfMDcCaykKBGWIbS9ZsTFIIYHIDHQ8PYV3sJkxf6TsACAok/9yhlQ3bP8c6jh1AJcXPcTNbRaBy9AjjjoGIL0N0FzDdvuh5rEwhUs/OD8vIJTWJGROBm96YbDi2Bvz8m/DxS268nm5InMhDtaGvtVJaY/RBptuG5ufUwiq7fyPGiQNoedFKrE35ZiF3qV/+KluEAfu3cxjbap/bc89QVe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(1076003)(6486002)(2616005)(478600001)(52116002)(6512007)(6506007)(26005)(38350700002)(186003)(38100700002)(41300700001)(83380400001)(7406005)(66476007)(5660300002)(4326008)(66556008)(8936002)(66946007)(7416002)(4744005)(36756003)(44832011)(6666004)(8676002)(54906003)(6916009)(316002)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0a4AuoFca2dOHASBgdSyv8mN+Wod9zKLLZ/qBxdPoyBdrB9tikcLmn3X4+/TTAvTbIuhBj/KhrqAWNeOeqlkIYs1LeXDOoNmo6WiwC1wv4imoBB5FCPWAXFLWDcGz2dKR0BWKVcyJP0VFa34xynJTv7NxUXyRWtozTLexRIV500DIxp0X9FiQffSFxTwgpXHZ7BxpEOu5Ev9TP1MtvQJKDXHKQFPyNcjMXDdKeLVz3lDRLp37Euo/4b3QGxza4DxwsWJ0eYEl5sKRbh6rSioiEIz6oy6I/zA8F7uo6chQHJAtYa764qvSmaj7BkqXJYj1NUYTxwUSBAb8csgxM4km6ZG8zzRxDM/Zwfv/sm5EzLX9lIg1xK4PagD1lFZcFTzWmkHNfn9M82Urvop9Q6mSM174tKs6ZLdGF5hKTlZx4p5g3NkwqPdrdhFkGwf1EWNJCdXlYcUmObSuR+jeJyTs+Ja2m2J8sWaQpWdIcicdMS0KCbXRMBaDYSu1AqLVstk5pMglyW2ZFj40yjZjxM+qzw46g55WpBkySqv7x7DSXC5n5ff6iq/mi9nfoKzxztQX3IrzTc6XoBEEIkHuV98zp74sIYN+Miel8t8XJNPNIJDK60md8zo8tLz8V7FIQqnKLbPsVedmkjLXT28RRme68w9aCUGwkuaYGN2BtlIKoYyQPtn6M9AR3hcdVPfhrSqSodblhet1MVsJAe+QVtg99uF1dIR1DV4aEqWmFp/HtLlwDHEjHOfoVQTDXAb3ikym7ndJeBPDi8gflO3YFZItdV8u/ydzVTR6ZfvnEQxzbdL3K//vGyiyJqrjdZjuiceD2II1nOaGlPK0zTp8pjj8s/aKizxw9PI6UANFKhUCKWVNnIACsGuv3TPjBij3FAlgRMdID6T/HzpnRtulz72GpyY2PeRUOKesgJCkYXLIRwkh1LX93R4g0PUkY1IwuOvaZkWJIcZCs3+B/jnVg31WkPynvgtQnJ4jC+qZ+Ece5Pvur3MOMMte7/dPZhB4VuENExT8fdmXrDK3Gsc/z+e3J6Q3sjwQitvBFvd/MGyoSFYJxo3PoGkci6Ugo2pqunsEuWpPAWR69kqCcqCYRmDQHvY4t1FpS/zhXBJsyBHZA3vF8xdR1/8PsYgoU3QncG5yCzQDUMEINhpM9LxyhUQHUwj3/CjR6VZTCiFRqujj2No0e91l/SFkA0nM5bNuK03H9Fxc+xZLqtKPxrE2lYrqUux+f1nHai5E4AJ7REzDCXzmkVXr1/jijSdhy+517LIGC9hTA9Bev03uTjEl6UZzOb4IhTVLrVn4BAXhdxPf95hSaIuZoQ/h8TKEgAdOLqWCR9M7+LWk75BwvFqzlMBZyDzxvZv8x6HytJqy2qcsb5iu0XvpFrEQigeAe96PCPwpIU6en3zfzxgqhami8/t6P2aqpK1XlvP3xxOzB8PTy0TAZFRS0ozDENjHLeWYJtBNlU/YqTM9nM5U95mew+BsfbvuWcRSxQiDG8pQMhYukUe9jUmHdJXbg60IyN3gEb1WFzsjRF/n5zB/LkVS99d+U2Mg/MbTIURXIMnIxYnif1zXMIHEbJnAnHqdOngJ/PrlO6Jz+xGdfz9ZNGs3NQ+2Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10d01817-ae3a-4610-e4e8-08da716543c5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 13:21:37.1837 (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: 0UcMm0vcsCw1zeQsEjeRE5wJVQ5SWOKTNlhejrpbzeBtMOauyLyo8q4wFOnI7aqrVcJWEwdG1OijPIXhNY+dlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7497 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Modules such as net/dsa/dsa_core.ko might want to iterate through an array of compatible strings for things such as validation (or rather, skipping it for some potentially broken drivers). of_device_is_compatible() is exported, by of_device_compatible_match() isn't. Export the latter as well, so we don't have to open-code the iteration. Cc: Rob Herring Cc: Frank Rowand Signed-off-by: Vladimir Oltean --- v1->v2: patch is new drivers/of/base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index d4f98c8469ed..5abd8fecaba2 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -578,6 +578,7 @@ int of_device_compatible_match(struct device_node *device, return score; } +EXPORT_SYMBOL_GPL(of_device_compatible_match); /** * of_machine_is_compatible - Test root of device tree for a given compatible value From patchwork Fri Jul 29 13:21:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12932455 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75994C00144 for ; Fri, 29 Jul 2022 13:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236448AbiG2NVr (ORCPT ); Fri, 29 Jul 2022 09:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235451AbiG2NVp (ORCPT ); Fri, 29 Jul 2022 09:21:45 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70072.outbound.protection.outlook.com [40.107.7.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 492AA61D69 for ; Fri, 29 Jul 2022 06:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KTtFSIhzBYSUwPX1Gpq04waXWFFVbPYahgfna8mgkDwQ69S3WUPhk2UUtOzKt1cu/lo+C9z5VzHaJ/3yaSGJG6JCnH7JtUvdb2QOu+DxmaC4pVAYAYEfwhnZM2EtnkNR2ZtKQYt+IIbQ3WdppWAsFtlYrGd81iCuFEC4fzrtWreuij1nLyk1JU1PigniBzuMelgfmTfeKdKno1Ke0FUz29VxEmWIgx96bOv8i8GpORniQkvSC6Xx7z7eMMmPRijCBiNi8Oo9TrUeoRG5ARWcjdbGfDCwH2pTmvIHI7FVykpaIyeFybAO4vmBji7kKTFtF+8W/pvKYPOgL41teFjAJg== 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=HgJUnIQVTH1QrxQmmN6IVoh7fDfi1RkHR1+XcBRoAtY=; b=M9S1tCjlSMKOLgJljWwezoMXZZIsdVD/58MshJfTzn9JQtm6mQxIB5faBYqDruqw4F2njFht/FNE+9fBduQp3Ikc7wmeIltJi1tbygHiK07IbL2SIsCLDOqnDFFC83pEWntDfZJktMZNieMqcfmzCyC1DPtn6fcN4YfTcqaAEzG7zRm73fy+vHi4n3F2YjzvF4ombnIDCIasOgQryzQJnt9DufLirmwfVflf6c+lOG46YEyemjuhsT5E61eW8nZdxxIqQ03x0Y57pI3Md/4jOeTCp+VN3DAUQINBZd85gChJpNRJMDOYMHDwz7bDTla8hB8aFWV5Wqfb+u++WaWr9g== 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=HgJUnIQVTH1QrxQmmN6IVoh7fDfi1RkHR1+XcBRoAtY=; b=EaaMigYscM4VRAzlD/Hqt8iD80MgTk7CfeJg3YWQK5bnAGC3dhrXio5k0BItsLW9YdNN99QWstkhlXbdRM1PBw1nIApvs7HAZTD7CLr0IYQzFG9v3PEaugn2UaDh5k88o8AuBcVwyOa42Hwlrql0s7DB+fQrMTTkYW9qFfdbvUM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DBBPR04MB7497.eurprd04.prod.outlook.com (2603:10a6:10:204::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 13:21:40 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857%4]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 13:21:40 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , Oleksij Rempel , Christian Marangi , John Crispin , Kurt Kanzenbach , Mans Rullgard , Arun Ramadoss , Woojung Huh , UNGLinuxDriver@microchip.com, Claudiu Manoil , Alexandre Belloni , George McCollister , DENG Qingfang , Sean Wang , Landen Chao , Matthias Brugger , Hauke Mehrtens , Martin Blumenstingl , Aleksander Jan Bajkowski , =?utf-8?q?Alvin_=C5=A0ipraga?= , Luiz Angelo Daros de Luca , Linus Walleij , Pawel Dembicki , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Geert Uytterhoeven , Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Marcin Wojtas Subject: [PATCH v2 net-next 2/4] net: dsa: avoid dsa_port_link_{,un}register_of() calls with platform data Date: Fri, 29 Jul 2022 16:21:17 +0300 Message-Id: <20220729132119.1191227-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220729132119.1191227-1-vladimir.oltean@nxp.com> References: <20220729132119.1191227-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM8P251CA0022.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::27) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31e1ae26-c23f-4898-c128-08da716545f3 X-MS-TrafficTypeDiagnostic: DBBPR04MB7497:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: liWvbjUVxxRhvBv0UrjPCCsCspqG59Wrbghj605HUsUPPU9fQE4GUFw4QDf5rjehn+Y0BR3BZy8ly0HrIuare4ubVsKptwGVEvu8GtX3aGuh9Cmqyd8Wxarcn1yQ5EYnuZrCnbHOxxD6zrsUt2p10DG0cq5mY3lva8k4OOfVve6obHFUWAg3Acjes57PflqRh62M1q+Jbmf3PfpbXyLB63NQPiQQ/4LbrVwvveiZVf7c2nhTXcRg4seg0dlc63IZUOMRkK8/RpELoT2HFgN/3zNZRfrWrQOAJagAMVsCKmOHb3H/2ys/aGPe/r/Yi+Ir3ITAT7sT9jenAdB61Hhcyyz6HRAzJYGDxk5JI9GguG0INeHi0IuvZ0rdI+i6D9QFx02vdqemStnBt11eDLkgkgbH36b/Uq+pwBrl9ZQu9fxVVzByMkJn+PY6kGVhhs8dXCmP0Bbo5l3nxQXkdftWKBSnLGHea42xoKrqKNkYT17DqCeIupScWX32LLnQY9LYryiNlBknF2o6MNcVXA6EgrTzzWZPXVK23J5ipM+8eb65kO293g0z/5pNbtWsbwP6hlmc8t2wmKxWszD6oH17kznQVk4gKKbVT7LJR9uKPCbXTaS33GrpE5S7Ev1N40YEKPefoYZGBTeeQErx2gIzXQJ+rWjq1ld+GcHqghfP/I6ztJBXZb+oDRH5/mMmcqXn0mm8iei5kyDqawX1Kr2YJ3OFIT7gYbZ3ONJvKbwEdNrKZWvUP8zsWPWOTO1zf82HI9R8uqairG0I8FZKDDqF/T8isovYSuIWCIETVhWs13XhPSNYGWaP4FCnjzOv2kaZ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(1076003)(6486002)(2616005)(478600001)(52116002)(6512007)(6506007)(26005)(38350700002)(186003)(38100700002)(41300700001)(83380400001)(7406005)(66476007)(5660300002)(4326008)(66556008)(8936002)(66946007)(7416002)(36756003)(44832011)(6666004)(8676002)(54906003)(6916009)(316002)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 073BZBGXhezd+jJ3QUkXYHypToGP25KWG/Kjb4761GEOaY2uCLRYryoLq1BA/npiCn3NulX9qetm3mFdqfH1RuPlx0uAGMO0Fk2EOCav2ZVvtcxPhKPo0RtzvPeGztLBPw3i/baR7WD9ltpFNXyZnLa5qFUrc4E2T9Xif0AszcJrwW/2eA6ikCy/CL3RPjjP6V/f0y/iOYe86MDVLcvlWBXHQisdJ+BayqLoX3NlFWf6bDInUXlZATHbNm268HNy2fINefCOFU2YvaXsHyfBPBSLwv2z8CfiMsyYhI3asIW5kofrFwCmExfNQwFgYQu4ILtySbXdyc5bZwbuR9G4lr/rhiB3vSikuwb57uw//JaeOna96XGoPSipuDHrzEcSbqyJGz73xc4g5SPCyWDTExsym4Igse657u7zWFjdu5iJ/9bO8vLJmh/4p0/ETNBevNZCRqInMP08xu6XFpJOPAXYBgpoDKC82XL6AzChIEeYyEzGVikfQNmaQoNTZzsNJUsyhoantV9TTVbQvfzHsAO/e+xa+jCnWt1IZSTEGsqn822t5CZsFhANin/cqU2BMG54GAuSEMVpcFNgBD++oGrP6O+Yy0OSkwicqt2dnJxeQB6dQr1fGX8YPv0frSYQZhdnzuR81yXOLSlpYLjl5wFzpqS4F0ULgVHokvecOcx3kpram3F886VOmolOekPuEttvUy1zWERTVyoFzXhUEy21ILWkgNw5Xp6RlozPfL/ofBZYgwan1iqe7x4uccda1HJJuZcFzfSyd8D0NsZXcwxo6w/Q58HV9Y/+8ANamqDFmnXeHt6IUCs3GUvUGWSedQzWNefauFT1RmFwsQKusVpsMrmMFeKg3qfZm4BMcQWNXQPyDBA5F44Gly7i07dcm9nG85Q63CdYNAp4jIqdmzVMCrbq6E4QkFWHRwVYJ1isZyG9+19wAOeh0C4b5i5LW8WKEKiXqqXbjZzppmfBwEtDI0QWqSyA5LSmzml3J/nU3D33/cU95hjbTR7D3zoFjdDVO+ILs7lb0ToOv8dyDKQ5KajOud2LB41lLX2I/58Qm0BxkwX9XWAIGOmdrGh66IDoig50PnCo9SJyBQVNOxqezxt7mjApYxHKQxtlPVuXTLCA6JhmF0meoK/RrM+wjAYTSlEn4pMGi3PHAQlnEpyF48BeGxSfPgZulSxQy8YQmzr3RGx8Dkrz06CFwC5ZT9b++XrmeqmuQMBoir2o4txVjhAajx4WveRAFEDNAVqecu/L7BlVx5YRS+Fh1p5tUEQW/oeBwTbETgaNAkd882xufVIINWCJ8pGjHkiytTF8HaV3tWmyzERgYiZKjEB9bQ8oQkT4x4g+DfAgqOBf4lnLNxpvO9I9/Jaf3qjJv5N37r31m67vW3Utyh+hl83or9BfUiN52Xz20uZts4fJxr0IZ478JgLNvDr7j5eESouVgCkToYkMdxLOQovx7QjFxMn6xRDxtbZ2Ctawl76LZ+IG07bQWGw2wux//hNOHFHVfPp/rWouMx/+LM9KTZH0fGqwWfxD+3igjfnWmKXYkwzCMfc+16A6loQhnV4M4i9eWpDWsDyTJE85k3IHreME8EfzG+nZn0DEF/YMuM8g7A== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31e1ae26-c23f-4898-c128-08da716545f3 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 13:21:40.6990 (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: sw8AN+lN/xFH40XF+F4+2tspHW2axFnbJ74Tm5yqsRWaRsXFxdtmYDSLwoW2l+48AEoIoPr1c/yR1XH1rECNIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7497 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org dsa_port_link_register_of() and dsa_port_link_unregister_of() are not written with the fact in mind that they can be called with a dp->dn that is NULL (as evidenced even by the _of suffix in their name), but this is exactly what happens. How this behaves will differ depending on whether the backing driver implements ->adjust_link() or not. If it doesn't, the "if (of_phy_is_fixed_link(dp->dn) || phy_np)" condition will return false, and dsa_port_link_register_of() will do nothing and return 0. If the driver does implement ->adjust_link(), the "if (of_phy_is_fixed_link(dp->dn))" condition will return false (dp->dn is NULL) and we will call dsa_port_setup_phy_of(). This will call dsa_port_get_phy_device(), which will also return NULL, and we will also do nothing and return 0. It is hard to maintain this code and make future changes to it in this state, so just suppress calls to these 2 functions if dp->dn is NULL. The only functional effect is that if the driver does implement ->adjust_link(), we'll stop printing this to the console: Using legacy PHYLIB callbacks. Please migrate to PHYLINK! but instead we'll always print: [ 8.539848] dsa-loop fixed-0:1f: skipping link registration for CPU port 5 This is for the better anyway, since "using legacy phylib callbacks" was misleading information - we weren't issuing _any_ callbacks due to dsa_port_get_phy_device() returning NULL. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/dsa/dsa2.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index cac48a741f27..12479707bf96 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -469,10 +469,16 @@ static int dsa_port_setup(struct dsa_port *dp) dsa_port_disable(dp); break; case DSA_PORT_TYPE_CPU: - err = dsa_port_link_register_of(dp); - if (err) - break; - dsa_port_link_registered = true; + if (dp->dn) { + err = dsa_port_link_register_of(dp); + if (err) + break; + dsa_port_link_registered = true; + } else { + dev_warn(ds->dev, + "skipping link registration for CPU port %d\n", + dp->index); + } err = dsa_port_enable(dp, NULL); if (err) @@ -481,10 +487,16 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_DSA: - err = dsa_port_link_register_of(dp); - if (err) - break; - dsa_port_link_registered = true; + if (dp->dn) { + err = dsa_port_link_register_of(dp); + if (err) + break; + dsa_port_link_registered = true; + } else { + dev_warn(ds->dev, + "skipping link registration for DSA port %d\n", + dp->index); + } err = dsa_port_enable(dp, NULL); if (err) @@ -577,11 +589,13 @@ static void dsa_port_teardown(struct dsa_port *dp) break; case DSA_PORT_TYPE_CPU: dsa_port_disable(dp); - dsa_port_link_unregister_of(dp); + if (dp->dn) + dsa_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_DSA: dsa_port_disable(dp); - dsa_port_link_unregister_of(dp); + if (dp->dn) + dsa_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_USER: if (dp->slave) { From patchwork Fri Jul 29 13:21:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12932456 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A04F3C00144 for ; Fri, 29 Jul 2022 13:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236538AbiG2NVu (ORCPT ); Fri, 29 Jul 2022 09:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236413AbiG2NVr (ORCPT ); Fri, 29 Jul 2022 09:21:47 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70072.outbound.protection.outlook.com [40.107.7.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8B76248C for ; Fri, 29 Jul 2022 06:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G7ReJNJLPkRS6Hn6kNPoAllblVCMZW8j0gtOQey0fw+dkxvylc96wk770v4+G64+YzpUMgp83XaL49X76bF3OBQDe0/A1fNa6jh8sKaYHDPav2kXF1LC3QpNtjExWT2tBsa/2pPfnKuwphS0kmml8q47vShf78U6QMwm/qFq6Tt8mLwg/5LsTWyBxkADaw6lluF311uwpLMr7M0dLU390S6s1CECERpng37+fzc0lRiIbxFzl1filk1MXQv4GUE5f5K3vPGP/v7z3hRxF0LmNbd7GsJfZvl//tKrn/3ctnsU/SfYABADFo2w/sXeJpNNiuLAXne6mM8suUD1Ac1fUQ== 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=eTcXLyFtQITQNGLuAAQ7HJZpOzCX/EqzBHwLozjD0vs=; b=TcsWAfDzJohsQb3ix6ajv+dqqoor8nVvTV5pqx2qhJX/h7AtRwveBlxjP1uk67gWq1WdcquyvdWPjnI+08nMu50C/vGdouoq3NJbROdeNipEFaGNqlM6Fe81ADDhVe1F8vU8xniA+robsoete1wH3h42YLmynVP4CDwADtN0SOU5UmdxStR4YUHzLx6o7OUyMhrxascCS47HRyQo/lUURhg4EOIkIu7RmM8/7HLWlKLUTKvI+6cWt4tU557FyidELGQ8KvDO84MPJi4G3s+vX+qRTW5eYV9XJ37HuhdhUE20T4VbJpkxq31W1A35nUYXcsVVkYwrtIIOB3KG21gHXw== 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=eTcXLyFtQITQNGLuAAQ7HJZpOzCX/EqzBHwLozjD0vs=; b=WelZnqqjLl30ITaN558QbkJSe5bmNlCJvumBXfW5iG5IKQGxPLPO6nZeo/wLzcSzCusR1AyspvEOrSGOhXb7pSaiputr7JCu4SVdgpdBVhsCBxf5jYmdJSD+kJuPXde0LJQswEtcMR1veixar0wZocyX8ozBmBKMK3Vv/5WZjYE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DBBPR04MB7497.eurprd04.prod.outlook.com (2603:10a6:10:204::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 13:21:44 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857%4]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 13:21:44 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , Oleksij Rempel , Christian Marangi , John Crispin , Kurt Kanzenbach , Mans Rullgard , Arun Ramadoss , Woojung Huh , UNGLinuxDriver@microchip.com, Claudiu Manoil , Alexandre Belloni , George McCollister , DENG Qingfang , Sean Wang , Landen Chao , Matthias Brugger , Hauke Mehrtens , Martin Blumenstingl , Aleksander Jan Bajkowski , =?utf-8?q?Alvin_=C5=A0ipraga?= , Luiz Angelo Daros de Luca , Linus Walleij , Pawel Dembicki , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Geert Uytterhoeven , Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Marcin Wojtas Subject: [PATCH v2 net-next 3/4] net: dsa: rename dsa_port_link_{,un}register_of Date: Fri, 29 Jul 2022 16:21:18 +0300 Message-Id: <20220729132119.1191227-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220729132119.1191227-1-vladimir.oltean@nxp.com> References: <20220729132119.1191227-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM8P251CA0022.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::27) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9331de6b-a9d6-47e6-6608-08da716547e8 X-MS-TrafficTypeDiagnostic: DBBPR04MB7497:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j+nEq27NyL7iklV4UahK3+qNDu1dPlirG+SoK21LnM8sysL7XSRUIxNFIxRuORifOeFZ+564onHR3jvAXROvAwkCfhHMquLNDs/LFNJETpavo7Dl4g2MN4BeTKRvtkqJSnpTGpzK6R3wJvXOFrLZtQQDNRH0v6dn1cKCn53/Y25j5AFMqoMS0ijnShLjX4hOn/maLBj7lJSydW9UMBUvYR9bAM60P51qI7F4RRUqiB2sPi0dhjlkg9iXEy3iSzF7K7E+3r3LTyfWbufTpRrlL8LETXVYTtwCtqcrcG39LXDCqoiYKQNlDQy76xZIubmNWe/vGLncX90UACPjM9CrVILvLLuqbT9DuHpGz6jJCEXTt1HqLEPwUxbkk6iEOOMiveNRU9r9SZTcu356wcvM8fLhO8kCUascC6YVzuOB3TNnHSKNhIiiPR1yBQY3YKHpViuePmwldoygJjog4+KoxnncGDgfqmHwtq2Xq4w1IL2mpyIqR1+OIlybougDh+5OpZn9V11s1j+PM4LjlcbQjxrvBEnSWzb0m5gdVCaD69pDJsbZqpbp5hlF45st4msfcWFdz7aN00K/v8VwNGGyzUJ4KGjOlLRjGAkzpE6gbzRICbjCjrA75TLvRcMOn5K7x7E6jBaRkJfJB07eIp+C6sVmM10qohfQG14Y4YjA+G17RFj/YqE8VPIo2SRjpcZLYzVrnR7c6PBTPlgMuW4mfiFXdOj5x/xapZJTWsqzhtqEuNgTKD8JBwo+FS8RibWlY+jATRwtzQczzQncpO17qnFPREZJzy+DI5HyDQzTetQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(1076003)(6486002)(2616005)(478600001)(52116002)(6512007)(6506007)(26005)(38350700002)(186003)(38100700002)(41300700001)(83380400001)(7406005)(66476007)(5660300002)(4326008)(66556008)(8936002)(66946007)(7416002)(36756003)(44832011)(6666004)(8676002)(54906003)(6916009)(316002)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kppKCdN8JBj49d0dJrfWITPALcP9IzgSv0D7dcZuWWDgLwXpGiq6LwlPoLO1qS05Kibnvd6DXNc3n4FEEnXJld5GcFXzUorJNE1kQ76HpiKFyeqoLJhUBdbLG0n2Sb3pOect1jqN37Vfstr4nTzr1WKn1ujSNCHDEeTyNK8usDRgTQGC1q7+Jj3pHH8z9ZZebgYmqYCdBIVKV00PWehN64lbjWZmzx6JokLrINFhvgELDfbs4Qn1cVvTGn5dLsZ46F25oJgID5IQtTf9hIMwu7ZOQ2Rx258zvPdjvLRQ3WR8498jlgL1uxb5qM0S3MAcDJ+i0XJtiosXyrow70yAH6I0oIB5WEANFRJ5GTqv7nwAd05DT28HNQbkrRx7pEzylZwgbo5axuh3XDYf4Glk8eDDTFXroZPiJQA8V+fipvmY9j3wLJZbDfsDL7WqamwGY8E12j92JrwP34rLr6v3nREdBHeb5x/SEEKBq0+piJjqmG0nQgB1wnkrirL+xlLFWpeWhq5+jCfWdoITG03ytjdft3yLETzMtYblzuRDZFleJCwuWliDfFOn81Ea7s6wAceTAgytiSXa6mjUqPtFaQ32iJblJzP78WDbBIMRshtYvQbLLi1Cm2VKAJ5ceB/McbsTGJ4Sd7tLy+x+ujIoujOO4mvPQB3YjpPc+IQO5CvXFU37uH9PDLz+RKZSjNqmGGDknmFr03McbGW9/ehy5h2D4C+655EDGJUjeoGa3J/6xG1YVDTr77r8M3xHMM7qH3465ri8kXjShhn2PposrWdFEwZQ1FtoYJdBpbq0rk37ttzEe7cdxHDdDMwi/UgEycyku7g5vLvfKM9ux4BCjWJpRNu18biQEWC+oaUTSoMcNYKFR7tM1GvczNzeLh/dY66DGfQFcmDcvtK9y4WUoxR/oKcJKbYgz0zT4E217INFOG5lI7Xv64+1+BG8gOZcgnuI/4UbtFK53vHfukBZqiUz29B75VaxgkcYx5iy/Zflcara8tJnDgWX7B/GZTG7hNUD84ycsMhFkhauW0XlhNnzJ8eonQQ7KTdBF2v+13K7/RIjIhcbdLp3G52kY8BgQSruYJ1nNl6WeSN8Ajri8M6XhRW7lPjv/8daCO42Eibw08N01PyWLKWtlEf9DNB5ShyIBGubb9cjs3JLsWCxEJ2QBG+8PwYz/xM+tMqjDJPkbGY2c85gPxOKOsi0SCf0ZUnIktBnd4FxxHGjC6K909z8i3jQ+VId58wKvZAw0FxEFFwWmuu86gAHzLIvFoZ9lGSOngOahRbBrqh9RqSlekbXkqBRr/IM7SBMhQgpE0Sfiu7l2P/2L/O59UzXMNt/e3SPY3BQ39r3N4rLsFWiDdbEZ/Dwnm8CnbSWHYVE3IJSG86KoWTXZNhejOTpJlkxr86yQXtfO80o8IvRhYfDSqCFoIHHGJ9p767ZHVtIN2O/gMHj+J9e703Lt6+6MY4ak2jyQ64W8n45pVk/42XvU6W/NwwTjKwfLruXBWyyVzHjuONhhF4CJmMcBNR0nN/weB2i/EbU5PWnGJugIy0rLSSyyP/97ySKcLgcBK9IfO6841lr+AFEvQCy28WlmCXXkuOsd5jNV5Hhc/nWvNdKbA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9331de6b-a9d6-47e6-6608-08da716547e8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 13:21:43.9801 (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: FxOzGghK5elTD5CaSUANpueYEe/r0grfEr2V/MZLWknxljM5soFtkvDRUu9ygvvinISFMU2KDUeWw0QrYRaSPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7497 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There is a subset of functions that applies only to shared (DSA and CPU) ports, yet this is difficult to comprehend by looking at their code alone. These are dsa_port_link_register_of(), dsa_port_link_unregister_of(), and the functions that only these 2 call. Rename this class of functions to dsa_shared_port_* to make this fact more evident, even if this goes against the apparent convention that function names in port.c must start with dsa_port_. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new net/dsa/dsa2.c | 10 +++++----- net/dsa/dsa_priv.h | 4 ++-- net/dsa/port.c | 18 +++++++++--------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 12479707bf96..055a6d1d4372 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -470,7 +470,7 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_CPU: if (dp->dn) { - err = dsa_port_link_register_of(dp); + err = dsa_shared_port_link_register_of(dp); if (err) break; dsa_port_link_registered = true; @@ -488,7 +488,7 @@ static int dsa_port_setup(struct dsa_port *dp) break; case DSA_PORT_TYPE_DSA: if (dp->dn) { - err = dsa_port_link_register_of(dp); + err = dsa_shared_port_link_register_of(dp); if (err) break; dsa_port_link_registered = true; @@ -517,7 +517,7 @@ static int dsa_port_setup(struct dsa_port *dp) if (err && dsa_port_enabled) dsa_port_disable(dp); if (err && dsa_port_link_registered) - dsa_port_link_unregister_of(dp); + dsa_shared_port_link_unregister_of(dp); if (err) { if (ds->ops->port_teardown) ds->ops->port_teardown(ds, dp->index); @@ -590,12 +590,12 @@ static void dsa_port_teardown(struct dsa_port *dp) case DSA_PORT_TYPE_CPU: dsa_port_disable(dp); if (dp->dn) - dsa_port_link_unregister_of(dp); + dsa_shared_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_DSA: dsa_port_disable(dp); if (dp->dn) - dsa_port_link_unregister_of(dp); + dsa_shared_port_link_unregister_of(dp); break; case DSA_PORT_TYPE_USER: if (dp->slave) { diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index d9722e49864b..8924366467e0 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -285,8 +285,8 @@ int dsa_port_mrp_add_ring_role(const struct dsa_port *dp, int dsa_port_mrp_del_ring_role(const struct dsa_port *dp, const struct switchdev_obj_ring_role_mrp *mrp); int dsa_port_phylink_create(struct dsa_port *dp); -int dsa_port_link_register_of(struct dsa_port *dp); -void dsa_port_link_unregister_of(struct dsa_port *dp); +int dsa_shared_port_link_register_of(struct dsa_port *dp); +void dsa_shared_port_link_unregister_of(struct dsa_port *dp); int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr); void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr); int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast); diff --git a/net/dsa/port.c b/net/dsa/port.c index 2dd76eb1621c..4b6139bff217 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1552,7 +1552,7 @@ int dsa_port_phylink_create(struct dsa_port *dp) return 0; } -static int dsa_port_setup_phy_of(struct dsa_port *dp, bool enable) +static int dsa_shared_port_setup_phy_of(struct dsa_port *dp, bool enable) { struct dsa_switch *ds = dp->ds; struct phy_device *phydev; @@ -1590,7 +1590,7 @@ static int dsa_port_setup_phy_of(struct dsa_port *dp, bool enable) return err; } -static int dsa_port_fixed_link_register_of(struct dsa_port *dp) +static int dsa_shared_port_fixed_link_register_of(struct dsa_port *dp) { struct device_node *dn = dp->dn; struct dsa_switch *ds = dp->ds; @@ -1624,7 +1624,7 @@ static int dsa_port_fixed_link_register_of(struct dsa_port *dp) return 0; } -static int dsa_port_phylink_register(struct dsa_port *dp) +static int dsa_shared_port_phylink_register(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; struct device_node *port_dn = dp->dn; @@ -1650,7 +1650,7 @@ static int dsa_port_phylink_register(struct dsa_port *dp) return err; } -int dsa_port_link_register_of(struct dsa_port *dp) +int dsa_shared_port_link_register_of(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; struct device_node *phy_np; @@ -1663,7 +1663,7 @@ int dsa_port_link_register_of(struct dsa_port *dp) ds->ops->phylink_mac_link_down(ds, port, MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); of_node_put(phy_np); - return dsa_port_phylink_register(dp); + return dsa_shared_port_phylink_register(dp); } of_node_put(phy_np); return 0; @@ -1673,12 +1673,12 @@ int dsa_port_link_register_of(struct dsa_port *dp) "Using legacy PHYLIB callbacks. Please migrate to PHYLINK!\n"); if (of_phy_is_fixed_link(dp->dn)) - return dsa_port_fixed_link_register_of(dp); + return dsa_shared_port_fixed_link_register_of(dp); else - return dsa_port_setup_phy_of(dp, true); + return dsa_shared_port_setup_phy_of(dp, true); } -void dsa_port_link_unregister_of(struct dsa_port *dp) +void dsa_shared_port_link_unregister_of(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; @@ -1694,7 +1694,7 @@ void dsa_port_link_unregister_of(struct dsa_port *dp) if (of_phy_is_fixed_link(dp->dn)) of_phy_deregister_fixed_link(dp->dn); else - dsa_port_setup_phy_of(dp, false); + dsa_shared_port_setup_phy_of(dp, false); } int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr) From patchwork Fri Jul 29 13:21:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12932457 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24FFEC00144 for ; Fri, 29 Jul 2022 13:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235451AbiG2NV5 (ORCPT ); Fri, 29 Jul 2022 09:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236264AbiG2NVz (ORCPT ); Fri, 29 Jul 2022 09:21:55 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2078.outbound.protection.outlook.com [40.107.22.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 340CC6393E for ; Fri, 29 Jul 2022 06:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l8Ep0lAe4QxYk10EaClpXnPw74FQxdZljW3sP9V4BhlrFBqA1kLiV/T5V91N+AkfuP8aXZjfVI7+OVB21qx04ozG5HdT+k97aEX2D4Bh4A/Nr7Er7ihxTGof2Ylefl337Se9aVt8r0CraCFDv0UYyiUDq8B82jJ63Bnr2ubEoLWwNTKTB4X0LCSgQPidGQwU8Agz8VwXZO+T3cw1nNo54ZCEz5taTo2cGoNwcY6mIkSsw0KkKcmvoPBHoZximfY6m7B7J+fsRAlY4EHMGAGm22g0OYzjXKTaEBh1anwuqF9acN1H42BWW6ylEheT/1AbtH2M86WAXod/VSt+eiuyKg== 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=bPIj9g+7xB+ZK1PaDd3mhwFp+t9PmHerfn2Vyh2ONz4=; b=gzEhCJGc8yQE1aHCrKvf6Od7+IQSZ4QxPdHmlc/RLyF9TXwiuk+S747Gt+k7hcyoG9KdYSkFR4oPWRrLtLctadvqpH1vPt9qh5Rw87FIs6wG1AoTo3GhnHs+VQwR9kpy96x6uH/WUZCcy+KKv+QMIDsL/P6PcltZOlOVZh8xBLkWHeausaDAWwb9AZHor2b9S9qZ2snCA2+2+OGN+7mAfHihq7RnBbkuKSl/lmvXZ7CTxUMofF5D0Ws8vs6AY76hTzuCYcZASyKxuGwXxdx77dfTzIHbIjqrlQCQQWS7SxfDBvcYwluV3s/qjEz0RM90PHXYcb90Dsy9w414jA8vrA== 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=bPIj9g+7xB+ZK1PaDd3mhwFp+t9PmHerfn2Vyh2ONz4=; b=szhExg4HtmVUmaKCcErbNUkEqkmGNI01wMXAqWVWFQRRXBwjRkhuCPDLyEzYWxUc/P5zO1tfvTFVE25KZ6GnIcYwEVElYcFAYYoD+Jd/PMVuPNBXeflLKyFZ9yIM4YaVyALRkERWrPVxEdR8JHhfIVqwTSKG3kyVXmGi6ktAhoY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by DBBPR04MB7497.eurprd04.prod.outlook.com (2603:10a6:10:204::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 13:21:47 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::71b7:8ed1:e4e0:3857%4]) with mapi id 15.20.5482.011; Fri, 29 Jul 2022 13:21:47 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , Oleksij Rempel , Christian Marangi , John Crispin , Kurt Kanzenbach , Mans Rullgard , Arun Ramadoss , Woojung Huh , UNGLinuxDriver@microchip.com, Claudiu Manoil , Alexandre Belloni , George McCollister , DENG Qingfang , Sean Wang , Landen Chao , Matthias Brugger , Hauke Mehrtens , Martin Blumenstingl , Aleksander Jan Bajkowski , =?utf-8?q?Alvin_=C5=A0ipraga?= , Luiz Angelo Daros de Luca , Linus Walleij , Pawel Dembicki , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Geert Uytterhoeven , Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Marcin Wojtas , Rob Herring , Frank Rowand Subject: [PATCH v2 net-next 4/4] net: dsa: validate that DT nodes of shared ports have the properties they need Date: Fri, 29 Jul 2022 16:21:19 +0300 Message-Id: <20220729132119.1191227-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220729132119.1191227-1-vladimir.oltean@nxp.com> References: <20220729132119.1191227-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM8P251CA0022.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::27) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc863551-5e5a-4b13-33da-08da716549c5 X-MS-TrafficTypeDiagnostic: DBBPR04MB7497:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GKkb+mwGXhjVeagyZnbC7xpwABC/YeJ9cv2Orne/NGhe870L4xPcf0SrDwQmXCt1HcFu41GvYbYo2fWD5XN8+0hCRd/aat2evitA73Y70xdh9mpnx8yDiIhXmLq6VYWnN++ozgm/Eg4jGr0F091tfkaWH9hlcpEYw5FiN3RaSUjLcg5jg5aQseIQlYoMnBOzrp1094ltG4zro3UIPqjd7jOiRSih3K9tWrau47Em4Pl0ES+AThRTpuvHAjmiUC7dJzW9bXfahK7+Oo8ZQVu3pvHys/2msyPW3HfRXQW+lNHzY4Eb/ONMa9K+loxFtN3fNHPh/k0STLW2BErdUjTB7yj5YFA5VIfS0OoAM63273gxm/mojO6HG33+GQMP6f7bg2+i3bdgETO8GQPWhCqFBPxx3Vw0mqHFkD7Gpa/5cvqSMFHDP650C9gNrxT99zYBkOIGQYmcPW+DcFb84BRpsjhs1KlGP80v2Eezck73CVYICA1mSC55fyAhocvY3Y30hmNf/aAP/H/O+eUNY6mILpEhrQR38YvJZhPeIrB4YFnE5dYGZU1myazQDy2y87XPmYZf0vBhZ2pTk1L2JoF4AJ/kmOehtTa9k/cwO3AFbue4jXF7Bi1HegviFxr5XloEEF59SMs/GImunHXxWdmdU8I1SBYwZO7DUkjh0HDU5ejfy5C4G7yZExEyoL14loJsLQ4wg21x+P82FyJuLWtsvzYWJeyl6arC84rx8bjBnVpSox5TcDXTAFvIxwXqi1BtJffTW0/PE0PZnq6XdjiHhts+9FHfsTTI9U5YFsm3gKg/gL67MNUVcysevwQxOM+uLryWPJwH2CH6wzI9T/zvGCZ90Bv0ctqUloY+e0+V1+4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(376002)(366004)(396003)(346002)(39860400002)(136003)(1076003)(6486002)(2616005)(478600001)(52116002)(6512007)(6506007)(26005)(66574015)(966005)(38350700002)(186003)(38100700002)(41300700001)(83380400001)(7406005)(66476007)(5660300002)(4326008)(66556008)(8936002)(66946007)(30864003)(7416002)(36756003)(44832011)(6666004)(8676002)(15650500001)(54906003)(6916009)(316002)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hr7iBirRTd7bMTlKsEi0l9mhiyrA?= =?utf-8?q?1vpLJxJJZyVkz+B94KLaGHYrEf9XZdQ6E3Zteb6azsCguZg3gWa0ulaX+3MD+NJEg?= =?utf-8?q?4YptDSQr1u5sQCwHpC3QGKTXVBUk2w58QeIEcxWiG9pEis/o6isIOdaLzU1J6b4nY?= =?utf-8?q?2ek6YFrNCfI7/FC+6rzT8aJPmoDioVupCCtHS47kjYraUG1Kpd8KYHR4j2MZFJqmP?= =?utf-8?q?dyVMvxMe4V5UYtPDx5sqKP4/wmqnQym2k3uK7Vao4BIIODevjrv/PMPL+lu8pYdhB?= =?utf-8?q?7S/LzJzBnNBP98vrlh60NC7OvAbgJsibO4ZvrmgQFHqSQmtJGiNicQIh8+mDO2eCs?= =?utf-8?q?IhVMHGx6PuOl/SxMRLLkAapt+EY9siAGRk36QWX1cH+7isk7Kx5ihBj/kwvQVQJmf?= =?utf-8?q?hdjaYDRX5DdCLPSP0g7Td0B08FvvJsaghLZQknL9XQhhV0OvVXkvIDlR32BzWFNi7?= =?utf-8?q?XugbPHNHU+jZhIuASoYJh5Uz6S5zDSkJgf7gnM8Hv8UEpQJ73wsSzub3HSl51QlQU?= =?utf-8?q?P5S3xeycfa47Sv0qyr/hq7voDE+/KAk8o9oio6iZ9lKNyxFFuzdxptXkEsgnolEy7?= =?utf-8?q?oAzGc7l2uQTnscJYA7fBX19i/lLjq+Fuyx/uaYhdNT9QE19Qv3ArJ7lSWK8nWB6wp?= =?utf-8?q?q6ougi/M9FIv0oY+SWmH5Kbkb1VvWNzWFLSlUNUXA88rAy+BeKgScH4FV3s8R0ZE3?= =?utf-8?q?XJfBjWdlFnvXreWSnC9DS8swSLBhOdvmu3RWkP64P6Bcq/M01Jvg2kT4UCn5V2dzO?= =?utf-8?q?h4oNXLYz0kP5Ve6bMMmE7DYpOVRg7ZyIuUzD+DCM2ANrTpNfoXlKU8/8PJLrgVY5d?= =?utf-8?q?rCGI1FpD+SpfAez/heh14pZz+uT3ti8vEAoEreS10dtBdOptBlY+STyCPjWTrVzmm?= =?utf-8?q?FB6RrGCJ8lEXGeweZGLnMGntlOX+lcQE/cAoEs65h0FbWbUHW+FOHfHmIwEoplki6?= =?utf-8?q?jGzQFeNyL5NZlvdAPCjeYY1BPGWzGtfldsQUf/2SkdcjWR8bsd6qmJb0BNL413kxF?= =?utf-8?q?MhB+6rQntyWaKKb1zN/YcJU6K9SQ3+3khQ1g9HjpTLrnh5+6aJPF3fipHKb0UOrIa?= =?utf-8?q?BaUC7wbZq+j43zxx1GeABb/lt85rzSZNX4n7JmMax9BfoqvirqGtt6TDj8Yd4r6NW?= =?utf-8?q?LeQoVbx+pvVg4hmpbNMvg9Op8Irk8R0hZiMr8xQ5keChFfypMfk5EGzSfghJfXq/p?= =?utf-8?q?SHM3Uy4wRtCFE+I8WbjEY0rTwDCxLkZDM9YM7/Bb6lD/QdBdhfusr/+i4XQFyMH3S?= =?utf-8?q?kqTGJx2Nl7BzkUNEfjpYaDL6IUKD2R8LLgHZMRPmUhnEdvgAq0vBeODcHesY9k7PG?= =?utf-8?q?9Dv8z7Q3iz5HgCs5EXyr66JxvG0FdFvZgbi70B0KZ0zJfZqt8io8/6Mq2Zrv2vZz3?= =?utf-8?q?8oiS+h1Dufoe+g3PSwg0rO0FojYy2avQbrdcDr+SFtCNeTK3eyjuSnYB5L6uyMDBR?= =?utf-8?q?mw5SmENyQ032aOQpBP1oGk9uA6hEux59oibPIK1G9uDi1cYOgI/zYEnoSYB5qHuHc?= =?utf-8?q?Eu7tmBSJgEgNxnGxFiF9TuUy3/OOl5xR/g=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc863551-5e5a-4b13-33da-08da716549c5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 13:21:47.1517 (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: zH26Q4F1Znwc2Z9uyKrrkR74Yu+/oS0SK5UoPRIHRTcEReamz/E0ZXH26l9YEF7pch/JMKGY2/l6pnUI0xxlZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7497 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There is a desire coming from Russell King to make all DSA drivers register unconditionally with phylink, to simplify the code paths: https://lore.kernel.org/netdev/YtGPO5SkMZfN8b%2Fs@shell.armlinux.org.uk/ However this is not possible today without risking to break drivers which rely on a different mechanism, that where ports are manually brought up to the highest link speed during setup, and never touched by phylink at runtime. This happens because DSA was not always integrated with phylink, and when the early drivers were converted from platform data to the new DSA bindings, there was no information kept in the platform data structures about port link speeds, so as a result, there was no information translated into the first DT bindings. https://lore.kernel.org/all/YtXFtTsf++AeDm1l@lunn.ch/ Today we have a workaround in place, introduced by commit a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed"), where shared ports would be checked for the presence of phy-handle/ fixed-link/managed OF properties, and if missing, phylink registration would be skipped. We modify the logic of this workaround such as to stop the proliferation of more port OF nodes with lacking information, to put an upper bound to the number of switches for which a link management description must be faked in order for phylink registration to become possible for them. Today we have drivers introduced years after the phylink migration of CPU/DSA ports, and yet we're still not completely sure whether all new drivers use phylink, because this depends on dynamic information (DT blob, which may very well not be upstream, because why would it). Driver maintainers may even be unaware about the fact that omitting fixed-link/phy-handle for CPU/DSA ports is legal, and even works with some of the old pre-phylink drivers. Add central validation in DSA for the OF properties required by phylink, in an attempt to sanitize the environment for future driver writers, and as much as possible for existing driver maintainers. Technically no driver except sja1105 and felix (partially) validates these properties, but perhaps due to subtle reasons, some of the other existing drivers may not actually work properly with a port OF node that lacks a complete description. There isn't any way to know except by deleting the fixed-link (or phy-mode or both) on a CPU port and trying. We can't fully know what is the situation with downstream DT blobs, but we can guess the overall trend by studying the DT blobs that were submitted upstream. If there are upstream blobs that have lacking descriptions, we take it as very likely that there are many more downstream blobs that do so too. If all upstream blobs have complete descriptions, we take that as a hint that the driver is a candidate for strict validation (considering that most bindings are copy-pasted). If there are no upstream DT blobs, we take the conservative route of skipping validation, unless the driver maintainer instructs us otherwise. The driver situation is as follows: ar9331 ~~~~~~ compatible strings: - qca,ar9331-switch 1 occurrence in mainline device trees, part of SoC dtsi (arch/mips/boot/dts/qca/ar9331.dtsi), description is not problematic. Verdict: opt into validation. b53 ~~~ compatible strings: - brcm,bcm5325 - brcm,bcm53115 - brcm,bcm53125 - brcm,bcm53128 - brcm,bcm5365 - brcm,bcm5389 - brcm,bcm5395 - brcm,bcm5397 - brcm,bcm5398 - brcm,bcm53010-srab - brcm,bcm53011-srab - brcm,bcm53012-srab - brcm,bcm53018-srab - brcm,bcm53019-srab - brcm,bcm5301x-srab - brcm,bcm11360-srab - brcm,bcm58522-srab - brcm,bcm58525-srab - brcm,bcm58535-srab - brcm,bcm58622-srab - brcm,bcm58623-srab - brcm,bcm58625-srab - brcm,bcm88312-srab - brcm,cygnus-srab - brcm,nsp-srab - brcm,omega-srab - brcm,bcm3384-switch - brcm,bcm6328-switch - brcm,bcm6368-switch - brcm,bcm63xx-switch I've found at least these mainline DT blobs with problems: arch/arm/boot/dts/bcm47094-linksys-panamera.dts - lacks phy-mode arch/arm/boot/dts/bcm47189-tenda-ac9.dts - lacks phy-mode and fixed-link arch/arm/boot/dts/bcm47081-luxul-xap-1410.dts arch/arm/boot/dts/bcm47081-luxul-xwr-1200.dts arch/arm/boot/dts/bcm47081-buffalo-wzr-600dhp2.dts - lacks phy-mode and fixed-link arch/arm/boot/dts/bcm47094-luxul-xbr-4500.dts arch/arm/boot/dts/bcm4708-smartrg-sr400ac.dts arch/arm/boot/dts/bcm4708-luxul-xap-1510.dts arch/arm/boot/dts/bcm953012er.dts arch/arm/boot/dts/bcm4708-netgear-r6250.dts arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi arch/arm/boot/dts/bcm4708-luxul-xwc-1000.dts arch/arm/boot/dts/bcm47094-luxul-abr-4500.dts - lacks phy-mode and fixed-link arch/arm/boot/dts/bcm53016-meraki-mr32.dts - lacks phy-mode Verdict: opt all switches out of strict validation. bcm_sf2 ~~~~~~~ compatible strings: - brcm,bcm4908-switch - brcm,bcm7445-switch-v4.0 - brcm,bcm7278-switch-v4.0 - brcm,bcm7278-switch-v4.8 A single occurrence in mainline (arch/arm64/boot/dts/broadcom/bcm4908/bcm4908.dtsi), part of a SoC dtsi, valid description. Florian Fainelli explains that most of the bcm_sf2 device trees lack a full description for the internal IMP ports. Verdict: opt the BCM4908 into strict validation, and opt out the rest. Note that even though BCM4908 has strict DT bindings, it still does not register with phylink on the IMP port due to it implementing ->adjust_link(). hellcreek ~~~~~~~~~ compatible strings: - hirschmann,hellcreek-de1soc-r1 No occurrence in mainline device trees. Kurt Kanzenbach confirms that the downstream device tree lacks phy-mode and fixed link, and needs work. Verdict: opt out of validation. lan9303 ~~~~~~~ compatible strings: - smsc,lan9303-mdio - smsc,lan9303-i2c 1 occurrence in mainline device trees: arch/arm/boot/dts/imx53-kp-hsc.dts - no phy-mode, no fixed-link Verdict: opt out of validation. lantiq_gswip ~~~~~~~~~~~~ compatible strings: - lantiq,xrx200-gswip - lantiq,xrx300-gswip - lantiq,xrx330-gswip No occurrences in mainline device trees. Martin Blumenstingl confirms that the downstream OpenWrt device trees lack a proper fixed-link and need work, and that the incomplete description can even be seen in the example from Documentation/devicetree/bindings/net/dsa/lantiq-gswip.txt. Verdict: opt out of validation. microchip ksz ~~~~~~~~~~~~~ compatible strings: - microchip,ksz8765 - microchip,ksz8794 - microchip,ksz8795 - microchip,ksz8863 - microchip,ksz8873 - microchip,ksz9477 - microchip,ksz9897 - microchip,ksz9893 - microchip,ksz9563 - microchip,ksz8563 - microchip,ksz9567 - microchip,lan9370 - microchip,lan9371 - microchip,lan9372 - microchip,lan9373 - microchip,lan9374 5 occurrences in mainline device trees, all descriptions are valid. But we had a snafu for the ksz8795 and ksz9477 drivers where the phy-mode property would be expected to be located directly under the 'switch' node rather than under a port OF node. It was fixed by commit edecfa98f602 ("net: dsa: microchip: look for phy-mode in port nodes"). The driver still has compatibility with the old DT blobs. The lan937x support was added later than the above snafu was fixed, and even though it has support for the broken DT blobs by virtue of sharing a common probing function, I'll take it that its DT blobs are correct. Verdict: opt lan937x into validation, and the others out. mt7530 ~~~~~~ compatible strings - mediatek,mt7621 - mediatek,mt7530 - mediatek,mt7531 Multiple occurrences in mainline device trees, one is part of an SoC dtsi (arch/mips/boot/dts/ralink/mt7621.dtsi), all descriptions are fine. Verdict: opt into strict validation. mv88e6060 ~~~~~~~~~ compatible string: - marvell,mv88e6060 no occurrences in mainline, nobody knows anybody who uses it. Verdict: opt out of strict validation. mv88e6xxx ~~~~~~~~~ compatible strings: - marvell,mv88e6085 - marvell,mv88e6190 - marvell,mv88e6250 Device trees that have incomplete descriptions of CPU or DSA ports: arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi - lacks phy-mode arch/arm64/boot/dts/marvell/cn9130-crb.dtsi - lacks phy-mode and fixed-link arch/arm/boot/dts/vf610-zii-ssmb-spu3.dts - lacks phy-mode arch/arm/boot/dts/kirkwood-mv88f6281gtw-ge.dts - lacks phy-mode arch/arm/boot/dts/vf610-zii-spb4.dts - lacks phy-mode arch/arm/boot/dts/vf610-zii-cfu1.dts - lacks phy-mode arch/arm/boot/dts/vf610-zii-dev-rev-c.dts - lacks phy-mode on CPU port, fixed-link on DSA ports arch/arm/boot/dts/vf610-zii-dev-rev-b.dts - lacks phy-mode on CPU port arch/arm/boot/dts/armada-381-netgear-gs110emx.dts - lacks phy-mode arch/arm/boot/dts/vf610-zii-scu4-aib.dts - lacks fixed-link on xgmii DSA ports and/or in-band-status on 2500base-x DSA ports, and phy-mode on CPU port arch/arm/boot/dts/imx6qdl-gw5904.dtsi - lacks phy-mode and fixed-link arch/arm/boot/dts/armada-385-clearfog-gtr-l8.dts - lacks phy-mode and fixed-link arch/arm/boot/dts/vf610-zii-ssmb-dtu.dts - lacks phy-mode arch/arm/boot/dts/kirkwood-dir665.dts - lacks phy-mode arch/arm/boot/dts/kirkwood-rd88f6281.dtsi - lacks phy-mode arch/arm/boot/dts/orion5x-netgear-wnr854t.dts - lacks phy-mode and fixed-link arch/arm/boot/dts/armada-388-clearfog.dts - lacks phy-mode arch/arm/boot/dts/armada-xp-linksys-mamba.dts - lacks phy-mode arch/arm/boot/dts/armada-385-linksys.dtsi - lacks phy-mode arch/arm/boot/dts/imx6q-b450v3.dts arch/arm/boot/dts/imx6q-b850v3.dts - has a phy-handle but not a phy-mode? arch/arm/boot/dts/armada-370-rd.dts - lacks phy-mode arch/arm/boot/dts/kirkwood-linksys-viper.dts - lacks phy-mode arch/arm/boot/dts/imx51-zii-rdu1.dts - lacks phy-mode arch/arm/boot/dts/imx51-zii-scu2-mezz.dts - lacks phy-mode arch/arm/boot/dts/imx6qdl-zii-rdu2.dtsi - lacks phy-mode arch/arm/boot/dts/armada-385-clearfog-gtr-s4.dts - lacks phy-mode and fixed-link Verdict: opt out of validation. ocelot ~~~~~~ compatible strings: - mscc,vsc9953-switch - felix (arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi) is a PCI device, has no compatible string 2 occurrences in mainline, both are part of SoC dtsi and complete. Verdict: opt into strict validation. qca8k ~~~~~ compatible strings: - qca,qca8327 - qca,qca8328 - qca,qca8334 - qca,qca8337 5 occurrences in mainline device trees, none of the descriptions are problematic. Verdict: opt into validation. realtek ~~~~~~~ compatible strings: - realtek,rtl8366rb - realtek,rtl8365mb 2 occurrences in mainline, both descriptions are fine, additionally rtl8365mb.c has a comment "The device tree firmware should also specify the link partner of the extension port - either via a fixed-link or other phy-handle." Verdict: opt into validation. rzn1_a5psw ~~~~~~~~~~ compatible strings: - renesas,rzn1-a5psw One single occurrence, part of SoC dtsi (arch/arm/boot/dts/r9a06g032.dtsi), description is fine. Verdict: opt into validation. sja1105 ~~~~~~~ Driver already validates its port OF nodes in sja1105_parse_ports_node(). Verdict: opt into validation. vsc73xx ~~~~~~~ compatible strings: - vitesse,vsc7385 - vitesse,vsc7388 - vitesse,vsc7395 - vitesse,vsc7398 2 occurrences in mainline device trees, both descriptions are fine. Verdict: opt into validation. xrs700x ~~~~~~~ compatible strings: - arrow,xrs7003e - arrow,xrs7003f - arrow,xrs7004e - arrow,xrs7004f no occurrences in mainline, we don't know. Verdict: opt out of strict validation. Because there is a pattern where newly added switches reuse existing drivers more often than introducing new ones, I've opted for deciding who gets to skip validation based on an OF compatible match table in the DSA core. The alternative would have been to add another boolean property to struct dsa_switch, like configure_vlan_while_not_filtering. But this avoids situations where sometimes driver maintainers obfuscate what goes on by sharing a common probing function, and therefore making new switches inherit old quirks. Cc: Rob Herring Cc: Frank Rowand Acked-by: Alvin Šipraga # realtek Signed-off-by: Vladimir Oltean --- v1->v2: - sort drivers alphabetically, and other rewordings in the commit message - move validation inside dsa_shared_port_link_register_of(), where it is better placed considering the future work that might take place here - perform validation for everyone, just don't enforce it for the switches listed, as suggested by Andrew Lunn net/dsa/port.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 170 insertions(+), 5 deletions(-) diff --git a/net/dsa/port.c b/net/dsa/port.c index 4b6139bff217..c07a7c69d5e0 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -1650,22 +1650,187 @@ static int dsa_shared_port_phylink_register(struct dsa_port *dp) return err; } +/* During the initial DSA driver migration to OF, port nodes were sometimes + * added to device trees with no indication of how they should operate from a + * link management perspective (phy-handle, fixed-link, etc). Additionally, the + * phy-mode may be absent. The interpretation of these port OF nodes depends on + * their type. + * + * User ports with no phy-handle or fixed-link are expected to connect to an + * internal PHY located on the ds->slave_mii_bus at an MDIO address equal to + * the port number. This description is still actively supported. + * + * Shared (CPU and DSA) ports with no phy-handle or fixed-link are expected to + * operate at the maximum speed that their phy-mode is capable of. If the + * phy-mode is absent, they are expected to operate using the phy-mode + * supported by the port that gives the highest link speed. It is unspecified + * if the port should use flow control or not, half duplex or full duplex, or + * if the phy-mode is a SERDES link, whether in-band autoneg is expected to be + * enabled or not. + * + * In the latter case of shared ports, omitting the link management description + * from the firmware node is deprecated and strongly discouraged. DSA uses + * phylink, which rejects the firmware nodes of these ports for lacking + * required properties. + * + * For switches in this table, DSA will skip enforcing validation and will + * later omit registering a phylink instance for the shared ports, if they lack + * a fixed-link, a phy-handle, or a managed = "in-band-status" property. + * It becomes the responsibility of the driver to ensure that these ports + * operate at the maximum speed (whatever this means) and will interoperate + * with the DSA master or other cascade port, since phylink methods will not be + * invoked for them. + * + * If you are considering expanding this table for newly introduced switches, + * think again. It is OK to remove switches from this table if there aren't DT + * blobs in circulation which rely on defaulting the shared ports. + */ +static const char * const dsa_switches_dont_enforce_validation[] = { +#if IS_ENABLED(CONFIG_NET_DSA_XRS700X) + "arrow,xrs7003e", + "arrow,xrs7003f", + "arrow,xrs7004e", + "arrow,xrs7004f", +#endif +#if IS_ENABLED(CONFIG_B53) + "brcm,bcm5325", + "brcm,bcm53115", + "brcm,bcm53125", + "brcm,bcm53128", + "brcm,bcm5365", + "brcm,bcm5389", + "brcm,bcm5395", + "brcm,bcm5397", + "brcm,bcm5398", + "brcm,bcm53010-srab", + "brcm,bcm53011-srab", + "brcm,bcm53012-srab", + "brcm,bcm53018-srab", + "brcm,bcm53019-srab", + "brcm,bcm5301x-srab", + "brcm,bcm11360-srab", + "brcm,bcm58522-srab", + "brcm,bcm58525-srab", + "brcm,bcm58535-srab", + "brcm,bcm58622-srab", + "brcm,bcm58623-srab", + "brcm,bcm58625-srab", + "brcm,bcm88312-srab", + "brcm,cygnus-srab", + "brcm,nsp-srab", + "brcm,omega-srab", + "brcm,bcm3384-switch", + "brcm,bcm6328-switch", + "brcm,bcm6368-switch", + "brcm,bcm63xx-switch", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_BCM_SF2) + "brcm,bcm7445-switch-v4.0", + "brcm,bcm7278-switch-v4.0", + "brcm,bcm7278-switch-v4.8", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_HIRSCHMANN_HELLCREEK) + "hirschmann,hellcreek-de1soc-r1", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_LANTIQ_GSWIP) + "lantiq,xrx200-gswip", + "lantiq,xrx300-gswip", + "lantiq,xrx330-gswip", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_MV88E6060) + "marvell,mv88e6060", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX) + "marvell,mv88e6085", + "marvell,mv88e6190", + "marvell,mv88e6250", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_MICROCHIP_KSZ_COMMON) + "microchip,ksz8765", + "microchip,ksz8794", + "microchip,ksz8795", + "microchip,ksz8863", + "microchip,ksz8873", + "microchip,ksz9477", + "microchip,ksz9897", + "microchip,ksz9893", + "microchip,ksz9563", + "microchip,ksz8563", + "microchip,ksz9567", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) + "smsc,lan9303-mdio", +#endif +#if IS_ENABLED(CONFIG_NET_DSA_SMSC_LAN9303_I2C) + "smsc,lan9303-i2c", +#endif + NULL, +}; + +static void dsa_shared_port_validate_of(struct dsa_port *dp, + bool *missing_phy_mode, + bool *missing_link_description) +{ + struct device_node *dn = dp->dn, *phy_np; + struct dsa_switch *ds = dp->ds; + phy_interface_t mode; + + *missing_phy_mode = false; + *missing_link_description = false; + + if (of_get_phy_mode(dn, &mode)) { + *missing_phy_mode = true; + dev_err(ds->dev, + "OF node %pOF of %s port %d lacks the required \"phy-mode\" property\n", + dn, dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); + } + + /* Note: of_phy_is_fixed_link() also returns true for + * managed = "in-band-status" + */ + if (of_phy_is_fixed_link(dn)) + return; + + phy_np = of_parse_phandle(dn, "phy-handle", 0); + if (phy_np) { + of_node_put(phy_np); + return; + } + + *missing_link_description = true; + + dev_err(ds->dev, + "OF node %pOF of %s port %d lacks the required \"phy-handle\", \"fixed-link\" or \"managed\" properties\n", + dn, dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); +} + int dsa_shared_port_link_register_of(struct dsa_port *dp) { struct dsa_switch *ds = dp->ds; - struct device_node *phy_np; + bool missing_link_description; + bool missing_phy_mode; int port = dp->index; + dsa_shared_port_validate_of(dp, &missing_phy_mode, + &missing_link_description); + + if ((missing_phy_mode || missing_link_description) && + !of_device_compatible_match(ds->dev->of_node, + dsa_switches_dont_enforce_validation)) + return -EINVAL; + if (!ds->ops->adjust_link) { - phy_np = of_parse_phandle(dp->dn, "phy-handle", 0); - if (of_phy_is_fixed_link(dp->dn) || phy_np) { + if (missing_link_description) { + dev_warn(ds->dev, + "Skipping phylink registration for %s port %d\n", + dsa_port_is_cpu(dp) ? "CPU" : "DSA", dp->index); + } else { if (ds->ops->phylink_mac_link_down) ds->ops->phylink_mac_link_down(ds, port, MLO_AN_FIXED, PHY_INTERFACE_MODE_NA); - of_node_put(phy_np); + return dsa_shared_port_phylink_register(dp); } - of_node_put(phy_np); return 0; }