Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a65d0d79 authored by Magnus Damm's avatar Magnus Damm Committed by Paul Mundt
Browse files

sh: allow runtime pm without suspend/resume callbacks



This patch updates the Runtime PM code for SuperH Mobile
to allow drivers to have NULL as pm or callback value.
With this in place there is no need for no-op functions.

Signed-off-by: default avatarMagnus Damm <damm@opensource.se>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 1c2e36cc
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -45,12 +45,14 @@ static int __platform_pm_runtime_resume(struct platform_device *pdev)


	dev_dbg(d, "__platform_pm_runtime_resume() [%d]\n", hwblk);
	dev_dbg(d, "__platform_pm_runtime_resume() [%d]\n", hwblk);


	if (d->driver && d->driver->pm && d->driver->pm->runtime_resume) {
	if (d->driver) {
		hwblk_enable(hwblk_info, hwblk);
		hwblk_enable(hwblk_info, hwblk);
		ret = 0;
		ret = 0;


		if (test_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags)) {
		if (test_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags)) {
			if (d->driver->pm && d->driver->pm->runtime_resume)
				ret = d->driver->pm->runtime_resume(d);
				ret = d->driver->pm->runtime_resume(d);

			if (!ret)
			if (!ret)
				clear_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
				clear_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
			else
			else
@@ -73,12 +75,15 @@ static int __platform_pm_runtime_suspend(struct platform_device *pdev)


	dev_dbg(d, "__platform_pm_runtime_suspend() [%d]\n", hwblk);
	dev_dbg(d, "__platform_pm_runtime_suspend() [%d]\n", hwblk);


	if (d->driver && d->driver->pm && d->driver->pm->runtime_suspend) {
	if (d->driver) {
		BUG_ON(!test_bit(PDEV_ARCHDATA_FLAG_IDLE, &ad->flags));
		BUG_ON(!test_bit(PDEV_ARCHDATA_FLAG_IDLE, &ad->flags));
		ret = 0;


		if (d->driver->pm && d->driver->pm->runtime_suspend) {
			hwblk_enable(hwblk_info, hwblk);
			hwblk_enable(hwblk_info, hwblk);
			ret = d->driver->pm->runtime_suspend(d);
			ret = d->driver->pm->runtime_suspend(d);
			hwblk_disable(hwblk_info, hwblk);
			hwblk_disable(hwblk_info, hwblk);
		}


		if (!ret) {
		if (!ret) {
			set_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
			set_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);