From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 0550738D404 for ; Sun, 26 Jul 2026 11:44:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785066264; cv=none; b=tr4gZFvAeDc7ixg/MUbU+5qYXez1CSRR5iuqSSO3Lsv9+LHNQFatqq2SF2ZhOH3nThFcgSfTeypgfF75OsxnuYSx/6i+Wzvc+0L1sEwsBuOQ8fp0UCsfaoJNf+4tHm/M8EIVN/xYT67ZFXTYjed23nz1zVBknxtrLPDU8cjdvCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785066264; c=relaxed/simple; bh=aRAxuoFIpT5iiNuX1y0oJLKjAX7jWXl8mgVLbL0uStE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hIF0vht6oOGHmFGieEdggzBBPpk1yRRdh6q0R/uKD8aJAyNWvlUHq9iK1PhtHhm/7viHPkvD8DbgaXbjikuRhjWilmdoTCSWIJrCD4U05vcBj1bZbVmuiGUH6zJTdHxAmd9xTLHxgeLFMfy9tbCkW6lCyp1s8uoM3qNBSx7M8Z8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eFY7V1+e; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eFY7V1+e" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-495757ccbc1so16660035e9.2 for ; Sun, 26 Jul 2026 04:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785066261; x=1785671061; darn=vger.kernel.org; h=content-transfer-encoding:content-type: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 :content-type; bh=LlEYYQFwJ049ecKkONrkZDcdDe6IgGEY4lTlwkRmH6g=; b=eFY7V1+e+2jBJGaasmYGIk3Y6lKIazs1dNK4t6LLpX1rloQslNI8HAzj6ngu6sgjQT jbS3gOZavUG9iJd9co3urMnPWl+S7v9IQT/zshd+Q7pFI7qpwlKdd1h8td7HCQ0nJRTk h1MmpdU4zbjzzd0FmEKtpUCFM1oWYfbOqIn0pyttiPgXc2lemBuJFHxdakTyvYk7MTHm V9p3Q64vRWCeHqUMmFVLmy7bptv95PaBoYIVIY61UUuLH7KnTYO++ou2WzzhW6RpyDLE j6zQ08RHx7AN99PrfYOwjj9C4Cf3OAeajDir/eEciQX5Y00KS+el4UpXzps6ARBANeeW 27Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785066261; x=1785671061; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LlEYYQFwJ049ecKkONrkZDcdDe6IgGEY4lTlwkRmH6g=; b=VpF8hNpI94MooFtKcq6G+yEJj1M9ZIfO3XMbkeKP1jV0aUADDfo9W87Is904q2zAlt bJ6bTte9hXx1S5o21JA5ZXRxgqd73Omt7yOGf+hYccD9B1qE8T3KNcjkhlx1XdOg/ywk schIalrYD9Nv4hRN//8lU1cB76LH0ANvA+DS4Pbuihbp0XTSXHFff5vgNLWyf8xj4f8Z 1Gs+3jIYHIMa3NH3I8UrKnZe3Q/jGrJslD9OZe98yZ4pX+VxRHENo22ENJHuYT8vIF2W CtAxYR0BTBjlbDgUMkv1qgwtx2BzhlqpS9FGER+S+f4eY7YihNAUIFqjxU7qUXQgG0w5 mYfQ== X-Forwarded-Encrypted: i=1; AHgh+Rovb8oqbsTqia5Rk5P6BBD+LT7TEy+q437+bag7D16skxYY4tQ8A55YQrvi8NIdK9O8/rGAiEbPurJnGXc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2cBZsk7Th2bCtF9e9NZUg9uYpLxVLScg69NbQyAKl0q7g9NS7 NnnnreQmk3ypn9CVRQO/tqvfmmGNwlNKUO8DzPn325gp0/WxGTkKA9or X-Gm-Gg: AR+sD138zT/m6zg15d8VRXm6Iq6q3cOq3UwRdCmA9cgUXJpXXALifxjsDs1VO5jcc0j fEByk+L5DxhqFJy9+emA0xxoVB2YbDOuLkMtxPcoE2mADtmwY9/xEIe6ybzZBUm4KJyJFl870NV fVQgysIg8Iqw1T1N/zWkK3wpneFYIrnj/tlI4UaOHQo/KaBvFBMEKAlOC3+1glKQhoZdV4Td07D 6bmD06Ct4wcie3cFHGytO5MaBn6PMvQEpbIbdk2pnUV6ZtLeRggiVzNwJVQSjTtR6IbS2OGnpDy Y9YEyVugDgzBUBrlMdFp2GpGQ/3vjJBpM0X5S8Ov35hbt16Wk3qOem0GaFT1pa+a3etdMWl+BVT NUv5rmM+wYyw1Epic9llQwfEjNJFEPo/6NHIZAfELMzWXuKE9z81MdE4v+VfNVvsmbF0VDC/Brz PUiXro5EVOjHWxOX5eGwR803UbtOPD7h7SBoy7ILg4o5Ckq94tvQz0 X-Received: by 2002:a05:600c:5486:b0:493:e57e:7aa5 with SMTP id 5b1f17b1804b1-496b56f9c9cmr60868985e9.22.1785066260893; Sun, 26 Jul 2026 04:44:20 -0700 (PDT) Received: from ?IPV6:2a01:e11:5402:d840:e7f1:1a60:4b66:808b? ([2a01:e11:5402:d840:e7f1:1a60:4b66:808b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-496b4ed6b76sm142289215e9.2.2026.07.26.04.44.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jul 2026 04:44:20 -0700 (PDT) Message-ID: <39df42eb-433f-4cc5-b76a-8a7beeb3704b@gmail.com> Date: Sun, 26 Jul 2026 13:44:19 +0200 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 v4 1/2] iio: light: cm3323: fix reg_conf not being initialized correctly To: Jonathan Cameron Cc: ktsai@capellamicro.com, dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, daniel.baluta@intel.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, me@brighamcampbell.com, linux-kernel-mentees@lists.linux.dev References: <20260407151702.15208-1-aldocontelk@gmail.com> <20260407151702.15208-2-aldocontelk@gmail.com> <20260420185333.3bab224d@jic23-huawei> Content-Language: en-US From: Aldo Conte In-Reply-To: <20260420185333.3bab224d@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20/04/26 19:53, Jonathan Cameron wrote: > On Tue, 7 Apr 2026 17:17:01 +0200 > Aldo Conte wrote: > >> The code stores the return value of i2c_smbus_write_word_data() >> in data->reg_conf; however, this value represents the result >> of the write operation and not the value actually written to >> the configuration register. This meant that the contents of >> data->reg_conf did not truly reflect the contents >> of the hardware register. >> >> Instead, save the value of the register before the write >> and use this value in the I2C write. >> >> The bug was found by code inspection: i2c_smbus_write_word_data() >> returns 0 on success, not the value written to the register. >> >> Tested using i2c-stub on a Raspberry Pi 3B running a custom 6.19.10 >> kernel. Before loading the driver, the configuration register 0x00 >> CM3323_CMD_CONF was populated with 0x0030 using >> `i2cset -y 11 0x10 0x00 0x0030 w`, encoding an integration time of 320ms >> in bits[6:4]. >> >> Due to incorrect initialization of data->reg_conf in >> cm3323_init(), the print of integration_time returns 0.040000 >> instead of the expected 0.320000. This happens because the read of the >> integration_time depends on cm3323_get_it_bits() that is based on the >> value of data->reg_conf, which is erroneously set to 0. >> >> With this fix applied, data->reg_conf correctly saves 0x0030 after init >> and the successive integration_time reports 0.320000 as expected. >> >> Fixes: 8b0544263761 ("iio: light: Add support for Capella CM3323 color sensor") >> Cc: stable@vger.kernel.org >> Signed-off-by: Aldo Conte > Applied this patch, but patch 2 will need to wait for this to make its way > into upstream - probably middle of the next cycle before that is in place. > > thanks, > > Jonathan > Hi Jonathan, The fix this depended on (commit 1f4f0bcc5255 "iio: light: cm3323: fix reg_conf not being initialized correctly") has since landed in mainline. Is there anything still needed on my side for patch 2 (iio: light: cm3323: use dev_err_probe() in probe path) to proceed? Thanks, Aldo