Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5746229rwb; Tue, 9 Aug 2022 03:29:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR5oz+W/owdFlAAydLwWaZD2xhBwVbJnNTpO668yKS/2RjQOiWEuht1+/CBR8/3J504CI5Gk X-Received: by 2002:aa7:cf18:0:b0:43d:34e:11b9 with SMTP id a24-20020aa7cf18000000b0043d034e11b9mr21455156edy.145.1660040957337; Tue, 09 Aug 2022 03:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660040957; cv=none; d=google.com; s=arc-20160816; b=Z3Zkk1Hp+EGHfy1J4IxFkfqnwwNFPzeYFcfiXhJJeE0fY7aEXZTa9Tuie2RbnyZ8EF G0yNeXQajGymthqqU76h+GudQWZDv+lZalEcqUxHG/O6iDwOXu8xSKbUrIKuxnk/R1OB M7nzg0AvKzvFsVs9WUGMEVd6ZvY9elngJkWIWUQgHuimR/FefysT341Gla6wfHeKQyaE BFaryFacSrHuxP3kYpBXxvO3V4myueadrXkO4NK2ZYHRv0PbJSk9cRGiR3SaR6LUAKXJ r8jPbiCKWhHU1c0iofFV3dA7PEuaIlw3IhUOWmbKXvCsIBz5U3Ie2S8Zq4P+B66OgSl+ sQ1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=1NkSog7fNwIuD5awyrROp78DqGLAA2ojxoXb1/HAoNk=; b=EzA8TYvNi/qNkhJNmrxhnOmUywvnsKy8KYtLKlc0bfhXpGBTwQXjuYgN5Swwj1FbEq 6aSjsckfNh3wizSBf9sUmsK6MsOj3l7wpIx2RCOKS70vtkVrEwvGNGFaySYRTnI48bru QnhOzGKfDaHK3zI1e+TKh/hhCUMm5I8+4JUMFjElJLkLDu5jsygQM+1K2eLyK/H23iFs jxefvtAVc4AOdM05aw3NmwiVrjBsD+WTgjAaRBphL1lcRE6D5cTgx92vAWwntxowJy3m iw4VXZuoSliI4STt3ehZxO6N51o45+WFxr+ir5djIY5VXQwjgLXh/RAki8ELXqTs/GSM P00A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=hFDLqYrg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qc25-20020a170906d8b900b0073046c15d8csi1765191ejb.610.2022.08.09.03.28.51; Tue, 09 Aug 2022 03:29:17 -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=@sberdevices.ru header.s=mail header.b=hFDLqYrg; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238384AbiHIJsF (ORCPT + 99 others); Tue, 9 Aug 2022 05:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbiHIJsE (ORCPT ); Tue, 9 Aug 2022 05:48:04 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D9B1F63A; Tue, 9 Aug 2022 02:48:01 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 8A1815FD05; Tue, 9 Aug 2022 12:47:59 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1660038479; bh=1NkSog7fNwIuD5awyrROp78DqGLAA2ojxoXb1/HAoNk=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=hFDLqYrgj81gSOH5Urbg46yf1sLyfdAl9V/bmisWnmBKVIF4b1YmuFUt0gVGqYSQf 42GnCO8zJNeHd6h6UtfkdBIDNeY38CJvqV1Qegwbs59Pdq4q1VXqy+fg7Bk0vXulxz juLR4kmdJ1Xf81UU+kwOUJlDS+kbIgYgE4u7Cu+ze6fXOsxrkBpZoW5+U0gUhde1rc Hjc8yGiVmmTzkkHrKSq5UI0GCZcA3xtrrA3yqnqsSuIu+5f55A+weRfhHDUPCNPEUb aC+EvHRee3fI3Cj2gAEP1KfaNPsRQqs5vq4lVJZAFLbl2Y6wGqPmm0M4L2lLhoTYaN 9Sc/qN+ZJDdgw== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Tue, 9 Aug 2022 12:47:58 +0300 (MSK) From: Dmitry Rokosov To: Jonathan Cameron CC: "robh+dt@kernel.org" , "stano.jakubek@gmail.com" , "shawnguo@kernel.org" , "lars@metafoo.de" , "andy.shevchenko@gmail.com" , "stephan@gerhold.net" , "linux-iio@vger.kernel.org" , "devicetree@vger.kernel.org" , kernel , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v4 2/3] iio: add MEMSensing MSA311 3-axis accelerometer driver Thread-Topic: [PATCH v4 2/3] iio: add MEMSensing MSA311 3-axis accelerometer driver Thread-Index: AQHYpzqIoQnaRj7vNkq2cXUUGjAB/62h0pwAgARW1QA= Date: Tue, 9 Aug 2022 09:47:54 +0000 Message-ID: <20220809094754.akfed7hxcdvxoacj@CAB-WSD-L081021.sigma.sbrf.ru> References: <20220803131132.19630-1-ddrokosov@sberdevices.ru> <20220803131132.19630-3-ddrokosov@sberdevices.ru> <20220806163204.3262c0e7@jic23-huawei> In-Reply-To: <20220806163204.3262c0e7@jic23-huawei> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-Type: text/plain; charset="us-ascii" Content-ID: <6373418BF86F2844AEE00C8459CE3039@sberdevices.ru> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/08/09 07:32:00 #20083496 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hello Jonathan, On Sat, Aug 06, 2022 at 04:32:04PM +0100, Jonathan Cameron wrote: [...] > > +/** > > + * struct msa311_priv - MSA311 internal private state > > + * @regs: Underlying I2C bus adapter used to abstract slave > > + * register accesses > > + * @fields: Abstract objects for each registers fields access > > + * @dev: Device handler associated with appropriate bus client > > + * @lock: Protects msa311 device state between setup and data access r= outines > > + * (power transitions, samp_freq/scale tune, retrieving axes da= ta, etc) > > + * @new_data_trig: Optional NEW_DATA interrupt driven trigger used > > + * to notify external consumers a new sample is ready > > + * @vdd: Optional external voltage regulator for the device power supp= ly > > + */ > > +struct msa311_priv { > > + struct regmap *regs; > > + struct regmap_field *fields[F_MAX_FIELDS]; > > + > > + struct device *dev; > > + struct mutex lock; /* state guard */ >=20 > Shouldn't need this comment given documentation above that provides > more information. Without this comment checkpatch.pl raises a warning about uncommented lock definition. I agree with you, above comment is redundant, but is it okay to ignore such warnings before sending the patch? I'm talking about below checkpatch condition: =3D=3D=3D=3D=3D # check for spinlock_t definitions without a comment. if ($line =3D~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ || $line =3D~ /^.\s*(DEFINE_MUTEX)\s*\(/) { my $which =3D $1; if (!ctx_has_comment($first_line, $linenr)) { CHK("UNCOMMENTED_DEFINITION", "$1 definition without comment\n" . $herecurr); } } =3D=3D=3D=3D=3D >=20 > > + > > + struct iio_trigger *new_data_trig; > > + struct regulator *vdd; > > +}; > > >=20 >=20 > > +static irqreturn_t msa311_irq_thread(int irq, void *p) > > +{ > > + struct msa311_priv *msa311 =3D iio_priv(p); > > + unsigned int new_data_int_enabled; > > + struct device *dev =3D msa311->dev; > > + int err; > > + > > + mutex_lock(&msa311->lock); >=20 > > + > > + /* > > + * We do not check NEW_DATA int status, because of based on > > + * specification it's cleared automatically after a fixed time. > > + * So just check that is enabled by driver logic. >=20 > That is going to be very problematic if we can have this and events comin= g > through the same interrupt pin. Not harmful for now though given you are > only supporting NEW_DATA for now. Just something to watch out for. >=20 Actually, I have run some experiments with NEW_DATA status bits. And looks like we can't determince actual status of NEW_DATA virtual interrupt when physical IRQ is raised. I will back to this problem when begin Motion Events feature implementation. [...] > > + err =3D devm_pm_runtime_enable(dev); > > + if (err) > > + return err; > > + > > + pm_runtime_get_noresume(dev); > > + pm_runtime_set_autosuspend_delay(dev, MSA311_PWR_SLEEP_DELAY_MS); > > + pm_runtime_use_autosuspend(dev); > > + > > + err =3D msa311_chip_init(msa311); > > + if (err) > > + return err; > > + > > + indio_dev->modes =3D 0; /* setup buffered mode later */ >=20 > As per other branch, I led you astray here it seems. >=20 Sorry, I've made a mistake. Comment about INDIO_DIRECT_MODE was left by Andy here: https://lore.kernel.org/linux-iio/CAHp75Vc0+ckNnm2tzLMPrjeFRjwoj3zy0C4koNSh= FRG3kP8b6w@mail.gmail.com/ [...] --=20 Thank you, Dmitry=