Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp397677lqb; Thu, 29 Feb 2024 04:34:22 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUZcIKC5lCVp1pskrbR6xvgNmJrdSdT8euTx+dBgjdCk35p4oULYtyRW2PGrCLq11vFuQLp4kDx/CMlj/jXN+OcYA/x3BvqufGDqEjGQ== X-Google-Smtp-Source: AGHT+IFcruZTCxiTIMRItUh3AjhTp474HiWxqSXu9l/TBsY8VmLNnoHq696akx710LaoK3rwR9Hd X-Received: by 2002:a05:6402:5246:b0:565:214d:8dd7 with SMTP id t6-20020a056402524600b00565214d8dd7mr1892205edd.35.1709210061951; Thu, 29 Feb 2024 04:34:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709210061; cv=pass; d=google.com; s=arc-20160816; b=oK1XWACi1pEfpvBzZnmMNV0WlVRgtr8TXVNQt88IiCDpGF+Mdzx0cf3KILfgXOCgbu boqlFOlY1QIkHMpl1iZU+0Fyj88xvo8Rx68MoLODKbG0EhhjnaAhqA+WBp+wx4Hx20zE dUKG5+65rQf/6PFAZZTmnVMdcH/P9laXEESOwij1vbc8M6bpOv4etuu3r+6cv8vjqxsZ iERXRy9b3zwjNposzEoWEF8Qqu0YXs5aL7I7XFbdH/8oWm8t326qxG8uRJUewrIhXD2z NccpV7y2u+kPDPPWRiUWRKHpFcWV1agWek8VK16fs9VLGlry0ZDYSZr4LESSBuMgyGug z4KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=TCexcYQzx0d2SnUJdNnjgTSL8kpRco6diT5oBF7z1io=; fh=hNRwKonkx4Fb49aGbbKenik/ZaehANOwUOHnQHcBph4=; b=PDIdZIlm1tsKle8QrJfac5w3DIUoaki3IlmPudT1sylS6RLWFd8PRHoFIqgBr+jHNr GT8dnuFmwDitEaIlPhv5sfdvQSeNxtGAs9/UJ8MTTS3dC82auwXE/azF5KTA0MOE5dJK vfj41gdwxHdYsCrvNkiCvq/DQkIZD0u+fUjeX9zLaQ6b8S8Lx2CggcYgONhf9p4DlZDa EprQr+U+YtRsAm3KrGbaTyKBvIexo08KZ8noMJmsZHQ1aponODYphhSwjKrBNiTd6m8S We/sQ+a9K7U46RE+8g5juYPIxvlmjw1pRoDnSbw4Katm9SuQtLQTbM24lmaQmEXHhKMn jIFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=BrBwoz32; arc=pass (i=1 spf=pass spfdomain=tweaklogic.com dkim=pass dkdomain=tweaklogic.com); spf=pass (google.com: domain of linux-kernel+bounces-86704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86704-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f13-20020a0564021e8d00b005665b5ddb50si535944edf.108.2024.02.29.04.34.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 04:34:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@tweaklogic.com header.s=google header.b=BrBwoz32; arc=pass (i=1 spf=pass spfdomain=tweaklogic.com dkim=pass dkdomain=tweaklogic.com); spf=pass (google.com: domain of linux-kernel+bounces-86704-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86704-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B03451F25B3F for ; Thu, 29 Feb 2024 12:34:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EF8376F1B; Thu, 29 Feb 2024 12:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tweaklogic.com header.i=@tweaklogic.com header.b="BrBwoz32" Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0A20185B for ; Thu, 29 Feb 2024 12:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709210054; cv=none; b=JgS5pN0Qhwlpana1RS9znrbF/etM6q2lGudOHyMFrbn+zGmOGiExk6qBfBCdooMYQhjYp8emHdEyQ3MZrx8JaIlgp7GM9bTczqIsE0kvnKBc73pG+8UfmAYDouUp/7IGjpjjBP78ZnsLq3dihdZyDuiMlyku+xa0IHXymfd3fzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709210054; c=relaxed/simple; bh=xkEGfy7d8zBivZmihVMVtEwsaqjjjDrBXICHq66svsY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JkhK8LbAta16rDkbu8+7vVdJAxFIvQJ3mlpLv7FxUxxkKBdfaQDFFQF+0Y76jIDb7erpAk+5jXUwFu7gMAIlnQRdSkWoaBTe1fVsxfzDi1Mk3F13wjAqXTAOtiXPX0KJ7ZTTmAbM4Uy7CO6bjHqjqK+1b4JuJuwA2UHtV7HiG9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tweaklogic.com; spf=pass smtp.mailfrom=tweaklogic.com; dkim=pass (2048-bit key) header.d=tweaklogic.com header.i=@tweaklogic.com header.b=BrBwoz32; arc=none smtp.client-ip=209.85.167.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tweaklogic.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tweaklogic.com Received: by mail-oi1-f174.google.com with SMTP id 5614622812f47-3c1c51f2fb1so252450b6e.0 for ; Thu, 29 Feb 2024 04:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tweaklogic.com; s=google; t=1709210052; x=1709814852; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=TCexcYQzx0d2SnUJdNnjgTSL8kpRco6diT5oBF7z1io=; b=BrBwoz328J+ZsWiE3qA9qQIEKJOeKHttw4cAX32uBSrRMaycp0l2djQqTHPtkMuqTu j4yo7o8AmTKXs2DO38cITIRtWB0mdNkiD200HqZGxCHE+23jSIBtPoje+/sBeKJWwgIn fkCHqsqOMfVzALnjKUPAtTPz5x+R3G0QVsqIp9rC3YaA6dnXriGB79ZJxrW8a0mk4HXW xDemdDqa8pdGQJ/lEgrQlLJ54V97wQW/7SKtnpI/Iq5adiosvdjwxE4uwxsb7QLFZykk A3txMMVm/7pRfxO9vXxBllBcX0EJM74A6M/R3G3Y8gs2BIX6q9WJ1ks4IA7EdnKsKaxQ XE0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709210052; x=1709814852; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TCexcYQzx0d2SnUJdNnjgTSL8kpRco6diT5oBF7z1io=; b=XoIgjAnpFArnm5/CNgeusfXJv5xTRi8TEaoKYybNNUgiMh5A3SVYnF9Kijv6JvCQkn r65Symm++KtB0K62WDSkVSHSYQuhidTVmSsi6TlM7XAgVDvrUMmhYX8LvsMVAaIeiZ3t whLDLIWCDmwowWF7vMVNe58eXbe2TJmoWN4t7JIK+aaF9EU99banT0A0ZpyixINZ3kSB pjjKkKUrPjK47PPDwqdiyq2iJJhd/fjpO7E0wo93QKQNRMzUgA85oNKu1TdRcNizS7sG EMU90GJG7w4WMW0Wfx2BzpxC9X5UCOALvBXWLm1VfcSyOQxocIha3U5zOW5JeswgkgHj x4gg== X-Forwarded-Encrypted: i=1; AJvYcCU9QGXF3MXJIukOTia8MastPfuau/M1pnPdU9k6cWwz+EsJBtcEItPDsYEGh/XQbBZ5ZcQdtGP43k4QiqQIZQ3YtEpGWoWsp4Hqtlw9 X-Gm-Message-State: AOJu0YwONQRA0Ou4a6/tEHGW9W98tpB0mE4J43UswAsvB4BVtIjEkvMY gOYYlfKDok+L8sURqWuolY5RvAtJer2Vhww8eNJ+XrNO5s6RBpJ1/ZrWeoMFLxE= X-Received: by 2002:a05:6808:22a4:b0:3c1:c2cf:87e6 with SMTP id bo36-20020a05680822a400b003c1c2cf87e6mr2063771oib.6.1709210051821; Thu, 29 Feb 2024 04:34:11 -0800 (PST) Received: from [192.168.20.11] ([180.150.112.31]) by smtp.gmail.com with ESMTPSA id r16-20020a62e410000000b006e46047fe04sm1149383pfh.204.2024.02.29.04.34.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Feb 2024 04:34:11 -0800 (PST) Message-ID: <45386f39-a034-4d70-a6d4-8804c27aadce@tweaklogic.com> Date: Thu, 29 Feb 2024 23:04:04 +1030 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 5/5] iio: light: Add support for APDS9306 Light Sensor Content-Language: en-US To: Andy Shevchenko , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Vasut , Anshul Dalal , Javier Carrasco , Matt Ranostay , Stefan Windfeldt-Prytz , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240228122408.18619-1-subhajit.ghosh@tweaklogic.com> <20240228122408.18619-6-subhajit.ghosh@tweaklogic.com> From: Subhajit Ghosh In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29/2/24 03:57, Andy Shevchenko wrote: > On Wed, Feb 28, 2024 at 03:08:56PM +0200, Matti Vaittinen wrote: >> On 2/28/24 14:24, Subhajit Ghosh wrote: > > ... > >>> + ret = iio_gts_find_new_gain_by_old_gain_time(&data->gts, gain_old, >>> + intg_old, val2, &gain_new); >> >> You don't use the 'ret' here, so maybe for the clarity, not assign it. >> Or, maybe you wan't to try to squeeze out few cycles for succesful case and >> check the ret for '0' - in which case you should be able to omit the check >> right below as well as the call to iio_find_closest_gain_low(). OTOH, this >> is likely not a "hot path" so I don't care too much about the extra call if >> you think code is clearer this way. >> >>> + if (gain_new < 0) { >>> + dev_err_ratelimited(dev, "Unsupported gain with time\n"); >>> + return gain_new; >>> + } > > What is the difference between negative response from the function itself and > similar in gain_new? > -ve response form the function is an error condition. -ve value in gain_new means - no valid gains could be computed. In case of error conditions from the function, the gain_new is also set to -1. My use case is valid hardware gain so I went for checking only gain_new. Matti will be the best person to answer on this. Regards, Subhajit Ghosh