From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795908884; b=oEm+8mdz68eaTCtksXHG1NXC+eUqcChB4pWxAEzNGcLGILu+BrVLzMz/YM26JcWbqQWK 5muUevTPdK28X/L4YTwjU2GvsZHtRnhecOiqx8QuafAHarlJZPPdujwrbZzAj6yUaPeEw YMjgWKWpttDKEmGfqtGxwnFmW3fDEwydq3ulESouR+6X+6Q1SFJ7XHqNQ1cbPlpDB6HIC HwI/kIcjTMQahh0A/5Ikb0sif81MfcyXK/pJumvzSWgBSpejuT6Vj2fmWZJF2Ju3juAqF 3OI+NAAgAiLDFsVmif813B7y/sPMiu8Ns7XVBNPHdD8dPJ9jluFXzFZR3zUxyxrjc/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795908884; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=n1CojedWwMO8dUV87Sm3sGh5obTX49LizTIRtQk2Ipw=; b=Hlb4PjFyDRwVudVXHZNCXCTeLOYtr2TaF/0aVZAbOBH1fpZdl9K/EknI67PfRV82oiGC K8kq8L0gHSKnLI9/jkuvh5h9vm2mtUfZjQyNxZURqSHwdSm6MpaxfyyxbeYzm3SXDSrm+ woG7pPUqJ5CEYt+oXXLwKnV8masMDKU2urGwUeOtSzc2rcRm8BZb3XvFRwFjqVmk9BLg5 EK230E0Ubjy/wH+CgtA/hehZvPN7SpHMBRh8R1sUkdoqhgPKPe+eLX0jfx+2su4WHSDUK p/MbDIzPeB5zTKnWpqAbI7Y7TxVk9bM0NpavDqANU6JH1Kmb8JUeCJmIE/8I2aFy8zg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lVf4ucVg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91523606A31C; Sat, 28 Nov 2026 23:34:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lVf4ucVg Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD6F91F000C1; Sat, 28 Nov 2026 23:34:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795908884; bh=n1CojedWwMO8dUV87Sm3sGh5obTX49LizTIRtQk2Ipw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=lVf4ucVg2OdX4/fKPjbxWuZeNlhWk/TdszM1EFlYHfLZco9eTSobSSxi68tDZM/mi QLbc+LImSA9MwCNt5QcyTJSW5KYPDIm1BQUxKk1vSfJS81OWW5eIAedG8HvvRYc1Qz 9RsbEKZ2fLB+a+sUn3xd2YadamSYKJ4ePyNburRd96t9+Y3xj9VErPUs5PKVordgMh lEeq2xI+ak3DdwhSQQuGVQijipkKskQyzeGUabN5rjukY+4u1PjWQhQ/hG29k/XOqA 8PW8eP9YjmV4+P3gsGxeyvH5tPDMgHqJOTAdKUR42fG9i3mNJMXICkFiSRO20Jwx7X ATuJXxicrJ4+A== Date: Sat, 28 Nov 2026 23:34:36 +0000 From: Jonathan Cameron To: Abdelnasser Hussein Cc: linux-iio@vger.kernel.org, dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, giorgitchankvetadze1997@gmail.com, amin.gattout@gmail.com, antoniu.miclaus@analog.com, gregkh@linuxfoundation.org, mripard@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 8/8] iio: adc: at91_adc: convert to device-managed resources Message-ID: <20261128233436.56106280@jic23-hlaptop> In-Reply-To: <20261123070101.53868-9-abdelnasserhussein11@gmail.com> References: <20261123070101.53868-1-abdelnasserhussein11@gmail.com> <20261123070101.53868-9-abdelnasserhussein11@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 23 Nov 2026 09:01:01 +0200 Abdelnasser Hussein wrote: > Convert the driver to device-managed APIs so that all resources are > freed automatically on probe failure and on driver detach: > - allocate and register the IIO triggers directly in at91_adc_probe() > with devm_iio_trigger_alloc() and devm_iio_trigger_register(), > dropping at91_adc_allocate_trigger(), at91_adc_trigger_init() and > at91_adc_trigger_remove() along with their manual rollback paths. > The st->trig array is no longer needed and is removed as well, since > the triggers are now owned by devres > - set up the triggered buffer with devm_iio_triggered_buffer_setup() > directly in at91_adc_probe(), dropping at91_adc_buffer_init() and > at91_adc_buffer_remove() > - allocate the touchscreen input device with > devm_input_allocate_device(), dropping at91_ts_unregister() and the > manual input_free_device() error path in at91_ts_register() > - register the IIO device with devm_iio_device_register() This is too much information given we can just look at the patch. Something that calls out the main topic then anything unusual. Convert the driver to device-managed APIs so that all resources are freed automatically on probe failure or driver detach. Includes dropping redundant error messages and helpers. The triggers are now only directly referred to in probe() so drop the pointers from struct at91_adc_state. > > Redundant allocation error messages ("Failed to allocate TS device!" and > "Couldn't setup the triggers.") are dropped, and at91_ts_register() now > uses dev_err_probe() to report its remaining error. Errors from > devm_iio_trigger_register() are reported with dev_err_probe() as well. > > at91_adc_probe() no longer needs any error unwinding labels and > at91_adc_remove() is removed together with the platform driver's > .remove callback. > > Suggested-by: Jonathan Cameron > Signed-off-by: Abdelnasser Hussein Code looks fine to me but this is the sort of thing where Sashiko really comes into its own wrt to catching corner cases humans miss. Jonathan