Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1061617iob; Thu, 28 Apr 2022 18:04:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHkTrGjROyQN1XL4p9UgKftpnfOXs1T+RkyRvuwpor5MrM/VB1uPGWYSyhQf8uq/QzaQcu X-Received: by 2002:a05:6512:2249:b0:472:3507:f76c with SMTP id i9-20020a056512224900b004723507f76cmr5012906lfu.351.1651194296685; Thu, 28 Apr 2022 18:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651194296; cv=none; d=google.com; s=arc-20160816; b=Qh+nt2PDjYpCd7beZCTLlUBLD874lxyKmrNmlTKj5HCo7StDR7buSUSs9uRhdv14hB 4/EVXXQ3pI5HXPdtGnNt4MplyZkKaYppsqIDD7yO2P1zY8uTGrdQag46mzRRD6vb9rpe 97HC7qfV0k9UuBRYiZiWJfontaj9i9Rb/vSj0zNYqxAWQbSo6mHtKcqlqtnpd94Tak8d ccCfdwbjUBObEXE1DaQi6C+DsGOoVE4+53ZjQQjE4alshERw676WAIx8feaDREgxU93a LcM+0W/ti6DBrRrMEzjz51UdsYQZAvoWiBRJ8KibCoF1LJrs8I86npUQleL+KfW9tzE6 IEpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DqYFNy0Ye1hG0JvZqo/UaJOYPE63YVH9ZWtIRJQCusE=; b=Ijg1CncojpyINn4EVUwd52DcTNJtbZREcyOzYZ378FJhJvbZqKSQ4H7EAm8uT2qU7d DTYQDc6tRzoTc3FAYo5w9OcIGdFGV5jjMteN/iOzZs1qAhdeVTss/FZUl6WBIW70dP7v hWRyq1PZTbgFh20TQELZ+Nniw8Hphy9vIrYhq8P2IWn4n77mypMg1n+d2IBs9sHiVKAZ fKuqJY+0EiTvpXoSVmO6jxQJRuK41cBdPh6oFz2axBFGTywiST4MJ1fM/TyE1QnLeEJv jTy12hyyZUlyVfUgSf98fiaiPqbVCKAHlXAC+gmMkUo20MrCe3STTl3AxQEX08sXaOEB 5Iqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XQLshbFr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a2e8495000000b0024f0a4d035csi5460951ljh.157.2022.04.28.18.04.29; Thu, 28 Apr 2022 18:04:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XQLshbFr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230480AbiD0VFP (ORCPT + 99 others); Wed, 27 Apr 2022 17:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbiD0VFL (ORCPT ); Wed, 27 Apr 2022 17:05:11 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7A2BF43; Wed, 27 Apr 2022 14:01:58 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id d23-20020a17090a115700b001d2bde6c234so4491202pje.1; Wed, 27 Apr 2022 14:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DqYFNy0Ye1hG0JvZqo/UaJOYPE63YVH9ZWtIRJQCusE=; b=XQLshbFroY/oV5ijkx6Jh5DxQyHuOqj2ianmBSoFT+s6hC/g6qq91dNna3cR24DCdj 4jI2UzB0lDjDClKeu3wVpDkKT9CgW5SGiOeYulemQwJAL94tLwkZ9BqD7N/ayIY01W66 RHG7Z53plRevZQRErpmKz7AxHUUDNybKQYZzxEIC+G35RUrxDqjnWLKWQDowOmNrFqI4 nzbvYc0swtbUGueZbtgttFuKKin+3PoqpVsbDAofEcS+t9H8+YUUCi92N6EU0gjjhMms x1xY6UABX9aBNVrq5dmv1pOrj38SuNUicZ6xgQo35x9hv42UjhdT+daYI+ANNFk1WukP edWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DqYFNy0Ye1hG0JvZqo/UaJOYPE63YVH9ZWtIRJQCusE=; b=N5OUJ0uruDRmCYAxttEEFcWWbuE0zJ1VHkIiY3J6COgP6I79T3Bbs8oW/bDB9N2Y8a 1LJks5GOdyO0v2XHXR4CYYkdORE/AMm6bh20QhFYhVvIJ6xIHPQ7/4ADSvS2cXRl0MnS ZWtf3bdHxH0qjU2goDLBlCN/+ETgF4rfq7b2bB7/Kl/iCHewThHbd0Y065ev1T71/5D3 7oMvV8wPAen6rwdskSKGWyYgjmxFTpYuc0fB1kj4zlqZx7VPQPcdfFZp3HjwlwkdLOqS hj7KfPFu9BQzeCsrrT2Rb2o9hw5y+l8ICFVaEO5/Bf/Sm47r0tEp9OJRXg60vV4IfBPL wC8g== X-Gm-Message-State: AOAM533CoDlArrE5cAQESANZl/2FhtLVn2tode0h2jVZZag3FkkqsWLz 9hP2u9l+Q2Qs6kqKzT/D12oGIQABiEUHW95PSB4= X-Received: by 2002:a17:90b:1d0e:b0:1d2:79e9:21aa with SMTP id on14-20020a17090b1d0e00b001d279e921aamr45334321pjb.153.1651093318360; Wed, 27 Apr 2022 14:01:58 -0700 (PDT) MIME-Version: 1.0 References: <20220420211105.14654-1-jagathjog1996@gmail.com> <20220420211105.14654-6-jagathjog1996@gmail.com> In-Reply-To: From: Jagath Jog J Date: Thu, 28 Apr 2022 02:31:47 +0530 Message-ID: Subject: Re: [PATCH v4 5/9] iio: accel: bma400: Add separate channel for step counter To: Andy Shevchenko Cc: Dan Robertson , Jonathan Cameron , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Wed, Apr 27, 2022 at 6:04 PM Andy Shevchenko wrote: > > On Wed, Apr 20, 2022 at 11:11 PM Jagath Jog J wrote: > > > > Added channel for step counter which can be enable or disable > > through the sysfs interface. > > ... > > > +static int bma400_enable_steps(struct bma400_data *data, int val) > > +{ > > + int ret; > > + > > + if (data->steps_enabled == val) > > + return 0; > > + > > + ret = regmap_update_bits(data->regmap, BMA400_INT_CONFIG1_REG, > > + BMA400_STEP_INT_MSK, > > + FIELD_PREP(BMA400_STEP_INT_MSK, !!val)); > > > + data->steps_enabled = val; > > This will update the value even if we got an error and actual device > state is unknown here. Does this make sense? I will correct this in the next series. > > > + return ret; > > +} > > ... > > I perhaps missed why kmalloc() is needed now. Any pointers to the discussion? Here step is a 24-bit value and since this is a sysfs channel read (slow path), kmalloc() is used to make the buffer DMA safe to read the multibyte value using regmap_bulk_read(). > > -- > With Best Regards, > Andy Shevchenko Thank you, Jagath