Received: by 10.223.176.46 with SMTP id f43csp1772717wra; Sun, 21 Jan 2018 04:14:04 -0800 (PST) X-Google-Smtp-Source: AH8x226Ykm89HtKyUH2jrjoN+t57y3mw6JDWU1/g4vGHa+ciiB7Paqz19BqOfv+7iTogOkzBS2ec X-Received: by 10.98.108.130 with SMTP id h124mr5124875pfc.33.1516536844501; Sun, 21 Jan 2018 04:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516536844; cv=none; d=google.com; s=arc-20160816; b=mDClr9k4vbbg48fhPKmDxEBz0CXPnXsFbn6ZIC0IAdhaCps7L8r5OiFLvQeIXta8DV scmay8RckQYfkOPv+ck+xPTFqcKE7YppJortdu/Tf/exRoSFmPSzLwZy2kwlw00CUuI3 4nE/lEsPAtnSh4U45l+/gxxtnLPp7SRmXgnaG/t1DNkF5ht5Aef7Q+AquuO4Q3jespa6 Jn2zXg4ysf4oSxOKgvR+ITrWjhekcNmjH5pqqBU0lDR2SUaV/TYhZuYLVP7crg0pmf5a EL5nrTd/VdU6m6hpHp3bB+saa/hRH7tPBpFnp8tkP6jvZbLZq7goGwV/Vnvy49UCVxeD wdTg== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=rIRu635XB2wgu0QVefxpKqdjP8DXrSLKWL4azvJKCIw=; b=PGW4VI49McCVvgmrrSuBV9G5konMmk+j9TkLZMOFhjIW3O4/G5AckfDPB39ZXXmuaY L/M4MmOBouTzxq43N7CznXZ03dduCOLUARdDlVrhSIPcryuIrf566c20rXZQN51e7oBa awbxRh0gQZK42DeFjm8yfRuDqHUmGiEoBZtpTGWqaBuWlf68gsRCNtHkPbM25Se0qLyG fGf59GtyuswLRQRzCfsrV6hl8b75pF/ICNJTUKaRZNxQrMZ0rvkjbdGD4L8xgRGvleB9 4WCU8PEyKLIjzAwiVFWMyAhcuKiP/iHs+VmIM1e7QkfUY6egMZq3j6EmiVGTmxsmbHZo VHng== 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 126si13349320pfe.67.2018.01.21.04.13.50; Sun, 21 Jan 2018 04:14:04 -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 S1751174AbeAUMN1 (ORCPT + 99 others); Sun, 21 Jan 2018 07:13:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:45802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbeAUMNZ (ORCPT ); Sun, 21 Jan 2018 07:13:25 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E26D21715; Sun, 21 Jan 2018 12:13:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E26D21715 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sun, 21 Jan 2018 12:13:19 +0000 From: Jonathan Cameron To: Quentin Schulz Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, sre@kernel.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org, linux-iio@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, julian.calaby@gmail.com Subject: Re: [PATCH v3 01/16] iio: adc: axp20x_adc: put ADC rate setting in a per-variant function Message-ID: <20180121121319.3322fe96@archlinux> In-Reply-To: <9488159b43c4cc8418afa9d1562d972c4631cb02.1516012352.git-series.quentin.schulz@free-electrons.com> References: <9488159b43c4cc8418afa9d1562d972c4631cb02.1516012352.git-series.quentin.schulz@free-electrons.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Jan 2018 11:33:35 +0100 Quentin Schulz wrote: > To prepare for a new comer that set a different register with different > values, move rate setting in a function that is specific to each AXP > variant. > > Signed-off-by: Quentin Schulz Applied to the togreg branch of iio.git and pushed out as testing. Thanks, Jonathan > --- > drivers/iio/adc/axp20x_adc.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c > index a30a972..3fc1b06 100644 > --- a/drivers/iio/adc/axp20x_adc.c > +++ b/drivers/iio/adc/axp20x_adc.c > @@ -470,14 +470,18 @@ static const struct iio_info axp22x_adc_iio_info = { > .read_raw = axp22x_read_raw, > }; > > -static int axp20x_adc_rate(int rate) > +static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate) > { > - return AXP20X_ADC_RATE_HZ(rate); > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE, > + AXP20X_ADC_RATE_MASK, > + AXP20X_ADC_RATE_HZ(rate)); > } > > -static int axp22x_adc_rate(int rate) > +static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate) > { > - return AXP22X_ADC_RATE_HZ(rate); > + return regmap_update_bits(info->regmap, AXP20X_ADC_RATE, > + AXP20X_ADC_RATE_MASK, > + AXP22X_ADC_RATE_HZ(rate)); > } > > struct axp_data { > @@ -485,7 +489,8 @@ struct axp_data { > int num_channels; > struct iio_chan_spec const *channels; > unsigned long adc_en1_mask; > - int (*adc_rate)(int rate); > + int (*adc_rate)(struct axp20x_adc_iio *info, > + int rate); > bool adc_en2; > struct iio_map *maps; > }; > @@ -554,8 +559,7 @@ static int axp20x_probe(struct platform_device *pdev) > AXP20X_ADC_EN2_MASK, AXP20X_ADC_EN2_MASK); > > /* Configure ADCs rate */ > - regmap_update_bits(info->regmap, AXP20X_ADC_RATE, AXP20X_ADC_RATE_MASK, > - info->data->adc_rate(100)); > + info->data->adc_rate(info, 100); > > ret = iio_map_array_register(indio_dev, info->data->maps); > if (ret < 0) {