Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4776025pxv; Tue, 27 Jul 2021 16:32:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuys9KoZrD6HezqD3iG/ta7wyDUZMc5zciHnsKJoNqRAXvYKIQR/2idyvbFqfD8XUCJZly X-Received: by 2002:aa7:c804:: with SMTP id a4mr30561230edt.294.1627428731338; Tue, 27 Jul 2021 16:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627428731; cv=none; d=google.com; s=arc-20160816; b=lBHqlJyI2mRWzyvj/huu1/t0pSaaht0Kq54qtTby+SbYpJwv3iXSJBcyDK7Z5uIfFY 4M4V/fwdGQfdzxk6kRTBqM1XkaGcYQV3U0oY/glrm2RLtBcTEAm8VqPHmfegeLimg6Nq ftkOIE/X6g5z1d7TSgKrYSxIjlYhnNPMhxhF1dST26yBAQbXGHmqqO8i8NX/mD2034mn LNi6XbFGaDsHL22Qhuq09OrKu9BNO+5MeWgv+/9DjwudXqol3vMkv4igtIk9XlEduUhl s6FtYiZnlDmvMHtA/SRsJwf7YuruJcKCHMXtFuIHJ4evEnO8xFyAV1gXofLET8pe0NX+ V8og== 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:date:subject:cc:to:from :dkim-signature; bh=Csc8wT/95G9747ozFthDCH/y0the7872d54YDDPRcbw=; b=ByoJ72KOs5T/UluQuaRHds16WA0XFx72E1ymQpnia9utFZOc4R/L4eDfM82ZTjjb4C 98RAZO+rog2rL4L02L1Xzjrm0Yq5yrvOwv32NYdjqgNOB0Dl7v6AiUNluLoi7mu+segr nTyBgNabhGELrMklCoXXVcSCGIC2aS/Z4kHLfvJVsny2s/BDcIx4/l3m6Wt50jjV/NaJ Xif0KL/ATEvBuMwFQyv/2kf3yVtrMdvkmDgVYxq3D9Lf7AB026ILjuU7Vm1I2+aVX/eA +N0Os5DWBlRivvjVcaiY4kWCcV8XzNtSIuxl9CxGoUbb8E017qoO9t4K3QF5eaNldyTB ZkWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R8lSn+Pk; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y4si1703266edt.434.2021.07.27.16.31.47; Tue, 27 Jul 2021 16:32:11 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R8lSn+Pk; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234048AbhG0X3n (ORCPT + 99 others); Tue, 27 Jul 2021 19:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233258AbhG0X32 (ORCPT ); Tue, 27 Jul 2021 19:29:28 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00767C061760; Tue, 27 Jul 2021 16:29:26 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id 184so510220qkh.1; Tue, 27 Jul 2021 16:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Csc8wT/95G9747ozFthDCH/y0the7872d54YDDPRcbw=; b=R8lSn+PkPn1WSVxtrB4LEJ7u2NOHgF3okdWNJ7xzOeyy+7P9UTaQvTDvHgOadoWXd+ TjrIpwi5jM/N2LoG24fvC2kAzzpO0ewfd8z04v3nyGbssOOgHD7FlJBUBe76gMsFkPsY vj5fla4/G3G+z4DcMWna13jiFz+93+9GdDBojaaNVBHjty/oeMSCUb7pc1Vfnq2GyGKb jq2XbnoDxnGX39jsIGyaRfuccYgoIIs8PS0+fu5lS6pOREKGOznsj96qpMMlEbT9X+md oaCXrySgTc99/VnYmddL/5nMjfKfC7lv83cXA7Wh41DSseJhsDCHAyZtEevK9qOGBB0R Er7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Csc8wT/95G9747ozFthDCH/y0the7872d54YDDPRcbw=; b=JXTvnHC7JOfhEgtzpMZyXbcf1h4fdtnz00KfUv+u7lrU09mRiH7SCS7BOT53CZD7LX 4iwklvYUfi7OtIMMKnVOQ1T4mErX9YlfgVwxVe0s22ICRWox/oRgsXXhVcbFDLMSJY7r WTN/BSip3QOw0Dlu72U/ptQt1Cz7/TlKVBnJkDf7RXwqvqgrYTdRjBjuFLfcAPEEyXaX diZ9t3tSsJeM16bofCemzCO4/FEJZEGuWSZ6XC4k5q4GKgsUAjFRQdSo5OH1r8bn7Nz/ XmwSHW3g+coKmxfhCmH5DfFVSRsaN1GZILszh/GUBP5dNWmVlCok0jJLoLbcLZxwNrXc sNJw== X-Gm-Message-State: AOAM532b5/q7C49ESrNytHWEt8bMDap5AsddRBpBaPgIQ7c0r03lXEJR ffBgvgTrPTqRyxmgZ2yqWA0= X-Received: by 2002:a37:66d6:: with SMTP id a205mr24218043qkc.422.1627428566232; Tue, 27 Jul 2021 16:29:26 -0700 (PDT) Received: from shaak.xiphos.ca (198-48-202-89.cpe.pppoe.ca. [198.48.202.89]) by smtp.gmail.com with ESMTPSA id p188sm2380514qka.114.2021.07.27.16.29.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 16:29:25 -0700 (PDT) From: Liam Beguin To: liambeguin@gmail.com, lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, charles-antoine.couret@essensium.com, Nuno.Sa@analog.com Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org Subject: [PATCH v4 5/5] iio: adc: ad7949: use devm managed functions Date: Tue, 27 Jul 2021 19:29:06 -0400 Message-Id: <20210727232906.980769-6-liambeguin@gmail.com> X-Mailer: git-send-email 2.30.1.489.g328c10930387 In-Reply-To: <20210727232906.980769-1-liambeguin@gmail.com> References: <20210727232906.980769-1-liambeguin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liam Beguin Switch to devm_iio_device_register to finalize devm migration. This removes the use for iio_device_unregister() and since mutex_destroy() is not necessary here, remove it altogether. Signed-off-by: Liam Beguin --- drivers/iio/adc/ad7949.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c index eaea8f5e87d8..29a87a12e551 100644 --- a/drivers/iio/adc/ad7949.c +++ b/drivers/iio/adc/ad7949.c @@ -452,34 +452,16 @@ static int ad7949_spi_probe(struct spi_device *spi) ret = ad7949_spi_init(ad7949_adc); if (ret) { dev_err(dev, "enable to init this device: %d\n", ret); - goto err; + return ret; } - ret = iio_device_register(indio_dev); - if (ret) { + ret = devm_iio_device_register(dev, indio_dev); + if (ret) dev_err(dev, "fail to register iio device: %d\n", ret); - goto err; - } - - return 0; - -err: - mutex_destroy(&ad7949_adc->lock); return ret; } -static int ad7949_spi_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); - struct ad7949_adc_chip *ad7949_adc = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - mutex_destroy(&ad7949_adc->lock); - - return 0; -} - static const struct of_device_id ad7949_spi_of_id[] = { { .compatible = "adi,ad7949" }, { .compatible = "adi,ad7682" }, @@ -502,7 +484,6 @@ static struct spi_driver ad7949_spi_driver = { .of_match_table = ad7949_spi_of_id, }, .probe = ad7949_spi_probe, - .remove = ad7949_spi_remove, .id_table = ad7949_spi_id, }; module_spi_driver(ad7949_spi_driver); -- 2.30.1.489.g328c10930387