Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3288620ybb; Tue, 31 Mar 2020 02:10:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6LvMOynO0y/rPJzInBSbgmoz4+hbGtGm01urLaUODli/rasVhZQWau+P9pSLYKUxm1KH+ X-Received: by 2002:a05:6830:19e2:: with SMTP id t2mr11405734ott.97.1585645827073; Tue, 31 Mar 2020 02:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645827; cv=none; d=google.com; s=arc-20160816; b=W1SeqySCzwwVtE1gJ9vkGk+c9ZZzONs9htrwqLYn+BOtC5Z4yfOnWc0vOhv5mylDar LNI6tuP230Ra+YpFg/OhnReip2a3cXo143d2Wa4Z5D0qC4jzFBnkgwHNY/cEVvHL/cKy aoz0JFNgAc6li8HZmJymcgfmm3lRtxRWFMKhZdZHJH48tB2EZvzj+/k144Z9Ctopld9f gYMJYiRqwGFtGp1Qz9KtAzhCWgFin6XsKeAzeo/pnaaBDjFDVMd4krt0bnzwEc32jMTj KEr7I+E9ANWYyzL5ApgxJ9tI1Y+BlOctUPiJjs39YHy+Nn5ea+cI6dwNIurZ/cbJ6aq3 Pedw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BUrJbwOqeM3TxQQBzT3Hho30p2H1o91+Vy1PU9hUQJs=; b=CgrwuRJLjlXh/K8VoIe2V57T0Vw/0pZ6cyxOht0K88kf1D6USPLCaTMEfCW5F7OvpT Ecg6x49qt9evTY8Zd+u2okwvXxByq9fO5zImkUGRXOuHh24+gAw+be79oDU7HFdlTKTi +GJkq4neOvwkipFTzlpZe2J6ZazXxXVapOQSTqM8yiWCj7qnTyEerbrNdi9GnOA+hUq4 v5TIGigSbTWpl3MPrMozkqbWtYwMD8lesmgiafmwkF0cz33+op0+r8mTC18sKO8TpkKh OB+ROzRWew3TYOHMVgvM++4Mgb3QQj0VYI42IRzhtHDgwMSPU5sWwCfHXeTasMsduqeo Wtxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vcjhbqs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si6624925oih.136.2020.03.31.02.10.14; Tue, 31 Mar 2020 02:10:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vcjhbqs9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731400AbgCaJIx (ORCPT + 99 others); Tue, 31 Mar 2020 05:08:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:51600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730956AbgCaJIv (ORCPT ); Tue, 31 Mar 2020 05:08:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A1619208E0; Tue, 31 Mar 2020 09:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645731; bh=e4gP1AzGAjExssar5Y8zyS0WgVBcnkIz92jxOIUyN20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vcjhbqs9CLci06eu3pdlDcwA552Qzh+SLUJqpd4NBd76xEVPV0ZrkzKeCcOFTkJcV 8RRkxYstgLV5lk35HjWAfOvih+yAN3CssaF0kh5RHz68N/BimCnGmTEuykt1A/r//N iophog/Sy30VFzqg8Q+OAunv9Pi0y8vMDsRBejUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chih-Wei Huang , Heiner Kallweit , "David S. Miller" Subject: [PATCH 5.5 146/170] r8169: fix PHY driver check on platforms w/o module softdeps Date: Tue, 31 Mar 2020 10:59:20 +0200 Message-Id: <20200331085438.836502509@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiner Kallweit commit 2e8c339b4946490a922a21aa8cd869c6cfad2023 upstream. On Android/x86 the module loading infrastructure can't deal with softdeps. Therefore the check for presence of the Realtek PHY driver module fails. mdiobus_register() will try to load the PHY driver module, therefore move the check to after this call and explicitly check that a dedicated PHY driver is bound to the PHY device. Fixes: f32593773549 ("r8169: check that Realtek PHY driver module is loaded") Reported-by: Chih-Wei Huang Signed-off-by: Heiner Kallweit Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/realtek/r8169_main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -6670,6 +6670,13 @@ static int r8169_mdio_register(struct rt if (!tp->phydev) { mdiobus_unregister(new_bus); return -ENODEV; + } else if (!tp->phydev->drv) { + /* Most chip versions fail with the genphy driver. + * Therefore ensure that the dedicated PHY driver is loaded. + */ + dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n"); + mdiobus_unregister(new_bus); + return -EUNATCH; } /* PHY will be woken up in rtl_open() */ @@ -6831,15 +6838,6 @@ static int rtl_init_one(struct pci_dev * int chipset, region; int jumbo_max, rc; - /* Some tools for creating an initramfs don't consider softdeps, then - * r8169.ko may be in initramfs, but realtek.ko not. Then the generic - * PHY driver is used that doesn't work with most chip versions. - */ - if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) { - dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n"); - return -ENOENT; - } - dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp)); if (!dev) return -ENOMEM;