From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 653183F0AAD for ; Wed, 6 May 2026 15:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778081749; cv=none; b=glxnNuL6eV1cUDQ8HQjfmgq9UYhTMuMyhYKiCfybH1VhK3QjoEkFy9UQV0potCP9+q3vq8b/ioOiwSgcJT0bGf1DRMewp67EPFseVYI5xnkZyXrBsNSCY05O5RnbSCttNGwwgUpgYbEcbHF3XB+DXMr6r4gBIOhVU/0nUQGR3mU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778081749; c=relaxed/simple; bh=uerMeSSQ3acxmOZMeTOC3qPnNJjEqmCZDN82K86gjYo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IDrxqkFSC188V0nZzLbQFSA9j15Ifs3M3gPCOcILkyN51EWd/JQFtO69yyCxY9Jmwij6kEluRzwjbvXtWL6GQ3qB6ULzEGuigMR2lsKV8etsrm3WMBFRBJJkjlln53sVn8bfmTlH0L2J7+m/M44fOKE59ENLb8IgXnXG4VBgDlY= 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=pz7xICXj; arc=none smtp.client-ip=209.85.208.44 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="pz7xICXj" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-67be41d5eeeso7074747a12.1 for ; Wed, 06 May 2026 08:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778081744; x=1778686544; 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=6Nckv/LuldqfEBJSIft5ijwXQ8LBQOLvQF7H6CHlTT8=; b=pz7xICXj860TLar41rDp+a7GJXrnJOLw5JZ9tqDPmht1/6n38o4nWxz3cSXrN+IYNa pMLNKlPRyANBvJ5MacGZ4WlDxUkIykMA/WvqMGX6tJYx+9WrjRtrDz1KtxkhUeBAjvqn OyGII5t6W2mb6jgqUNRei47axhXAYXzp/8BnCcKbq1dNSFEZn491BMSrwzPrewc0ShzJ y8ZB/U1I/x3YLNvBNZ9B93FHifWl+vV872bdQ2t+yTsEQ29JEY/UQ49ucHkNmMx4MFiE 6qi78KIgkwuB5zmaUVLVINHv/Sx2gaaLbGPTURgG6oKI3IO5RS+qRXnWnQ2Mw1kNScfV huTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778081744; x=1778686544; h=content-transfer-encoding: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; bh=6Nckv/LuldqfEBJSIft5ijwXQ8LBQOLvQF7H6CHlTT8=; b=c89ezOURWCmsGO87ZkkYvz+7QcY2Xja8HImY5ySgEaErV9apTXpJ5KDx7Q8LvZ9H/I Ldxpny3Lct2lPgsgWtkmSep3JBZYP67ko1MGFBRtf7dgRVnjGgbB8o6GzcXlMcWxGe9j gEiZjjVqhcQtdl6lS3v7/SLnkjrg2eBabdIKXhose/W84s3uEIdWrLN4KMZqjKRC8elN s6ZydsQCgP8tGrE980a0uF+PuWaJyZNMySSZj0t07gysExa5+A6p7wpIL6y74r2EJluS FODO82POtjgPwWIFHVlqWU/MGoeeDfu2IxxH0Ke4jm4LaMsQeasMmlGPldFg3NnCFBPR 7zfQ== X-Forwarded-Encrypted: i=1; AFNElJ9qKOh/OYz1mw16784dIIuhRlLM7DkgDBldo0w92rQLQ4rkYe4YdvuYt6gSWPkAwqJfWTh1RUYYkl/t5zo=@vger.kernel.org X-Gm-Message-State: AOJu0YzPZSUH2tSDPtgR2GFYBDgxbVAOiuwArOVncEQUgTgW8CrXMjob L3KJPS23sNhm+SlQcxWJzEiINLJQdoNGxnt2zsyvlTgeJvWBNJJPRjys X-Gm-Gg: AeBDievXa7EV+Nq0M5B1GZNL00TAPAZnSGgSRYLDuhi00wnU2LdYcWVQP5/TZDvjVyL ix4G9brTv8XOfWQo1T/44OFf/maXwUMAj8z9fFmYxUTCr0saoH+TOfF1QiYEcrOoP0e3WnrUpeY 9zlfgTqNM8+XGEfTacH8lFi9UL/zNVPweoSfzpDHvtBq92RJwZFGvijDxJmk1QAXrHsX+cQV4g+ QnctrsclHrwAvFbM3VW9ojCRbgGWO+07NjBG4fnJC5xOvtMovDgZRKkk7kbMRZ/VHL+63+5tDq3 hzmk1U3XFt3DW7EnqOW5fu0DHNi5iNRhJ6imOzb7sbcGPgGc4nzMtKaFroVD7Z/VmOUnkH2bkqT vDtuUQ8DQdXmA2kstrBKRF4mg4dKqlK8IdwLknPl+RMmPt+zlYr0HJHm0TfflOCJ8zoCWKhEwvF 2P4oPcqPIlnHmRy4NvEH1YZXANSQhXZROOYRdktgHB X-Received: by 2002:a17:907:3e0c:b0:bc6:1550:ec56 with SMTP id a640c23a62f3a-bc61550ed0amr134372466b.39.1778081743850; Wed, 06 May 2026 08:35:43 -0700 (PDT) Received: from [192.168.37.44] ([217.61.173.50]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bc55f00d170sm96974666b.49.2026.05.06.08.35.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2026 08:35:43 -0700 (PDT) Message-ID: <16c08754-840f-440e-a252-b14172393394@gmail.com> Date: Wed, 6 May 2026 17:35:42 +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 0/3] iio: light: tcs3472: devm conversion, wait time, locking cleanup To: Andy Shevchenko Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, shuah@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linux.dev References: <20260506094311.222500-1-aldocontelk@gmail.com> Content-Language: en-US From: Aldo Conte In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/6/26 12:21, Andy Shevchenko wrote: > On Wed, May 06, 2026 at 11:43:08AM +0200, Aldo Conte wrote: >> This series of changes modernizes the tcs3472 driver by completing the >> devm conversion and updating the locking style to use an automatic >> guard (mutex). Furthermore, it implement control of the WAIT state, >> resolving a TODO. >> >> Patch1: Converts the driver to use device-managed resource allocation. >> This removes the need for an explicit remove() callback, since cleanup >> is now handled automatically. It also adds a new function called >> tcs3472_powerdown_action() that powers down the chip when the driver is >> unloaded, removed or when probe fails after the chip has been enabled. >> >> Patch2: adds support for the wait time resolving the old TODO comment. >> The user can control the WTIME indirectly by writing to the >> sampling_frequency attribute. Changing the sampling >> frequency attribute results in a change to the wtime while preserving >> the current integration time. >> Similarly, if the user has previously set a sampling frequency and >> then changes the integration time, the driver re-computes WTIME so the >> previous frequency is preserved. The patch also handles the deactivation >> of wtime when the requested frequency is very high, as well as the >> extension of wtime to its maximum values (by enabling the use of WLONG) >> when the requested frequency is very low. >> >> Patch3: converts the remaining mutex_lock()/mutex_unlock() pairs to >> guard(mutex). >> >> All patches have been tested on a Raspberry Pi 3B with a TCS3472 >> connected to I2C-1 at address 0x29. Sampling frequency and integration >> time changes have been exercised checking the value of WTIME and >> consequently WEN and WLONG. Raw RGBC reads, calibscale, integration_time >> and threshold events continue to work as before. > > Thanks for contribution, unfortunately this series needs much more work > and more preparatory patches as well. I have reviewed the current series. > Please, follow and address (or comment why it can't be done as suggested). > Hi Andy, Thanks a lot for the detailed review. I'll address all the points in v2. Regarding the series structure, I need to clarify the correct order: 1) Guard (mutex) conversion 2) Header sorting 3) Devm conversion (with the new TCS3472_Powerdown using Guard (mutex) directly) 4) Wait time implementation Would this be OK? Aldo