From patchwork Tue Aug 1 16:43:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mason X-Patchwork-Id: 9875027 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 E36AE6038F for ; Tue, 1 Aug 2017 16:46:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6C0028709 for ; Tue, 1 Aug 2017 16:46:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB7CD201CB; Tue, 1 Aug 2017 16:46:19 +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=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 690C528721 for ; Tue, 1 Aug 2017 16:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:Subject:From:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W0pH0O9UM597GF3hTY2b/hfCswJT/gvVOmWEFoUzFgk=; b=b0dKTga7+sRV6L Zr4D3zGfX1CTvjI1Ln1mE7mS5G44kGFqdJhiMJZegCkjK3hVojvwLTh+3T1HQSE6ZpPoOjsEwZn8/ o31MqUOJ9DT55OScMr3FksjZKXyVVz8IIgvQ547WDKGWC8X95sLD0l8Jl+ZqLwJBs+qPm7BmJRdKo veafvGgRzcmYHdCRKbKL7Mci58sxxFPAzcaF8yyZsBvL6PZWXodpnwo3BBOnacpars6rP7ctLgm9B MkiqAMiwXuQm1SGIL9yStZ2tjaiVEEre6qBD3x+21ggzy+sgUTFQNaPdAEBUDwyE81StW1MgchqD+ CQYgAAL1ycyEDutzAdXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dcaJB-0004GK-Lf; Tue, 01 Aug 2017 16:46:13 +0000 Received: from smtp5-g21.free.fr ([212.27.42.5]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcaIj-0003ev-6S for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2017 16:45:56 +0000 Received: from [172.27.0.114] (unknown [92.154.11.170]) (Authenticated sender: slash.tmp) by smtp5-g21.free.fr (Postfix) with ESMTPSA id DDF315FFD7; Tue, 1 Aug 2017 18:45:13 +0200 (CEST) From: Mason Subject: [RFC PATCH v2 2/2] net: ethernet: nb8800: Add suspend/resume support To: Florian Fainelli , David Miller , Mans Rullgard References: <33d1ab47-6098-5e3f-8a3c-f72626d07113@free.fr> Message-ID: <9e7bbeac-748d-c837-f621-89ab728d5c2f@free.fr> Date: Tue, 1 Aug 2017 18:43:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.1 MIME-Version: 1.0 In-Reply-To: <33d1ab47-6098-5e3f-8a3c-f72626d07113@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170801_094546_151840_54FAD98C X-CRM114-Status: GOOD ( 10.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev , Linux ARM Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Wrappers around nb8800_stop and nb8800_open. --- drivers/net/ethernet/aurora/nb8800.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c index aa18ea25d91f..607064a6d7a1 100644 --- a/drivers/net/ethernet/aurora/nb8800.c +++ b/drivers/net/ethernet/aurora/nb8800.c @@ -1012,7 +1012,6 @@ static int nb8800_stop(struct net_device *dev) netif_stop_queue(dev); napi_disable(&priv->napi); - nb8800_dma_stop(dev); nb8800_mac_rx(dev, false); nb8800_mac_tx(dev, false); @@ -1526,6 +1525,26 @@ static int nb8800_remove(struct platform_device *pdev) return 0; } +static int nb8800_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct net_device *dev = platform_get_drvdata(pdev); + + if (netif_running(dev)) + nb8800_stop(dev); + + return 0; +} + +static int nb8800_resume(struct platform_device *pdev) +{ + struct net_device *dev = platform_get_drvdata(pdev); + + if (netif_running(dev)) + nb8800_open(dev); + + return 0; +} + static struct platform_driver nb8800_driver = { .driver = { .name = "nb8800", @@ -1533,6 +1552,8 @@ static struct platform_driver nb8800_driver = { }, .probe = nb8800_probe, .remove = nb8800_remove, + .suspend = nb8800_suspend, + .resume = nb8800_resume, }; module_platform_driver(nb8800_driver);