treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm / mach-omap2 / omap-iommu.c
blobf1a6ece8108e47ad049416e682a730fe319dcab1
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * OMAP IOMMU quirks for various TI SoCs
5 * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/
6 * Suman Anna <s-anna@ti.com>
7 */
9 #include <linux/platform_device.h>
10 #include <linux/err.h>
12 #include "omap_hwmod.h"
13 #include "omap_device.h"
14 #include "powerdomain.h"
16 int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, bool request,
17 u8 *pwrst)
19 struct powerdomain *pwrdm;
20 struct omap_device *od;
21 u8 next_pwrst;
23 od = to_omap_device(pdev);
24 if (!od)
25 return -ENODEV;
27 if (od->hwmods_cnt != 1)
28 return -EINVAL;
30 pwrdm = omap_hwmod_get_pwrdm(od->hwmods[0]);
31 if (!pwrdm)
32 return -EINVAL;
34 if (request)
35 *pwrst = pwrdm_read_next_pwrst(pwrdm);
37 if (*pwrst > PWRDM_POWER_RET)
38 return 0;
40 next_pwrst = request ? PWRDM_POWER_ON : *pwrst;
42 return pwrdm_set_next_pwrst(pwrdm, next_pwrst);