Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1031785iob; Fri, 13 May 2022 20:21:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+AOY9JHbSahvF4WwX6dfNZaH9pUpEqSiGBoMhp2FKfzJefE8XqNP34fcpeaexktfYapWW X-Received: by 2002:a05:600c:2258:b0:394:2045:bed with SMTP id a24-20020a05600c225800b0039420450bedmr7137708wmm.174.1652498467828; Fri, 13 May 2022 20:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652498467; cv=none; d=google.com; s=arc-20160816; b=k1WsPHc+Q+iXagTtzWs2wa0LA+XcI8t5gIl3QqKpa5d73gKWLAo59fhHn0u9WA67Pw 6HGs7EfqMCquRfoXQsTJhDd7+39Z6pgkVhv4HwmcPj/AgcjdnsRwf0NqMIQgMJB2UKJN FKXt+TWS+Vu7+Dq4rn/mq84xcoPRaY3waoGXAeIm74KmT4ULSdOuH65iSHwRME8ch1iQ oIxw5lgbUb1pjnc0TXxl0q2VXPZkJZH5czOw17Saq9v+TjoMFr8RkanuOJi8N/a+MTob YBC4/WjNVKFlmYXW+c/wf7aSKN3zag0Umn0nxelpEyYU8wvjXhEUCTZ/rPRHJn2xeCmG p4Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SzGS5R2H9cN6gNSLBdrOmn5OBr2vHPyOwx7M3pjsPxc=; b=k5LQo/N2ECkmog2WaMX+rU6QT0UWccNjy7dNlI7340qMZNsWF/sV7itk/9DDdjqJzz hSJsUiAD6dORa89HuTyIVmj8Vu6pvlRMWzIJE4CUSoHtvsfOApowjdnu1Ch3ZS5EMvWZ /+hjzDiI7SIgLokVZtZY5HSMP5k/ui/wWebdax9dZtScqlCYhZ08Z4vjO4rlRIiumigB elZfBfjaoXfJYNlV4L+ShnKWv7knvhqT3ZF6OvqsDMyIGq8cJHpGbdi06Y8Cfrgu3zsL 2EWGwRKGLQgy3ggL5g16JF+FhEeGMI+SLYchXs/czG8k5fgWYEOvoH0If67p4lX00Ny9 oPsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KlwwhtF+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b17-20020adfe311000000b0020ac54ab1e0si4549973wrj.170.2022.05.13.20.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:21:07 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KlwwhtF+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 521B43F9DC8; Fri, 13 May 2022 16:58:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359731AbiEMAa4 (ORCPT + 99 others); Thu, 12 May 2022 20:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbiEMAax (ORCPT ); Thu, 12 May 2022 20:30:53 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C551C908; Thu, 12 May 2022 17:30:52 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id s27so8493630ljd.2; Thu, 12 May 2022 17:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=SzGS5R2H9cN6gNSLBdrOmn5OBr2vHPyOwx7M3pjsPxc=; b=KlwwhtF+eJ3KZtgfwlGWZ84vrXWIaLRvgLrHA5/JU+fPUFgF9K88EqxDUyZORZuTn9 TpjKU8VT4kju5pqG9ZlN3zy5zHiSL57j3cA9fqv2b8xsr8MdaM2j2iOUb5O/iBCY6Gso +MAd9Htm6NFMiqvX9WyG24x2x9bVAsvIB7zntPnErCEXpo1LzsvxKdn4zEc79KJYSh4D XjejRJdJHNbAkrNmTK8PVp8ZYk6NfOEoibq2jJMLkwAQzEMtnp5JKDEljRAKVyh+Rf+C rw0Ji5QEFxLym2jtAHxgUskoT2SZD/FwJ4JlDs+gNfYNjqOh/zZXrS3RHH2gHqtXAKHh fIdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=SzGS5R2H9cN6gNSLBdrOmn5OBr2vHPyOwx7M3pjsPxc=; b=bO7vvTGHAjR+xSU9GR67H7oIjUh45ZghX6SQUWq7+tUrw6bAe/DUgLCQEkftKkkL0S M6EaAn6lwpFpbQOrlHAEnC4IMkW46vXJdX3QIbdunRl69A2C5K7dKPyYejv2zr7QUGBF pS56UCwIUe1bTPV1gMM7/WimrhVEq2lgA6WU73knOjb3xZHoJDYqDST6dcnfA9A7KBLr g2mQTZTs59as/50297Mm1IiiGmof8zxz+6VH3PGDmhBP8ysI2IUSGmYgIvTzl9rQLogu 5cwCnrDUtLsCp85MojoTGF5Z/IbPpSTUfJUdcDAJW7kFBcJxqOTLkQ0KUDZUnPcRjGSP Jt8A== X-Gm-Message-State: AOAM532Nof7TrNq9I2NVrAzmyi2KnG2WGx8ExgITEG60kqKmY+OSgTHd RuzMqOhjnQbauMekgoYwoGE= X-Received: by 2002:a2e:bd83:0:b0:24e:fe7b:7235 with SMTP id o3-20020a2ebd83000000b0024efe7b7235mr1536181ljq.409.1652401851065; Thu, 12 May 2022 17:30:51 -0700 (PDT) Received: from [192.168.2.145] (109-252-137-244.dynamic.spd-mgts.ru. [109.252.137.244]) by smtp.googlemail.com with ESMTPSA id w26-20020ac2599a000000b004726284fe8csm144642lfn.133.2022.05.12.17.30.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 May 2022 17:30:50 -0700 (PDT) Message-ID: Date: Fri, 13 May 2022 03:30:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4 3/3] iio: light: Add support for ltrf216a sensor Content-Language: en-US To: Shreeya Patel , jic23@kernel.org, lars@metafoo.de, robh+dt@kernel.org, Zhigang.Shi@liteon.com, krisman@collabora.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, alvaro.soliverez@collabora.com References: <20220511094024.175994-1-shreeya.patel@collabora.com> <20220511094024.175994-4-shreeya.patel@collabora.com> From: Dmitry Osipenko In-Reply-To: <20220511094024.175994-4-shreeya.patel@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 11.05.2022 12:40, Shreeya Patel пишет: > +static int ltrf216a_set_int_time(struct ltrf216a_data *data, int itime) > +{ > + int i, ret, index = -1; > + u8 reg_val; > + > + for (i = 0; i < ARRAY_SIZE(ltrf216a_int_time_available); i++) { > + if (ltrf216a_int_time_available[i][1] == itime) { > + index = i; > + break; > + } > + } > + > + if (index < 0) > + return -EINVAL; > + > + reg_val = ltrf216a_int_time_reg[index][1]; > + data->int_time_fac = ltrf216a_int_time_reg[index][0]; > + > + ret = i2c_smbus_write_byte_data(data->client, LTRF216A_ALS_MEAS_RES, reg_val); > + if (ret < 0) > + return ret; Should the data->int_time_fac be updated only if I2C write was successful? I'm not sure what reading of LTRF216A_CLEAR_DATA reg does, but if it clears the measured data, then shouldn't the data be cleared after changing the config? > + data->int_time = itime; > + > + return 0; > +}