Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp422271rwl; Wed, 5 Apr 2023 02:41:14 -0700 (PDT) X-Google-Smtp-Source: AKy350YIeiw3DXVPrEFQ3dX5wAbPb5ih5m0iVAFbHpryuaAaGfj5DDc4uEpVu6PLp8EtwbczUd1p X-Received: by 2002:aa7:c30b:0:b0:502:4a8d:c71c with SMTP id l11-20020aa7c30b000000b005024a8dc71cmr1110773edq.9.1680687673948; Wed, 05 Apr 2023 02:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680687673; cv=none; d=google.com; s=arc-20160816; b=UI3Bhtr19PiF2NueeHXLfWlkI5XnscKNsckaWEUpj5CqrZzfzL8niNmqsh8H1h6lxD il8Bh7Eyg9mG4ErHOgZOk3JhAuAsH7DHH07qfAHozJitqdXB2uUnBfqxuGa1PGNrc+Qs JrWHmZCpxkmhdcD2pwAGJrXBNYS8NtcJjG25Hw1A75V3oAArqRbpELebaWX8yAT4p3Re Ojph1GCV2P+eznQQSCE+EzBiHDVSs1ltdfPjMZRhL6WQy15Q1r8UBD8yR/rQBo5LJ4JA rHnj3JWXRLAqj5zMJtBqVOszqmDCEZ4r3qpYHuNuoY4M/hiq+Nprobh/MU+kAoKEnR5g shEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=JeC+kp15pJoc9chmkOiGFi6kC3ndfdSyTMj6cHVq748=; b=0sxib/2vmBiWmDCCi2gaAnLOoBxqUhj/3CLR+9QGl6QD510UpxQpfB4WjQv6K+ujkQ oYLBjI4JiLtIEFy+PkT+QRiLqSRyd9TwK0OhL8B1cMcotPrY+Ylb7n+zmy2mXd1OZN4x Q4zJ+gAPbapZ1n8YCqmHuNZr9DpWNv214RDlB56bKRzOFFd6cQLnI1k7tNGzCIS6Co9b qODxdq/GiOLNBW2wvZjzHX016GyX65idPRMh2fSL2zlH4Zd4HC/46EBO6BoaoR6f7YCl 9JVInSnFwxhBswnWcx572fySX3tEdNRcM5K2u3EPI/I3N3QMKToSbu8g+8KpE3Y45ORF ttfA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a056402014600b004c10381668csi2503667edu.286.2023.04.05.02.40.48; Wed, 05 Apr 2023 02:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237314AbjDEJca (ORCPT + 99 others); Wed, 5 Apr 2023 05:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235652AbjDEJcM (ORCPT ); Wed, 5 Apr 2023 05:32:12 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F10011701 for ; Wed, 5 Apr 2023 02:31:18 -0700 (PDT) Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pjzQ7-0004pA-RV; Wed, 05 Apr 2023 11:27:11 +0200 From: Marco Felsch Date: Wed, 05 Apr 2023 11:27:00 +0200 Subject: [PATCH 09/12] net: phy: nxp-tja11xx: make use of phy_device_atomic_register() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230405-net-next-topic-net-phy-reset-v1-9-7e5329f08002@pengutronix.de> References: <20230405-net-next-topic-net-phy-reset-v1-0-7e5329f08002@pengutronix.de> In-Reply-To: <20230405-net-next-topic-net-phy-reset-v1-0-7e5329f08002@pengutronix.de> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Richard Cochran , Radu Pirea , Shyam Sundar S K , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de X-Mailer: b4 0.12.1 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new atomic API to setup and register the phy accordingly. Signed-off-by: Marco Felsch --- drivers/net/phy/nxp-tja11xx.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 2a4c0f6d74eb..af9cb5e1a7ee 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -561,6 +561,8 @@ static void tja1102_p1_register(struct work_struct *work) /* Real PHY ID of Port 1 is 0 */ .phy_id = PHY_ID_TJA1102, .phy_id_broken = true, + .parent_mdiodev = dev, + .fwnode = of_fwnode_handle(child), }; struct phy_device *phy; @@ -583,30 +585,11 @@ static void tja1102_p1_register(struct work_struct *work) continue; } - phy = phy_device_create(&config); - if (IS_ERR(phy)) { - dev_err(dev, "Can't create PHY device for Port 1: %i\n", - config.phy_addr); - continue; - } - - /* Overwrite parent device. phy_device_create() set parent to - * the mii_bus->dev, which is not correct in case. - */ - phy->mdio.dev.parent = dev; - - ret = of_mdiobus_phy_device_register(bus, phy, child, - config.phy_addr); - if (ret) { - /* All resources needed for Port 1 should be already - * available for Port 0. Both ports use the same - * interrupt line, so -EPROBE_DEFER would make no sense - * here. - */ - dev_err(dev, "Can't register Port 1. Unexpected error: %i\n", - ret); - phy_device_free(phy); - } + phy = phy_device_atomic_register(&config); + if (IS_ERR(phy)) + dev_err_probe(dev, PTR_ERR(phy), + "Can't create PHY device for Port 1: %i\n", + config.phy_addr); } } -- 2.39.2