From patchwork Thu Feb 19 23:41:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 5854171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6E7119F36A for ; Thu, 19 Feb 2015 23:46:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7866620351 for ; Thu, 19 Feb 2015 23:46:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 846382034E for ; Thu, 19 Feb 2015 23:46:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YOakS-0008Rc-7Z; Thu, 19 Feb 2015 23:43:12 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YOakP-0008On-0F for linux-arm-kernel@lists.infradead.org; Thu, 19 Feb 2015 23:43:09 +0000 Received: by mail-wi0-f170.google.com with SMTP id hi2so3428151wib.1 for ; Thu, 19 Feb 2015 15:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=IReVahv2+UpdCuzf+KFTN522HTA1JEXq2bmnqsxLCyA=; b=Ijh5qtPvhCYFiIyb1xd5Q22A7ZFWaaqPDLdJ1PBqATwsZC0OVuKBfT/TmgXOfhwRtz kgSaU/rpqk9/y9CIRPUpJBYjnj12aHiQKd9kmT5sv7Y10Tc3cC8iF+y+JBLbhadpyyNv jwpHRqltPWgTcZpefAMfgX/sGexgbxC9CZ4OAp1bw6QgftfrztWc8hBmuXWgSvT3JySS dK9vIoX9/YEZRPi9vbzFzK3SdRMm+skOnXpauOKeL0sowjgv+nfL02zjyYcIe7UUldW9 0zJeu6Te+wOPLstbboSyITp9sSiqQGevfWUMJ/9t9gbI5GG/2qRWYOLxhu5JbeJDHtgm dmtg== X-Received: by 10.194.81.193 with SMTP id c1mr13992031wjy.11.1424389365616; Thu, 19 Feb 2015 15:42:45 -0800 (PST) Received: from Pali-Latitude.kolej.mff.cuni.cz (pali.kolej.mff.cuni.cz. [78.128.193.202]) by mx.google.com with ESMTPSA id ga8sm23274515wib.6.2015.02.19.15.42.42 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Feb 2015 15:42:43 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Tony Lindgren , Russell King , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Paul Walmsley Subject: [PATCH] ARM: OMAP2+: Return correct error values from device and hwmod Date: Fri, 20 Feb 2015 00:41:41 +0100 Message-Id: <1424389302-24380-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150219_154309_190036_A21EA191 X-CRM114-Status: GOOD ( 15.90 ) X-Spam-Score: -0.8 (/) Cc: Nishanth Menon , Ivaylo Dimitrov , Aaro Koskinen , linux-kernel@vger.kernel.org, Felipe Balbi , Sebastian Reichel , Pavel Machek , =?UTF-8?q?Pali=20Roh=C3=A1r?= , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 Without this patch function pm_runtime_get_sync() returns 0 even when some omap subfunction fails. This patch properly propagate error codes from omap functions back to caller. This patch fix problem, when loading omap-aes driver in qemu cause kernel oops. Signed-off-by: Pali Rohár Acked-by: Pavel Machek --- arch/arm/mach-omap2/omap_device.c | 30 +++++++++++++++++------------- arch/arm/mach-omap2/omap_hwmod.c | 20 ++++++++++++-------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index be9541e..9fd47a9 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -224,13 +224,13 @@ static int _omap_device_notifier_call(struct notifier_block *nb, */ static int _omap_device_enable_hwmods(struct omap_device *od) { + int ret = 0; int i; for (i = 0; i < od->hwmods_cnt; i++) - omap_hwmod_enable(od->hwmods[i]); + ret |= omap_hwmod_enable(od->hwmods[i]); - /* XXX pass along return value here? */ - return 0; + return ret; } /** @@ -241,13 +241,13 @@ static int _omap_device_enable_hwmods(struct omap_device *od) */ static int _omap_device_idle_hwmods(struct omap_device *od) { + int ret = 0; int i; for (i = 0; i < od->hwmods_cnt; i++) - omap_hwmod_idle(od->hwmods[i]); + ret |= omap_hwmod_idle(od->hwmods[i]); - /* XXX pass along return value here? */ - return 0; + return ret; } /* Public functions for use by core code */ @@ -595,18 +595,20 @@ static int _od_runtime_suspend(struct device *dev) int ret; ret = pm_generic_runtime_suspend(dev); + if (ret) + return ret; - if (!ret) - omap_device_idle(pdev); - - return ret; + return omap_device_idle(pdev); } static int _od_runtime_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); + int ret; - omap_device_enable(pdev); + ret = omap_device_enable(pdev); + if (ret) + return ret; return pm_generic_runtime_resume(dev); } @@ -740,7 +742,8 @@ int omap_device_enable(struct platform_device *pdev) ret = _omap_device_enable_hwmods(od); - od->_state = OMAP_DEVICE_STATE_ENABLED; + if (ret == 0) + od->_state = OMAP_DEVICE_STATE_ENABLED; return ret; } @@ -770,7 +773,8 @@ int omap_device_idle(struct platform_device *pdev) ret = _omap_device_idle_hwmods(od); - od->_state = OMAP_DEVICE_STATE_IDLE; + if (ret == 0) + od->_state = OMAP_DEVICE_STATE_IDLE; return ret; } diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index cbb908d..2ce4f39 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -3350,16 +3350,17 @@ int omap_hwmod_enable(struct omap_hwmod *oh) */ int omap_hwmod_idle(struct omap_hwmod *oh) { + int r; unsigned long flags; if (!oh) return -EINVAL; spin_lock_irqsave(&oh->_lock, flags); - _idle(oh); + r = _idle(oh); spin_unlock_irqrestore(&oh->_lock, flags); - return 0; + return r; } /** @@ -3372,16 +3373,17 @@ int omap_hwmod_idle(struct omap_hwmod *oh) */ int omap_hwmod_shutdown(struct omap_hwmod *oh) { + int r; unsigned long flags; if (!oh) return -EINVAL; spin_lock_irqsave(&oh->_lock, flags); - _shutdown(oh); + r = _shutdown(oh); spin_unlock_irqrestore(&oh->_lock, flags); - return 0; + return r; } /** @@ -3392,13 +3394,14 @@ int omap_hwmod_shutdown(struct omap_hwmod *oh) */ int omap_hwmod_enable_clocks(struct omap_hwmod *oh) { + int r; unsigned long flags; spin_lock_irqsave(&oh->_lock, flags); - _enable_clocks(oh); + r = _enable_clocks(oh); spin_unlock_irqrestore(&oh->_lock, flags); - return 0; + return r; } /** @@ -3409,13 +3412,14 @@ int omap_hwmod_enable_clocks(struct omap_hwmod *oh) */ int omap_hwmod_disable_clocks(struct omap_hwmod *oh) { + int r; unsigned long flags; spin_lock_irqsave(&oh->_lock, flags); - _disable_clocks(oh); + r = _disable_clocks(oh); spin_unlock_irqrestore(&oh->_lock, flags); - return 0; + return r; } /**