Received: by 10.213.65.68 with SMTP id h4csp505235imn; Tue, 13 Mar 2018 11:09:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELuPFpf+LD01g/SKIUZpIC5kgswBFQtsGhYEc9r9iP05f8f+d0eiOAJ9A0XUdcXPKEtOyGJ0 X-Received: by 10.99.103.196 with SMTP id b187mr1206083pgc.1.1520964558202; Tue, 13 Mar 2018 11:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520964558; cv=none; d=google.com; s=arc-20160816; b=Kb9gRYdlsndDGX59p2Bc/s0Epu6Kzciy5XqBHpi8Arvz1woZ3z8bn0SEL41CZ4eQS6 h0Q0sDqxIzY45Vz15e0s+Fy3iSoKkC4E6tHhUCVQuW3MEj+LpI6B4/eeHhGJf/pyhXa0 UpZpdu2LlIAGKAhbK/PujGQN428MnmgeyG9MO5CKAyb7FjWkHY+V5lp02eMo7Up7F3H6 Y3vKE9MbMz/r+qggHQtl80m2Q4pT0q0I4gSUWP9orzlZCwbFNSHUJH2YjY0onYfSBquA g4gJRxNtIIQeyIXnkcJHqO3GtKNrt+spzJMYb7n39/SDzr5rFN63nGudUwsi7j7a6YS2 hBkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=C3aZapPpHAsW5nvK635+a0tkBxqMGdsb4rWTzAepH1o=; b=wlwXhYC1rCVJ13+LmZ452eNgutiCgczZnA8A3DWgVxEbyaAamaNALk8UF8gnt4wpXL opGAmLPgPCk9LDIwORisZEJTJB7vwSUxSooF9zPbsYNkOfuMh9zagFs2vWlDM8vxsaUL q+iIz6H3/sqDRpMfRzsSlu9GUjJpRdXGxEN+ntZOaZNO1Yd/d/uUiU+1Rc0fTymMY9cn taCGAwe36PPunVLwaXL01uM4PTAy1sVi5Bk1byez8e9Sp2Yt0pmASP1i303skP2UuKcb nYw+PlW1UJs0r7SXBKPX1T5hc4i+b2n2y1NZnNB89uT7DZCrpY/4Yw88EtMpceXF1j7t m+og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=qjj5L2xL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si446870pgo.209.2018.03.13.11.09.00; Tue, 13 Mar 2018 11:09:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=qjj5L2xL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752858AbeCMSHY (ORCPT + 99 others); Tue, 13 Mar 2018 14:07:24 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:41755 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753158AbeCMSFr (ORCPT ); Tue, 13 Mar 2018 14:05:47 -0400 Received: from CookieMonster.cookiemonster.local (unknown [149.254.234.209]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 770A3212FA; Tue, 13 Mar 2018 19:03:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1520964215; bh=G5OxQePBOxvzOpkAu1NYUeKOOOjshGy4enAgqjqrrz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=qjj5L2xLruP/EZ58HXhsrmTrNzXrshhvODSE+tFTCxWai0Yp8/59IjhxdWOnnNub1 oJ54xKnwdxIo/J9D/SRggh0vm8RxAUXdP+NSboO+JoBaUUEd/8bK+qPEgK8br8bkZt ivlinuYZvjq3gOa7YbEYW37xTfUNhaSxEhNJM66w= From: Kieran Bingham To: Laurent Pinchart , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 06/11] media: vsp1: Provide VSP1 feature helper macro Date: Tue, 13 Mar 2018 19:05:22 +0100 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The VSP1 devices define their specific capabilities through features marked in their device info structure. Various parts of the code read this info structure to infer if the features are available. Wrap this into a more readable vsp1_feature(vsp1, f) macro to ensure that usage is consistent throughout the driver. Signed-off-by: Kieran Bingham --- drivers/media/platform/vsp1/vsp1.h | 2 ++ drivers/media/platform/vsp1/vsp1_drv.c | 16 ++++++++-------- drivers/media/platform/vsp1/vsp1_wpf.c | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h index 78ef838416b3..1c080538c993 100644 --- a/drivers/media/platform/vsp1/vsp1.h +++ b/drivers/media/platform/vsp1/vsp1.h @@ -69,6 +69,8 @@ struct vsp1_device_info { bool uapi; }; +#define vsp1_feature(vsp1, f) ((vsp1)->info->features & (f)) + struct vsp1_device { struct device *dev; const struct vsp1_device_info *info; diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index eed9516e25e1..6fa0019ffc6e 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -268,7 +268,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) } /* Instantiate all the entities. */ - if (vsp1->info->features & VSP1_HAS_BRS) { + if (vsp1_feature(vsp1, VSP1_HAS_BRS)) { vsp1->brs = vsp1_bru_create(vsp1, VSP1_ENTITY_BRS); if (IS_ERR(vsp1->brs)) { ret = PTR_ERR(vsp1->brs); @@ -278,7 +278,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) list_add_tail(&vsp1->brs->entity.list_dev, &vsp1->entities); } - if (vsp1->info->features & VSP1_HAS_BRU) { + if (vsp1_feature(vsp1, VSP1_HAS_BRU)) { vsp1->bru = vsp1_bru_create(vsp1, VSP1_ENTITY_BRU); if (IS_ERR(vsp1->bru)) { ret = PTR_ERR(vsp1->bru); @@ -288,7 +288,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) list_add_tail(&vsp1->bru->entity.list_dev, &vsp1->entities); } - if (vsp1->info->features & VSP1_HAS_CLU) { + if (vsp1_feature(vsp1, VSP1_HAS_CLU)) { vsp1->clu = vsp1_clu_create(vsp1); if (IS_ERR(vsp1->clu)) { ret = PTR_ERR(vsp1->clu); @@ -314,7 +314,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) list_add_tail(&vsp1->hst->entity.list_dev, &vsp1->entities); - if (vsp1->info->features & VSP1_HAS_HGO && vsp1->info->uapi) { + if (vsp1_feature(vsp1, VSP1_HAS_HGO) && vsp1->info->uapi) { vsp1->hgo = vsp1_hgo_create(vsp1); if (IS_ERR(vsp1->hgo)) { ret = PTR_ERR(vsp1->hgo); @@ -325,7 +325,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) &vsp1->entities); } - if (vsp1->info->features & VSP1_HAS_HGT && vsp1->info->uapi) { + if (vsp1_feature(vsp1, VSP1_HAS_HGT) && vsp1->info->uapi) { vsp1->hgt = vsp1_hgt_create(vsp1); if (IS_ERR(vsp1->hgt)) { ret = PTR_ERR(vsp1->hgt); @@ -356,7 +356,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) } } - if (vsp1->info->features & VSP1_HAS_LUT) { + if (vsp1_feature(vsp1, VSP1_HAS_LUT)) { vsp1->lut = vsp1_lut_create(vsp1); if (IS_ERR(vsp1->lut)) { ret = PTR_ERR(vsp1->lut); @@ -390,7 +390,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) } } - if (vsp1->info->features & VSP1_HAS_SRU) { + if (vsp1_feature(vsp1, VSP1_HAS_SRU)) { vsp1->sru = vsp1_sru_create(vsp1); if (IS_ERR(vsp1->sru)) { ret = PTR_ERR(vsp1->sru); @@ -524,7 +524,7 @@ static int vsp1_device_init(struct vsp1_device *vsp1) vsp1_write(vsp1, VI6_DPR_HSI_ROUTE, VI6_DPR_NODE_UNUSED); vsp1_write(vsp1, VI6_DPR_BRU_ROUTE, VI6_DPR_NODE_UNUSED); - if (vsp1->info->features & VSP1_HAS_BRS) + if (vsp1_feature(vsp1, VSP1_HAS_BRS)) vsp1_write(vsp1, VI6_DPR_ILV_BRS_ROUTE, VI6_DPR_NODE_UNUSED); vsp1_write(vsp1, VI6_DPR_HGO_SMPPT, (7 << VI6_DPR_SMPPT_TGW_SHIFT) | diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 68218625549e..f90e474cf2cc 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -146,13 +146,13 @@ static int wpf_init_controls(struct vsp1_rwpf *wpf) if (wpf->entity.index != 0) { /* Only WPF0 supports flipping. */ num_flip_ctrls = 0; - } else if (vsp1->info->features & VSP1_HAS_WPF_HFLIP) { + } else if (vsp1_feature(vsp1, VSP1_HAS_WPF_HFLIP)) { /* * When horizontal flip is supported the WPF implements three * controls (horizontal flip, vertical flip and rotation). */ num_flip_ctrls = 3; - } else if (vsp1->info->features & VSP1_HAS_WPF_VFLIP) { + } else if (vsp1_feature(vsp1, VSP1_HAS_WPF_VFLIP)) { /* * When only vertical flip is supported the WPF implements a * single control (vertical flip). @@ -281,7 +281,7 @@ static void wpf_configure_stream(struct vsp1_entity *entity, vsp1_wpf_write(wpf, dlb, VI6_WPF_DSWAP, fmtinfo->swap); - if (vsp1->info->features & VSP1_HAS_WPF_HFLIP && + if (vsp1_feature(vsp1, VSP1_HAS_WPF_HFLIP) && wpf->entity.index == 0) vsp1_wpf_write(wpf, dlb, VI6_WPF_ROT_CTRL, VI6_WPF_ROT_CTRL_LN16 | -- git-series 0.9.1