Received: by 10.223.176.5 with SMTP id f5csp820148wra; Fri, 9 Feb 2018 07:44:42 -0800 (PST) X-Google-Smtp-Source: AH8x224ZphDBUZLNWek1oUr6+xl3A91khY0xV61Pc0YWWJQzku9Vt+juiAUocL3T3U3bTYsj6HtB X-Received: by 2002:a17:902:6a81:: with SMTP id n1-v6mr2969887plk.11.1518191082669; Fri, 09 Feb 2018 07:44:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518191082; cv=none; d=google.com; s=arc-20160816; b=cEdYYbjRgU2WpI1bIFMQ9NmJ/cmttQznlwY5DuJgwPRpjwv4LaXehAbAHjA5j/gvUy 20W7a+Xb3VhR+5EEzmShvFbvgSVTyy+cK/S+Z1I+u+/dQD+PMSR9xHXZ9NoOuccP62SE cxCDh2Waap9+tTyZIjA3pXERqtm4gmROBXhueElcGoYQhWzB6i452o4jI1V1QllBCCC2 a9ZNxLKhy9LsB0nFi2qV7BrulWbfWfKVn2ChV3ti8ipioLIQgxklaSjxdr/t0fACpF1Z Vet8HkhaxKZniGm8GE6GTozHMHTIS6c0GMqyXwXpkzWofZJ6NPln8pztSg0Fj5lEqNoj y9BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=m2vf3HpbxObwxkCpfVT/ZEBDC/c6A51uyGuf1c8yuAM=; b=aLxmNlz0V4FXkFgXz1It2Ipb02AgFEWSI1HaxUnGDkgBB2u7o7wPCgKtXFMxGMP9Z7 NYKHAC/UO5mP6fwRDuZSsmi9wm2aIZV/IOp737S2VB5DIQHBcwI4r6XtPN4mVJTyW0yl 2TtC/H3XPZxoQhVhadZ9ySJNo7Xk3tbfrqbhnfbKyBT1aW1c231XXH/ff3V5YE4paw+X 1krH10AMlAhx2j6in0IANfQPrc//PrVSwAsLUprWnRg2HeR54ca7jWqkLzMhkpKl+KP0 oMGShUUIPS+sEevSI9LPI2ay0PDLsTRcJIUj6KQY3RitF6JmBguWxaEq493dFn24YTUC oN8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=B91arg6/; 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 l2si1478647pgl.823.2018.02.09.07.44.28; Fri, 09 Feb 2018 07:44:42 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=B91arg6/; 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 S1752181AbeBIPnr (ORCPT + 99 others); Fri, 9 Feb 2018 10:43:47 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:34041 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbeBIPnp (ORCPT ); Fri, 9 Feb 2018 10:43:45 -0500 Received: from [192.168.0.20] (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id D0935200AD; Fri, 9 Feb 2018 16:42:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1518190939; bh=e8pCej4wZD18wbnRjGLDg4vstxTRcYURxIIoE/2r/lM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=B91arg6/2+3r08o17OQ5XElfh+nE6BPw++B7LPtT5ObudCkCSPjKH0OzRP0lCi1Sf RQX6PAlMTC7fFt1t8rsYtu1ONwdElH+gzyISBBwB2/q6maMJDfsqpgk7iMidvP3omE KJFJAhRV7HRaXhJH42iMeoVEhc5OcYpambp451Mo= Subject: Re: [PATCH 1/2] media: i2c: adv748x: Simplify regmap configuration To: =?UTF-8?Q?Niklas_S=c3=b6derlund?= Cc: Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham , Mauro Carvalho Chehab , open list References: <1518024886-842-1-git-send-email-kbingham@kernel.org> <1518024886-842-2-git-send-email-kbingham@kernel.org> <20180209153915.GE7666@bigcity.dyn.berto.se> From: Kieran Bingham Organization: Ideas on Board Message-ID: <88e7c065-f2cb-f203-1f62-579760b7b6c2@ideasonboard.com> Date: Fri, 9 Feb 2018 15:43:41 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180209153915.GE7666@bigcity.dyn.berto.se> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Niklas, On 09/02/18 15:39, Niklas Söderlund wrote: > Hi Kieran, > > Thanks for your patch. > > On 2018-02-07 17:34:45 +0000, Kieran Bingham wrote: >> 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 >> + > > Why is this macro undefined here? It have a rather limited scope as it's > only local to this C file and it have a good prefix of ADV748X_ so > conflicts are highly unlikely. Is there something I'm missing? > > Is it really customary to undefine helper macros like this once they are > used to populate the structure? You are right - this is probably unnecessary, as the scope is limited to this file. I guess I was trying to further highlight that the scope of the macro is limited to this specific table as well. Certainly likely to be required if this was a header, but it's not. So I'm happy to remove... > >> static int adv748x_configure_regmap(struct adv748x_state *state, int region) >> { >> int err; >> -- >> 2.7.4 >> >