Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2609123ybt; Mon, 22 Jun 2020 02:44:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU33h4jF/c2lxc28wv0yWKg8ph0WrQ4YfkWcQMDx2G2mBAJPndox/iG8ol366ofUfs2sv+ X-Received: by 2002:a05:6402:155a:: with SMTP id p26mr15390813edx.376.1592819076686; Mon, 22 Jun 2020 02:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592819076; cv=none; d=google.com; s=arc-20160816; b=xPVNYndtbESTDcjHmNSDXeh8ZN1zv/AcWBwHEUk+iy55OXg5Xc6P+xm+yn7hY2LtK6 sdeRq4A3GbqjcAAEDlftbqruM7PWts1LGrCTee0XnS+EOndhd2SMUY0+yBBXRc1Uwdm0 usU9XezZOnDLHgBDXiXJjbZKp/R+083n8TNJg8cEazxj3SAznI8/hzKeTYmvxdm1EfNW 9mrFbL1BnB17mNo+n4DnhX1xbo1JR/D5LDOtb5XYlYVRn3Vw3UdhPrDzu1d++MFTiP3X KaxP7itnQD4O1f7IIomiK7BKEDdlu2rn49O5m1ArB/J2ZXN7/VrPBJcRDPJotCA+htMd wxjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yy6XgmLu+rdPXztYG22qHG3UQylFLO0aZanRZZZSG+U=; b=YE7/E1JIhCtIsFC5vpGr6x4XySeXSyN8eG7x69DV+imDEzE8xekSxZ1xwI7q7mJiya LcsbQOkXNSkUYgPJR4K+7EOdZHHMogeLG7fGeYVapswUAT9r/LmJ9LFTKSsh67ABqs4e s1t/V5Ef/2gNE/PQlcZfJsmmDY3pAzhTIg2R/fsPyi/v8UahqUYfwDYv7FVOLjx5R4yl cizcaybXD04YGM46gip7LLYHddpsJ8BP0ZTJ1lc2GONo9fcHzsS5d/OBZnBazqyEQn4l xtBuxxmkLWjkyCHRKjE/fyKgV9SHD1KBoCukfdF3XMXiF99kIcwUH8POu+QgJ4BF7xk3 Ohqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=UtNEe+Y7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si8876364edw.181.2020.06.22.02.44.14; Mon, 22 Jun 2020 02:44:36 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=UtNEe+Y7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727795AbgFVJlr (ORCPT + 99 others); Mon, 22 Jun 2020 05:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbgFVJlh (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 70ED3C061796 for ; Mon, 22 Jun 2020 02:41:37 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id q5so3552830wru.6 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=qr5dQZyDAueuZGVfFvU9SG81i2r/GvChpW4xg/ORxl8hM0vFhHYTf9RAbosZwoF/hv 82yLQptSf3ejAgT+PqvQEOoMVu6p+xyMyaGJELMSVny/D5+buQz5OFNX0UKoHwzitimy 5D7aQpKxHTMIFj1U/GYl9HHPy3bSJu+HmXeVwBW5XrPOcoOE/w/b+vXDZOT06BKVspQy 0icObAvYZSjsXmXuGJnHmM30VE6V6AEY7/9iC1IxxkrgurEDtezLQnkJ7/wG8Sylbu4c e3qtbgKEAkN2tlQLYQdX9tt5XREsGPtnNzYynBeeL6flsaJUEbCUXtKlqJafPYZZSFic WZLw== X-Gm-Message-State: AOAM533i/u7o1KJlb+7dSZC3xKrB+oAplLwWUfT6K+hbbqI2j7OBBiCu YE0mr8GWwp3Jlmn1Q7omHaj4cw== 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.26.1