Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1967690ybh; Tue, 14 Jul 2020 11:55:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqTQZ12ZLblMo0eFLDZnYu+6x4OimNXFWS24QjwZXma9+gQ2N+m7CCxHjOaDXrZPsSh6ph X-Received: by 2002:aa7:c3d8:: with SMTP id l24mr5788263edr.97.1594752903907; Tue, 14 Jul 2020 11:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594752903; cv=none; d=google.com; s=arc-20160816; b=CAZ5c/eYDC8mi+Nx/enPQaAga+SW94Fctn219OI5uUEAgJtx8ltBRn3q+dK37TbzYm UJnjUMxcdJM42GlEdw5uxOmLowLZBWv/E5vdpRJEBUPU253sctrQQBAvZTcIDkseonrm uPkQH0HU+Ud4boMlPPqq6NmPRUh/0sgAk2wW9+HyL246rfW16qhQ8j05pEWT1VvMiGit o6jLKhy6X17QlkrnKmnhsUd8FTzrrNxXcUlsm/DreFmTauJ5yHiF3SFloWKk3rzDRlA4 3Y7B0+Q4UPqRTcuHiIRVuNGn2cxQPAAFM9OcLvz3d148KMQMPmbAbFu8tgT3T2WORluQ 6sZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EZIaem3a0h9wlXPCcYd1imPGW1zH5CY/u3+Y2XF3e78=; b=RMSTjGZy5ubZsuX/NFUtj+buKY1u3WvRoBS2+YJCLD8k+dLmoBKOEXQ1tzPL8sSy/c 5ZQFK/oIidcKMmvMTSd+Bm1XUngfewZMK//DBgeJBTBYB4b//nuvW1Ocsdtm7BKpNN53 q2O8N7zYOyIxDWMkLhl6U2lxU6aJYL0O6zH0ESwiWPKi/kAwnW3PkmoXHxj1Y5G5DqG4 xFmeQcOqwAh4839sq5UCTl72d+gbW4fDdZ8Xm+2dqpe0zo9zrCpo2DtpfeIeEuMrNOgN zFvu3NAqMMKR/sX5+bgACkNkTIqXWeaZREX7XvST4GkNbGjgJpdCrCNw78+/j9CF4LCE KZKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Es62PjgI; 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 y1si10445332edt.101.2020.07.14.11.54.40; Tue, 14 Jul 2020 11:55:03 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Es62PjgI; 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 S1730392AbgGNSvU (ORCPT + 99 others); Tue, 14 Jul 2020 14:51:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:47656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730370AbgGNSvO (ORCPT ); Tue, 14 Jul 2020 14:51:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F331522B3F; Tue, 14 Jul 2020 18:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594752674; bh=nPabgI61cyglhr8CDG2fYST1FksxQWMrZeREH6JDWuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Es62PjgIiz9QwtHQzV2qdK0S0m8i33UpRDkGOy4xrULoHTKcSZxzlOk6/Qeeyt7oR tKs+tHr3AHd2mopsfCyir5lHYNrkzUeB3YQN11Iom4VogAO51fpbvDPNlmvUUZ0h3q UJwpN5UIaJ4T02RSS8lC07ZRs4zD6BEgYVmtEdj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Harini Katakam , Sergio Prado , Florian Fainelli , Nicolas Ferre , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 067/109] net: macb: fix call to pm_runtime in the suspend/resume functions Date: Tue, 14 Jul 2020 20:44:10 +0200 Message-Id: <20200714184108.732893390@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714184105.507384017@linuxfoundation.org> References: <20200714184105.507384017@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicolas Ferre [ Upstream commit 6c8f85cac98a4c6b767c4c4f6af7283724c32b47 ] The calls to pm_runtime_force_suspend/resume() functions are only relevant if the device is not configured to act as a WoL wakeup source. Add the device_may_wakeup() test before calling them. Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Sergio Prado Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index e7fafe2fcae5d..01ed4d4296db2 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4453,7 +4453,8 @@ static int __maybe_unused macb_suspend(struct device *dev) netif_carrier_off(netdev); if (bp->ptp_info) bp->ptp_info->ptp_remove(netdev); - pm_runtime_force_suspend(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_suspend(dev); return 0; } @@ -4468,7 +4469,8 @@ static int __maybe_unused macb_resume(struct device *dev) if (!netif_running(netdev)) return 0; - pm_runtime_force_resume(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_resume(dev); if (bp->wol & MACB_WOL_ENABLED) { macb_writel(bp, IDR, MACB_BIT(WOL)); -- 2.25.1