Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2891354ybz; Mon, 27 Apr 2020 06:30:33 -0700 (PDT) X-Google-Smtp-Source: APiQypIKkjMedNo2s57yBava3UsSZNwtl7hIfXslyXvXgcGcr1I9iql9vV6QMsYhQ2d0KcW59Yhx X-Received: by 2002:a17:907:2049:: with SMTP id pg9mr20194212ejb.248.1587994233302; Mon, 27 Apr 2020 06:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587994233; cv=none; d=google.com; s=arc-20160816; b=NT8nFq4rm4FELz+fdvQaIi5trCYS683rMOpHn2xMyMsBQDsrvy5dgbm8gzPrpYhj/8 2I97IrkrOrMOVYPlA1TPp7kzdIYMaKaYd57GKDEtHPOr/enMh+ncg6TK0DpCtjTWZaNi mNQqYleiKzVmeGXey3c5G9N2Cq8lP1yIkOEktehAZFSMNCg5iWpmXcv0kMT622FoLOWQ kHafWuo+yjOw5c3QZyCUHyHqgw5tFEqbcFw+S+ay8KZGAhrBawdhtFIAf4uNuJndGWoz bOFKfBeHTFfVNva63jDZu41jWxD1zIWDAX+xAKvFDHQ4kCFsc21L9OtFRdODc88N4tTY X89Q== 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=GHn5LhhRmzy3sndf78S27qfruwCqi4o/1SdzUaUG+CY=; b=fQM/NAiXmZv/PFcP/RImTH9vS5janV9yHR38lUJ2zuY32gsr+kQPtjbe7bpAWOUV48 S0Lt5zEhJD9n2MeLK7EdYxqQLopRpYPyrygHMw2pFRTQy5Xc+e+ox2sP8RZA7E03Q+1W J23BNTSP3wvVgREeoFvq1ZjI6d9rwNExI9NfA+S8YZWjcLu0OmWftONbyFKkap2S0OgU 4VNtzdHP3ISCFRJxTkY7HmkjmIGm7dKXJ/0dGD+eZKBrriXf2SL8qvN+g+5g3/TTQ5B0 DlE2EtHjyzWGyktBndE9/Uu9nIKBwKo6AM7NXRnvgcAHESIrIxmI1HO73aioRgZhPNdL 6UAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="P/eSHGWJ"; 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 y19si8639279ejp.397.2020.04.27.06.30.08; Mon, 27 Apr 2020 06:30:33 -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="P/eSHGWJ"; 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 S1727042AbgD0N2W (ORCPT + 99 others); Mon, 27 Apr 2020 09:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726769AbgD0N2U (ORCPT ); Mon, 27 Apr 2020 09:28:20 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81CEDC0610D5; Mon, 27 Apr 2020 06:28:20 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id e6so7437764pjt.4; Mon, 27 Apr 2020 06:28:20 -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=GHn5LhhRmzy3sndf78S27qfruwCqi4o/1SdzUaUG+CY=; b=P/eSHGWJI1R3+uwssq2jpcVpDs0STyTfYIjS/6fMuUcoKIU0mq5NqPzlrT8vwwPNAW uWttoIiLsdjqqVFUgcTi1GYSStxqdgmYStqY38agWPApHa+cK/4u2CfH0yRl5SFqVKAv Lr1F/A+HFTmbHrP9nKai236DFWbk6CzIXm1hXRwW7lDktn98mx6HZrofcjh1rRx6lsJT 5QegEpUU99h1j5Krd1SLd4YTii50H5tDTxxsdTW5OcElutDBV78VY0szJ6Ogjodm/e59 5IkNZ0WklVmQIYsgXD2jWRDMIdKvEsuK5EAhTmM8MChcBuQ0SzdZHqGBhH++PbTkQ3VE jtaw== 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=GHn5LhhRmzy3sndf78S27qfruwCqi4o/1SdzUaUG+CY=; b=aeK8Uyr/6fN8u276LP1T5Tu4GaSG9EQTALOBVALSRKahmR60h+1hNTZA7F+P0IgFyb pemHGld97av8l/DmPcblVX/HCJadbfkk/Nbd40K4aJWoDNuCtfpQCXQAohz4EHq8vrip hNkQC7h3wmCPd8/bbZfa2XUVUO6H+KpjsEgK0XE99/y62/Fr3k0KQLZKKLZGRw9gD5wo hj+DK23z7ATcXmNFUWZ072uwmyW8StWMxMn8zgvSaHOdG0+X8W7/4Bh7hXZeFJtzu6Og e8Q9LTD09DqhsV6HkVb/NrcNiz0G6VRCd9dfkgo79+mAeKnrKZD5aSTMKz8HiQ8hj2v4 EZ0g== X-Gm-Message-State: AGi0PuZsafI9WR+z9hj4BzqbM8g3TidQJ2iQ3W5bfT4ME6S2GQ1ca63V 95+xfBnCn9ZHHSurY0gMcfCQUMm5a+CY/AMpGts= X-Received: by 2002:a17:90a:364c:: with SMTP id s70mr23246347pjb.143.1587994099840; Mon, 27 Apr 2020 06:28:19 -0700 (PDT) MIME-Version: 1.0 References: <1586942266-21480-1-git-send-email-jprakash@codeaurora.org> <1586942266-21480-4-git-send-email-jprakash@codeaurora.org> <68d9c770-b190-dd13-0869-fdae9fb1f16f@codeaurora.org> In-Reply-To: <68d9c770-b190-dd13-0869-fdae9fb1f16f@codeaurora.org> From: Andy Shevchenko Date: Mon, 27 Apr 2020 16:28:13 +0300 Message-ID: Subject: Re: [PATCH V2 3/3] iio: adc: Add support for PMIC7 ADC To: Jishnu Prakash Cc: agross@kernel.org, Bjorn Andersson , devicetree , Linux Kernel Mailing List , Matthias Kaehlcke , Linus Walleij , Jonathan Cameron , smohanad@codeaurora.org, kgunda@codeaurora.org, aghayal@codeaurora.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-arm-msm@vger.kernel.org, linux-iio , linux-arm-msm-owner@vger.kernel.org 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 Mon, Apr 27, 2020 at 3:56 PM Jishnu Prakash wrote: > On 4/17/2020 3:51 PM, Andy Shevchenko wrote: > On Thu, Apr 16, 2020 at 1:48 AM Jishnu Prakash wrote: Stop using HTML. It breaks badly the reply and discussion. ... > +static const struct adc5_data adc7_data_pmic; > > Global variable? Hmm... > > adc7_data_pmic is referenced twice before its actual definition (which was added along with corresponding adc5_data struct for PMIC5 ADC), so I have given the initial declaration here. Maybe you can realize how to avoid global variable at all? ... > + buf[1] &= 0xff & ~ADC5_USR_FAST_AVG_CTL_SAMPLES_MASK; > > What the point of 0xff & part? > > This was something you suggested in my first post: > > > + buf[1] &= (u8) ~ADC5_USR_FAST_AVG_CTL_SAMPLES_MASK; > > Use '0xFF ^ _MASK' instead of casting. > > ... > > > + buf[3] &= (u8) ~ADC5_USR_HW_SETTLE_DELAY_MASK; > > Ditto. > > I think "0xff &" works as intended here in place of casting to (u8)... Does it work without casting? (Note, I suggested slightly different expression) I.o.w. what the problem casting solves? > + buf[1] |= prop->avg_samples; > + > + /* Select ADC channel */ > + buf[2] = prop->channel; > + > + /* Select HW settle delay for channel */ > + buf[3] &= 0xff & ~ADC5_USR_HW_SETTLE_DELAY_MASK; > > Ditto. > > + buf[3] |= prop->hw_settle_time; -- With Best Regards, Andy Shevchenko