From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham 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 D9695C43387 for ; Wed, 16 Jan 2019 21:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B45820652 for ; Wed, 16 Jan 2019 21:48:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="K3mrqEpw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731535AbfAPVse (ORCPT ); Wed, 16 Jan 2019 16:48:34 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:45853 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730479AbfAPVse (ORCPT ); Wed, 16 Jan 2019 16:48:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Ap5EKBfdPuyXUZUWPxSflEJ5AyNsdhQgC+fssNMe+ec=; b=K3mrqEpwJmAJAXN64sXdh5Ta/ABzGDiy/8GNfyHzyPxJW1pvLNnUdXIbBf/2HReldf1M5dwnuhzUnkm1fO6ZaXy7wG+SLha/1xmvX8XVXZOSSVSf7E+08OCTxwmQMkd51xLheAWEX8wnuMZhoH+N+WmRdwDQsl9oaDI+ynHbpTQ=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1gjt30-0002De-RY; Wed, 16 Jan 2019 22:48:30 +0100 Date: Wed, 16 Jan 2019 22:48:30 +0100 From: Andrew Lunn To: Heiner Kallweit Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" Subject: Re: [PATCH v2 net-next 1/3] net: phy: check that PHY is stopped when entering phy_disconnect Message-ID: <20190116214830.GK29244@lunn.ch> References: <36e18752-488a-8fa7-ce0a-376446455345@gmail.com> <36d66609-9d1f-a116-c12b-266802eb61de@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36d66609-9d1f-a116-c12b-266802eb61de@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 16, 2019 at 09:25:15PM +0100, Heiner Kallweit wrote: > Every driver should have called phy_stop() before calling > phy_disconnect(). Let's check for this and ensure PHY is stopped > when starting with the actual work in phy_disconnect(). Hi Heiner Looking at the patch, i think why must the MAC driver call phy_stop() before phy_disconnect()? It keeps is symmetrical, you need phy_connect() and then phy_start(). But if the core can detect that phy_stop() has not been called, and can call phy_stop() when needed, we can probably simplify the MAC drivers by removing many of the phy_stop() calls. I think it might come down to where the phy_connect()/phy_disconnect() is performed. Sometimes it is in probe()/remove(), sometimes it is in open()/close(). If phy_disconnect() is in remove(), phy_stop() is needed in close(). But if phy_disconnect() is called in close() the phy_stop() could be skipped? Before we start adding warning, we probably should first document the expectations. Documentation/networking/phy.txt seems like a good place. Andrew