From patchwork Wed May 14 01:31:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 30140 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B5FDD20446 for ; Wed, 14 May 2014 01:32:25 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wo20sf5536516obc.7 for ; Tue, 13 May 2014 18:32:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=xoLlvv1EvTzL4itc/FG3gkuI1KYOclamqSY6n39O7r0=; b=WplTKwnzOWrp3FWxepZ3Plfi1iq8MCf4N4+iUGktKhboPeHMfOuajRlRyQSKsslzpI 7oiBiMM/z87laB1Wj1iGmv8Paj0dW2/r8ql3aA4qjVJnkVAQNQLrZCrm0W6hzgUPmNlj n1dXxnyhmY8YE7tyvxc1t6U29kRbjCWmVq77IC/KjybR2k0CG4njloEzwCbmCk96UxKu AhTRkJOdbea2j2Kkebs/mq1SpclezbIr5+3bw/fPprAdiF384oWAMGdkQ163XjkrUCAI Sw/AZ3q9OAhjYPULWu7wnG+Q5vC5oIJU0iHvWegV/TGF4TF5fV/nIoB5+/f9vqqv1uEZ 9wEQ== X-Gm-Message-State: ALoCoQnjA0Wt19+oUdZRr25I6GdWFLLl/RLi52OtxFH1DvzdMtxW6U0MnMj0KYuSsOxEwh0KOp/2 X-Received: by 10.42.155.137 with SMTP id u9mr277775icw.12.1400031145181; Tue, 13 May 2014 18:32:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls1696367qgx.9.gmail; Tue, 13 May 2014 18:32:25 -0700 (PDT) X-Received: by 10.58.122.164 with SMTP id lt4mr354842veb.2.1400031145090; Tue, 13 May 2014 18:32:25 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id qw5si52354vcb.48.2014.05.13.18.32.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 18:32:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so1523174veb.16 for ; Tue, 13 May 2014 18:32:25 -0700 (PDT) X-Received: by 10.220.133.197 with SMTP id g5mr341025vct.20.1400031144863; Tue, 13 May 2014 18:32:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp194106vcb; Tue, 13 May 2014 18:32:24 -0700 (PDT) X-Received: by 10.68.248.7 with SMTP id yi7mr553484pbc.31.1400031144117; Tue, 13 May 2014 18:32:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dg5si128965pbc.265.2014.05.13.18.31.54; Tue, 13 May 2014 18:31:54 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752026AbaENBbv (ORCPT + 3 others); Tue, 13 May 2014 21:31:51 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:43121 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbaENBbu (ORCPT ); Tue, 13 May 2014 21:31:50 -0400 Received: by mail-pa0-f42.google.com with SMTP id rd3so970832pab.29 for ; Tue, 13 May 2014 18:31:50 -0700 (PDT) X-Received: by 10.66.231.105 with SMTP id tf9mr627921pac.84.1400031110431; Tue, 13 May 2014 18:31:50 -0700 (PDT) Received: from localhost.localdomain ([60.166.209.254]) by mx.google.com with ESMTPSA id or4sm363478pbb.17.2014.05.13.18.31.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 18:31:49 -0700 (PDT) From: Zhangfei Gao To: sebastian.hesselbarth@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, sergei.shtylyov@cogentembedded.com Cc: netdev@vger.kernel.org, Zhangfei Gao , Jiancheng Xue Subject: [PATCH v1] net: phy: resume phydev when going to RESUMING Date: Wed, 14 May 2014 09:31:38 +0800 Message-Id: <1400031098-19072-1-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: netdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , "With commit be9dad1f9f26604fb ("net: phy: suspend phydev when going to HALTED"), an unused PHY device will be put in a low-power mode using BMCR_PDOWN. Some Ethernet drivers might be calling phy_start() and phy_stop() from ndo_open and ndo_close() respectively, while calling phy_connect() and phy_disconnect() from probe and remove. In such a case, the PHY will be powered down during the phy_stop() call, but will fail to be powered up in phy_start(). This patch fixes the following scenario." Signed-off-by: Jiancheng Xue Signed-off-by: Zhangfei Gao --- drivers/net/phy/phy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1b6d09a..be5d52e 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -715,7 +715,7 @@ void phy_state_machine(struct work_struct *work) struct delayed_work *dwork = to_delayed_work(work); struct phy_device *phydev = container_of(dwork, struct phy_device, state_queue); - int needs_aneg = 0, do_suspend = 0; + int needs_aneg = 0, do_suspend = 0, do_resume = 0; int err = 0; mutex_lock(&phydev->lock); @@ -865,6 +865,8 @@ void phy_state_machine(struct work_struct *work) } phydev->adjust_link(phydev->attached_dev); } + + do_resume = 1; break; } @@ -876,6 +878,9 @@ void phy_state_machine(struct work_struct *work) if (do_suspend) phy_suspend(phydev); + if (do_resume) + phy_resume(phydev); + if (err < 0) phy_error(phydev);