From patchwork Fri Jun 21 22:11:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13708124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F790C2D0CE for ; Fri, 21 Jun 2024 22:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oTLhWXGcYPpFvPhVLNSGQecQSX/f3kZ7bOMANlmHk/s=; b=hrShJNoDkmpDg5VnCIJ2za2mJd g75U/7CodZWVP07sV++lxTv4OZy/RwQQibvp0DQrzgEIfXYPZlszXdVHUvbxMUwHO41XuWexGl6Z+ FxrU5p+SuUgP/wiL0TKfdhXFFoiUyphwK4GT0j/wJR8249gC/VjEIg1p9whFYOHBWPRUyd7gY7w1C N6vCewyQwK5Re4kPwlY5uMqJChvEfGmGqr69aYmLdcCaZDZ8Y091MNCAMPnpKjTJpdZ90FKYTry/J 7h0NirBFZZI5FSwTNkhMaOt4ZeY3rYqw/ar1bOvkHGySoG9rGyqIBAJXrUh9tv1G5lVhw8QhnpNpa 8gidqk/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKmUq-0000000AiUm-4BwD; Fri, 21 Jun 2024 22:12:41 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKmUN-0000000Ai6P-1abY for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2024 22:12:12 +0000 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6f8d0a00a35so2307962a34.2 for ; Fri, 21 Jun 2024 15:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719007930; x=1719612730; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oTLhWXGcYPpFvPhVLNSGQecQSX/f3kZ7bOMANlmHk/s=; b=hZLfz1sO6Zg9oqCR5NQqsYaRBWGJUVpSnrV26+xRAHN4nLcZHaKYr1XdFR/GHcvMRh hfHeglxHTzXkSeLZY4e0KVv1uJxVbDumgCncErWVcXu2QWnTycK2/lM1/vTuE2nc9sbC 0wM/0zD1fYC0g3+O3nyZMqKz0Hz83gGcKkTjmGz4t5AgCcDtpHv5rMbInjHjDDNaSrmd +EPPtatIxR6LqEZGAEcnb+rlg1Vonq7/34yH0AwsudP84AUAX4r0xTaJFHpgJVF/6Pzp fYkTrTZRNnj7jus7szk7ogeRedT5sG20ctg3L7tPqQV44L8GZIeP0CWLrfWWbLwuU+V9 zUoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719007930; x=1719612730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oTLhWXGcYPpFvPhVLNSGQecQSX/f3kZ7bOMANlmHk/s=; b=xKgMmgW2nosrs+F007NZIwOqXfAY1fiVGeD1jx7B1ShuA86sXA6xnxaSp/x1j0c14S Jcw+peVHWlmXqRhY5/mPGnSU07WRVQSBARWcpf+Q1ISpsAd/bDGT+Bkp0l0460OfEsM0 Uz2Pm13KvI/Akx8mpV0P/pzaXJrxTgV96W43kh3v9nj7oiLdsyMhQ/oFGF/83p1FUZHn /etXpqDWQqKkveQn1XqRbORQKBMm1br3zwnFl7gGI/yRWzkoyfHqkhv7TgP9JmuVKmGq VbPACULJH6Nxt4tiI0WPWqVol1WD24B/K8C6r3cdwo5I2XoAZAV6Kp7CMT066Le4oylJ +Stw== X-Forwarded-Encrypted: i=1; AJvYcCUlB4j4HCaCSUz6q7Kkgle+BG1GG/H7aUmy2MLDBEH6ap5gWzOrp5Uwon+PgwEVHf1un7GKjtkUu3Uz/XpazDezIiulv5CwNxVCc+77rjF6/XZEgMA= X-Gm-Message-State: AOJu0Yxfhl74D0YeWpI/+eg72NWs9AuTCLadlMt9aJ5JrCCPQqjKMid8 CUWNmVzih1VFQ0wkkQ8kDawB7SIphS/Q+E14NekhgHYPONEymPGUdWZP1j50qlM= X-Google-Smtp-Source: AGHT+IF2SgOBJxuK1mN8+m/jYX05pEOQGH/eglbTypLzjQRP70yZxGSEzwMMU70XpDgEFsNdBCoitQ== X-Received: by 2002:a05:6830:4121:b0:6fb:d9b0:c17e with SMTP id 46e09a7af769-700767308a6mr11026891a34.35.1719007930440; Fri, 21 Jun 2024 15:12:10 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5c1d94fb2a4sm329837eaf.10.2024.06.21.15.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 15:12:10 -0700 (PDT) From: David Lechner To: Jonathan Cameron Cc: David Lechner , Joel Stanley , Andrew Jeffery , Liam Girdwood , Mark Brown , Andreas Klinger , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/10] iio: adc: ti-ads8688: drop ads8688_remove() Date: Fri, 21 Jun 2024 17:11:56 -0500 Message-ID: <20240621-iio-regulator-refactor-round-2-v1-9-49e50cd0b99a@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240621-iio-regulator-refactor-round-2-v1-0-49e50cd0b99a@baylibre.com> References: <20240621-iio-regulator-refactor-round-2-v1-0-49e50cd0b99a@baylibre.com> MIME-Version: 1.0 X-Mailer: b4 0.12.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240621_151211_552460_44F34FE3 X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By using a few devm_ functions, we can simplify the driver and remove the ads8688_remove() function. spi_set_drvdata() is removed since there are no more callers of spi_get_drvdata(). Also use dev_err_probe() to simplify error return. Signed-off-by: David Lechner --- drivers/iio/adc/ti-ads8688.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index fca3032c59d9..7a79f0cebfbf 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -432,8 +432,6 @@ static int ads8688_probe(struct spi_device *spi) spi->mode = SPI_MODE_1; - spi_set_drvdata(spi, indio_dev); - st->spi = spi; indio_dev->name = spi_get_device_id(spi)->name; @@ -446,30 +444,13 @@ static int ads8688_probe(struct spi_device *spi) mutex_init(&st->lock); - ret = iio_triggered_buffer_setup(indio_dev, NULL, ads8688_trigger_handler, NULL); - if (ret < 0) { - dev_err(&spi->dev, "iio triggered buffer setup failed\n"); - return ret; - } - - ret = iio_device_register(indio_dev); - if (ret) - goto err_buffer_cleanup; - - return 0; - -err_buffer_cleanup: - iio_triggered_buffer_cleanup(indio_dev); - - return ret; -} - -static void ads8688_remove(struct spi_device *spi) -{ - struct iio_dev *indio_dev = spi_get_drvdata(spi); + ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev, NULL, + ads8688_trigger_handler, NULL); + if (ret < 0) + return dev_err_probe(&spi->dev, ret, + "iio triggered buffer setup failed\n"); - iio_device_unregister(indio_dev); - iio_triggered_buffer_cleanup(indio_dev); + return devm_iio_device_register(&spi->dev, indio_dev); } static const struct spi_device_id ads8688_id[] = { @@ -492,7 +473,6 @@ static struct spi_driver ads8688_driver = { .of_match_table = ads8688_of_match, }, .probe = ads8688_probe, - .remove = ads8688_remove, .id_table = ads8688_id, }; module_spi_driver(ads8688_driver);