Received: by 10.223.176.5 with SMTP id f5csp921603wra; Wed, 7 Feb 2018 09:37:59 -0800 (PST) X-Google-Smtp-Source: AH8x225q1c/a7JWC9jTeYzm4Wq7Gw5PqiuQyK33K/pp14YZlJNp290P9l1lCKtgFmLgTVF29nu4E X-Received: by 10.101.66.193 with SMTP id l1mr5503372pgp.17.1518025079734; Wed, 07 Feb 2018 09:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518025079; cv=none; d=google.com; s=arc-20160816; b=T4dsSY6ycTqbkJ0HCWMq/F1HN3TFU18h7LOm19OVQ6E1l+dLl/kGmhIuE4yDrXdgcb 5TU9a414VDxgd3vlziFAs98EJ/9uIjzIa/lCy6cQ7Am+s9REF1wiRTEWXi64GzxI3HXs QKaW/I5RdLYieCFyzk/+6KyCE3BSFB+qtXu7ZTlLbOnJ6ey+qy2mFxqufsFgnHBhWskr AprFe4npzVMlE4jbAVx4Pb2tUEfpKKcunQDcek5ezkNEp+7lvmeQRxAF46jUoHk/NACX NNFAGBS45dhlBX0Dzds00u+YqW4w5y25t+MNib79vjTfFkGW05HD4VsnMN/aVS2lLh5H C5OQ== 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:message-id:date :subject:cc:to:from:dmarc-filter:arc-authentication-results; bh=hSMcKq8HO75JDy63NTZaNd5nh2ULNIr8hVT7dRYDybE=; b=G8fgOWQbrziLr1IhMMWRXGYcIWQhnS/twTQfYEYlSsbNfy2q2zwTTdouCvCAX/ndQe TRqgnCnwOy7UmhBfg1DzYX26mZK9QM7CeLV9wC/16caCTTVG95c5eaTqKxL95uh43ngO yc7BV5H+7lhltsXvnzA/AP/5SWDqL5B2K8Jh5Wvd7jbqAgzqgXEjRR3MHmXAtDREN17q mwoSwE+Hgux3IKQDCAgi6tU/hdLGeMXodYffyp3zb0NsgiyxUbbhUv11HSJzPpclbTfp tJKvH+b5qlA3FvcSsOpe/+x0Y7X1cAPym9LvTcoFBPnjTbr8CAjKEForzispckPjCPfR nMTQ== ARC-Authentication-Results: i=1; mx.google.com; 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 m7si1181243pgq.449.2018.02.07.09.37.29; Wed, 07 Feb 2018 09:37:59 -0800 (PST) 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; 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 S1754016AbeBGRfJ (ORCPT + 99 others); Wed, 7 Feb 2018 12:35:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:44910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753721AbeBGRfH (ORCPT ); Wed, 7 Feb 2018 12:35:07 -0500 Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8A8F721788; Wed, 7 Feb 2018 17:35:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A8F721788 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=kbingham@kernel.org From: Kieran Bingham To: Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] media: i2c: adv748x: Simplify regmap configuration Date: Wed, 7 Feb 2018 17:34:45 +0000 Message-Id: <1518024886-842-2-git-send-email-kbingham@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518024886-842-1-git-send-email-kbingham@kernel.org> References: <1518024886-842-1-git-send-email-kbingham@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kieran Bingham The ADV748x has identical map configurations for each register map. The duplication of each map can be simplified using a helper macro such that each map is represented on a single line. Define ADV748X_REGMAP_CONF for this purpose and un-define after it's use. Signed-off-by: Kieran Bingham --- drivers/media/i2c/adv748x/adv748x-core.c | 111 ++++++------------------------- 1 file changed, 22 insertions(+), 89 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c index fd92c9e4b519..71c69b816db2 100644 --- a/drivers/media/i2c/adv748x/adv748x-core.c +++ b/drivers/media/i2c/adv748x/adv748x-core.c @@ -35,98 +35,31 @@ * Register manipulation */ -static const struct regmap_config adv748x_regmap_cnf[] = { - { - .name = "io", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "dpll", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "cp", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "hdmi", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "edid", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "repeater", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "infoframe", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "cec", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "sdp", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - - { - .name = "txb", - .reg_bits = 8, - .val_bits = 8, - - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, - { - .name = "txa", - .reg_bits = 8, - .val_bits = 8, +#define ADV748X_REGMAP_CONF(n) \ +{ \ + .name = n, \ + .reg_bits = 8, \ + .val_bits = 8, \ + .max_register = 0xff, \ + .cache_type = REGCACHE_NONE, \ +} - .max_register = 0xff, - .cache_type = REGCACHE_NONE, - }, +static const struct regmap_config adv748x_regmap_cnf[] = { + ADV748X_REGMAP_CONF("io"), + ADV748X_REGMAP_CONF("dpll"), + ADV748X_REGMAP_CONF("cp"), + ADV748X_REGMAP_CONF("hdmi"), + ADV748X_REGMAP_CONF("edid"), + ADV748X_REGMAP_CONF("repeater"), + ADV748X_REGMAP_CONF("infoframe"), + ADV748X_REGMAP_CONF("cec"), + ADV748X_REGMAP_CONF("sdp"), + ADV748X_REGMAP_CONF("txa"), + ADV748X_REGMAP_CONF("txb"), }; +#undef ADV748X_REGMAP_CONF + static int adv748x_configure_regmap(struct adv748x_state *state, int region) { int err; -- 2.7.4