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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS 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 D6B1CC43387 for ; Thu, 17 Jan 2019 19:09:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A43C820657 for ; Thu, 17 Jan 2019 19:09:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ufDq90Sk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728463AbfAQTJt (ORCPT ); Thu, 17 Jan 2019 14:09:49 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55002 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728047AbfAQTJt (ORCPT ); Thu, 17 Jan 2019 14:09:49 -0500 Received: by mail-wm1-f66.google.com with SMTP id a62so2223323wmh.4 for ; Thu, 17 Jan 2019 11:09:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QMm0Jpc17zm9PjKeAVfo4snfCa9CnYP1upJ+FwuOkXs=; b=ufDq90Sk6Lo1+1SlFOChv7g/WQvtU9uvQR/tA9D80tr4npAzt6T8B5GbkSPtoG3a4J 8rLxRcVZR18dRtgTzEG+G6G7Ke8bcOKvaHwuD/mrbS1CnZv50KS3sob6vfjfGE+0gSSf ovp0OhQmNdC3j4Lqod7dYR8qwuJ6g3rE9MNyCf1E+B2MUEbXDmBHh4wios2oN5ZknqBA lvcU2NzDEUc6+KPvrwqBPfZ5yw2MFgY0Xny1RKchKghng5TBL0ojfiMOaoL9aoQff375 q8x2RV7cE3rXEszf3g2Lh//UoTBNncrFXPOMBoHtKMR0wzu+17rqjZvVwZZR6GskFz3v 0LRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QMm0Jpc17zm9PjKeAVfo4snfCa9CnYP1upJ+FwuOkXs=; b=g1silhlaKVnkwU8JQReXeP/wwuyRq7TBiuGYwMT6Zzki8V7dx14zoAvQLvGjYPsdIZ e9MF4YpgaYJGG7fBLUTLYHXBjcRfijPOlIErSHvAhwxPd8DCGi71ei6TeyZsUVZttXxZ ZxJOzLea4GzpjT7qoD0XsLyU6xHatIeCeWnnZGHv7HyO8IWlVt1TBf4HFxN/DBfg2gba GRovFFjVUujtEvXA4weIhfZLwiZR4HqoPp9SinAFvCVHNtMfz3PeYVkhGn5xC27cRyJU 69EQX5rKiF0qorvgK0+uu9+OO/h7DMz3xIrbUKzTGiGaN8qINsC0mSIiv8E+mlYR/X+o RY0g== X-Gm-Message-State: AJcUukcjchGNbkdJV5kyzd7bo971mOuRKa37IaNk6ps5ZdnkEu5XzcYp UAnNELO3h5PMT9kOP3DOPWM/0lsX X-Google-Smtp-Source: ALg8bN4WJAhRHkEV27QWNAoyVOBRxOnKumKbWPKwRxZOCp6dfxTMcR3Dz/XVAKoEBvuoZVBfXO126w== X-Received: by 2002:a1c:9183:: with SMTP id t125mr12592329wmd.79.1547752187307; Thu, 17 Jan 2019 11:09:47 -0800 (PST) Received: from ?IPv6:2003:ea:8bf1:e200:e16f:df31:daf0:b736? (p200300EA8BF1E200E16FDF31DAF0B736.dip0.t-ipconnect.de. [2003:ea:8bf1:e200:e16f:df31:daf0:b736]) by smtp.googlemail.com with ESMTPSA id x12sm64590703wrt.20.2019.01.17.11.09.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 11:09:46 -0800 (PST) Subject: [PATCH v3 net-next 1/3] net: phy: stop PHY if needed when entering phy_disconnect From: Heiner Kallweit To: Florian Fainelli , Andrew Lunn , David Miller Cc: "netdev@vger.kernel.org" References: <317e1806-c820-9a2a-dadd-5d7121b3047a@gmail.com> Message-ID: Date: Thu, 17 Jan 2019 20:07:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <317e1806-c820-9a2a-dadd-5d7121b3047a@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Stop PHY if needed when entering phy_disconnect. This allows drivers that don't need a separate call to phy_stop() to omit this call. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b5f5cda4c..9e588f03e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -999,6 +999,9 @@ EXPORT_SYMBOL(phy_connect); */ void phy_disconnect(struct phy_device *phydev) { + if (phy_is_started(phydev)) + phy_stop(phydev); + if (phydev->irq > 0) phy_stop_interrupts(phydev); -- 2.20.1