Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13829777pxu; Mon, 4 Jan 2021 05:45:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZkO6aAtGfB0XU8+u+/CAwsxep672L/fYkCE/Ywp4lsuW7lDzCjlcx09cUM45rWfAy49me X-Received: by 2002:a05:6402:129a:: with SMTP id w26mr72577010edv.355.1609767926829; Mon, 04 Jan 2021 05:45:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609767926; cv=none; d=google.com; s=arc-20160816; b=dcoIvyFpEkMnIUKz1suhoR8whSC74NI43y5LKeraic4rSWGviod+mqc37xrOgxFlwn u5Ig5JFiDf3Mrfmx6tGdFfDJW8DOQo7lYUgv8M8z2sWvaMWMa4Yh1QKK03zjXWDTMHEI uXXwz3Qjy/bsUWsFJTtltCKxkslUH2p+ttshqhtvswzfnStUscPv8p6v8WkkdO0ytZ7i NfVz8noltJO/A6vnIb+qxdwfyAY01C+i/baLzWNwCBN4hQI4UuicAQhswyvNILikA12S 3NzztlyI8HNGE1N0g6mJ+hGDlkECBc10gudGHGOnna6hQZzrwFvMcdvPFaI15dL2sWeW Igrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=DWf6z2OIC+lTWIgt6fgK7fJgxdAn3XFKyGff4CPvkec=; b=l9mfnNk8AGRDIhA1TM9jf7VuJB110XuwRLJhT4EwNyKzrifyJEaHKKTsiEs+oKYlww p61iYrzC7eo4ZSgVroGtKGF//32noYpX3y/w8nAY3CtkW7xUC0zKMpyVOzCHjVTj6nZS CQdZtwI/qmMNmF2GBXU15LRP9SP/EZq/pZff/gfIMD3EXMGca5NYZutJMahwr4mos5r1 lFYMHkxeTkgd3/TlsYDv90zO7G8vBX9ZfkXInSw2Pa7rDFAuwMeU/fVqqSXUCqXGP7aV ZLSYPe8G1z393Yn9U7u9BdH53kCeutkwvoZcKFNUKxQboLX+jWQq7SH6HNjgf0e3sLbw Nq1A== ARC-Authentication-Results: i=1; mx.google.com; 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 b24si31736678eds.235.2021.01.04.05.45.03; Mon, 04 Jan 2021 05:45:26 -0800 (PST) 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; 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 S1726300AbhADNnq (ORCPT + 99 others); Mon, 4 Jan 2021 08:43:46 -0500 Received: from mail-ua1-f47.google.com ([209.85.222.47]:34363 "EHLO mail-ua1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbhADNnq (ORCPT ); Mon, 4 Jan 2021 08:43:46 -0500 Received: by mail-ua1-f47.google.com with SMTP id k47so9084859uad.1; Mon, 04 Jan 2021 05:43:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DWf6z2OIC+lTWIgt6fgK7fJgxdAn3XFKyGff4CPvkec=; b=DmEEw1/UZsaY8+0sdoqdic+3nuLC8n7UF1KWyKUaVKIJFEzF9AB6qhMzBD98gFxKxO Pqg5eTlLLEBfdjSiQ/ZI18SojKrJlCxGGTzCcg/VvPZH2vHoyEFf0uCsLoKMQWtzJcVo ZD/w1Y1+WUewD8rhE2eZJVj9WQb3Z/H8W6VrPsrne89rgH8Uge+K8TtVBcgKMLcUadHN MNPO4Sryc012yPh35ogPJeQ17MTqLGoW2Fq+DMs3hxvo3DNK02ipq7eXREXq+31ngfWF VWGpqHq8YGfrlTORQoK6c5ETnJ3+lKS+OEI11XMZKROzy+5NzmSetWduM1OBEZ1ktZ29 11fA== X-Gm-Message-State: AOAM533EnJS00LTFBBmZJcO4k9hhP0uJ8icfV6d/vn128w1ivpK1+oXK NqaHzO0e/TYS27SyWkHui0K99muJUU5Gkw== X-Received: by 2002:ab0:2a01:: with SMTP id o1mr36318366uar.133.1609767783938; Mon, 04 Jan 2021 05:43:03 -0800 (PST) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com. [209.85.222.46]) by smtp.gmail.com with ESMTPSA id f1sm8526287vkb.46.2021.01.04.05.43.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jan 2021 05:43:03 -0800 (PST) Received: by mail-ua1-f46.google.com with SMTP id 73so9078844uac.8; Mon, 04 Jan 2021 05:43:02 -0800 (PST) X-Received: by 2002:ab0:6512:: with SMTP id w18mr43605161uam.55.1609767782501; Mon, 04 Jan 2021 05:43:02 -0800 (PST) MIME-Version: 1.0 References: <20210103111744.34989-1-samuel@sholland.org> <20210103111744.34989-3-samuel@sholland.org> In-Reply-To: <20210103111744.34989-3-samuel@sholland.org> From: Chen-Yu Tsai Date: Mon, 4 Jan 2021 21:42:52 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net 2/4] net: stmmac: dwmac-sun8i: Balance internal PHY resource references To: Samuel Holland Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Ripard , Jernej Skrabec , Corentin Labbe , Ondrej Jirman , netdev , linux-arm-kernel , linux-kernel , linux-sunxi Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 3, 2021 at 7:17 PM Samuel Holland wrote: > > While stmmac_pltfr_remove calls sun8i_dwmac_exit, the sun8i_dwmac_init > and sun8i_dwmac_exit functions are also called by the stmmac_platform > suspend/resume callbacks. They may be called many times during the > device's lifetime and should not release resources used by the driver. > > Furthermore, there was no error handling in case registering the MDIO > mux failed during probe, and the EPHY clock was never released at all. > > Fix all of these issues by moving the deinitialization code to a driver > removal callback. Also ensure the EPHY is powered down before removal. > > Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs") > Signed-off-by: Samuel Holland Reviewed-by: Chen-Yu Tsai