Commit 9cc7d85e authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Inki Dae

drm/exynos/ipp: simplify ipp_find_driver

The patch puts repeated code sequence into one function, removes verbose
comments and decreases log verbosity.
Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 12ff54d2
...@@ -174,18 +174,18 @@ static void *ipp_find_obj(struct idr *id_idr, struct mutex *lock, u32 id) ...@@ -174,18 +174,18 @@ static void *ipp_find_obj(struct idr *id_idr, struct mutex *lock, u32 id)
return obj; return obj;
} }
static inline bool ipp_check_dedicated(struct exynos_drm_ippdrv *ippdrv, static int ipp_check_driver(struct exynos_drm_ippdrv *ippdrv,
enum drm_exynos_ipp_cmd cmd) struct drm_exynos_ipp_property *property)
{ {
/* if (ippdrv->dedicated || (!ipp_is_m2m_cmd(property->cmd) &&
* check dedicated flag and WB, OUTPUT operation with !pm_runtime_suspended(ippdrv->dev)))
* power on state. return -EBUSY;
*/
if (ippdrv->dedicated || (!ipp_is_m2m_cmd(cmd) &&
!pm_runtime_suspended(ippdrv->dev)))
return true;
return false; if (ippdrv->check_property &&
ippdrv->check_property(ippdrv->dev, property))
return -EINVAL;
return 0;
} }
static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx, static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx,
...@@ -193,62 +193,30 @@ static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx, ...@@ -193,62 +193,30 @@ static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx,
{ {
struct exynos_drm_ippdrv *ippdrv; struct exynos_drm_ippdrv *ippdrv;
u32 ipp_id = property->ipp_id; u32 ipp_id = property->ipp_id;
int ret;
DRM_DEBUG_KMS("ipp_id[%d]\n", ipp_id);
if (ipp_id) { if (ipp_id) {
/* find ipp driver using idr */ ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, ipp_id);
ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock,
ipp_id);
if (!ippdrv) { if (!ippdrv) {
DRM_ERROR("not found ipp%d driver.\n", ipp_id); DRM_DEBUG("ipp%d driver not found\n", ipp_id);
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
} }
/* ret = ipp_check_driver(ippdrv, property);
* WB, OUTPUT opertion not supported multi-operation. if (ret < 0) {
* so, make dedicated state at set property ioctl. DRM_DEBUG("ipp%d driver check error %d\n", ipp_id, ret);
* when ipp driver finished operations, clear dedicated flags. return ERR_PTR(ret);
*/
if (ipp_check_dedicated(ippdrv, property->cmd)) {
DRM_ERROR("already used choose device.\n");
return ERR_PTR(-EBUSY);
}
/*
* This is necessary to find correct device in ipp drivers.
* ipp drivers have different abilities,
* so need to check property.
*/
if (ippdrv->check_property &&
ippdrv->check_property(ippdrv->dev, property)) {
DRM_ERROR("not support property.\n");
return ERR_PTR(-EINVAL);
} }
return ippdrv; return ippdrv;
} else { } else {
/*
* This case is search all ipp driver for finding.
* user application don't set ipp_id in this case,
* so ipp subsystem search correct driver in driver list.
*/
list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) { list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) {
if (ipp_check_dedicated(ippdrv, property->cmd)) { ret = ipp_check_driver(ippdrv, property);
DRM_DEBUG_KMS("used device.\n"); if (ret == 0)
continue; return ippdrv;
}
if (ippdrv->check_property &&
ippdrv->check_property(ippdrv->dev, property)) {
DRM_DEBUG_KMS("not support property.\n");
continue;
}
return ippdrv;
} }
DRM_ERROR("not support ipp driver operations.\n"); DRM_DEBUG("cannot find driver suitable for given property.\n");
} }
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment