From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B198C433DF for ; Thu, 21 May 2020 18:19:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C2068207D3 for ; Thu, 21 May 2020 18:19:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="peclEdhT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Sid+RAof" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2068207D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CV+l0aQMADM7rnp/7HoymFYZQ64j2i4Ce9wSVXsphyc=; b=peclEdhT8TnmIE oQluJWW4+YD9gEdg2nvKT7qdBBqxd6E9rMZaMb/4A6AAZcdofJ87rhB9/SFoh+5VfncAWdlu6tu0g sToT/ElC8gNGi0nETaPVmzl8YE8jBLsvLfDMEYUIwCsJEepV6/YKYZBSMirsH/hI7S8A9N2v4ayqO Xg2RTLmtGEe0tm4UMP3xGR0nBLegjNotar3PdunD1BqALClup/CpCV+UwcvYduLWR0WmJGdlvIvQl c8cjZ08QwFH7w5khx7LF8OUzjSIAAyf7DpVueoN93/a2nhj7ZHuVNMQTCzHjt4+Oj8X6THM5H1qDL RVsT0feluId7l6USI+uw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbpmz-0006Am-6j; Thu, 21 May 2020 18:19:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbpmw-0006A7-VY for linux-arm-kernel@lists.infradead.org; Thu, 21 May 2020 18:19:28 +0000 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 52A4E20738; Thu, 21 May 2020 18:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590085166; bh=N5CsmBgzgRJ1qoSjQJyCqgE9IOj3hAVxpxWnjwMHcOw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Sid+RAofpJhvVSePV8bzGp+OZMlEJfxE7e+9xOWfDmVLegyKQnOgPc3nSTCPsC5hP cA1F18rZmRreoph12CkIhK+B3aUHnjMRyG2RXLt2QMgmjtjzVIok24QNlTbalhEa/0 Yn+IsceiGCdvPfkRTpU8D7Sf3FEzdiKaCkv9zVdc= Date: Thu, 21 May 2020 19:19:21 +0100 From: Jonathan Cameron To: "Ardelean, Alexandru" Subject: Re: [PATCH v2 3/8] iio: at91_adc: pass ref to IIO device via param for int function Message-ID: <20200521191921.11473cba@archlinux> In-Reply-To: <99993df0dce7f7561e9659985265d6c1f5839208.camel@analog.com> References: <20200514131710.84201-1-alexandru.ardelean@analog.com> <20200514131710.84201-4-alexandru.ardelean@analog.com> <20200516181749.243c9515@archlinux> <99993df0dce7f7561e9659985265d6c1f5839208.camel@analog.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200521_111927_053777_65E214CE X-CRM114-Status: GOOD ( 29.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "alexandre.belloni@bootlin.com" , "alexandre.torgue@st.com" , "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "ludovic.desroches@microchip.com" , "ak@it-klinger.de" , "mcoquelin.stm32@gmail.com" , "eugen.hristev@microchip.com" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 18 May 2020 08:32:11 +0000 "Ardelean, Alexandru" wrote: > On Sat, 2020-05-16 at 18:17 +0100, Jonathan Cameron wrote: > > [External] > > > > On Thu, 14 May 2020 16:17:05 +0300 > > Alexandru Ardelean wrote: > > > > > Since there will be some changes to how iio_priv_to_dev() is implemented, > > > it could be that the helper becomes a bit slower, as it will be hidden away > > > in the IIO core. > > > > > > For this driver, the IIO device can be passed directly as a parameter to > > > the at91_ts_sample() function, thus making it immune to the change of > > > iio_priv_to_dev(). > > > The function gets called in an interrupt context. > > > > > > Signed-off-by: Alexandru Ardelean > > I wonder. Should we just pass the struct device? It's only used for > > error printing I think, so we could make that explicit. > > I was also thinking that for this series, [for some drivers] it would make sense > to put a reference to indio_dev on the state-struct; and just return it. > I'll see about it. > I am feeling that sometimes these IIO core cleanups end up being more than I > want to do. But I'll try to see about it. Maybe I can make time or delegate some > of this. Absolutely understood. No problem if you don't have time / energy to do this stuff. I very much appreciate it when you do, but I know how unrewarding it can be! > > My personal interest with them, is to reduce my complaints during reviews. > People starting to write IIO drivers: well, I can see their frustration [on > their faces] when I complain that they shouldn't use something, and they copied > it from somewhere. > That's more or less the only reason I write IIO patches currently! Though I get to mostly avoid seeing the faces of those who fall into the traps of old code we should have tidied up years ago :( Not gotten near any of new hardware pile of IIO hardware in a long time. Plenty of other new hardware, but not IIO stuff! Jonathan > > > > > I'm not that bothered either way though. > > > > Jonathan > > > > > --- > > > drivers/iio/adc/at91_adc.c | 5 ++--- > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c > > > index 0368b6dc6d60..5999defe47cd 100644 > > > --- a/drivers/iio/adc/at91_adc.c > > > +++ b/drivers/iio/adc/at91_adc.c > > > @@ -287,13 +287,12 @@ static void handle_adc_eoc_trigger(int irq, struct > > > iio_dev *idev) > > > } > > > } > > > > > > -static int at91_ts_sample(struct at91_adc_state *st) > > > +static int at91_ts_sample(struct iio_dev *idev, struct at91_adc_state *st) > > > { > > > unsigned int xscale, yscale, reg, z1, z2; > > > unsigned int x, y, pres, xpos, ypos; > > > unsigned int rxp = 1; > > > unsigned int factor = 1000; > > > - struct iio_dev *idev = iio_priv_to_dev(st); > > > > > > unsigned int xyz_mask_bits = st->res; > > > unsigned int xyz_mask = (1 << xyz_mask_bits) - 1; > > > @@ -449,7 +448,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void > > > *private) > > > > > > if (status & AT91_ADC_ISR_PENS) { > > > /* validate data by pen contact */ > > > - at91_ts_sample(st); > > > + at91_ts_sample(idev, st); > > > } else { > > > /* triggered by event that is no pen contact, just read > > > * them to clean the interrupt and discard all. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel