Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp410458ybz; Fri, 17 Apr 2020 03:28:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKnR0721ODjPwJzOT3UjduK2//mn0DlXz8jVc3KJPcXivQwKg16gB0rg5PM9BPYfCaBZTx/ X-Received: by 2002:a05:6402:8d8:: with SMTP id d24mr2272602edz.173.1587119314332; Fri, 17 Apr 2020 03:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587119314; cv=none; d=google.com; s=arc-20160816; b=ioZte8rgBbtMXhNWwfYldud/dCXC9jNEOaTuB1/21V+fSmlcuyCQ1FPc2pn+jWwkfp V7oUxbGbkAGGm9LvyEiIf33C6qn0J7RKNkpSVsXchRdqlr4IcjnN3NteRv0pz1KuC0EA 6IgQtPGQe989qs1nkDPBqbogxq/EKHQ3xWtGY4Q9TKorEZ+zEla8ZxXv9oWzd/ZH/0lU Xmo+4K6AM72XcoxN9v3rvKcN2yGa5M0K9fHP5d+PxJSfgCCcSE/QCZmLEytPM3lcgsWh bCFJlQcprTvsMoZ29zh5nSat/biaYDEqrApWthcNG/3yGMo564tZ3E2syjWT756lqGic ZbCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=b59Nt5scDU2I1ZDjfM7PvNLErzWlHfnlPXD2jIEsqco=; b=AOxP9L0GEcsT8Y88cSfQ39Le4crji7xyRDFSvZH70gyNlMtgnFitaGe5yEa6R82NPz NV/YYeI+SeEvFKRT39ZfF8VSoTT/ZDtS3yba1o3m366tDAP0Z4tkGcmsb7FEeGkxbvF2 GAOBrbPIDwCHvncJZ8NRLVXo7wwiIwDiVdUZMy4Y7Oik4VF/czhnTQO9XX5s9hf7uiha Z4jfvosUzVe7Fn9Bl2bEMpATHZQdFHFXUxERuIPwR8PC1Tq/fZnsynC6bJaF50KbQ1Iy rGs5y58S4vgC5smnNav2WgFonJ0TS7oAH6Tr5d2M3tIRqTWNch2WZr6du3GmMrPqCj7j 2u4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="QF/62xKO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si4310877ejt.100.2020.04.17.03.28.11; Fri, 17 Apr 2020 03:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="QF/62xKO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729144AbgDQKZJ (ORCPT + 99 others); Fri, 17 Apr 2020 06:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726207AbgDQKZJ (ORCPT ); Fri, 17 Apr 2020 06:25:09 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D794DC061A0C; Fri, 17 Apr 2020 03:25:08 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id h69so900780pgc.8; Fri, 17 Apr 2020 03:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b59Nt5scDU2I1ZDjfM7PvNLErzWlHfnlPXD2jIEsqco=; b=QF/62xKOAGBXrpJVXe2CSzq0qfuJV5Jn7SLuPzRkDM4nnT6httYseD3xm1KN+exzJ0 3iKkz7+eNWQRw+cT9m4eZTnQy3Tsl1WNIxmUjXFLWKXJ7TKMw63RNaHN/EXoFzNRK3UR KJ+dvaUFseoBPUECuk1agUwjwK5PNIHj1983Ona1WMgbwEO2izQfnYGSxO5YhrZfjrns sM7Ncz8OeHUvb7/lpmMOa5WhKfVojort7uihb7WWkV4Ts8QyYDOKdQze8ORPoD4LjIlP 5pO9swd8Mh2Bjw/XYEbJXbm1U1SIQw+mzGmQeizLNi0BGA5mMG3FCv2EUgIMmFFVQ60i JUgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b59Nt5scDU2I1ZDjfM7PvNLErzWlHfnlPXD2jIEsqco=; b=Oijhq2f3DXgrcWVJCxlAcukulNOfbYPSlKnxLGFXLGeUwumGqE12mfiGZGyI1OXoRh jGX3gpOgx4Q3bNlsWnmWVofR0/W6+4Yacs98gK3FZEKc0aoR9TrNvwnNx7Ie3N4tEErG vI7B5CpcTTfk18ojj2rEHMkMhSAhSQmI1HsX/z9l+BCmw7HJKPgdFIfyO/f71WaQfI3T 7cQacOzP0DYfIFvhHeuLThPQP4+e59SK4RIHmV+OhH01nJmxTS/fDoHwDjACjmns/OLf W4wLkiJmndN9kJz0yAacBsB0r87rFGpHQsJUy8YOR8/fgzLFzHQMtPxF6UgYABfcYDAs yT8Q== X-Gm-Message-State: AGi0PuZuRD6ttE2O5IsJboSyuuDrh0ghHf9t02uefA0xkc6kraHAhAcU 5/S/7O0RmqPDuJ6rfg1/oyVtGjOppiuFflYQrqM= X-Received: by 2002:aa7:9097:: with SMTP id i23mr2448171pfa.170.1587119108436; Fri, 17 Apr 2020 03:25:08 -0700 (PDT) MIME-Version: 1.0 References: <20200415212257.161238-1-alexandre.belloni@bootlin.com> <20200415212257.161238-3-alexandre.belloni@bootlin.com> In-Reply-To: <20200415212257.161238-3-alexandre.belloni@bootlin.com> From: Andy Shevchenko Date: Fri, 17 Apr 2020 13:24:57 +0300 Message-ID: Subject: Re: [PATCH 2/3] iio: adc: ti-ads8344: remove tx_buf from driver data To: Alexandre Belloni Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Gregory CLEMENT , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2020 at 4:08 AM Alexandre Belloni wrote: > > There is no need to keep tx_buf around, it is only used for the conversion. > As Lars said. And some SPI controllers may want to DMA even one byte, so, NAK. > Signed-off-by: Alexandre Belloni > --- > drivers/iio/adc/ti-ads8344.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/iio/adc/ti-ads8344.c b/drivers/iio/adc/ti-ads8344.c > index 6da50ea35217..9b2d3a8ea6bd 100644 > --- a/drivers/iio/adc/ti-ads8344.c > +++ b/drivers/iio/adc/ti-ads8344.c > @@ -22,13 +22,7 @@ > struct ads8344 { > struct spi_device *spi; > struct regulator *reg; > - /* > - * Lock protecting access to adc->tx_buff and rx_buff, > - * especially from concurrent read on sysfs file. > - */ > - struct mutex lock; > - > - u8 tx_buf ____cacheline_aligned; > + struct mutex lock; /* protect from concurrent conversions */ > }; > > #define ADS8344_VOLTAGE_CHANNEL(chan, si) \ > @@ -77,13 +71,13 @@ static int ads8344_adc_conversion(struct ads8344 *adc, int channel, > int ret; > u8 buf[3]; > > - adc->tx_buf = ADS8344_START; > + buf[0] = ADS8344_START; > if (!differential) > - adc->tx_buf |= ADS8344_SINGLE_END; > - adc->tx_buf |= ADS8344_CHANNEL(channel); > - adc->tx_buf |= ADS8344_CLOCK_INTERNAL; > + buf[0] |= ADS8344_SINGLE_END; > + buf[0] |= ADS8344_CHANNEL(channel); > + buf[0] |= ADS8344_CLOCK_INTERNAL; > > - ret = spi_write(spi, &adc->tx_buf, 1); > + ret = spi_write(spi, buf, 1); > if (ret) > return ret; > > -- > 2.25.2 > -- With Best Regards, Andy Shevchenko