From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Sender: linux-kernel-owner@vger.kernel.org To: Tony Lindgren , Russell King , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Paul Walmsley Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Pavel Machek , Sebastian Reichel , Aaro Koskinen , Ivaylo Dimitrov , Felipe Balbi , Nishanth Menon , =?UTF-8?q?Pali=20Roh=C3=A1r?= List-Id: linux-omap@vger.kernel.org Without this patch function pm_runtime_get_sync() returns 0 even when s= ome 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 kern= el oops. Signed-off-by: Pali Roh=C3=A1r --- 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/om= ap_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 noti= fier_block *nb, */ static int _omap_device_enable_hwmods(struct omap_device *od) { + int ret =3D 0; int i; =20 for (i =3D 0; i < od->hwmods_cnt; i++) - omap_hwmod_enable(od->hwmods[i]); + ret |=3D omap_hwmod_enable(od->hwmods[i]); =20 - /* XXX pass along return value here? */ - return 0; + return ret; } =20 /** @@ -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 =3D 0; int i; =20 for (i =3D 0; i < od->hwmods_cnt; i++) - omap_hwmod_idle(od->hwmods[i]); + ret |=3D omap_hwmod_idle(od->hwmods[i]); =20 - /* XXX pass along return value here? */ - return 0; + return ret; } =20 /* Public functions for use by core code */ @@ -595,18 +595,20 @@ static int _od_runtime_suspend(struct device *dev= ) int ret; =20 ret =3D pm_generic_runtime_suspend(dev); + if (ret) + return ret; =20 - if (!ret) - omap_device_idle(pdev); - - return ret; + return omap_device_idle(pdev); } =20 static int _od_runtime_resume(struct device *dev) { struct platform_device *pdev =3D to_platform_device(dev); + int ret; =20 - omap_device_enable(pdev); + ret =3D omap_device_enable(pdev); + if (ret) + return ret; =20 return pm_generic_runtime_resume(dev); } @@ -740,7 +742,8 @@ int omap_device_enable(struct platform_device *pdev= ) =20 ret =3D _omap_device_enable_hwmods(od); =20 - od->_state =3D OMAP_DEVICE_STATE_ENABLED; + if (ret =3D=3D 0) + od->_state =3D OMAP_DEVICE_STATE_ENABLED; =20 return ret; } @@ -770,7 +773,8 @@ int omap_device_idle(struct platform_device *pdev) =20 ret =3D _omap_device_idle_hwmods(od); =20 - od->_state =3D OMAP_DEVICE_STATE_IDLE; + if (ret =3D=3D 0) + od->_state =3D OMAP_DEVICE_STATE_IDLE; =20 return ret; } diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/oma= p_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; =20 if (!oh) return -EINVAL; =20 spin_lock_irqsave(&oh->_lock, flags); - _idle(oh); + r =3D _idle(oh); spin_unlock_irqrestore(&oh->_lock, flags); =20 - return 0; + return r; } =20 /** @@ -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; =20 if (!oh) return -EINVAL; =20 spin_lock_irqsave(&oh->_lock, flags); - _shutdown(oh); + r =3D _shutdown(oh); spin_unlock_irqrestore(&oh->_lock, flags); =20 - return 0; + return r; } =20 /** @@ -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; =20 spin_lock_irqsave(&oh->_lock, flags); - _enable_clocks(oh); + r =3D _enable_clocks(oh); spin_unlock_irqrestore(&oh->_lock, flags); =20 - return 0; + return r; } =20 /** @@ -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; =20 spin_lock_irqsave(&oh->_lock, flags); - _disable_clocks(oh); + r =3D _disable_clocks(oh); spin_unlock_irqrestore(&oh->_lock, flags); =20 - return 0; + return r; } =20 /** --=20 1.7.9.5