Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp90759rdg; Tue, 10 Oct 2023 05:17:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3O54CIs0P1kDRJ4J2/QK4BvWlm6d4lFzSwB7yHAwWVFuENOba9NHKbNrE4RDJuhw+cpSD X-Received: by 2002:a05:6a20:7343:b0:14c:3218:c1bd with SMTP id v3-20020a056a20734300b0014c3218c1bdmr20870245pzc.11.1696940276957; Tue, 10 Oct 2023 05:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696940276; cv=none; d=google.com; s=arc-20160816; b=e/+SFVoYk8FhYOe66mIvfHfBiIOTHa5iG0QT3EWP2DaaKToCF7JDYL+FGlQtNjLWTe jE5sKCwBYUzzserKkt5pEWGmjoA9b3B+t2WKWc5X5MA1vJsz+jgCDSrF5x4iFzoje2Dy 4yyfRHwtLctjFFplYCw5pQ39sO/Et1CeUxTCS6U0fyZ1BG97KE1AYYT1rvfyuWVT/UrZ 9MIWwnA2E8OOKuTzsOTSS/O/oc5vaAXzaN/I1F2mDvS+coD1k2+hns7mEEAHiDXEagoP nHciz8XfOZ/l4wa4R3+96geC7qw/Bjag9wHO38ZjNA4r1JcBJeWE+BL66IrhER5wR0F4 KplQ== 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 :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=bKsq0H0QHqCTR39XhYQAd4r30i5LT0wElncnk9nlAWQ=; fh=Zr+WlJYjKgHWuuBHb09UWmNREeTS91OI1mPcnUXlXPA=; b=ciP+DxmomrRzctIuOFUG2SAPESXyj8pys6Qna49Z+avPXNmfA6QuX+0YXduM7vdnDU y22eGI3IC8KWns6OCBEESwdCX7wNO3w3cKIcFgXGaIIjlEgVLu8lfXkwL4etoS1ucQxC Xozs6Bde/6m0EHE0rVPXBjXMMwafq84d9WhB0bjztjTcbw1wfxJA8BzFy30ozKjMt9Dd 4lMdEtR23V1+2b/12Gp9s28dtLY78frkD9qTqDsyi4hxGhCNY76fTfkR9mzXs0orxTGA BOqL1PvNCQ0OdENNuGndGaPJSJJNSwo3/YjnIfSU7NPVmwFkDXjMpRn21FfMe4TWQmKh J09A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=A8FsNjTX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id dc4-20020a056a0035c400b0068a6f6d9f85si7513045pfb.140.2023.10.10.05.17.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:17:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=A8FsNjTX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E8CD6801BFE2; Tue, 10 Oct 2023 05:17:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231633AbjJJMR0 (ORCPT + 99 others); Tue, 10 Oct 2023 08:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjJJMRY (ORCPT ); Tue, 10 Oct 2023 08:17:24 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07A5BA for ; Tue, 10 Oct 2023 05:17:23 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso4914023b3a.2 for ; Tue, 10 Oct 2023 05:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tweaklogic.com; s=google; t=1696940243; x=1697545043; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bKsq0H0QHqCTR39XhYQAd4r30i5LT0wElncnk9nlAWQ=; b=A8FsNjTX5N5T228pMHyRyTyr3FKmc0o6girvqXeO4tYRk5VFuft/9yWSOStOdyvRz/ nITYR1dy3Kf1H5SSY1W1xfess+lbcBRyOLX4U7QJPZImb+stu4woc1qPuTQi98xl6tTY kqr47f0ofei8Kgiu+BD1/7wXfqm3aJ+ZekJ55B9+Il37qUkgDye4KOc/5/1vpyDb1msR 2In51Ys4hIVu68WcUQLjC4L1jIdfm0dxzcvQtQFznssghYaDp3BG7Ai/zNj0AG9dmFee U6kAfqOkTTEePk1Il/5L187QwmAjOwIa6uxC5tk2/BNtRHTe7hNEh5l2tE1+tLizbbAS 55Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696940243; x=1697545043; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bKsq0H0QHqCTR39XhYQAd4r30i5LT0wElncnk9nlAWQ=; b=m4EsBHn62kIT2M+auz8tmHG2n4WNMGyAI6MWN2iM0LS/zhnQUQi++cCg17u6xtKK8r ptxpHr8gNqXB5lok4PawznRx5oFL/aeyjTlZy/OX5nepTTvQNj6M/QeOUU4d7p9+i86l eDdFS9QcgfjGuiS3jLYkqPYzvhQRIohzD3HO+8AH57CMbFIuNbIAWvQpi0/PaVatad+q TgcwPPv3X3AWF8yYszIfEKoG+S0OtsMZuX7uBGT4CZS7UoGxFHBI+iHD4U+lquuRRGBD 5qEqIuHpx2dui5gTja1Yvd9GtyX4a3twv2aq0l9hrJvCliux9FssPm+ARqvoDUP9fnXn OZnw== X-Gm-Message-State: AOJu0YyL8j6WbYnvqWM6CBPghGrmr3BaXzzDuq3W9wpeAP8/ps8AJIYm U54B6mxM9x7Wk8LBZack+Asw/Q== X-Received: by 2002:a05:6300:8003:b0:172:9b19:66b6 with SMTP id an3-20020a056300800300b001729b1966b6mr360575pzc.32.1696940242810; Tue, 10 Oct 2023 05:17:22 -0700 (PDT) Received: from ?IPV6:2403:580d:82f4:0:4346:670f:8942:33b? (2403-580d-82f4-0-4346-670f-8942-33b.ip6.aussiebb.net. [2403:580d:82f4:0:4346:670f:8942:33b]) by smtp.gmail.com with ESMTPSA id e24-20020a62aa18000000b006979f70fdd5sm8083541pff.219.2023.10.10.05.17.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Oct 2023 05:17:22 -0700 (PDT) Message-ID: <09a07473-2558-2b05-c9d5-8d439749bfa7@tweaklogic.com> Date: Tue, 10 Oct 2023 22:47:14 +1030 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH 2/2] iio: light: Add support for APDS9306 Light Sensor To: Matti Vaittinen , Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Gazzillo , Conor Dooley , Stefan Windfeldt-Prytz References: <20231008154857.24162-1-subhajit.ghosh@tweaklogic.com> <20231008154857.24162-3-subhajit.ghosh@tweaklogic.com> Content-Language: en-US From: Subhajit Ghosh In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:17:54 -0700 (PDT) On 10/10/23 20:15, Matti Vaittinen wrote: > > To my eyes this driver looks nice. Just spotted two minor things. > Thanks Matti. Nice is one nice thing I heard after some time! >> +    gain_new_closest = iio_find_closest_gain_low(&data->gts, gain_new, &ok); >> +    if (gain_new_closest < 0) { >> +        gain_new_closest = iio_gts_get_min_gain(&data->gts); >> +        if (gain_new_closest < 0) >> +            return gain_new_closest < 0; > > Returning the truth value on purpose? :) Nope, it's a bug. I'll fix it. >> +static int get_device_id_lux_per_count(struct apds9306_data *data) >> +{ >> +    int ret, part_id; >> + >> +    ret = regmap_read(data->regmap, APDS9306_PART_ID, &part_id); >> +    if (ret) >> +        return ret; >> + >> +    if (part_id == apds9306_part_id_nlux_per_count[0].part_id) >> +        data->nlux_per_count = >> +            apds9306_part_id_nlux_per_count[0].nlux_per_count; >> +    else if (part_id == apds9306_part_id_nlux_per_count[1].part_id) >> +        data->nlux_per_count = >> +            apds9306_part_id_nlux_per_count[1].nlux_per_count; >> +    else >> +        return -ENXIO; > > I think we should be able to differentiate between the IC variants by DT compatible. (Commented that on bindings patch). Not sure if we need to support cases where the sensor is instantiated without device-tree. I am not super happy when code requires the part-id to be known if we have separate compatibles for variants. Can we in dt-case just print a warning if the part-ID is not what we expect - and proceed assuming the nlux_per_count based on the DT information? (Sometimes we see new variants with same part-IDs - or many part-IDs with no SW changes needed. Hence maintaining the part-ID lists may be tedious). This is just some pondering though, no strong requirements from my side Yes, I agree with you. The purpose of DT is to provide proper hardware descriptions. I will throw a warning as well as implement a compatibility match. Regards, Subhajit Ghosh