From patchwork Fri Jun 21 22:11:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 13708117 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 62B2EC2D0CE for ; Fri, 21 Jun 2024 22:12:29 +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=TqnA463lWGmo1DkYd27gIKH1c3eeWL6q+1Fm9JrS/t8=; b=ddKol0nPevvlwmaimq/V+705Qx lN67GXM4+5PaoHizOBj66s2muB9fJAcLnV0JzF80QqJowWBTZZlRA6edD5K39TZGrSPyxkC9zwmE1 Mj+mZrEMsGgRlDGuYnxK/Iwz5YRwDlEXHumBGybmFcBB/G9LIj4EAX+vXg7alUUCVxWU11OL9QtvN BntuvSs5itLazg3U38kcsuPuFxoDT559/FWJ2LtMAvkRcmz7gB5qZiFY/RW6zA0RLhbJ44dAyr9y1 fDY0seD9sdrvNRDfBflGAoX/9zXuuqlbA2+93Ih6o1ZmXdmc/YiiFwxwuhRsdhU1U7YGCwXUr8VNs 21NX4zXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKmUR-0000000Ai8v-23E7; Fri, 21 Jun 2024 22:12:15 +0000 Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKmUI-0000000Ai3E-0GYL for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2024 22:12:07 +0000 Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5c1b27e0a34so1177556eaf.2 for ; Fri, 21 Jun 2024 15:12:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719007925; x=1719612725; 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=TqnA463lWGmo1DkYd27gIKH1c3eeWL6q+1Fm9JrS/t8=; b=R3TTaeEXdqYWJuYrKguCFCJ1beKPE+m/r8iqzQdPQJ041miuYtF+rlguOUXzd1Tei+ l+Mabr8W5b942mbhxghyAUEU8wCEEVT1DvZ9j3Vcs1442iy2KMp1AhSyuE7oGq+kr45h DZ3Oj2Z4o1RTLg380rEeaEC2DYi38qSqdW6OZmc2jVblv4dtcSyz52VZPAYqgdoJq/SF 7v2gnIFw/2T+sWy16IMd0RQjePl4ETHRiDitz82so1Hk1bjR3uPGUGB/5kVSDaA73lmU E1qWbbe72f8rG2kfjQR4xabitLdaaQh3qFlCrmUNDmyL8p3mt7OMp60t4F9kMDBlyXtH vUFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719007925; x=1719612725; 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=TqnA463lWGmo1DkYd27gIKH1c3eeWL6q+1Fm9JrS/t8=; b=gZz3Gwa78+JJs0PcMs1qwwy+n+wz6tINl15tFzYpm4ZNDBPyDTIth1gsy0/z0YZGxC WpBfJrSDTUz3/ZnUKvIF8qazBC64y2fVfmCOwh58PBPWJDL6t7YoYRK2O0L0uq5tjIyt k92tzXIjDOMSw3ZcNuSVO1Gp44HwzUVT9xBlwEtpB91n1MZh0rBbNz+Qor/akBhH1Bou Ja3ZLNttfwrAj+m/yWQBWBAIpZyGlVbBlrmM31Qt9afMz2N0jxvclmJkdPm3dZGhKH6/ oJGXVX8gZUEDK5y/AG3ggO2qx81VbnkQR+oZ3lymjLkX256z8LsLhuL7a7ElJehiL9f4 THIQ== X-Forwarded-Encrypted: i=1; AJvYcCVeAuhB9oFQSVVRb3FuNN+KzDcdNGN+4s29Md3cIbCF0mQdJNlyOV9GO5LvjOy0QuEgE4XUzRC3XWXs6ayPQtPIdUaBUkrMDmzebMULg3H5+DtB8DY= X-Gm-Message-State: AOJu0YyqAlPZOxQS4nmUDf0iBrU0n3CPiNn0ZB7o4yOlmcF3Kr43ZdgV 36jpIIHupWj8vumaqMLKwgR1rJk4B+08VrhJFYRRxXn6MkXTNKJqOx5waCUPSN8= X-Google-Smtp-Source: AGHT+IGyOuPixSMNWTrgJ93EOZnRr5Mc7Ev97HbXaH84J6/Bv30RS8z/PVagDiDtAkY5vq1kH6S7MA== X-Received: by 2002:a4a:6251:0:b0:5bf:aa53:2de7 with SMTP id 006d021491bc7-5c1adbca083mr9462944eaf.5.1719007925247; Fri, 21 Jun 2024 15:12:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 15:12:04 -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 03/10] iio: adc: hx711: remove hx711_remove() Date: Fri, 21 Jun 2024 17:11:50 -0500 Message-ID: <20240621-iio-regulator-refactor-round-2-v1-3-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_151206_131223_A4C85E42 X-CRM114-Status: GOOD ( 16.21 ) 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 more devm_ functions, we can remove the hx711_remove() function in the hx711 driver. platform_set_drvdata() is also removed since there are no more callers of platform_get_drvdata(). Signed-off-by: David Lechner Reviewed-by: Andreas Klinger --- drivers/iio/adc/hx711.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c index 6efdc971689c..8461b1fe6bad 100644 --- a/drivers/iio/adc/hx711.c +++ b/drivers/iio/adc/hx711.c @@ -539,43 +539,27 @@ static int hx711_probe(struct platform_device *pdev) hx711_data->data_ready_delay_ns = 1000000000 / hx711_data->clock_frequency; - platform_set_drvdata(pdev, indio_dev); - indio_dev->name = "hx711"; indio_dev->info = &hx711_iio_info; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->channels = hx711_chan_spec; indio_dev->num_channels = ARRAY_SIZE(hx711_chan_spec); - ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time, - hx711_trigger, NULL); + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, + iio_pollfunc_store_time, + hx711_trigger, NULL); if (ret < 0) { dev_err(dev, "setup of iio triggered buffer failed\n"); return ret; } - ret = iio_device_register(indio_dev); + ret = devm_iio_device_register(dev, indio_dev); if (ret < 0) { dev_err(dev, "Couldn't register the device\n"); - goto error_buffer; + return ret; } return 0; - -error_buffer: - iio_triggered_buffer_cleanup(indio_dev); - - return ret; -} - -static void hx711_remove(struct platform_device *pdev) -{ - struct iio_dev *indio_dev; - - indio_dev = platform_get_drvdata(pdev); - - iio_device_unregister(indio_dev); - iio_triggered_buffer_cleanup(indio_dev); } static const struct of_device_id of_hx711_match[] = { @@ -587,7 +571,6 @@ MODULE_DEVICE_TABLE(of, of_hx711_match); static struct platform_driver hx711_driver = { .probe = hx711_probe, - .remove_new = hx711_remove, .driver = { .name = "hx711-gpio", .of_match_table = of_hx711_match,