Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp666385pxj; Thu, 10 Jun 2021 09:45:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQi8f+MNH6naQpyFTCufdmIC870iZhMERLRsdX3nO6EUyWZFo/a3/egnReqyQW/SYcthuI X-Received: by 2002:a05:6402:177a:: with SMTP id da26mr415790edb.40.1623343515474; Thu, 10 Jun 2021 09:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623343515; cv=none; d=google.com; s=arc-20160816; b=eirLmM2GBQCSrRJdUBWx+8IJv6RvLBmk6u0Fb2q9J3Nfc0VaYVIv37OrgccYTbNbdH VnNlx0Zwm94hE6SRFcY8EaAXuXchAlSyJi92YPkomBXMDBPYqBUa+13rcsB34RRtjRUR G6phWuJPSn8FLwsX/KuISguALTnqN8jWvG7Fux3X7PPcopWeeRlfO3VanO1btmsHvfio 5IGRTOEM4tKQx2f0JwD7O5BN7AKVlKh5MMrG0NeJXHaYHEcjGxD+UIHL0r+FVh9/46xS kh1QgMeeRgYuslZbFWKJ7RvwG1p0DQZAOygwbSU+eVC1GQCzXq4noF4wl8+iFaecc2SK M4uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cGYQZXC/NhPdwOiaUJSomKVZ7Ulae3WO3fpWEzXcO0k=; b=B6qmBQTVUGJREqeONm96GyzNeUE4H3N6adCaE4McMfq1GGFW2Qr8KzSb1O3BaAmXgt /573ONxV2Ciy60KeQAX153ZAFpyGL1A5xtGaHrRL3ZXulZZ9sW3c4zXpHL8lYDaMGSUf rVRfapvk5tB4lFr0153cczhOLPWHsjt0mhZDfbv2rZX3G1TnrxUWulSCejiqCZbT8ibV cg0GYGB8VlX+S+MgJNjnWHfiGq2uekwaMj1JfwGdOjW8go6r7hExbDccmAMJ99B9A0UO N49bzfzjddrEWGqdU1s074sBCO1G9YyDtixcEmY6cIHx4K3hQ21K6D81gMSYTUHcPqKu 22zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t+siAVMT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dj4si2681509edb.230.2021.06.10.09.44.51; Thu, 10 Jun 2021 09:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t+siAVMT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231716AbhFJQoI (ORCPT + 99 others); Thu, 10 Jun 2021 12:44:08 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]:36809 "EHLO mail-ed1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231620AbhFJQnh (ORCPT ); Thu, 10 Jun 2021 12:43:37 -0400 Received: by mail-ed1-f42.google.com with SMTP id w21so33743221edv.3; Thu, 10 Jun 2021 09:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cGYQZXC/NhPdwOiaUJSomKVZ7Ulae3WO3fpWEzXcO0k=; b=t+siAVMT3mT+Hwr7+PWLzFq6stbRRymsCcY5eDwBodVZr4+r2ylFc5CCcnRDzreu5W mOry5eFoT/Prr/AifIUIeIRVOD6m9Z6Y8k94R15vW+qROBDcWWv9SRwAij5Mtwxua44H 0ZFT2+96It96Ro1pocjcfTJMOBscl1FSzki/9KlqGNxyrLhF+aK8pfpND1upUUaJgZ+r LEOUCPD2LDf2FKZa1iyk2mSzCChZFWH7OappwPFw3MhRvQY/95l7gQDO3v6fY+C+BJwY VwWw3kSy50leyhCLYXnLxIFTitsxQtxC3c/pj7ThcEXCmb72xQNqFI9/IwGC8HOUA+ol +wVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cGYQZXC/NhPdwOiaUJSomKVZ7Ulae3WO3fpWEzXcO0k=; b=HVU/v8N1MMudGPvZqxOHF7oxDeG1EkuQhcJMi/hVIHENJ2Q2ffOmGn9aeasWSNzL9K CIBYNCJKJs+OR4LhQbPKUXNa3MMG9U4S8cc9FuStI7z5/BKrfve1hEEnD1/tcwAqu0o/ 4X9BFrMQwNWX18BFH1jvZIbu1TXPKeQwB7bFNdygOoukMnIgDkkc9QDRL2m0qsJBIwx8 yrBOoQhD39zIO9LGTfXT7gdOd5eBQwzzJxkfK4kiRciYIgi+RbbSAm6caMc6hfjnJSZS t9VqURWMJwIzWPsY4zKIkZD4Ni0by+H2zbvH/RWiEaD67/kxiA4n8dPc8Y8RBIkqnK7X B1vQ== X-Gm-Message-State: AOAM531HeBLO6ezGEgT0nEba/GEwp6ZPVJyiDJ/Q95UC7IvGNBleODnY 9IobK9WIQSxaQevRodZBStY= X-Received: by 2002:aa7:da8c:: with SMTP id q12mr358069eds.368.1623343234121; Thu, 10 Jun 2021 09:40:34 -0700 (PDT) Received: from yoga-910.localhost ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id e22sm1657166edv.57.2021.06.10.09.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 09:40:33 -0700 (PDT) From: Ioana Ciornei To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , calvin.johnson@nxp.com Cc: Cristi Sovaiala , Florin Laurentiu Chiculita , Madalin Bucur , 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 , Len Brown , "Rafael J . Wysocki" , Calvin Johnson , Ioana Ciornei Subject: [PATCH net-next v8 09/15] of: mdio: Refactor of_mdiobus_register_phy() Date: Thu, 10 Jun 2021 19:39:11 +0300 Message-Id: <20210610163917.4138412-10-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610163917.4138412-1-ciorneiioana@gmail.com> References: <20210610163917.4138412-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Calvin Johnson Refactor of_mdiobus_register_phy() to use fwnode_mdiobus_register_phy(). Signed-off-by: Calvin Johnson Signed-off-by: Ioana Ciornei --- Changes in v8: None 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 9b1cadfd465d..8744b1e1c2b1 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -44,43 +45,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, -- 2.31.1