From patchwork Mon Jun 22 09:37:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 217419 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=-10.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 8DBB4C433E0 for ; Mon, 22 Jun 2020 09:42:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6AF6F2071A for ; Mon, 22 Jun 2020 09:42:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="UtNEe+Y7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727953AbgFVJmr (ORCPT ); Mon, 22 Jun 2020 05:42:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbgFVJlh (ORCPT ); Mon, 22 Jun 2020 05:41:37 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F849C061795 for ; Mon, 22 Jun 2020 02:41:37 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id b6so15932835wrs.11 for ; Mon, 22 Jun 2020 02:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yy6XgmLu+rdPXztYG22qHG3UQylFLO0aZanRZZZSG+U=; b=UtNEe+Y7D5ArH7Qe/vs7TUd5yHPcILffWoYh4wTCQdtMBq36DtKsydxvi6z3a7HbGS FB2blBliY4Y+cVZyVIBbNCz/TMBZbmhI+WrSDUrAZc+nT9RqNVT9ahaolMbn+oxd3MXf 1G7L1Tcb6rs72hInUAFR8sZDDUZyVq9WQ8aEF0wR9UhVHcEeuUBRsA99mkWAfVG8D7Fm zKsJUFL1xKBJ0gZxZlQvxrVGukdEa54zY4pSR0TYGGrqagLXr4OzxpZFMV8ttxXXVHQU uiUpPpCNqmeepGbSEiBWxIRbMBVFfKFJKOIFmK8bRZsbBYVxA3/rlPTyqTaIaGU38MYj ac8w== 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=yy6XgmLu+rdPXztYG22qHG3UQylFLO0aZanRZZZSG+U=; b=WrOW08t40W8f+SbsDgZhEDJv/kGTf6+Brvv+FbEu6slj8GprBvdbf6LVga5RWxi2N3 6CDdBtKBt6pa/t+6O6u+MAZn1iYzHqlgy1uThTGwUg9OMf1VNHqlClrFzQajzM5q8Cuk PlQNGe0bDDlPMf5JOQxtn1zcflCS4LG5GWuWzZtfcWX34ck4o8Q4alw9KHDNCQi9QhhD 0uUDias9+UAfId2MI6uXXk+aL8PK436dYBr++ghYTZDyflUBNddNB7og/SvV0UlJxZXi tIvxRhbe9QAC3G0g+S6N74cFtr5NHMcrtYNcmuxK7brHHm8qDPfpXbgAm3fZl30pY8+W bjzA== X-Gm-Message-State: AOAM5304//9YyHjIM3sCXPiY+iZE9q5PcDMfVNfQ0LlSYqhooSlZg6tk maLp56HLc0Ul4HGIJyZAFuXZbA== X-Google-Smtp-Source: ABdhPJyFGfPZiEZAaPA05Oy9u/8YECmNenqKkrnMxPg4aIkaLDansk5+kyg8mkF5tPJf9KrUB0gUSQ== X-Received: by 2002:a5d:6987:: with SMTP id g7mr17998302wru.79.1592818896247; Mon, 22 Jun 2020 02:41:36 -0700 (PDT) Received: from localhost.localdomain (lfbn-nic-1-65-232.w2-15.abo.wanadoo.fr. [2.15.156.232]) by smtp.gmail.com with ESMTPSA id j24sm14392652wrd.43.2020.06.22.02.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 02:41:35 -0700 (PDT) From: Bartosz Golaszewski To: Andrew Lunn , Florian Fainelli , Heiner Kallweit , Russell King , "David S . Miller" , Jakub Kicinski , Rob Herring , Matthias Brugger , Microchip Linux Driver Support , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , Vivien Didelot , Tom Lendacky , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Frank Rowand , Philipp Zabel , Liam Girdwood , Mark Brown Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Fabien Parent , Stephane Le Provost , Pedro Tsai , Andrew Perepech , Bartosz Golaszewski Subject: [PATCH 08/15] net: phy: check the PHY presence in get_phy_id() Date: Mon, 22 Jun 2020 11:37:37 +0200 Message-Id: <20200622093744.13685-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200622093744.13685-1-brgl@bgdev.pl> References: <20200622093744.13685-1-brgl@bgdev.pl> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Bartosz Golaszewski get_phy_id() is only called from get_phy_device() so the check for the 0x1fffffff value can be pulled into the former. This way it'll be easier to remove get_phy_device() later on. Signed-off-by: Bartosz Golaszewski --- drivers/net/phy/phy_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8037a9663a85..eccbf6aea63d 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -806,6 +806,10 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id, *phy_id |= phy_reg; + /* If the phy_id is mostly Fs, there is no device there */ + if ((*phy_id & 0x1fffffff) == 0x1fffffff) + return -ENODEV; + return 0; } @@ -832,10 +836,6 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) if (r) return ERR_PTR(r); - /* If the phy_id is mostly Fs, there is no device there */ - if ((phy_id & 0x1fffffff) == 0x1fffffff) - return ERR_PTR(-ENODEV); - return phy_device_create(bus, addr, phy_id, is_c45, &c45_ids); } EXPORT_SYMBOL(get_phy_device);