Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1235087pxy; Sun, 15 Aug 2021 14:36:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNAM9717rdJd1SmQtww0TM8qfxbRyhF02NZG0kOlZiLv+mNnb+917s7qLRyX3tXJuhoBZ+ X-Received: by 2002:a92:c5c8:: with SMTP id s8mr9324462ilt.140.1629063365833; Sun, 15 Aug 2021 14:36:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629063365; cv=none; d=google.com; s=arc-20160816; b=gxtYg/mf05+FE4Scgt54b9/K20/Xd8m+4oXGDBBoSHCYc/QMCzJV1yp5wXOs5v2BA/ Tnuo0BrJqU6PioIunzBfqRa9MOuyp5KtESBOOtuTKP7fybYXbNAR/8DjuVF1e35YZ6FS M/dk/n9+G5N0RAxNRyT98wisRwv3PIFrgEzzOkutf58A/HHuuk8lPzSv2c+M/AncCo9y 8faA3+fDf4uqJ69Q2iBUke6tYLLM3oJnsCF1/pwNprc7NFLc1OtOm46lPHBS1pHVHAWt cbritnjvmnln8gn7y3x0dFf8F2+I3kEdnZdpSUVqfGrElQDxixy+BlXShmNjrp0HiLMA CpKQ== 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=paVSC5jFhWBtvyWQP2dPKvlBYJAW6pw4Z4wd3QzT2mk=; b=EAZXc0O4DyAhGqE3wNx4tGDNLj1l5mJht4E+MzTGX7uuLf+GxjKuLv1jXb6Th86CsV G9Bwgm3BhB8IzmDfU6H7ggT3+/ilYOCqRs62fuZ8IUPDycwpxOYewqsz58H7Xgv6BJ01 YNpSq3Q7kb7WSOEs5764ltupjN1jvr/wMref8GiRVpHCAMOcyZA0FEPQF0ZPdd1YIFH/ mk28UYOsaAx1fktQqZeliClhIpbHYhPZ+SaJ2pe93ZTNsvk5Kx+3XRAMGvqNiUXK1OLi eoylMGbVUZqqJWWBWybwdG+VcBuBKFet6o8xP3U4gt/26hQrfxhqfhfupbnv2xQlI4wo jM1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZY+OddLC; 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 h199si3740413iof.50.2021.08.15.14.35.54; Sun, 15 Aug 2021 14:36:05 -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=ZY+OddLC; 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 S231738AbhHOVfY (ORCPT + 99 others); Sun, 15 Aug 2021 17:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233207AbhHOVfK (ORCPT ); Sun, 15 Aug 2021 17:35:10 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4B2C06124A; Sun, 15 Aug 2021 14:33:57 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id t68so17125837qkf.8; Sun, 15 Aug 2021 14:33:57 -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=paVSC5jFhWBtvyWQP2dPKvlBYJAW6pw4Z4wd3QzT2mk=; b=ZY+OddLCosEBVnS1NclkUB7itP5bkV4QGWa9fMies0b0DUNHnF9BDBDfMlCUS4vT2+ lbHGw42JCzu9dRorcc0lcjjjrlzdDPVtMbYE3OZx0wGRNHo+5gW5kZYrP+IqXosn8nzo nPFSCb/QHuIWoWYX60gfSiGXIJ6LptmpVfWHDmINaTaRKpDUqvXIjY2557R0iHymmpdj 7Q/CiIIt80FkjpWPmtUxsbY3J7cn0o/qnfdJzsXi2NbN+rrEorUJu8WBe8pvG0h2eb3n m9K0nIa7XA7TwyyMXOGiEIJKUAKtzPsU4QCV0GfNFqJl3MfZRz0rHzuYr9vXUaPHVN37 3o4A== 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=paVSC5jFhWBtvyWQP2dPKvlBYJAW6pw4Z4wd3QzT2mk=; b=Me4rGX71Gyhr2alhSQ3ku/LNNB7wx9GXq2kMMy+Cpnf2DFVUUQu/sXuk0e/K41urcI e2KDFOG7XUNwTnJq6dejP9x/CuXnZYAOTIQBOXXFIaklaKzhMjSGrAzFY4qj0sZdxhew DXHeYzPvlkuFuV5pAab5Oghfv0/YoDLfKzn9Lf/nSpsDevhlDLu3ya2F0e4dpkfsohTO cORcW2uGBhVH9FpG6ojjSmcwzy2QupfWUsUL0nOAbG1oBilga7uLk9prS+zzZoccLWBq PB15PMh59DDJiQpBmTsx53joyfAt3Wnq33AkwZPxM5NpDMeXYd51L5z1o2xrObdjSH1U mFPA== X-Gm-Message-State: AOAM530BFPbGRm+7/VYHMnz+triCoSz8W0f3Ao02ph2jYGIXT8JiEqqE MFLm/e8aaQ/HSK8ggFTUzLo= X-Received: by 2002:a37:8e44:: with SMTP id q65mr12972514qkd.372.1629063237157; Sun, 15 Aug 2021 14:33:57 -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 u19sm3870988qtx.48.2021.08.15.14.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Aug 2021 14:33:56 -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 v6 5/5] iio: adc: ad7949: use devm managed functions Date: Sun, 15 Aug 2021 17:33:09 -0400 Message-Id: <20210815213309.2847711-6-liambeguin@gmail.com> X-Mailer: git-send-email 2.32.0.452.g940fe202adcb In-Reply-To: <20210815213309.2847711-1-liambeguin@gmail.com> References: <20210815213309.2847711-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 5168d687687d..5b8858719b53 100644 --- a/drivers/iio/adc/ad7949.c +++ b/drivers/iio/adc/ad7949.c @@ -405,34 +405,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" }, @@ -455,7 +437,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.32.0.452.g940fe202adcb