summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-06 21:36:20 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-07-19 11:14:55 +0300
commit4d04c23fadc67acc47f26f7143e15c81b0143f47 (patch)
tree4399e388d957fc4ca808227106fa3a2d19da5bdd /drivers/media
parentf5ddf19eca33281d8aabb8d802bed5a5658bbcb6 (diff)
downloadlinux-4d04c23fadc67acc47f26f7143e15c81b0143f47.tar.xz
media: ti-vpe: cal: Use ARRAY_SIZE to replace numerical value
Use ARRAY_SIZE(cal->ctx) to iterate over the cal->ctx array instead of using the numerical value from the CAL_NUM_CONTEXT macro (or, worse, hardcoding the value 2). This will allow reworking contexts with less changes in the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Benoit Parrot <bparrot@ti.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/ti-vpe/cal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index a2c245ad23be..e91788519bb4 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -1314,7 +1314,7 @@ static irqreturn_t cal_irq(int irq_cal, void *data)
/* Clear Interrupt status */
reg_write(cal, CAL_HL_IRQSTATUS(1), status);
- for (i = 0; i < 2; ++i) {
+ for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
if (isportirqset(status, i)) {
ctx = cal->ctx[i];
@@ -1337,7 +1337,7 @@ static irqreturn_t cal_irq(int irq_cal, void *data)
/* Clear Interrupt status */
reg_write(cal, CAL_HL_IRQSTATUS(2), status);
- for (i = 0; i < 2; ++i) {
+ for (i = 0; i < ARRAY_SIZE(cal->ctx); ++i) {
if (isportirqset(status, i)) {
ctx = cal->ctx[i];
dma_q = &ctx->vidq;
@@ -2345,7 +2345,7 @@ error_pm_runtime:
pm_runtime_disable(&pdev->dev);
error_context:
- for (i = 0; i < CAL_NUM_CONTEXT; i++) {
+ for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
ctx = cal->ctx[i];
if (ctx) {
v4l2_async_notifier_unregister(&ctx->notifier);
@@ -2373,7 +2373,7 @@ static int cal_remove(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
- for (i = 0; i < CAL_NUM_CONTEXT; i++) {
+ for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
ctx = cal->ctx[i];
if (ctx) {
ctx_dbg(1, ctx, "unregistering %s\n",