From patchwork Thu Mar 11 06:19:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8269AC433E6 for ; Thu, 11 Mar 2021 06:22:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 569F864FD8 for ; Thu, 11 Mar 2021 06:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230283AbhCKGVe (ORCPT ); Thu, 11 Mar 2021 01:21:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbhCKGVG (ORCPT ); Thu, 11 Mar 2021 01:21:06 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0612.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::612]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9E80C061760; Wed, 10 Mar 2021 22:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VL0NoYC8NpHMHPztvwwSh3wEqIj82A/1tTXzor+MkQZ+vIbqz4DtWnc5mqP9l4PqCNVv0wJiIML0ZOeqdi+Bs51b6adEZ48TIeOpfj/GeM9pXw8GzjW1DW8EYB37RG5PEWaOaX8Wv8uckw6nY0R3EdypF0uzFbSxhiWVUS3KCY0n8xo3W03iRtYI3ArzDJ24fF6A9W8hrC/KM4lTy0qnWmch7WFHHLPviEx/8Bgef09x9m5DCzO5jHyGFC0e8lvn7DuvXYkEClVLAB1zx6bWNEjExmHRzulIq5upRXVPX/6XKUCFykMgH0jXlV28I+xrcBNGGmQIDGOPu/EIp+24nQ== 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-SenderADCheck; bh=AyDtI2Azne/VIEWFO+kBwKlpm+Ru9nL1MKRh6DMTeRM=; b=enxw2uwwvJx2gW5M0+ad1WGr0nrmTyF6JonY2jQt0sFEZrJUgnv3n/00L+UrQJQ+OTK8gDUR1DFw4HgMchSsExMb3QgSKvZpGDoIuzfmrLj1wuNEAm5x8gMOC5o5ITRfcIKPO9gr/1Y6lJ3dhR0+9dwmLi1q73wo0yxrgfH5vThDB3GII+cKwBYm5mMO0DWryBOQCCq11jmYFZc72OZiq09OmcG0glPhb6SB+B1NlyV6Tc6KqVeBjSwKsfch7VrYrAgsccp7T7hcwZ9snd5MLQC/klIwBvqrpFsOoivgTIxh7zJ9yDp7lnO9ZnWGeCXxq8yvbfN/0neP5wpNetML5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AyDtI2Azne/VIEWFO+kBwKlpm+Ru9nL1MKRh6DMTeRM=; b=AchWl3IWXJa38DL4pqjBTPaMAJhCQ8DVAEkfOECyHcK5JRC445gPBHc2Dx2Ox8i7k6AoohN68EDmg8lfGgD1gpjFPDBSGxWF0rtjk+X4FgyiGw62xcYa584fWL8W8Zmyzbzs99m7QX8MkasYa1B9c5b1weEKfvRgl94uEdLU6qA= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB5473.eurprd04.prod.outlook.com (2603:10a6:208:112::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Thu, 11 Mar 2021 06:21:01 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:01 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 02/16] net: phy: Introduce fwnode_mdio_find_device() Date: Thu, 11 Mar 2021 11:49:57 +0530 Message-Id: <20210311062011.8054-3-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:20:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 50792285-bfa6-4eeb-d6da-08d8e455d72d X-MS-TrafficTypeDiagnostic: AM0PR04MB5473: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y3s9U3HySg7RzM0ulEKr32CZaqOVyH9eRG2XzHXDlO48UuqHoCQyq4iHN+XudnmwzJUy8bATATrkkfwxGN5ddUwMnXzvnH5jHnetpObspEJQsKhdWsloFKOyB8jtm6+STemPWiqIUg5MyplchFHJXPkWflHyqHBWXjlGi665MuoYTM3LQNVZXlCc/CqOZYEJHUcRdzaqYV1wGAnH0dlJcuhDb/Scq+8XW9DFyo/frize27Uh53IeZMhw+B7Hd3TFJWqka5HEIBpaUnw6rZhzCTD7Q4MCHWxjojgLLuEc1SJFtQdBxS/GnV9D+w/Hujk7xFmNSRD99bz6dvQSR/OspVG8qs75QYd/RQ4Et1+lalpmX7BnyFejknLsIIgcXhrOh3HEPpogx1jaqLZVJW47S4/fM2iAusplJc2ZRGeAc/+myo24lQ4bSVpfrzaPZrlo4tFJ7jYB366hmLClsc6l4El+0qEEHt9WEA8VSQLH9aH5y7g1V9eHleg2ST71hzpXu18K7RyoI+dsRJerfii/0pytq3uDTkMEmcoEuDF2nK6wzdnDAVnKSRezTEd+3Ly2bRAJXOnmupT9ahR/JMPiYsLHLPEgKHiEYuemF8ivZ1o= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(136003)(346002)(376002)(396003)(44832011)(186003)(54906003)(66476007)(52116002)(5660300002)(110136005)(1076003)(66946007)(2906002)(316002)(16526019)(6486002)(921005)(4326008)(478600001)(83380400001)(6506007)(26005)(2616005)(6512007)(8936002)(7416002)(55236004)(1006002)(8676002)(86362001)(66556008)(956004)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ezc+YpJFGzofJlgUOc7ts/z0za7LarbF6jDYXJfbQwiUWruyfH9pX+mxa5cAGMVgrJDkaYq5M5XzJWrVGEjfx8FV5SjpuvNNJPugRrmpOTK5qxRk81mUAPjRp9NxMR+uqi2yY5Gk4A8HOkKM2figjX4cnlM5UTrsqx9oABqz0FtQ0xIE8m2C8xiui6oMZxGnKbg4Q5WtaUVUWxxmsNWq6i7Ko34OXs8iziD5Vl/sBYvRmoogDwCtyrqpGK4drbu09CMQGnW8IqDihFAi3gMGDWdwg8hM8ZCcACc/LOB6KwTBKfLvtu+iIGIG/etsbsgkjz5Z8qmbwNmnTfbHuVwIVP6JNE/onpsGsRhqMdGNoZSthd0tuQ+T/AEPutmro4BlFJxKsN/m3XbLPwtjpGd+4ZfsRwksd4KoZBt3MhjsuN1VgP3xIDXKhZBYijGqXMrFFUS5xyY6i8/1/abxsBvXjcNlvjm3ph7mB7eZ915qP3i7cQmP1WqA+IgpGzaFZqk6UwxHgBvmXOT+p537biSV4qe3rKCRV6O/FpH80pro8uL3JYoSj0dM28+5qQiGRBFqgOfqCZeASqYmO8gVlfFj+YcZW0Gh1xsGR1VV4xgvXHjIbda5iTd275AbCQf9LtpUvNQPGfkLI0s2T74c1S9/aEu/qnKv5xkH3GnbPGc9KYFEGRob2hpO6x5YMRIs6A2J9O34yPbbHEDZFymGSetmJ5rGFigcYtJsrO9nBE6Mp6EHEde1tSL6fNhxIUjlMAPeztJQzRJp6mP/+aWTpdlZye78GTSc0sx5hp7GqOYMBo3lN5CJQxUrggKBUx+951Dh2nRCMnF5yGzMK7p792/u1QfWNafN+DonrtCpoxQJaWDVMtraTklkJbp0jF6d8j/KTSVOTxfYwmZ9vclS0WYpBID84jhOw9w3PgxMG/O1aeL0BCDGXBtSnyWxOv3ykYkABfxvRj9iX3gjxeyMnwBbVhyyhhbUs19NTXjiYRq6+ZcEL25U3Lu+y0FJ2l5tAGd4ZVfiwUQTlhWU7LejXVGKV6H1Msju54MaC+kZLk4FNnrJrt9tiEjBZgfcz49AKtu8gEQF+qdNy4hCqWA09PMlt+a3EwQ2mhK2Q4k+z0G5Jrv3DxT7DnOhGccHgwQ1SpRITvibpS9OP29qiY2dxVBaTt5tckF4M4A950Pn0G0rRJUTL6dLJY92y+2SgwOAYQSywBV5O76mfSdlAVIQPhoaatKU6QELfwNHXIzZJf0gV1IFUXPnjLfp1uYiPWCRIy7Mn5gS5CypcZUMtTZPXaz/ssW8J12HMFNh/cDBo3v9MPRpa84kWNXpTM/C5UtrFpkq X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50792285-bfa6-4eeb-d6da-08d8e455d72d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:01.0811 (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: mWJ5ttTKy5vxg426gV+anJzMJllF+AQjYSgQ4iLcAenVKwJxMMIqaOsvQEdsvrFE5EWgw9hRBMtix6HDJ076Rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5473 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Define fwnode_mdio_find_device() to get a pointer to the mdio_device from fwnode passed to the function. Refactor of_mdio_find_device() to use fwnode_mdio_find_device(). Signed-off-by: Calvin Johnson --- Changes in v7: - correct fwnode_mdio_find_device() description Changes in v6: - fix warning for function parameter of fwnode_mdio_find_device() Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 11 +---------- drivers/net/phy/phy_device.c | 23 +++++++++++++++++++++++ include/linux/phy.h | 6 ++++++ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index ea9d5855fb52..d5e0970b2561 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -347,16 +347,7 @@ EXPORT_SYMBOL(of_mdiobus_register); */ struct mdio_device *of_mdio_find_device(struct device_node *np) { - struct device *d; - - if (!np) - return NULL; - - d = bus_find_device_by_of_node(&mdio_bus_type, np); - if (!d) - return NULL; - - return to_mdio_device(d); + return fwnode_mdio_find_device(of_fwnode_handle(np)); } EXPORT_SYMBOL(of_mdio_find_device); diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index cc38e326405a..daabb17bba00 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -2819,6 +2819,29 @@ static bool phy_drv_supports_irq(struct phy_driver *phydrv) return phydrv->config_intr && phydrv->handle_interrupt; } +/** + * fwnode_mdio_find_device - Given a fwnode, find the mdio_device + * @fwnode: pointer to the mdio_device's fwnode + * + * If successful, returns a pointer to the mdio_device with the embedded + * struct device refcount incremented by one, or NULL on failure. + * The caller should call put_device() on the mdio_device after its use. + */ +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + struct device *d; + + if (!fwnode) + return NULL; + + d = bus_find_device_by_fwnode(&mdio_bus_type, fwnode); + if (!d) + return NULL; + + return to_mdio_device(d); +} +EXPORT_SYMBOL(fwnode_mdio_find_device); + /** * phy_probe - probe and init a PHY device * @dev: device to probe and init diff --git a/include/linux/phy.h b/include/linux/phy.h index 1a12e4436b5b..f5eb1e3981a1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1366,11 +1366,17 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); #if IS_ENABLED(CONFIG_PHYLIB) +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); #else static inline +struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode) +{ + return 0; +} +static inline struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) { return NULL; From patchwork Thu Mar 11 06:19:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D61BEC43331 for ; Thu, 11 Mar 2021 06:22:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC00D64FD8 for ; Thu, 11 Mar 2021 06:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230387AbhCKGVh (ORCPT ); Thu, 11 Mar 2021 01:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbhCKGVW (ORCPT ); Thu, 11 Mar 2021 01:21:22 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0621.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::621]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5AB1C061574; Wed, 10 Mar 2021 22:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SHH76PMkc+Qzg8xmpJNY3EwGJEKALSDvycd+YdvvJrqbSFlJMgTyzMwh+Ni5lSl6LCBDgly8H4ETT65UztfGjtNtx9B9B3AcAOJ735V5gFSqSQQCRTtGjvNsxDp6ukAiXhxjwCi66Lfb2SElwie5zkukFaLCJhSiOeQ+CjVI7LTCMpYr8DslQ2kQAjop+uIckV4ABU/zpdkE3RviKWPjjt4uuXP4lteQT9xMOeiP+2yyPuIFb3qHP7BnQmzj4b6BlNxjV866PZgSbrVOT68NzAg2jWgnDKcn3jA0Sr/HoWYSWihl6ZFCSMvXpunD+PnN8o/TRwOiD55bH7afGaVMDw== 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-SenderADCheck; bh=yUCcUeOixe4seIGhSVfibievgonYYsJIkqsL6FMhwA4=; b=DEGMfxbsOKr+nEOWp04WvIcPnRx8yiLHwEm5SsLz3n8n0vwbA+ohF9VPf5uUZOk4Yfy6QxheVjyWd6pMkyElxYuXQLw9GkJk7us8E2WgpE9pN6mbEcSXXE0VT4/veqbjgO0+1zzvTUaND9ykMohn0Vyqs7tyOmit4c5QAN8Iw8jsM8FIPiBJ4uu7n4oK+HOogDzc6ddObuXXRuxVYPbaEdzALWUENXilNybgkAE1Z3BdpKiqWCrLYRF02zEHVNQPFDFNjdMEPgo+4Hfj3RPLUm781/Q4pTeqaDpnM4cPbRuwJ/tmcOpWFLk7Yt4SpKtIjbRCZdeLbGmcMed1t1mv1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yUCcUeOixe4seIGhSVfibievgonYYsJIkqsL6FMhwA4=; b=IBdfwMz7mKpOK7ryGdt2jrBqUeY2bzFM4DeCO+pYylyPmlgxQSconDHPlckYCfRjkaLhNsfVrgOYYemoPJ6CtaSZ6+3gmnjTXL7ztsVxGAbaf1iKWFibyB+uxhZQItzutYJBFljHo0kjb0EcAE5CdKZbMxVAf7fJ09DdZWyw6IQ= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB5473.eurprd04.prod.outlook.com (2603:10a6:208:112::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.26; Thu, 11 Mar 2021 06:21:19 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:19 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 04/16] of: mdio: Refactor of_phy_find_device() Date: Thu, 11 Mar 2021 11:49:59 +0530 Message-Id: <20210311062011.8054-5-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1706caf9-587f-4099-7561-08d8e455e1d9 X-MS-TrafficTypeDiagnostic: AM0PR04MB5473: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kiB6ILo7oDMvY2v4bzrKvgJLTYZzUBgUV5vAEYk7giRgp5X40cvs6YBz0iZYt+RzeXArVsCmWoergwAp7rs5HyZNTNmSYQ7Z36dByLpG2frCtr3+Ytj7vQ3h3VJwUZFgbdeTll94ko1K01Ig5YejdusMrxlwOPSE5RNB3nVqmPRnIgyikPIJWl1FrAxmwpHr9CLuGyr6/5xTROHQDsoSdT3OSe3ZQBbaIbJjnxpi0nlB6bPcWkd1t9g0eZNr6tWoJshfrAYhylEWNZO3uXWlcCVpwl3w2Db7Rq005nSTg8lRIW3nLSsG9T45VkVRK1GnM68qCXgncIjeY7949B3MIF6riWa9ywFZKrpMkJgMd8J6tRZwDwu9NNrBHa6/sHL6Mp4Ggc2NncStlhitW0EhMXEq5NN4vFlr79W+eG6wCheddB85gq5AOW7M9MNR0oTTrO/Jvv4p/A7tqqcTcmBhWANVdQCyAV+YVpjhlKTlrPRqYVpF97T25FoYFEv5ePwWYBntICtUJeF3UCh136GBu/q2PN2pAB4/zCYHFCdvTHI9YsuZWzqvfu15m0QoU+aOCRqn/RBavybhcfZ0OmsodA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(39860400002)(136003)(346002)(376002)(396003)(44832011)(186003)(54906003)(66476007)(52116002)(5660300002)(110136005)(1076003)(66946007)(2906002)(316002)(16526019)(4744005)(6666004)(6486002)(921005)(4326008)(478600001)(83380400001)(6506007)(26005)(2616005)(6512007)(8936002)(7416002)(55236004)(1006002)(8676002)(86362001)(66556008)(956004)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: FLyl+bbrwW7vuW8JwVJ1CxGRs54jHIW0ao9ZjoDknC2Wf0thdnFJ9Lp/z2TZVztILA+9TzIsbs9iVi4QTFUuByLJ4g4ZoJ0iFZiPYNSvopyg9ess7szd16HXa2/skxl8ZC3Zz7DvetaPNJWF3Q+YkQBVWQl4u/JWopb7cYeKbJa21cnNDCCZwSfZt5Dwrqa9tXFUp+SmuF8qZnGupLbAJmo2fPAMEd0Z/9VgKvxOkQ0c4Ex0E5PCYSbGsIq2qZG8xQMCQyHThvqoA/FOnMORc4rZEyCI2tUTFfttBj21x6dBV22cvh6bD2ZszGAa1qG1zQvh5jL7lA9j+Pge7cXlGKybuxtzLTPvx3kFiaQTsPVEoncdeJH2xNFveGl9ngD5/mHtzx7AkypSztEI8esOFjGNIkhzirH3E3UW9zOwZyuJRSdQsORzqyhP6POBO/15FfYBmcaqr2W7gk5n1TJdlzab4LBrg2zTftw/LbQDWx3cUhB4a5QQbf5RndsNOivZpOXzu97GwjxGyLEGtGzKeVQUMcbQ0OVkz3Ie14ha5fquYE9pe+gN2dLsObWt5NjKGqWhAKKkUdc1Fp4MSmFtsitCF85SOyyruosRKg3UWQDreHAlwspW9eC/D4Z73K4F8agwST9CDs2utojsTw/w9/aP9PHacy4pakYtSjIaMMn+PhH5PbdG2KPFCzB4brFzoU3rnHnHeP+pxIwPclqrwRJk1WLq3IVohpOn2uw9Hf04ur1yVaER5gUP+en8AW4AdxU8OyHF7KsgVTTJGm01Q5JPt8W+AUa0zSV1WFQEN0vn+c1WRcWKVTiKe60ud9rGUIUD7lczooIwYDPgNK2/gbSgHc719BrupH31Pq78qxYEVdI31/8lmJ80Z1upKmOSntvsG0HRFkEXbIjWpkWHqlz2dCzEuut20WAkEHapeX19r9NqSnTCUZwWEWEBMRx3H4gmbIpRqOZ6or1P9oe8fUeQ88dDEEXlZrfhnURufgTM54CBs6qmwrtPjhvtFHoM/KKiCRIj7xkoCvGWM0ioRxxG7uechzDa4qp0jPVYVn7CPL4wfIvkYX/OrbS5nBipnBX3kv2XfEeuRE4b9q/whcSWkKNAPcuZcSGRaqGpB9uxSqgWqtjhPVCAHzoUH1j4mDvwxpecL6YmVUrnHL9A4OJwJT46r7KEEsPsq1Vpmh77/jUE/9Woeq02GD8BaEoKveAsNmpon5qCSigdXaJgSn5vN1jMAt00CBCvcb5u0owFFxHNainVWpt4xtimpvp5MiFATzPkOaiI6vZUf+B6hOhBJhr0h9tq6u49CurX0e2hQLxGo3tU7AUxn+GPvCXZ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1706caf9-587f-4099-7561-08d8e455e1d9 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:18.9261 (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: ZXeiM2EEw+rf9OjwOPVGOhPWV40SE1//TI/6nPZYAnK2KC5yTasoZJvH9a5xxAi4edB/UdTX88TdhX5NDSRDXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5473 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Refactor of_phy_find_device() to use fwnode_phy_find_device(). Signed-off-by: Calvin Johnson --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index d5e0970b2561..b5e0b5b22f1a 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -360,18 +360,7 @@ EXPORT_SYMBOL(of_mdio_find_device); */ struct phy_device *of_phy_find_device(struct device_node *phy_np) { - struct mdio_device *mdiodev; - - mdiodev = of_mdio_find_device(phy_np); - if (!mdiodev) - return NULL; - - if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) - return to_phy_device(&mdiodev->dev); - - put_device(&mdiodev->dev); - - return NULL; + return fwnode_phy_find_device(of_fwnode_handle(phy_np)); } EXPORT_SYMBOL(of_phy_find_device); From patchwork Thu Mar 11 06:20:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5354C433DB for ; Thu, 11 Mar 2021 06:22:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D0D664FCE for ; Thu, 11 Mar 2021 06:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbhCKGWH (ORCPT ); Thu, 11 Mar 2021 01:22:07 -0500 Received: from mail-eopbgr20078.outbound.protection.outlook.com ([40.107.2.78]:58371 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231313AbhCKGVs (ORCPT ); Thu, 11 Mar 2021 01:21:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jK2NXiEmbBbc943eAgOt+mOFt6E7dWqqkck3+vzd/pzlpZzZrMHwOF2WA2IBepty1Z18EdWBXwu086WqqmL5EAJQcwGMAss0pVxSV8XHeUDjWCmHCfJikMP87l/7jInol6QaFLN9Wd9Xiq20Q2voAylpWw/2SVzDeH+2lIc1SZ3izBNt6ATwwxlsPpBdeteeEN5M4z7IPAMxtX+E+pjmS5ON9r1gIhYcif2IOWPH4aTQJN+qEWefLz29gsRphj+caZ+OmgLAFak/kOrP/qQyAyDaQUv4sDYBw9boQjiT70lPFql9GQ7nr8mEnYbmP8usJAU9OO7sZQxgl0QTcw++5g== 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-SenderADCheck; bh=a+8NwrK/szoll8K5Y2CAeAVgyQAQMY4RtCeOpAOwO38=; b=Lrnux/8FMJcEy/abXpw29RgTtFBH9X+D1Pqu93ID0TZ7W6y0hrKHen6lmLJektWZdAosqfP5+VVidsfoov5v4p8m5SjtRrz6S4umD7qGfeMRDgeJpDwYWC14lb8RDL50ZOcplc4Tmf94o3+ud4lSjLuNcVT6RVlmXODBYk7i3SrGWaO6HIcwlIlJubS1WNVS6E6zqQjJtgV3f5Nj4YLvuxsReHip0tyAWiCVsBehiyGhHwa20haKAcWJGEncxDBeLTQEixjWa6BeAme5ZXY7jqwiXypPw/X5qwFgRnrUr0U5sh8DBMujO5k5awHWB4MgMywwm26VJbALZwhJShD85A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a+8NwrK/szoll8K5Y2CAeAVgyQAQMY4RtCeOpAOwO38=; b=Orrst5+z7qo3AKiqkZFa3OMl6S7hPOPY5lIlpf6wczqpz6IB+HsVqH83g+DY9vHPl+Sobo6oHhABBpGJTPsJNHbpDKiPBTGr8nvqQ6J06rit65AmSrXvtyMVnHkXbpk81u4YZ+qN2U1mpxySwZw2TQ7AUf3263zeM3b1kN5hMdg= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:21:46 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:21:46 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 07/16] net: mii_timestamper: check NULL in unregister_mii_timestamper() Date: Thu, 11 Mar 2021 11:50:02 +0530 Message-Id: <20210311062011.8054-8-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5cde01ac-0ce0-4067-1026-08d8e455f204 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NfG0GbLAYsIXaATvTuYwEdEflNXYT+F0p875XSu0yTHJLe6ekRvnF9UCv+guFd2h3k37Rm/8tq8gK/885dENxJnChoXo4lQtFuZ7VJlulCBeD7jn8VMxAqbTWoUUyo11K5EqqENg9Xp1a/8hf+EaCMAhpJiTY1wyPH5nDdB5lAxsI3oNAxGpwZOZ8GUwBilx0x1qmmu9WuzAU3uQr/jVvhohj+s9khZm2V35SEUc2STSEDiiXEDqnUiMPTKfb6Z/rv2Pc4UD33wmQxFcmHb3jlZaIa/7OUNPMw+r6mePR+OrsDjkBHO1SHc646FfMBOD3y63yHnmYzxPtSpmwr+O/XL169HUnaCmGnqsADFbqmXZjy/BiRJ8L2fv5iz1/PENWq/PF2cJc83Y9tMcewtFzluY+cte1fhGfQdG+MOZ/tE+PTGIeHAnEhHM42C4Lqq6OsU6bG3y/8FEBFZL+evofWyiYZTc40jBrcRqPk22SZC3vRJq7I2apk9eFkbU9A4I2j1Mcv1Cdaid6ogwXjIw5moiK8mpkC4frARtMckeDfSkQTisITo/vuAJ1uVBsl2Ider4jXEIRat9Kilgi822MQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4YrwtBzItUaS3Eq1SfR1FmY4L9NVjh7xRAxd/RZTUBli2CCiK2rvrkTm6EVskOc6xpfUB1/B9wKbsTabKlAQBV56zP0189Hd8ZUj0x6DH47Sj3Wyb5UbrE9owyJiPNXCgfriY7MlIS0v+Q9Ed7xifbVylKdjAG6yo9TLEergFuOsu/C1TcGhBwuy9o0BF89RWIELPMGMvZR9vgPWBsi5c/kRZBXYlo8SG/9m68KUDH2yg1P7+rRpayG2CjtcEp57BspEO98E/3DbuI26Ck8NICJPDFuBnB5Qgs8HCHdUb1UV9Rgenw1ZqGXvqYVDhfC0VAzvIlXwc17h+HGxKOInMc9haAwNL/TSwwEh064VnXzOOWl6keG6EIke904qF6jylmG8oCUuV/oPR+k9DtDIsswDwuCIF/e0cLqGi33M7R7EanQAvshq+Bi2hsLLUzlFiaCXx25B/EHl4UeonlUe9Rory/LNu0tBF2fX/YreoxPkjCQ4qPHFgn8XXUDvdjdJlYQuQp+3DSrh484IP2I7hkVInqNpcyN97CHsG/yhNhCuhdObdx1nRMBv+Gj2q6TrqDnYGvgnmFoDY+0U2yS4m6rtU+OdvzsOtjYgnQQXk3D9i2Ne8F6B66fiuY/K0cUbYZ6TfpY90+g6MuvX5Mi0O+ANwTnG7BcL/ztmZTN3qsFCb5CnZn2Jhna72PIvHcyLaitdUqnD/zyIsRsJTVfhlDHfhm6FDszarKrn3w+ivs8wMgl9NB0NT0D4l/wrLk/VM7rTt2V1pFOtiLzPsNVgS8Av3qRf4t2PryoNNrfhPBEviJRW0oEbVD66YH9sD5/LBQfuuOZTNHgVsk17OA6+ObSv6ZID/o+pjRgs1qoP6fhnNek0skDS+41Ar00pXAZwBi+q4rKYd+tM+r9Tho/R5VAbRJs0s+rAK6Dg3Q/rPOr9azy5W35hiyJVbR4/94wDod8AI81nxAc1UnLxT83k6+Jcqcga8B7xSRvtjUlGvnJCHw2nHwa35GWXnWF04J4rdPzz2Nk3+GhOzplJ597KOdRnwKAY++q7uLKHSUDYOhJIro4I1tzQs3gN+OWrL+O8Vakk8KaHjpGa90Xc4vFolBNKNk1CpvOnZQRJimB6x4LkUgs4UD4hjbKRMoycpx/S9+VjpU72sUIj8HjluOgSVWGW3QDj6sKhha7EabRacLNKo09sFz89V0IIdJl5xurAf8gE5N3qm3/YdJMHVcUflI8JNxhWdqwcH82JErvzUgDQU8Wg2MSdp9kl2XWt8gNywwU+hQdLFJlV98VHZJWX6yLo8Q5SuGbcOd8NB6x7mBmUNI0n2tHg/7fFixmRPNFM X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cde01ac-0ce0-4067-1026-08d8e455f204 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:21:45.9139 (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: fXhT/Eb8aafcKs9FBrF2a72Uyq+1shazAfqgEYqA2WKE5bH9e9G0do94hTe8j1cx4o50JMd+0WhsuwwCdKreXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Callers of unregister_mii_timestamper() currently check for NULL value of mii_ts before calling it. Place the NULL check inside unregister_mii_timestamper() and update the callers accordingly. Signed-off-by: Calvin Johnson Reviewed-by: Andy Shevchenko --- Changes in v7: - check NULL in unregister_mii_timestamper() Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 6 ++---- drivers/net/phy/mii_timestamper.c | 3 +++ drivers/net/phy/phy_device.c | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 612a37970f14..48b6b8458c17 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -115,15 +115,13 @@ static int of_mdiobus_register_phy(struct mii_bus *mdio, else phy = get_phy_device(mdio, addr, is_c45); if (IS_ERR(phy)) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); + unregister_mii_timestamper(mii_ts); return PTR_ERR(phy); } rc = of_mdiobus_phy_device_register(mdio, phy, child, addr); if (rc) { - if (mii_ts) - unregister_mii_timestamper(mii_ts); + unregister_mii_timestamper(mii_ts); phy_device_free(phy); return rc; } diff --git a/drivers/net/phy/mii_timestamper.c b/drivers/net/phy/mii_timestamper.c index b71b7456462d..51ae0593a04f 100644 --- a/drivers/net/phy/mii_timestamper.c +++ b/drivers/net/phy/mii_timestamper.c @@ -111,6 +111,9 @@ void unregister_mii_timestamper(struct mii_timestamper *mii_ts) struct mii_timestamping_desc *desc; struct list_head *this; + if (!mii_ts) + return; + /* mii_timestamper statically registered by the PHY driver won't use the * register_mii_timestamper() and thus don't have ->device set. Don't * try to unregister these. diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index f875efe7b4d1..9c5127405d91 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -928,8 +928,7 @@ EXPORT_SYMBOL(phy_device_register); */ void phy_device_remove(struct phy_device *phydev) { - if (phydev->mii_ts) - unregister_mii_timestamper(phydev->mii_ts); + unregister_mii_timestamper(phydev->mii_ts); device_del(&phydev->mdio.dev); From patchwork Thu Mar 11 06:20:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABC22C433E0 for ; Thu, 11 Mar 2021 06:23:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7798D64F34 for ; Thu, 11 Mar 2021 06:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbhCKGWh (ORCPT ); Thu, 11 Mar 2021 01:22:37 -0500 Received: from mail-eopbgr20085.outbound.protection.outlook.com ([40.107.2.85]:25790 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230280AbhCKGWI (ORCPT ); Thu, 11 Mar 2021 01:22:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehcJodcgysLkFIjF8dJrff3uwygR3nuaC3zLeemdzypL0cBipoEeFhPvjtsHOlDjdHZ6WDBOP/02Wr8lmIL39UPo7pNTgiGq9ctrEsC7q0EXoIsiC92s+H3VkVbArRRnvugGZNHK7TlI4g0vqFgNZrVi7S2pybrCYlAWX8xE63gMCIBMyp+AsgrQwFLYTCn+cSzpaH1+I4eQWFW5ZU/4wVcJ9DS5A/fEli2grKZnDzOr5cJCUikKLQ8Tba/fL2N8E/ENGJ1iiC/Bx8S2ZrCmGCnEF+GadCdHhYmc4KawC3ixmduez2WuT27PHLg9klp7BLx9URm13f+Wfsf7KTXwuw== 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-SenderADCheck; bh=TCNvfizjWrO5Sn821EUj0HeifNRRaWcvF9O4nLZwNDU=; b=Ahlde0XKwFoiiP5PpxLYSUN+Syh79tyEh8xo2BFR3rsG6eLOeHhjZZgge60recn5FCM+VLPnrVyuH7jFYaSamHAMJvPx0TBiaOzwxJrKSCAU7tSljUgKR900UMLY50SacS43dueQtQ8ztqDbJeEpeifvbFcG19phv7EVmsWJqZjlBpGL7pHaw4crojNovxFFBvTrhN4JW5l0mPeZ5suz7sNT39y9T2ioikBTeKw2FeEMDMDrIZP9GF+Znd+xlzkPJc2t52gSRSGGPbRhaCg9yIfMRcHkmg1fGazR/fuloAnBqmhyJvsxptaX67m2b0rwpU2zfpBz2eEeBF6odE0vAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TCNvfizjWrO5Sn821EUj0HeifNRRaWcvF9O4nLZwNDU=; b=GhVg4Uoi2sFscONMyz5FX3u7PK1ui530U4OTjSfLaj/modk7B9gqG0uN3y1WBpr6BALxfgI+Idm7e9lwR3+R9gxL86T3iXy2wjQ4i2r+dPLp8SlgfPQieRmYcb2SwgZ851xEVzbpq3XS3OleGaA90SU2Rxl6rHP8SZuovECpzbI= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:05 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:05 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 09/16] of: mdio: Refactor of_mdiobus_register_phy() Date: Thu, 11 Mar 2021 11:50:04 +0530 Message-Id: <20210311062011.8054-10-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:21:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 631dbef7-000a-47c9-cf4f-08d8e455fd4f X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R5xX7DXyoBxPMBb7da6uwPP0yGXn56U/dhaCdLPfzIo4Nj7mooHkw9HCEezaSd2wlbnYEJjlSuxRMESgQR22RX82kwgsvYVxhNSL0ZNr4v2lJPbiC+XZYphRYJmLcZoZi8w3EXTXJ1AWvNy43PZ+XqWV1f34OOkwG5YJTQvcsXe6lH92sqSuZSQYzNmoooOXxTk+QCEg8SWoMysxMLgi66d3iuEKuSBAWrLkYp5sPiTkM2oTZ5tQGwDw+BkMqiSaPGtxDd2roSJCJ0NejWvnmuJRuC8gsqJv7AwuWGCkAMDe29Wr/03ExfyySnFSOzPURuSIAY+5U7Znv7LW1Msw9YD2X1+Snpf9e4lPnKLxi/tNTOqHAwbsLV+jOGJzUy90apwZn9IVpnB7PwU0e5sSzCoPh/dG9HeNwbt2MNWUXNLFB2q80d/pgfNKq5+SWNzjQDpZlZgLf4IptUdltmNmn7i5UaJfNGo+kJCS2Djuk6vP+3pHyTJ83GvBfimo6F4MIPRPIxxGVo0cu9Za7AIClkeL+9EkW3CrgqQmlqq4GbCPlSLqfDB0mAelXVZBQiFvjGaGbjupPylWlBHLiZttV+kp+2CHpdFapSvUq24v4jU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 90h7gksaSkjnNbXPlC3glYRLurun7+jE5oYfmdoWCeF9FyaHnLz4MG80OK/ZKVkgtNxy0zxsLMjOyYuedQ2lNBFCX+jdwE1c94CbSzURfuhoYHV6cbfXigstWd3rFzXGgE6pJTj1G/zAEHovqCCDq7A7hAUeGYeF/ooBaHVm+vXF8CXoM7SGoV34JPULYgYrOk2Q3WerLUq8kK/sBBBg1k6r3O6WmNVCzlAWuBnJv+uu5X+QieavN2nRusnwkqHmQ9h5KPIk3u3jNV/KVFT+Wt6EKUgijcEV/qhtQE/4q6/7jwhTGdbF+FjkFeorSYuot3/sCkaS4baHfF1BqA3bCwTu+oj3wlh42fmIq5wVPqfrX2XVXx3Hqua7FIuCeaW+DOp29A5cB9OinatDXj+a0LVnqGkVx/PX7DIKIEu8c7SbThpF2egE0wAaiT5ToVGxrsnCoiQWtvfSB1WQOeIPzr/0rsdvPoLGrURMQL+H+7rjxaBg+1gKoC4WptQQAHTy9j1nOY4Lmw1roeeofsUVPf0C8iDQvhhaUW3LhWp/pcnr6cEEBRiXk8gAm0ny99lLqbxNJGz5W0bd04jnO8P5FCDsD+FJKyLhzmo/rHWJ+cVbTRk3vG92CIeMjvKFwQPjYO9QmJi4YfdcUvlEfz5Jz5XAbt7EK0xqXSrqXzb2pUJFYKBVI9bX09E6zB0K8cx+Dp111Xys8ILQWfGwvEaWqeDpbdtolJKqLgnr65vAOq7EwvGblRRolKwuEjSmdDGk6+6ECyH0bj3CtUe67SKXGPxAqDjroBhkQxKbHIS24kS7rIh7NP92slc7ORkV6qupKkYkbze2EvPSBHjjKM/5KlkPlJor5iExSh3sIKu9Y3tXZjvRZhXtKObVugtYnswJog2iW2tBMxM9dy5o6KXeCL6jv1aPRv8jTS5TGYCEEvxRQpxv4l1VXOT7Tm7Ts3wsJEBzy6uKGetv4we3U+CX0iwj8l2QwCKh/+ykO2fxJHbdVa6CMeUDsD0cJB8tsT5ghywJofVqQLELcNZJTffCfJhtpxYzSH07sYRfnEgO2eDNbnsHkP/3aTFXbuPw7sobDThtkyUlaumFeIdTK/wjn5pLkYN8S/ZxzsBnDzadqWUG5GexI2hh7ORiEISHGfPQvph8/OJ+6mSDoJOV3JyOT3q7dFHUR4ruNna1hdb1k6pCx1rCnL/JP/5Pui57K2aaMKxP2PIoKwc4xGRprj8cqsGoyERKBXcRjL97RiF2k2q/01jvQKkAyFcyG7OVnjIKrehUVLu9sm6nQ54x26U9WGZNg9UXO/Q0xp9QdcBJCarK0hjI49nFwT2jDmVrTwu+ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 631dbef7-000a-47c9-cf4f-08d8e455fd4f X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:04.8433 (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: SKxgqg42Vpj7esG0mb8cAlYLAKBGCxic5D9eZmMTFE8hzQ+tQSqYbfih6NAXMNwSA7nW5HB/XU8/1MkafUYEWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Refactor of_mdiobus_register_phy() to use fwnode_mdiobus_register_phy(). Signed-off-by: Calvin Johnson --- Changes in v7: - include fwnode_mdio.h Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/mdio/of_mdio.c | 39 ++------------------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index db293e0b8249..eebd4d9e1656 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -98,43 +99,7 @@ EXPORT_SYMBOL(of_mdiobus_phy_device_register); static int of_mdiobus_register_phy(struct mii_bus *mdio, struct device_node *child, u32 addr) { - struct mii_timestamper *mii_ts; - struct phy_device *phy; - bool is_c45; - int rc; - u32 phy_id; - - mii_ts = of_find_mii_timestamper(child); - if (IS_ERR(mii_ts)) - return PTR_ERR(mii_ts); - - is_c45 = of_device_is_compatible(child, - "ethernet-phy-ieee802.3-c45"); - - if (!is_c45 && !of_get_phy_id(child, &phy_id)) - phy = phy_device_create(mdio, addr, phy_id, 0, NULL); - else - phy = get_phy_device(mdio, addr, is_c45); - if (IS_ERR(phy)) { - unregister_mii_timestamper(mii_ts); - return PTR_ERR(phy); - } - - rc = of_mdiobus_phy_device_register(mdio, phy, child, addr); - if (rc) { - unregister_mii_timestamper(mii_ts); - phy_device_free(phy); - return rc; - } - - /* phy->mii_ts may already be defined by the PHY driver. A - * mii_timestamper probed via the device tree will still have - * precedence. - */ - if (mii_ts) - phy->mii_ts = mii_ts; - - return 0; + return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr); } static int of_mdiobus_register_device(struct mii_bus *mdio, From patchwork Thu Mar 11 06:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8278FC4332E for ; Thu, 11 Mar 2021 06:23:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 63F9164F34 for ; Thu, 11 Mar 2021 06:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbhCKGWl (ORCPT ); Thu, 11 Mar 2021 01:22:41 -0500 Received: from mail-eopbgr20087.outbound.protection.outlook.com ([40.107.2.87]:62542 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229731AbhCKGWe (ORCPT ); Thu, 11 Mar 2021 01:22:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G9JeHM1M6YqumzxQWyag2U6BXkTyIRF1OyMCD5i+SmGZPTySckGKfIrNFnLqoMScYGDWt5Yfjq3uqvNy8/i384d/H9T7k8AQ37KvRZtiQTAGd1cc2cfEIw+fLQ/f8IjL00Qma5dT95+9gQ1Y4RZWOfWNMyeSVDHMS1KSNgfdUEn6NjIzutsZltlId15F/011StdHvb3i6QL9s6kqQqB72/g3zQrHcrOc7kaamdoZ2EnEFgph2Aycr7GKOIq8m2zNAGkCN0CxrYZ42wk5JfOwLFxS9WhpodI9u3jw5e6NLJ44s/Rf5BY7zRfFfJupH4oItEqnzIcgcQscETxYvHsTTw== 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-SenderADCheck; bh=FbeNqHN9xOSnqFb3oOZPxdTI8st23xm44ggrUr2CeK4=; b=M/kTxJ9HBqC2aelBy+6FTTDPOq5gutCViNvpsNDEtPEvu9lha0zcBWlDlayYetA9us2/Ros/+dri2sHFFz65n/P0TucVxpro0s0+Dr4erZtjp3WYSgRy8EtczFxWZvDc/bmaDs5BkviuZIDyLlMaudyU3xK9ZU6suxLwxiTro6fPccz2ww2UTTZKRcWsoaJmYNcjCTNmAaOOrf5smvLdvM6reOhPGLXVBPjoUfPqr1q1F2QbwtPUfhBz7zHmaf5BlRQWOFEHFgSMXvuPIsxvj3GNqRx2nYvOmKtF4HK1vEsliDXwV7HetoHK2DtW4/A9gqoseLGuJ0bjRMNRBgEQBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FbeNqHN9xOSnqFb3oOZPxdTI8st23xm44ggrUr2CeK4=; b=k5DipbjriJpySm82S1WYwOV4func9rI+CbglfCLxhO4Xf3bqvipeMsHcs1MXbnUne+hdSXvyAGh/vH6f832n/ej/1KaRGNe4y2pQFma+f36fW9moDqA1YwD+fNOXTZdk7Yw3W2HWF5N2lZ0k64V0Ka5lLYMY9yhrfMWEN4d/HiY= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:31 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:31 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 12/16] net: mdiobus: Introduce fwnode_mdiobus_register() Date: Thu, 11 Mar 2021 11:50:07 +0530 Message-Id: <20210311062011.8054-13-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 55f2d28c-f105-4e60-7ed7-08d8e4560d08 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AbKDB6n53heb4je9uikNKVJ2Z2UIWP1/GV+aAJa2/EfZUBjkfcbAUcCsiejNDxk87X8XTKbCCeJtXhVo5TGh5amvtAdj+yc8rMHsaUA3ykMwu5MLzBAPbo2f5XR6iFj3yjpGmqJgirjzu7ex7Xth1uN+z6Mu98VT7HiMeYY+SDzsZktDovEJnMK5fDRzyhtDtqGk8/5jgg+dXIc+6kBfUpMp3Lz9pjwM1Kig/CQCM2z4HyqKCrJakVrRjqUs8gBk1t0dHnOpjjokVbHf/luqwToeEDyOVcTTVaYcR6nU6RZLkfhHCHp2gXMP6eJxBYRpBUEaZgsEqeMTjSrMYgJncpkq6zcNOzEVni93uYGb+Adzn2mtHVFIU1CuoZ71+xgDYCVpKZ3Wyg/lNnYL23GcoHZmNTnyIop4tOjwcB1sWEyEIVkHZPIsJo7qGcUPfqXPw9UzVMExGVsEwNtq++SemPM5UFVZ6UyP8yqFNYsbvSe9AhcUoflfiC1AKTSBYK9LQoCYW5WYn7MJaPd8oguLHdHttAj4MSfAjMn8tsDK3tX1PGIjY4sU74fnwZKLtXjWskduekPh5GruwYgOgnCwy71jfcT0xES1ZeBuJJL7o4c= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: q0/WAhl1WFRKfhp0SdZdpCB4LgsD136TKY0EHxJexHs5BnD6E8b2osE4z0je17KLZvedzsSSuOhM4aATQBlhsfe7RN6D+86Lv5sT981R1MuT4TiuyfSutyDDxTkGHDudZ2IECb1aGGR02Azvlsu0rEQJVUZLah16PCuQuXOIEm2V8+mcoEsnCSksJFK2n8QFZCnQ2CijHIrZ6KhbpJ1blatjxQcOxF6xwmdwJFwNbVu8FVKz2sGFsMkN1TShY4JSec/OeoHORWVMac0ZBbBf2OB/Q0slxO01dxY6NEzgLQRbfKsjI4Rwx+yMpnOllZ+dEP1f3Btj9tS1fW6RZMuZvBQlGIfxFCOfvbpehIbtOQuiicwrbt3EMeFvMLvUcmVtxucCiSVgcpW1F2W3btZib5pETr7px0EGIM7hnnsjUMAeaszscx1lhU0rUw8UC2vktg4fuPEHFwxnobQYwiLCg7y4RMuEgdgTSpior/AT6Yd8O8QKDymEkU2Q+ZTSEfOgxZ/xdPbPyhzU6IFuB8Qp7kWP93vwJk6oYXurUv3l3gVKAiQpJ7VmV21W3NlwTwFtchq/nRMWmoe8XLIorEpRedBQOmuSXlzfrnvjQyntrODuukLJJUMV0xO94W8DyOGixVNvKGBez5jdx/Urv4Zp607yzF4DJeGPRbEyRztb9EoLU4OTGn17WHo/wXhPe9GzX5vXtVzfVkIy5xe6uNIqCFGkcJGb6+tQm1n3ATMgYUnNlLC+ho9rFwFdAbWli6bFaFLNwiqlnqZcD1Wy/ojhiFM0sWoXemBuESXpd+TZtmaG+R2jhkJ+lahWEJf7b2fCsGY7QO1DNiV9hv0DoWw3MAu/v60TEJur7ydfZe3ZXE1HP/hD3uVapYAABeMzc/lfsAUaKrHijX7pnF6XMo0a5S/woh/6gkzy4uqcvBDtSvl6Ycut/z5v0y46Gd6yEtlm89/Q6zyDAnBeoAUtGNm7MoO+ra5mBaWM/P7x9pLsaPP4kyWo55kCYIZuCrHa2q9sDi4a969V9ciBpvIUCTFrAxuDu3I0VMJpZv0b7pSJGCw4lCZbHkIR3xxXS73N3eNvrMKVieNJgRseHkO3+CXHVX9WSvbuWs+kTfw6Ktn9+95+5Olr906BChjyMroUS9P2fmaxrQ0nKpGc9TaU2xF10aSozbhF1oA+rROGE0ynZyuwWmfjbwV59G9KbRnHCTuwC0G0PPZtmYHpmh8INEBJ7AubsIVlOHffxGCAXhg08xrh06sG7bpj1VkKmCaqqhJgOb0Pvex1A2ONadaoOjZvv/xVZMNlHqCTH0XNwplbo5wVxLJArZIoFfTNHTznW9dG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55f2d28c-f105-4e60-7ed7-08d8e4560d08 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:31.3424 (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: icWiSvD9ukvZJtRGgOGwYMRQbfEw2wa3LJt+24OzKyVTwEH7kEN292fmt5cTIfpZzdNJ6R1U+ODiBgdulxM8yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Introduce fwnode_mdiobus_register() to register PHYs on the mdiobus. If the fwnode is DT node, then call of_mdiobus_register(). If it is an ACPI node, then call acpi_mdiobus_register(). Signed-off-by: Calvin Johnson --- Changes in v7: - Move fwnode_mdiobus_register() to fwnode_mdio.c Changes in v6: None Changes in v5: None Changes in v4: - Remove redundant else from fwnode_mdiobus_register() Changes in v3: - Use acpi_mdiobus_register() Changes in v2: None drivers/net/mdio/fwnode_mdio.c | 21 +++++++++++++++++++++ include/linux/fwnode_mdio.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c index 0982e816a6fb..523c2778b287 100644 --- a/drivers/net/mdio/fwnode_mdio.c +++ b/drivers/net/mdio/fwnode_mdio.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -75,3 +76,23 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, return 0; } EXPORT_SYMBOL(fwnode_mdiobus_register_phy); + +/** + * fwnode_mdiobus_register - Register mii_bus and create PHYs from fwnode + * @mdio: pointer to mii_bus structure + * @fwnode: pointer to fwnode of MDIO bus. + * + * This function returns of_mdiobus_register() for DT and + * acpi_mdiobus_register() for ACPI. + */ +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + if (is_of_node(fwnode)) + return of_mdiobus_register(mdio, to_of_node(fwnode)); + + if (is_acpi_node(fwnode)) + return acpi_mdiobus_register(mdio, fwnode); + + return -EINVAL; +} +EXPORT_SYMBOL(fwnode_mdiobus_register); diff --git a/include/linux/fwnode_mdio.h b/include/linux/fwnode_mdio.h index 8c0392845916..20f22211260b 100644 --- a/include/linux/fwnode_mdio.h +++ b/include/linux/fwnode_mdio.h @@ -12,6 +12,7 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, u32 addr); +int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode); #else /* CONFIG_FWNODE_MDIO */ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, struct fwnode_handle *child, @@ -19,6 +20,10 @@ static inline int fwnode_mdiobus_register_phy(struct mii_bus *bus, { return -EINVAL; } +static int fwnode_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode) +{ + return -EINVAL; +} #endif #endif /* __LINUX_FWNODE_MDIO_H */ From patchwork Thu Mar 11 06:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CE86C433DB for ; Thu, 11 Mar 2021 06:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 662DB6148E for ; Thu, 11 Mar 2021 06:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbhCKGXK (ORCPT ); Thu, 11 Mar 2021 01:23:10 -0500 Received: from mail-am6eur05on2087.outbound.protection.outlook.com ([40.107.22.87]:58560 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231455AbhCKGWn (ORCPT ); Thu, 11 Mar 2021 01:22:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cgzDD08YUw/XA/un7rfP9PXH55srMugWSSbcV5kTLM0CHxWqsg8pniGABnrlWK73askXjeKdR1sZ932V59kkKMUWBH66cK+AIB43B6MT4+iOsLQLB+ECb7EKdoZSIBs/ieQ034lchPENhuVyxP7nalnIIxoiTz+K9BGTHXqAZaNVrVJGbh8bY2O7XUq+gFk4jUluFUFJNjRhMcb14YQtl6ydASBNKRh70qDZ69y3vI/IeIuB6sl2TryHKeEZfDRV4VKczv1ezPuQj/rbPMCvO8lipD8GYETiRMdiZq1VQmcWnZwHdOF6vgd0DxdpXs+mF9VjOhadRfSMHhbKoML22w== 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-SenderADCheck; bh=JRYSLoQWnWnrDWdjSSVe8XeC4AwOa3fG5xSoEWPqlQg=; b=jTgOP+6X0URNPlctdI6fd9sqnGsbVB0h5ICMcFTeKcCwPdWydzipAn2Gc1Tbf+YWSRWXH0Oix1TcG7pgaGRFnhuSBb+/X6Vall89fl0gPmEYOSPfRpD3XavGIej3DvOjTg5Cvqzst5TKwBx3FoVPi6vpLFf1Pf1f33SMk6nm6HA/imsCfwSWi0c6YWgQGJNUqSRHtaHStrJGS0ew3yBsscRrQoZbKJgC7Ij9CdILLYwAECV8CB+cSQWTX8ncAtUJbZ1Mrz4ws1Xh4Ol1qc6KNWTa+BQin2gRXldLGgKR/w8aoaM6o2LePcXuFDWeEBjN8ELbHWVnTwCARLoat1EIpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JRYSLoQWnWnrDWdjSSVe8XeC4AwOa3fG5xSoEWPqlQg=; b=lDFUu5ffTns/HCqFZLjuX8APwoPPH3eq90livlZ+qhZTys0u0u/OUacKWyBwtujkMKF8KdElVZV9+V6J7RTchESExe75MtUrabgRBQS+O3PAQ4uMK5Ij4Z0wM0dkYrDpW9jsNcpLfqveMyUwTj+dyblAmitVtU80rBQ9rwaxy+k= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:40 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:40 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Jakub Kicinski , Jamie Iles Subject: [net-next PATCH v7 13/16] net/fsl: Use fwnode_mdiobus_register() Date: Thu, 11 Mar 2021 11:50:08 +0530 Message-Id: <20210311062011.8054-14-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b1fa9b67-3460-4608-1915-08d8e456126d X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HsIT2ZIye23GnY3ng2SbI6UHGM2cHFoZxHfoykxzldi3h7ij47DauGUaBkdGvFl9qeLQE29OhMTb6H5lrKnNmjl/bVuOtAbBll0wWMPDXkvv9C3vMH4CRLXZEw/7Mp7+CLZQMsEiTVL7SLlWNt392s03olWYvBLZKBrydDrrqZEqT85y+HfvGKKcsfNqJO+nG/KMI51dCZyOi4T23KGJXSnYtcqLvpA80ZJeaNf2QC9glSgu6Yt1QRTf1b8kFYPTUN69pBcxTo6XwIUsRi/JO4MTOsFkgDqwqIPJXlkckTzZFF8dQyy+RUSnHJEYRVV+uIc6DqQNTB+VaPjysH671GavJTidWDADdjk89iSD+QOMpgSgAvYJipX/6JHuYCM9PXFCxFeQxgL1vUlOXuQ7/4BqT7K9tYuRx9WCXYpwyfRYd/epr+LjqrQpVyCF02vFog+Nzh4tTTx/QwyixxBCeh9rsysKW5i2axxglgL7DqEEP4WGD74GgUpP5PfAQxuiUD+iAtpsbmqQlpZvPwQOIc+pNb39/xEmkz7ULx1mRJpfDPfX/RRt07mYxB7nWYWyfRcrMy13QU91uwavtLXqJl5tQUJUOCkStnGwobPbEZY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ngjW4FxRFlk47LpVIUOYqRezdj5/51C396RCTkPTxA7TYnI1rduydHp1JPAIsmfsFlZgkp/sOAnDdT71iisIjeIxu5MAd7/IAmNgMbk562Yrs1FFjDyhM+3hZxGWBYjrn+62jfoRe/ZVKwqh0oqbMsjhoYJxnjNAetuGp/m8LzA0eS0alZr6EnV6IbnldzxWikRt9f8VTuGL68+j0E8lD1voRzUbh9sXe13BGcfmt3onp3smddG1fw9ZAQ3MO9Q7QyuQIGMlKxbZB4OqYgj0nH6t7nEtKJ3QHaFMigqCfDsQG8tKw7ZAZU+eMi/ylV+lrEsSm1mlDnGn9w5rAMf3mKtwZOEyWw3MQGSyCNq3OJp2EviRGQ3rZ5HSDDuyojVNPXYhIblqeM8e9hVy0NktSvve329HtKBPh9dbVULc7vcEKPhdhS+5EtjjTfbpH3tk/SC0cM5qGpQhT1nJ/jlIThT4kKmU2fQ+Jbu9mEnIhH00VIjMs9ZOUjos1h9byff0P8rSZRMssJxQBkUYDvlud1vOOQjPLX32Gw4fh2/r6ZDPLX/ZO5MIEz34ann9nGwE5AmWFrvzm2DI/pyNW2oe3n9NecwfbeUyGfyEqJbpt2oHjWnDAwe8p1xmHF7tIcd7UUWenKChdsFO2Qu2gr8o+W4T/Rh8ZTP7G/FDs/nhbf7ZTg9cxLLuA+mdxs8y27UKhlp7sW8p+WXJBx+PfaKa9LZq5yjijTqoh+QuaIeixvUpYVorgkB+23QiCkO7NrxxlK9PWOOXQO5bXiDfs/Y8r5Yn4Uop4OCSy2531kALl4uCtNbkEZb/3/61i1ar05tE7oxQB0Jp05a3YwaFx9n+g1NlbcCe9RFFxUVoToKN2AzKJrn+TZHDDW2IV8JT1Vr6KSVkI8t2DPg+gz3LH2OgxNupwdACCxR4/g+VZYPEDQEC9SZBT4SGcq4abMTvyUsva7wGkpqymp1d0SsEDjWrEp0oN1Xp+3zca1RglQvep786p0jKKtZ5X0iGLurAbXKLkSpp7YZuCMJHNFWwOFQm9MxJwrCOWAgrjqayZQ5J9dUXBV1n5Srrfs5ELAJ1OkRzhZYu/fIADRiDaBmtvGBK3EDw/63tVkTn8TdkS76AUDxe84ciE6EyZes7Kg/n+SRAPzZ2vKSO5KrzKmdOFIN2oVnoSpsCzO97KvxXRqDn55rrF+a6zqCXZUI9k8VwEf4Hi8lNpLtVWA9dH4rkzurumb0ku7ypt0myCicnTtSFf97bBSC0E7Kks7c2czRFA3SJFTK/AxpHumFa+D2FsISZ9DShfLTmJXKWH3SpbSReAYErTCfyQW3j5unIAdK1IRKu X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1fa9b67-3460-4608-1915-08d8e456126d X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:40.2853 (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: FHiw9hl0zKFX+pSkvfT5evDoA7SNvRPK/IPzt+Cw9WwOuQlX2z4QjsANN4bp/7aYQwMJh+bwS9fjWBRbABEzAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org fwnode_mdiobus_register() internally takes care of both DT and ACPI cases to register mdiobus. Replace existing of_mdiobus_register() with fwnode_mdiobus_register(). Note: For both ACPI and DT cases, endianness of MDIO controller need to be specified using "little-endian" property. Signed-off-by: Calvin Johnson --- Changes in v7: - Include fwnode_mdio.h - Alphabetically sort header inclusions Changes in v6: None Changes in v5: None Changes in v4: - Cleanup xgmac_mdio_probe() Changes in v3: - Avoid unnecessary line removal - Remove unused inclusion of acpi.h Changes in v2: None drivers/net/ethernet/freescale/xgmac_mdio.c | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index bfa2826c5545..6daf1fb2e9ea 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -2,6 +2,7 @@ * QorIQ 10G MDIO Controller * * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2021 NXP * * Authors: Andy Fleming * Timur Tabi @@ -11,15 +12,16 @@ * kind, whether express or implied. */ -#include -#include +#include #include -#include -#include +#include #include +#include #include -#include #include +#include +#include +#include /* Number of microseconds to wait for a register to respond */ #define TIMEOUT 1000 @@ -243,10 +245,9 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) static int xgmac_mdio_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; - struct mii_bus *bus; - struct resource *res; struct mdio_fsl_priv *priv; + struct resource *res; + struct mii_bus *bus; int ret; /* In DPAA-1, MDIO is one of the many FMan sub-devices. The FMan @@ -279,13 +280,16 @@ static int xgmac_mdio_probe(struct platform_device *pdev) goto err_ioremap; } + /* For both ACPI and DT cases, endianness of MDIO controller + * needs to be specified using "little-endian" property. + */ priv->is_little_endian = device_property_read_bool(&pdev->dev, "little-endian"); priv->has_a011043 = device_property_read_bool(&pdev->dev, "fsl,erratum-a011043"); - ret = of_mdiobus_register(bus, np); + ret = fwnode_mdiobus_register(bus, pdev->dev.fwnode); if (ret) { dev_err(&pdev->dev, "cannot register MDIO bus\n"); goto err_registration; From patchwork Thu Mar 11 06:20:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 397633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F6ABC4332D for ; Thu, 11 Mar 2021 06:23:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD29164FDC for ; Thu, 11 Mar 2021 06:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231481AbhCKGXL (ORCPT ); Thu, 11 Mar 2021 01:23:11 -0500 Received: from mail-eopbgr20082.outbound.protection.outlook.com ([40.107.2.82]:36174 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231617AbhCKGXB (ORCPT ); Thu, 11 Mar 2021 01:23:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i54lwoEgzMD+1NVQ+cJso1uOa7ewEG45bjBTh4Sh5WoUSWZJctzfcu7Dao+TbUhcEi80qcV7b/09YHl7809YLwVqkt46N1AWWOlljrz4Apdun9uOdoJvmZp+YTvhTVEFVI4JZZCOvpq4tv9F593Fi8qaNejEwVDIrIYEU+/WPLWcs4Nf7/WlvRw8NZ9nE/3pvJiLmCyj0wTQ0yJWaNjBtVf/9dCnbPVhMvQMmCyIOj68XouwFxElGtgP+Ouq+PvvKsaL7tY0fuctVFJ1on9s2//Z8Qsok7TXE39qrpgphzDVo143U0P4/ht7r23Wlig544wONKQFYBdZe/WprpuuOg== 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-SenderADCheck; bh=j7SN/BUqBAwlVBwCfUUBNaCGolKQ5r3lhz3ovvjZzX4=; b=jytBh1biAmfOYcuL16vTFtN+B6KnPyVUSmS7RTkb794Y1UjaSA1Xwe1shocGyvzG2QWMPjn/m2P9zQ5ZKb77DdGrdjx5CMpQLbkOELr+mxfXZeLSyJoebmIMuUZqFojow8FS8UhHYxQHAfngFawzpcTmE5PFb2fPYfNfZAwbaRwpdZLPn6Urq2X6FmKzu192zexsS0sPZbs9KRtGjNtJWyQ9YAcYF6igbOP5HZtsumWhHiUHX1NdRVTH3oi9HZeENzDA7N0+UmCVuqWiRXZKUrp4c26S/uNiecV6BUkxcGn8C+JHAMZXoGcAGKG9aMX5+8ilVrxo8ks1Ars3J+RBAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j7SN/BUqBAwlVBwCfUUBNaCGolKQ5r3lhz3ovvjZzX4=; b=lpEii64k19K/Yx4KKHY3U9HPganetcobnJGDqQnQjlwRKpMfN5uGYquOo1Vv/TdVYiiD/iWucyHLK6oeJpZ6onuBo4mXdqHEwmD+h/mUj6tKt4UIoRBYl7FVD94lxk2wndFwx22gQeSoIPfqj+L+hefSWr9ErbmM7IPd+odf3fM= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none; arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:58 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:58 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Subject: [net-next PATCH v7 15/16] net: phylink: Refactor phylink_of_phy_connect() Date: Thu, 11 Mar 2021 11:50:10 +0530 Message-Id: <20210311062011.8054-16-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0dbe97bd-b4de-4518-17b2-08d8e4561d11 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bmqrx5P/bX8EvYENr7SB0hGx6pfRSwAxNmVXA1lbA6dfdDq2dIsA8TedGZ50mo2agj60sNSqrRbh/5rTK7ld4ZZRboVhY1YMBVFCuXC2jyTK7bWyHoDtfreAbTtEud6c/xt/U0Uyx471rcbs2k391Npy9A+FBmAY3kfo15Vqfb0KUg6J6zhPH5KcR3Ab1LVAwFYQ8FSVHxR2tOkaGKZCYsosklZloIHqVE/mmG7T5GKsEsUO3Llk7FKmRNID8snMfgm+iseHJXdl065dBmwy2geTDEzerFQD3obX2mFDj58xi+mY00ZECVRrW/JLOp4u3Kh7xktiJAMXZpuZCeQUBfm/nEerIj+dmJVbUsnkCkZQhzbl68vzMvQWOpydDnaqtypvFsH9VWToCYK8zFLm9i7bpSj08T9HZK8aq16gP1Mon7NQOW82Sxf28N51gKMjTvTknS6bPywdCLHFe0JWshhwmN6N4qFoUMHo++eKz/efrr8cc6aaGnBqinIn+KA9UepKLpJQLyN7mF5JzHAYF6x18Lxa0TuLzcsgXko87KgO8KeHiXKrJIjxf7wWRVj/WVahEfKHESuDMXLGVh//Dw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(6666004)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: p47z3aLYbeTyC8gzslFz7KGpTaJ792nXyAXkPF1ljyMYxM3gR3Y95gUlROhRtPaC8EDvek1ZLYO5JNr1SVfVBQJMERM0TEUvYxtenFLFkYzaIw2F3GOCF57T81m+AMxdjg3WM5TfKSpxU3jOQcHxoNOhao1cyjsWELPVz79Pee7ubFr11e2LK6fCldOpiAxK/Ik3jez6pdSFY656iSGPpvkEEt5hOIFrC2lM4h6d74/JLUidD6PpfjwBFgosDHSlYQpuEOcrwM8unsK2DwWyn43p7UVWt9+p7z5S2/sH+hAoNdnBYG2a3gMjvZwUBG8bZh9sMg1ojU8QgG+r2a2i8jy+/C6+KmwpHxLhRFltMqNFtaC2wutpJgpYBg2gg7Eus+1Lk7UjQ2SBUWFzR/w48D4sXI04GmF3B2peFkpACmS0EWBCc5sTABbA/DsGVGKiab97+NYyrhr/EKH3wxjLTHNojTMjYug61myevaGrWpbm9Q9WAbrQGJN2NjZMVGg9MAFUTHgxXPFAiOA02V62Ybr5B/KOts4NbUbMllizjBB1th2O2wWSqw3+wb0zp4kXYfP3W0xORPG5XNuWWsl1fI2C4x3amGL3LTRoE+yIB2MRld6+PGRzgx4ajtm16/VfsyKFFpmLLh3FSJYciD/lNK+x8U6vsP2DSbdX+8ox2hDYjbKvrjnJ+RFBKISqLQCFyLqvwKnuf+acAG4JcM/uYRUkQxyLkyJPQ8/KrI6Sw50VPjmfPV7ldR6Y0uMMuSOgHMVDTMkkJRHv8EdmlFbZKeyvPYXLQ35QZJa2qY2Y1AVTlrkRLdLsb1LFM0MagTjm4xFyEKTNYbw6Nd+T1gvkQd1RJDEYhtTeVVOOHvAFynKjTS8OMiT7uZD9cfMRArNzXmYDWF+EQxtT3OhvnReq+2vkfZGPiNdLvP054ndlRW94dCN3QxE+DtAQwqb7AWqTKG0aorgBtNJ5lZnflB3vTTo69XMG1Mhbpx6skwxunYGdjQWKiOi6ojT9FkHCY1KqeLop8Y5tIi3sE6XMcwGnOP6fUl5ehVgaNxi1lNSmW73sv1OVKp6+7AmR6/oz+Z7K8NupekeQeWPppY+Ek68kKTlHEViEDTAk4iCUf63u/XqiKKuwQWP6qhxZNYycDUHec9LJy4edlHEkFjpphj/HOTYvts7/naKRbPwrqTJAl+deMf7CydMe1DwanE9XY/5Z8SoNWU95/rn9aalHBPKyTnIeqQJGrKtNgSgURPV3+a6lca3hs4vBJ8YzWGA8QgSuI0YJF7EPpZcezOwMakA3vorhGteeEVJE7vIFO1z3vljU1gtnYqk3PnaEE7Xp68IF X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dbe97bd-b4de-4518-17b2-08d8e4561d11 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:58.1273 (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: odbnNfMVhlbFGoXuNZqM24PONPzfORyTA7AHfxgVcoDTve8tWcldaWvjEcu9xpuhUuNL2gQ3Ljp9wCBhqvqxmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Refactor phylink_of_phy_connect() to use phylink_fwnode_phy_connect(). Signed-off-by: Calvin Johnson --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/net/phy/phylink.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 23753f92e0a6..ce7e918430c8 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1084,44 +1084,7 @@ EXPORT_SYMBOL_GPL(phylink_connect_phy); int phylink_of_phy_connect(struct phylink *pl, struct device_node *dn, u32 flags) { - struct device_node *phy_node; - struct phy_device *phy_dev; - int ret; - - /* Fixed links and 802.3z are handled without needing a PHY */ - if (pl->cfg_link_an_mode == MLO_AN_FIXED || - (pl->cfg_link_an_mode == MLO_AN_INBAND && - phy_interface_mode_is_8023z(pl->link_interface))) - return 0; - - phy_node = of_parse_phandle(dn, "phy-handle", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy", 0); - if (!phy_node) - phy_node = of_parse_phandle(dn, "phy-device", 0); - - if (!phy_node) { - if (pl->cfg_link_an_mode == MLO_AN_PHY) - return -ENODEV; - return 0; - } - - phy_dev = of_phy_find_device(phy_node); - /* We're done with the phy_node handle */ - of_node_put(phy_node); - if (!phy_dev) - return -ENODEV; - - ret = phy_attach_direct(pl->netdev, phy_dev, flags, - pl->link_interface); - if (ret) - return ret; - - ret = phylink_bringup_phy(pl, phy_dev, pl->link_config.interface); - if (ret) - phy_detach(phy_dev); - - return ret; + return phylink_fwnode_phy_connect(pl, of_fwnode_handle(dn), flags); } EXPORT_SYMBOL_GPL(phylink_of_phy_connect);