From patchwork Tue Dec 11 19:12:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 153505 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp984509ljp; Tue, 11 Dec 2018 11:12:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/UL97yH5GszusnnnyWs33yYPZkRME50AwOsCmp7ZVih7pmSzb/mRw2t7Rr2PDEZgDIrTfQn X-Received: by 2002:a17:902:714c:: with SMTP id u12mr16906324plm.234.1544555555264; Tue, 11 Dec 2018 11:12:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544555555; cv=none; d=google.com; s=arc-20160816; b=vic5lV+oXwynMevKL/HFw2qljIz7ElNnrskIzEpnuDt2JrN6MTdtk7f1l6b0m4qs+6 kc78GKQOAC1OqtaLa1Cy9nKzY37Tn4fRi8qLELFeMOwHM0wOn5yiJPEo3e4MDhHZFvSz eT35+OfyfdoVOecySNelu6vHgUU2tPccB98KRsXEnjQBVEppCn5t/1tNRDqLaMPqkJBF PbmlbNVkVPvb9nfw9ZAXF+xlc07acj6LeOghorxTIB5ELFwHKzDanbriD6r0CEv3RVc0 wiazWuasX4AOufuoUeJwvWS3V2FpV9dhmYaX2DXgOSz9mEsrDHOVoJCpQaPBcf5RjZf7 907A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZMupGSZ0KfkZn40zfMtACkB5aYcH5RjAyq86kxZimtU=; b=W9hXGYJbt5akljdkHphVV1UA2bSaNebUxUVfad6zHTBBMc8DelE6TWt9LmmPDG8nDb JSoXFPWGEenXuYHBE7a7f29prKy/JQ6PHAjtPP9Xn/l23h+j8ejaKTJPUqP9PHSRK56e b+wWgXOtyWntaCwlZCnQOUtWlK+J5YQWkJ3lKWEEOtFF+4j46kWVI19pAcC2UA6Ix4WE 286nrJDvf4AEKBVAU3As9e4aklVs8G2rdVxRAlJn1pcM7tn0oGqFexZDDw8oyZK1pZ1J A59gIM9ii/S76fdqQOgR0Qu+MPt3yjMs8+7ufx33eAHiRh+ncud3j+8O4sgh92nNdXQ4 ZI+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si13617994plz.263.2018.12.11.11.12.34; Tue, 11 Dec 2018 11:12:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbeLKTMW (ORCPT + 31 others); Tue, 11 Dec 2018 14:12:22 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:57712 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbeLKTMR (ORCPT ); Tue, 11 Dec 2018 14:12:17 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id wBBJCEjk114460; Tue, 11 Dec 2018 13:12:14 -0600 Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wBBJCEiZ101998 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 11 Dec 2018 13:12:14 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 11 Dec 2018 13:12:14 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 11 Dec 2018 13:12:14 -0600 Received: from legion.dal.desgin.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wBBJCEVl008735; Tue, 11 Dec 2018 13:12:14 -0600 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.100.89]) by legion.dal.desgin.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id wBBJCEU05336; Tue, 11 Dec 2018 13:12:14 -0600 (CST) From: Dan Murphy To: CC: , , , Dan Murphy Subject: [PATCH v2 4/4] iio: ti-ads8688: Migrate to device managed IIO calls Date: Tue, 11 Dec 2018 13:12:07 -0600 Message-ID: <20181211191207.21900-4-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20181211191207.21900-1-dmurphy@ti.com> References: <20181211191207.21900-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Migrate the driver to use the devm IIO calls as opposed to the unmanaged calls. Signed-off-by: Dan Murphy --- v2 - New patch drivers/iio/adc/ti-ads8688.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) -- 2.20.0.rc2.7.g965798d1f2 diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index 3597bc0697ee..8f42103a1fd9 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -462,21 +462,21 @@ static int ads8688_probe(struct spi_device *spi) mutex_init(&st->lock); - ret = iio_triggered_buffer_setup(indio_dev, NULL, ads8688_trigger_handler, NULL); + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL, + ads8688_trigger_handler, NULL); if (ret < 0) { dev_err(&spi->dev, "iio triggered buffer setup failed\n"); goto err_regulator_disable; } - ret = iio_device_register(indio_dev); - if (ret) - goto err_buffer_cleanup; + ret = devm_iio_device_register(&spi->dev, indio_dev); + if (ret < 0) { + dev_err(&spi->dev, "iio device registration failed\n"); + goto err_regulator_disable; + } return 0; -err_buffer_cleanup: - iio_triggered_buffer_cleanup(indio_dev); - err_regulator_disable: if (!IS_ERR(st->reg)) regulator_disable(st->reg); @@ -489,9 +489,6 @@ static int ads8688_remove(struct spi_device *spi) struct iio_dev *indio_dev = spi_get_drvdata(spi); struct ads8688_state *st = iio_priv(indio_dev); - iio_device_unregister(indio_dev); - iio_triggered_buffer_cleanup(indio_dev); - if (!IS_ERR(st->reg)) regulator_disable(st->reg);