From patchwork Fri Mar 14 19:00:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3834641 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3CDA7BF540 for ; Fri, 14 Mar 2014 19:00:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3423A2034E for ; Fri, 14 Mar 2014 19:00:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D24520304 for ; Fri, 14 Mar 2014 19:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754997AbaCNTAL (ORCPT ); Fri, 14 Mar 2014 15:00:11 -0400 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81]:52700 "EHLO rainbowdash.ducie.codethink.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754970AbaCNTAL (ORCPT ); Fri, 14 Mar 2014 15:00:11 -0400 Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1WOXKx-0008Ip-4S; Fri, 14 Mar 2014 19:00:07 +0000 From: Ben Dooks To: linux-sh@vger.kernel.org Cc: geert@linux-m68k.org, laurent.pinchart@ideasonboard.com, Ben Dooks Subject: [PATCH] sh_eth: ensure pm_runtime cannot suspend the device during init Date: Fri, 14 Mar 2014 19:00:05 +0000 Message-Id: <1394823605-31883-1-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.9.0 In-Reply-To: References: Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It seems the pm_rumtime work queue is causing the device to be suspended during initialisation, thus the initialisation may not be able to access registers properly. Use pm_runtime_get_sync() and pm_runtime_put_sync() to ensure that the pm system does not suspend it during the probe() call. Signed-off-by: Ben Dooks Tested-by: Geert Uytterhoeven --- drivers/net/ethernet/renesas/sh_eth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 4f76b5e..88aac2c 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2870,6 +2870,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) mdp->pdev = pdev; pm_runtime_enable(&pdev->dev); pm_runtime_resume(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); if (pdev->dev.of_node) pd = sh_eth_parse_dt(&pdev->dev); @@ -2961,6 +2962,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) pr_info("Base address at 0x%x, %pM, IRQ %d.\n", (u32)ndev->base_addr, ndev->dev_addr, ndev->irq); + pm_runtime_put_sync(&pdev->dev); platform_set_drvdata(pdev, ndev); return ret;