Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1936267pxb; Sun, 5 Sep 2021 04:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLbA9L1kuE5525YZv5DlyyxHUM/a/b2izfle1wjJLT7HJBUxFmTwIIQt71eIQwWQiuvDtS X-Received: by 2002:aa7:c04a:: with SMTP id k10mr8426546edo.32.1630839680765; Sun, 05 Sep 2021 04:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630839680; cv=none; d=google.com; s=arc-20160816; b=ju3ttCaXSNKTwx2eXZD+OMpX9iqLWD/jjD9yqo/vodxIwbFFR6GeM6W8sgzM2hkWyd Rnhv0Wd0e8AlTjaMIgI3q30Q8hUdnrIAOzD0ksFnS857/WMXZl2UgoFTKGKAvfYglh4w jh4RfCtdhe0TNdM0rDrKFPvDU0Bjgev/Qvz2q1XZVZYEkdHjbVwDLCGm1Z4vL5C0EKI6 kMsNTJ37BJhs9ajHCIfcOBdVZEnzTVBuh4BXAHMhv5fS1z4eMXw99MGWvD5a9Wl5+xkh WMdq4nIYVqJXujhY5dTfyV/TTjWDV36YyEEIFDVr/Cx1yklczTT1u9XV4QO/xoSVOuGe ABjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=muNHNViyXiQmvu9qTI/aKtIXnsXzsNlQDrTOH9LiPP0=; b=cOGVM5DJB1PjoCEnixKuL62nClZlzoqLUFVGycO6o5Tp2PwajnGqVclheS8MYsBXN2 G3FIN4tnr7rFZa9598ZQZgx9JN1F1dWs5NOvaFsIBB/T6Xi01h3Uyu+WywCqt9DjVVku CJHDN6hO6VIfx6uRyVVDSHMgbWdKSs+dQ5Al/zhGH/UP44UAbIiUU+M+9SPfYJUDO2v4 BpDTYv4Vc13gRdW2hhpUfnvpKRUFzAddNDO+PCmYIDX6ePeeujJVFGZUveU2p98Bg/hW VE5YuoH+Y4yZIz4B49DiYlFtI1cOuCp7besiowvpx5KYiki0T4trox+acrn3bpI/nELC Xtag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si4767159eds.119.2021.09.05.04.00.51; Sun, 05 Sep 2021 04:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237602AbhIEKyb (ORCPT + 99 others); Sun, 5 Sep 2021 06:54:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbhIEKya (ORCPT ); Sun, 5 Sep 2021 06:54:30 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 34C3C60EE1; Sun, 5 Sep 2021 10:53:25 +0000 (UTC) Date: Sun, 5 Sep 2021 11:56:48 +0100 From: Jonathan Cameron To: Alexandru Ardelean Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Gregory CLEMENT Subject: Re: [PATCH] iio: adc: ti-ads8344: convert probe to device-managed Message-ID: <20210905115648.5c02df3d@jic23-huawei> In-Reply-To: <20210903073707.46892-1-aardelean@deviqon.com> References: <20210903073707.46892-1-aardelean@deviqon.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Sep 2021 10:37:07 +0300 Alexandru Ardelean wrote: > This change converts the driver to register via devm_iio_device_register(). > The regulator disable is moved on a devm_add_action_or_reset() hook. > > And the spi_set_drvdata() isn't required anymore. > And finally, the ads8344_remove() can be removed as well. > > Signed-off-by: Alexandru Ardelean Applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed. > --- > drivers/iio/adc/ti-ads8344.c | 27 ++++++++------------------- > 1 file changed, 8 insertions(+), 19 deletions(-) > > diff --git a/drivers/iio/adc/ti-ads8344.c b/drivers/iio/adc/ti-ads8344.c > index a345a30d74fa..c96d2a9ba924 100644 > --- a/drivers/iio/adc/ti-ads8344.c > +++ b/drivers/iio/adc/ti-ads8344.c > @@ -133,6 +133,11 @@ static const struct iio_info ads8344_info = { > .read_raw = ads8344_read_raw, > }; > > +static void ads8344_reg_disable(void *data) > +{ > + regulator_disable(data); > +} > + > static int ads8344_probe(struct spi_device *spi) > { > struct iio_dev *indio_dev; > @@ -161,26 +166,11 @@ static int ads8344_probe(struct spi_device *spi) > if (ret) > return ret; > > - spi_set_drvdata(spi, indio_dev); > - > - ret = iio_device_register(indio_dev); > - if (ret) { > - regulator_disable(adc->reg); > + ret = devm_add_action_or_reset(&spi->dev, ads8344_reg_disable, adc->reg); > + if (ret) > return ret; > - } > - > - return 0; > -} > - > -static int ads8344_remove(struct spi_device *spi) > -{ > - struct iio_dev *indio_dev = spi_get_drvdata(spi); > - struct ads8344 *adc = iio_priv(indio_dev); > - > - iio_device_unregister(indio_dev); > - regulator_disable(adc->reg); > > - return 0; > + return devm_iio_device_register(&spi->dev, indio_dev); > } > > static const struct of_device_id ads8344_of_match[] = { > @@ -195,7 +185,6 @@ static struct spi_driver ads8344_driver = { > .of_match_table = ads8344_of_match, > }, > .probe = ads8344_probe, > - .remove = ads8344_remove, > }; > module_spi_driver(ads8344_driver); >