Received: by 10.223.176.5 with SMTP id f5csp816122wra; Fri, 9 Feb 2018 07:40:19 -0800 (PST) X-Google-Smtp-Source: AH8x226cv/6DWRH8GrLW7CDTOayx7vJHPve+0mZL6Oyvmm1FY/fF+IkyUrvsYw3nQRPO0RHb9jzk X-Received: by 10.101.76.2 with SMTP id u2mr2636472pgq.363.1518190819403; Fri, 09 Feb 2018 07:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518190819; cv=none; d=google.com; s=arc-20160816; b=yrjVrRw5IYmbpQjGRM67XrumIJh7s6zWlx0VUaVQyTYKxVoJEtCmXgXrjjFn+6Up93 +0l37UZAKH52IAlxWjzNoXMfYe1KMTxEcVKeV4RK+qYTbQRzNVtxydotWRr7RuNS1uhQ 2ebMGwypU5gpv6X1vLgjrSYifqulcv1tbKIJ2RllPRhtZ4DRuhIASzlFoRfRv+m4xsCb bJ5jfDX2IoeOaicdXZi49GsocCFbGx/bgHMNagNz5UZvUdjpb44R2PwZO27XZtY9si2u AVF3+TKBpy4jXdv43YcjB4wf1pDXXUWTcuRP4mbJbHXHxOxAxOUm5hXBknXkdMgYb3JS 234g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=VFzWZUKtu3/1PzIOIX0QnwHjdNpS+aLkvyC40qEQi3o=; b=BaOMAY0QZkhbY3WmQtmI8xCZ7ozJroWqrJCo+BFkcFgt/wEZ9h5F9kr7zIv6YXUYYJ EjoOT4wyba+Ua/3xY7sq7XNF+aEmtehpb42a5t0K9iR6QOR91RS3THotcHxYQ0ijJ72q HZGGOXAQSZWu+7WSzcBDVjKMLzawdov1w8LKKo3t3QgQ2s9TK5fmu43Zc6iyE5+EWpXQ tq6HRrR2FMWMPb9WKOJOey76xHNHV5EwUBXN7exFC2/i2Fhs3orIjfMlWWOwJb6BAZdf uTCyfU9g9xGOI2aXJ/3knqgcZFQFHAYNNNz3a8s8zrlCUCK7JDU26KSmDExLhddI9FwO Gamw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=iDTyKJxM; 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.40.04; Fri, 09 Feb 2018 07:40:19 -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 header.i=@ragnatech-se.20150623.gappssmtp.com header.s=20150623 header.b=iDTyKJxM; 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 S1752171AbeBIPjW (ORCPT + 99 others); Fri, 9 Feb 2018 10:39:22 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:40176 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752013AbeBIPjT (ORCPT ); Fri, 9 Feb 2018 10:39:19 -0500 Received: by mail-lf0-f67.google.com with SMTP id i24so8646904lfc.7 for ; Fri, 09 Feb 2018 07:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=VFzWZUKtu3/1PzIOIX0QnwHjdNpS+aLkvyC40qEQi3o=; b=iDTyKJxM+wfPo2eobr2h1Cic5wc/YbkExawWj+J68feo7tmP8wKolzcmVjHpFBS7Gb 9j2ugEp/0M/Lfe9HG+R315jc4JNa3VvJ1/JYeI3sJvCwTzJ7dSKC2UnHjUcKcwomSQ0p Fg/NfmY2ZTkyUv7Ym5eBsDDESBLNnofPHu7qQm5y7G5EFi04F81iLWkySkAsGKtHWfVU nxy371Aulk5iJcZG9rS17Uh0B28VrPZrjdbES3JN7/3LNSpP6FyRGIzgEFfF23wMZ369 /+shICDv2SmIQ1PwRKfZtsGNWlLB7kip5cbfqnnSSr0x/eIsrBIil7IL8gktyjgDg0qJ eeIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=VFzWZUKtu3/1PzIOIX0QnwHjdNpS+aLkvyC40qEQi3o=; b=m64T/LAD0ndUD8Punc6dL5PXjtyWQux/+GP/NU6SK4c3K6RGSWcBV7/3dDsRcH3FTx 74OJhpPwOuufrRrcv0t7evusSCARJKTI5BCqN0UEDYICOozkFnZPjg3VJsUCCKzRAMRj ZRTKwm/6xt/72lO2NpYxVyZID5kHSp5aTmpxJCIdTcR0XvLcbyDHExGMDu0tsUledfvv Sg/QcmBE5cAkass0nchXMr7keI+cIQqRjTzWdhmBGLxYbKVwsylnhTss2R4/vvlroUcn t57kbRFcKFBew2u0LyYvz4TFMeGFULnVY3TOudhfomSWuB5WQ4F9h3nzf6zsjn3no3UC DqQg== X-Gm-Message-State: APf1xPAAT+TXvBYqXbrbX8KAeLFM5zOSFF9Z4ISzto6kQaBQk+JAQOWs x4NbNenNt+jb3JUU2leIAwM9kQ== X-Received: by 10.46.21.75 with SMTP id 11mr2376957ljv.58.1518190757342; Fri, 09 Feb 2018 07:39:17 -0800 (PST) Received: from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99]) by smtp.gmail.com with ESMTPSA id w21sm499068lfi.86.2018.02.09.07.39.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Feb 2018 07:39:16 -0800 (PST) Date: Fri, 9 Feb 2018 16:39:15 +0100 From: Niklas =?iso-8859-1?Q?S=F6derlund?= To: Kieran Bingham Cc: Kieran Bingham , linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Kieran Bingham , Mauro Carvalho Chehab , open list Subject: Re: [PATCH 1/2] media: i2c: adv748x: Simplify regmap configuration Message-ID: <20180209153915.GE7666@bigcity.dyn.berto.se> References: <1518024886-842-1-git-send-email-kbingham@kernel.org> <1518024886-842-2-git-send-email-kbingham@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1518024886-842-2-git-send-email-kbingham@kernel.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > static int adv748x_configure_regmap(struct adv748x_state *state, int region) > { > int err; > -- > 2.7.4 > -- Regards, Niklas S?derlund