From patchwork Thu Feb 26 13:49:51 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: 5893061 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@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 A6A5E9F373 for ; Thu, 26 Feb 2015 13:55:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE939203A5 for ; Thu, 26 Feb 2015 13:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5581203A1 for ; Thu, 26 Feb 2015 13:55:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932246AbbBZNua (ORCPT ); Thu, 26 Feb 2015 08:50:30 -0500 Received: from mail-wg0-f45.google.com ([74.125.82.45]:42979 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932239AbbBZNu1 (ORCPT ); Thu, 26 Feb 2015 08:50:27 -0500 Received: by wghl2 with SMTP id l2so10920645wgh.9; Thu, 26 Feb 2015 05:50:25 -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:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=lICX+G4vAeoL3xYl1Ie+VYT2hJuofZNmhAPXk3/Gbqg=; b=FzvZhcxGJJWVbxhocVmDnbhZAYQTstWbbWx0otSw2XFonteDm/Pac7gOycqdhVo0YF 2Wmj25Ne1I9I5BerL2OcLD1Xd0wN6OfYTcEqmG+JJXAB6Kzymy5QfkKfXzhz34JoW6fm MMv0FkGACPOy3lxZ0RiCK1YbV4543dxF+25THjXJT2y61vo2+/MIJxXz69yCbtHP3HI6 T2IWZMS8jMHC4e3wF0OJe9V2vQ4AmxMgviXEtSCcE0HaOJHUHEILtOBlxvWGUf5iQE+e LhasE97EF4Py40v1ORiamr2txJKG6dcPeoAVWdfZNFM238bqI49m9xGWGbxgwm9dtFEw mgUw== X-Received: by 10.180.106.70 with SMTP id gs6mr41167435wib.39.1424958625723; Thu, 26 Feb 2015 05:50:25 -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 k6sm29959364wia.6.2015.02.26.05.50.23 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Feb 2015 05:50:24 -0800 (PST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Tony Lindgren , Rob Herring , Russell King , Paul Walmsley , Herbert Xu , "David S. Miller" Cc: linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Pavel Machek , Nishanth Menon , Ivaylo Dimitrov , Aaro Koskinen , Sebastian Reichel , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 01/10] ARM: OMAP2+: Return correct error values from device and hwmod Date: Thu, 26 Feb 2015 14:49:51 +0100 Message-Id: <1424958600-18881-2-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1424958600-18881-1-git-send-email-pali.rohar@gmail.com> References: <1424958600-18881-1-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 --- arch/arm/mach-omap2/omap_device.c | 30 +++++++++++++++++------------- arch/arm/mach-omap2/omap_hwmod.c | 10 ++++++---- 2 files changed, 23 insertions(+), 17 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 92afb72..870e984 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; } /*