Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp97762lqh; Wed, 27 Mar 2024 16:21:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpgwXDO4o1rKhs86fwmDw+ZwWLKDCdxumr4AnyJZQ+ENrROYJzm/p+JE+CThZ1xP/ZWBqdj8JHeOqHzTBaoIogO5CMuDLJupxE0YJtZg== X-Google-Smtp-Source: AGHT+IFb9zymccjl0oqeoyfkXARdJaMVnGxDcWb/uqu6BzjofC3G90rptc45dJXGoicR6VFFM6lJ X-Received: by 2002:a05:6a20:6d9c:b0:1a3:a76b:337c with SMTP id gl28-20020a056a206d9c00b001a3a76b337cmr1083204pzb.16.1711581705435; Wed, 27 Mar 2024 16:21:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711581705; cv=pass; d=google.com; s=arc-20160816; b=iBDPq8uKlq+MaUuI5JitJdEfR8CDy3yByJoE2Z63uBzvmv3rBcdfBWqeJj2/svn8Oh jm6Hsf8YHOKbqDz4+LfosAWqVULVGwsxq2bOrgMm48wgVyMP8CGrZYkeMas9m4bXUevJ pXxrmDW+UMvFP8DeEWvOKcviYXMnRdoxTOZprOasf+gTFhoqWS8vPD0/MGOmTd4KthVE 2xobuAnTCNUbEORXX1mt9EXf+0x9oio8xEatQBHPRGrtRBRCL18dfkWTVCoq/0g2YTvA jN5tKhPaCnTwNLiwaZ3l+PnonLhee1N/XxxIT0Hq1xZcQ1UUDe06pkDoTc45shd79btd e3cw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CBx5yqCcIG/deXybWASqoKrfUt47GVVbdT7E/yXEMkE=; fh=GkeYvbf+xNZ6FnLbCdM1301cNGqBUUBy40H1OcykQY8=; b=d22DYYwIqUUhUbFur2NPVopM5QzYQWSR27zFRIEzdTsaI1IcGDBLOJaAS+NiR254zy Q55iCjMADmDMhB+jyJxwYGkhPapZ7gnbSUi5IpeJLTMpKQE76s8YwU1GMw3/siLXLeIi zLIxh+aL6s7si9rqdP9ifpZd6x5ybBCzUgKrJ1wzV7OnQ07JeFEcmuSt3jPOCJDpdAoZ g4FKepZpUqoqXYilAs9E9IZMGR1RYUImxX/jxkVkSKLNTcYmnwB5PJj4BTmOeeP6ssIq eXbgQUUAebe1g8UMI2lxAIM3LeUHDPfyKrBDi1+F2zdiJ7c3pSh72+dpUYIhHQxz+652 USkw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b="AZe/5H+P"; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-122162-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122162-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i9-20020aa787c9000000b006e735f90cbasi176718pfo.240.2024.03.27.16.21.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 16:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122162-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b="AZe/5H+P"; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-122162-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122162-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4BAB3B223A4 for ; Wed, 27 Mar 2024 23:21:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCF39156896; Wed, 27 Mar 2024 23:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="AZe/5H+P" Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95EE91552E2 for ; Wed, 27 Mar 2024 23:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581553; cv=none; b=OkfIN9c6paO2+A+zIortI4kcUSWbu9CYCnrx1FSv52PxfZps7OzH9I2KpyAgELD46uNfvWzRhwfFVZhEL7tWxPU0K5dznMQLaDwB/kHj/xRFD/ytKOagnDS6ir/LdK3Bxr78XcM55xR13NlgYs1yQLGgNF4r3CCUO9LAjeQJbz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581553; c=relaxed/simple; bh=xlOFHnY+VUAHimj0/6CI3uzJ6CONg5CROD3tFFJ2TF4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rP6Tv3YMTA/9tXdFC781T3mjnk/Wclm32jgm7inJZ3wY9qLnAj+aW5TydohA4rKmqLpMpfII/+n2Udt5p0buSFkllOD3xXCx2KIDTP/XAmYUQLI+BeKl6ldpIjnlsyL1RDGVCh5ivyD/08DQ3Z3ZP7orQHYoiRhkiRax0RlZ4SI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=AZe/5H+P; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-22215ccbafeso260714fac.0 for ; Wed, 27 Mar 2024 16:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1711581549; x=1712186349; darn=vger.kernel.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=CBx5yqCcIG/deXybWASqoKrfUt47GVVbdT7E/yXEMkE=; b=AZe/5H+Pjy5tCOeoAALOzNVLm6n1Q05iv9SH37MheVT1+g0TMz85zs6kL0vLUX5hRI gkaVoES9vc1z7jptM736If8A1nvpdcEZJb3ylbLRrEBcGud7KoJoDk6rPvt61ysRhnKb bKczNZLbrIb07MnkGyjqTJB7Q5+iT+PAxDnNA/AYFSNU8P8CR7Kkkwnn7y3eG9VoyJbZ Z1FzV9DRwmCFD+ccxbCVFv6cxwpJz6Cvl5PqQLZS3ch5H7fQm2jzuTTS1ylPJXX9BKTH qCwFjwoPgkRFzZS23CN9bn5BfO5lXQrGT0gyO94Lll+G1k3THkzdh0dGAFF6QxnGMKTz Og/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711581549; x=1712186349; 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=CBx5yqCcIG/deXybWASqoKrfUt47GVVbdT7E/yXEMkE=; b=GciV0eZdRSiJ6nzas43QpkneXjOAqHCfimg1OaojBtxxwQDjrCHvDtxR3Zbfrl9o7y 7VNREWrfD7rjlVuwqEkfNQ8o/cyDbUZrZgnzMOyPPuFeYV4lPpCuOOaVxNMfcRM6AHzc s93NISfufVayF8wAUDyvYb51tpfwwqix88urgWZfsViPvBs55MYplvsR/VZwZhWSew52 t/m0JKUp4WuSZ31yZh6TpmWYwD5DVQpibn2TItIgjIBz3Sidtt5rXT+El+Rj8izL+O3w WfKVagLeLMO9edkuKdRJnZ+tqwbyieS0YQ6LRyAgkMH1ta6TcUA+QDDZzbhl+9/kdMji lr8w== X-Forwarded-Encrypted: i=1; AJvYcCW+LfPgzka66pov5XdB/4skvf0UV0dtr7R9eKWq5pRbLh2AsGyJQJa5bRyb7TzvF1pR94r1k+8UZdAIu4VBkVVcOaIPV++dUBNMWd5C X-Gm-Message-State: AOJu0Yzr9RuaHcxu5IPv/z+fA6X+7kZe+BqGjSOXZanvagGrVEiRzNnP IEtw6+5FKPlO2dT8UKu06k0Fxi5ZkOteLGrm+i8tUtLUQUQHuGvGkYG+N3TzSxc= X-Received: by 2002:a05:6870:b14b:b0:229:fa5a:2fec with SMTP id a11-20020a056870b14b00b00229fa5a2fecmr1265617oal.54.1711581549199; Wed, 27 Mar 2024 16:19:09 -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 js3-20020a056870bac300b0022a0519183csm81381oab.2.2024.03.27.16.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 16:19:08 -0700 (PDT) From: David Lechner To: Jonathan Corbet , Liam Girdwood , Mark Brown , Jean Delvare , Guenter Roeck , Support Opensource , Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Antoniu Miclaus , Greg Kroah-Hartman , Dmitry Torokhov Cc: David Lechner , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-input@vger.kernel.org Subject: [PATCH RFC 6/7] staging: iio: impedance-analyzer: admv1013: Use devm_regulator_get_enable_get_voltage() Date: Wed, 27 Mar 2024 18:18:55 -0500 Message-ID: <20240327-regulator-get-enable-get-votlage-v1-6-5f4517faa059@baylibre.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240327-regulator-get-enable-get-votlage-v1-0-5f4517faa059@baylibre.com> References: <20240327-regulator-get-enable-get-votlage-v1-0-5f4517faa059@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit We can reduce boilerplate code by using devm_regulator_get_enable_get_voltage(). Signed-off-by: David Lechner --- drivers/staging/iio/impedance-analyzer/ad5933.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index 9149d41fe65b..e4942833b793 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -84,7 +84,6 @@ struct ad5933_state { struct i2c_client *client; - struct regulator *reg; struct clk *mclk; struct delayed_work work; struct mutex lock; /* Protect sensor state */ @@ -660,13 +659,6 @@ static void ad5933_work(struct work_struct *work) } } -static void ad5933_reg_disable(void *data) -{ - struct ad5933_state *st = data; - - regulator_disable(st->reg); -} - static int ad5933_probe(struct i2c_client *client) { const struct i2c_device_id *id = i2c_client_get_device_id(client); @@ -685,21 +677,7 @@ static int ad5933_probe(struct i2c_client *client) mutex_init(&st->lock); - st->reg = devm_regulator_get(&client->dev, "vdd"); - if (IS_ERR(st->reg)) - return PTR_ERR(st->reg); - - ret = regulator_enable(st->reg); - if (ret) { - dev_err(&client->dev, "Failed to enable specified VDD supply\n"); - return ret; - } - - ret = devm_add_action_or_reset(&client->dev, ad5933_reg_disable, st); - if (ret) - return ret; - - ret = regulator_get_voltage(st->reg); + ret = devm_regulator_get_enable_get_voltage(&client->dev, "vdd"); if (ret < 0) return ret; -- 2.43.2