From patchwork Thu Oct 27 11:23:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9399457 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4BA3605A7 for ; Thu, 27 Oct 2016 14:10:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 870BF2A2F3 for ; Thu, 27 Oct 2016 14:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AB2D2A30C; Thu, 27 Oct 2016 14:10:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE46B2A2FF for ; Thu, 27 Oct 2016 14:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942356AbcJ0OHe (ORCPT ); Thu, 27 Oct 2016 10:07:34 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36423 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936547AbcJ0OHd (ORCPT ); Thu, 27 Oct 2016 10:07:33 -0400 Received: by mail-lf0-f53.google.com with SMTP id b75so32270882lfg.3 for ; Thu, 27 Oct 2016 07:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6DT3JJT6eNu5/d1KBQSuRRmireOiKUQF5n7dgofaOQA=; b=NFrhqevbu6vFKeeJZ4Omvs3SYPAqHWaEoM6FwFVWSzhMJV8LxkojOo1jABrI1vtOfH egXfVP3BDuAjGpjJFqr2tHIu+MrCXZ+MzThiqdFWLNFFqgZ9E7sp6Hdd9GHLdLS2/bRa HK/k5mTeErm5cyFZMiHfYu3+6MvRElXv+KFU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6DT3JJT6eNu5/d1KBQSuRRmireOiKUQF5n7dgofaOQA=; b=ERPJ/gXeMyD4uIWnV0KGLtYMLcDa0kyVTcT3UamSp63wrpEYgLSBT3RGwOB2rfqc0l RkO8gdRh3Fsj2i1OUuxlfUMR+oRuUY6KjFQZgWLeyGy5lxCsvKyUw8re0E1U16KYg3ez cuxcCE5O3lflUoMxFaUrSPESbZB26+1yoO1NiRh4R1UUhSxHN7HGhqnPcGHC9XGInpVR jWYcb+V5yHUTpyWRD3vTkKuEuIIfq0W/wXs0gMbX6Gqwe5AAVofL1uI7f6/nxsBfVzAw dW58XI3yQWRBEoNPoVMxalIpiSTKploLStUvftDXw/tv7CkLDk2EM8dExDTd2E9cYLuY ykvQ== X-Gm-Message-State: ABUngvdMQCBL973NjJsMLuG9iWL/StFIjyPi9UbuW+gK2NrVOz9uQo4aBw8buNxmy8UaHP12 X-Received: by 10.25.215.88 with SMTP id o85mr5798393lfg.98.1477567450460; Thu, 27 Oct 2016 04:24:10 -0700 (PDT) Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id b76sm1184658lfg.25.2016.10.27.04.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Oct 2016 04:24:09 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Alan Stern , Ulf Hansson , linux-pm@vger.kernel.org, netdev@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Geert Uytterhoeven , Lina Iyer , Jon Hunter , Marek Szyprowski , Linus Walleij , Steve Glendinning Subject: [PATCH] net: smsc911x: Synchronize the runtime PM status during system suspend Date: Thu, 27 Oct 2016 13:23:54 +0200 Message-Id: <1477567434-5128-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The smsc911c driver puts its device into low power state when entering system suspend. Although it doesn't update the device's runtime PM status to RPM_SUSPENDED, which causes problems for a parent device. In particular, when the runtime PM status of the parent is requested to be updated to RPM_SUSPENDED, the runtime PM core prevent this, because it's forbidden to runtime suspend a device, which has an active child. Fix this by updating the runtime PM status of the smsc911x device to RPM_SUSPENDED during system suspend. In system resume, let's reverse that action by runtime resuming the device and thus also the parent. Signed-off-by: Ulf Hansson Tested-by: Geert Uytterhoeven Cc: Steve Glendinning Fixes: 8b1107b85efd ("PM / Runtime: Don't allow to suspend a device with an active child") --- Note that the commit this change fixes is currently queued for 4.10 via Rafael's linux-pm tree. So this fix should go via that tree as well. --- drivers/net/ethernet/smsc/smsc911x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index e9b8579..65fca9c 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2584,6 +2584,9 @@ static int smsc911x_suspend(struct device *dev) PMT_CTRL_PM_MODE_D1_ | PMT_CTRL_WOL_EN_ | PMT_CTRL_ED_EN_ | PMT_CTRL_PME_EN_); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + return 0; } @@ -2593,6 +2596,9 @@ static int smsc911x_resume(struct device *dev) struct smsc911x_data *pdata = netdev_priv(ndev); unsigned int to = 100; + pm_runtime_enable(dev); + pm_runtime_resume(dev); + /* Note 3.11 from the datasheet: * "When the LAN9220 is in a power saving state, a write of any * data to the BYTE_TEST register will wake-up the device."