Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5316916ima; Tue, 5 Feb 2019 09:42:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IYQNnex/SyGk/TTFAvH3n6dllEJv/+qbeT6pIMbPCKkp7IipGZ3ntWw+KA/NNSF5AddUAdl X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr5993235plb.70.1549388560010; Tue, 05 Feb 2019 09:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549388560; cv=none; d=google.com; s=arc-20160816; b=CLYpn0fy4BdM8a8UX67B7JOm0Rz5S5M7iqqTLFfpu/bAY/ym43/hYmPlRGi0QazTkn CotjlwAo4BSDsnTeTMYroeGMlGo8atrlDuruLlEMC5toHrz6DRGYRAiUYiDesU7GoYwg XKNwQrAaCHl3eQfc/8ccIdwjF18apN4158oCtzmrT5APo2GKjWW+QZlWadgqLIg2GVaw x2F64E5eGL+8Axk4sik099ZpYaIzB1p9i0FJyC2FF126YJW5xwT2Z6uLEDmYq5O3Iiq5 geCB4MPkGYY05DSee2UwOc/4alu3Vu1cBvwn2awZzxbmw84wq0MpZW0FlxkGrA/T/iDk xYLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vFSrBwfGt5LBuMGMNCi1mHrZCrU6Rt7g9XGY2s5Y+K8=; b=vPnzm6vx3J3mqzGDllMQRvlpfqBwViGc4DsT8ZQ/VE6jWFAWP0jgDh+DSqt7wIZ51j n2DQRWKiMnfQrED1mUDTO+X7rF5X8p5SDdy37FU0sed+LL+GhBpmvbyXbXy6pfejbIX5 ULqmwSbQy2ShWHMAnW3iPFVFn78gA/EcAS9yA24fXCBAl/cD8QSNoZ8KRjXiDLVkTLRo NzdkgF+J2PN4+Xg+VnfPSlK3GLD5wNm/2zeq8c0s/vxGnsigwuUPitM//VIfLEcQLci9 Ao3xQHJNANFwfeHupx8hEvGRyc9duOwZ18QGLmICY2jlEAZWv7MmRkLx9tnCOKobDMjZ 1nUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QH1ZW5E4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 44si3997385plc.110.2019.02.05.09.42.24; Tue, 05 Feb 2019 09:42:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QH1ZW5E4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729003AbfBERN3 (ORCPT + 99 others); Tue, 5 Feb 2019 12:13:29 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38586 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbfBERN3 (ORCPT ); Tue, 5 Feb 2019 12:13:29 -0500 Received: by mail-qt1-f195.google.com with SMTP id 2so4673634qtb.5; Tue, 05 Feb 2019 09:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=vFSrBwfGt5LBuMGMNCi1mHrZCrU6Rt7g9XGY2s5Y+K8=; b=QH1ZW5E4ujvJyhiMA0rYxAQm6pKydOyS7KQGmMyjR+QTVu0VD1k5vKXvd5xkL3V2EA K+7Y1docxLclppcQ1UhxaXzXNuUk7ME04xOOL1PO8VfCTPr+L5o6trl6dnydEn75kcjA SLQa0asIFEob/SbhiPUk4TwdOpc/12BneIH6o5sk0Yfht8voBRi4ErEsrqtd5fi+TC7M /xjZxQScb8eoLWfZzC1OJx3gJhzq2zSjBW2kEcN9r/wr7ULJ96pWANqhqQwepiRlRF2h /WusKxDAgUjldLBikNLr0yPKfl/Oa8hsh1XcRTCQ9tPRIdaDUYcNHdGe+qWl2XshddSV ACgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=vFSrBwfGt5LBuMGMNCi1mHrZCrU6Rt7g9XGY2s5Y+K8=; b=ALNyrcLUo0e3JApjIwThHYLmZ+HRA3C8Oqua61Pvlalz8idPgdZZVfUlE0jKiLidbI QAv+NzqEoz79nrmYFUbavyxCdYlAg34MInVXQcst6fiowVvtkKSEMlSVBQ/+mWFVF8Iw QZ6PJj/d3V1geLYqh2/udMspHgKnqqwMpYskFFqRgkHFJLAZte7yQoCD3DkuxltQ0Ue3 eY+Brhk2e75tsrxbIIrlSui+gS//NUCsNXh5+WnwghAA6aAAxuMBgBsbVBP2Cy4DCc+t qzWA01kcBRd0v4KVkyP7gyU6GviQ+dWcwMh4880CooLhHE/oJVR+hus3G0euAzTnAlIp DAqA== X-Gm-Message-State: AHQUAua7+8ypSmiDS9GgjK8pfuIgBPaJCHKMaewuYuuZq0/XIw9AVJfO aQKdJ8bbCk8f5YzFCqabxcY= X-Received: by 2002:a0c:eb4b:: with SMTP id c11mr2664184qvq.207.1549386807612; Tue, 05 Feb 2019 09:13:27 -0800 (PST) Received: from renatolg ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id o25sm17588252qtj.10.2019.02.05.09.13.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 09:13:27 -0800 (PST) Date: Tue, 5 Feb 2019 15:13:21 -0200 From: Renato Lui Geh To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, stefan.popa@analog.com, alexandru.Ardelean@analog.com, giuliano.belinassi@usp.br Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: [PATCH v3 2/4] staging: iio: ad7780: move regulator to after GPIO init Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To maintain consistency between ad7780_probe and ad7780_remove orders, regulator initialization has been moved to after GPIO initializations. Signed-off-by: Renato Lui Geh --- drivers/staging/iio/adc/ad7780.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c index 6e4357800d31..7804cd2b273e 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -250,16 +250,6 @@ static int ad7780_probe(struct spi_device *spi) ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info); - st->reg = devm_regulator_get(&spi->dev, "avdd"); - if (IS_ERR(st->reg)) - return PTR_ERR(st->reg); - - ret = regulator_enable(st->reg); - if (ret) { - dev_err(&spi->dev, "Failed to enable specified AVdd supply\n"); - return ret; - } - st->chip_info = &ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data]; @@ -279,7 +269,7 @@ static int ad7780_probe(struct spi_device *spi) ret = PTR_ERR(st->powerdown_gpio); dev_err(&spi->dev, "Failed to request powerdown GPIO: %d\n", ret); - goto error_disable_reg; + return ret; } if (st->chip_info->is_ad778x) { @@ -290,7 +280,7 @@ static int ad7780_probe(struct spi_device *spi) ret = PTR_ERR(st->gain_gpio); dev_err(&spi->dev, "Failed to request gain GPIO: %d\n", ret); - goto error_disable_reg; + return ret; } st->filter_gpio = devm_gpiod_get_optional(&spi->dev, @@ -301,10 +291,20 @@ static int ad7780_probe(struct spi_device *spi) dev_err(&spi->dev, "Failed to request filter GPIO: %d\n", ret); - goto error_disable_reg; + return ret; } } + st->reg = devm_regulator_get(&spi->dev, "avdd"); + if (IS_ERR(st->reg)) + return PTR_ERR(st->reg); + + ret = regulator_enable(st->reg); + if (ret) { + dev_err(&spi->dev, "Failed to enable specified AVdd supply\n"); + return ret; + } + ret = ad_sd_setup_buffer_and_trigger(indio_dev); if (ret) goto error_disable_reg; -- 2.20.1