Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp728883img; Thu, 28 Feb 2019 07:01:09 -0800 (PST) X-Google-Smtp-Source: AHgI3IaJP1WAoixep9f4xzLL+r3vgA23QHMzFnlTAlbu3h7p8kTXT0gYLbIVXq0xGWYqQ5z2XfRa X-Received: by 2002:a62:e413:: with SMTP id r19mr24896pfh.236.1551366069155; Thu, 28 Feb 2019 07:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551366069; cv=none; d=google.com; s=arc-20160816; b=Uziixp661idZFPKRYJ3kXnUWVjRYVUO3Iz5I+YijYQ13k+nJhHqENYoyMA6Q7TFZOB cmvYNRUJKYkZU68VQ2/HOAuuh0fgs0hz3fQerS+HNQI4xOW225y4eL9lnGGo3n1tbPgX jQS/RupFtaIVvWpebq/90XKyQj6RB0rrSXjkA7FcwDQncoSvuQMv6nAsnXSSYfehxexw RWTQuqan5CeTxLoMgCyBBxRgc7TwlxOjUjWzJarxnvXpseV5bg1ETSqfUnn1lEnXYiag P7EH6+M3BO0l/Q2mtuj9TZmm3ocmSdw++m/Wd5eamA9MolD4sKbbDDS+W0YbRFwcQQjp xW8w== 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=7IjTEn/vSJKDmLNmxTfgAiOgC0kjjMvr7wAaLhI+NQw=; b=iBSH/fmTZ6NIhiB3UO5n+SEW6hbLFEj+Fa8ca1vSPLvxd6toaSI2pnubzXiUMWqHHM 2g1nPUTcdaVolh4lUW15RcqjNaHp7KKJ87h1q/wOtI+gYnulXkWBGQrIRFgAWd+K0fqq WfVVb+KmUNBUhxOn/3cA5swSamj/yyB3QSBp/+/XTgvHrvSGuE08b+z1n8VLK98yxVgg liW/LSOHnlYPeUjIQOIYL45srTdKiNEFqdkh+siUgFltaA3gFbzI47rlMoLA7OFLTSFZ 36wGd3MhvnrJiqoMtqCivwQykw1ZX2KtRKkC0Mc7w97YGeSdCbivRV5QwpEi70LGWZIN +HXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tTp8qRSX; 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 l61si18819699plb.6.2019.02.28.07.00.53; Thu, 28 Feb 2019 07:01:09 -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=tTp8qRSX; 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 S1732866AbfB1OZT (ORCPT + 99 others); Thu, 28 Feb 2019 09:25:19 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42864 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732841AbfB1OZQ (ORCPT ); Thu, 28 Feb 2019 09:25:16 -0500 Received: by mail-qt1-f193.google.com with SMTP id u7so14432483qtg.9; Thu, 28 Feb 2019 06:25:15 -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=7IjTEn/vSJKDmLNmxTfgAiOgC0kjjMvr7wAaLhI+NQw=; b=tTp8qRSXsofJF+XuoEKGP3DhVSrrCLPYQim2iMK9FbzOojDAMcBqp4a9N1PyyMkMX6 X3HmpjMyMptSfQOgAu3gBtHmVuVZIBkxMNbjpVNjTaoy0X2VKzhTlwBfBaZAdGsKhUUY o2XK13B4eY7AqcMq8CmywCL00gyACUsqpf6/rfWvxkTvOET6FTFCxdY3C2fgO5V/Un8Q tvYSSjNOLkKqQyTmgUE2tk7R8B6UE185ZMQ3Yz79OjKnfX1MDMHLOycZMEVDbe8xfmMt +wvwBi8eFC7uOTbavvWln3bAGKzhk+jjCVFAeQWdxmbveM0x5E4ofg5mWM89Ptbwtjoq EbnA== 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=7IjTEn/vSJKDmLNmxTfgAiOgC0kjjMvr7wAaLhI+NQw=; b=iLDp+nJ4ZN+bfhzjwzvdFLf/c0NUEXZcZChFVz5zbRp5YOl1WqpeO2CXDH9htKbKQJ Ca1kOoFjxQgGH42vC/JWFHbwuMcSTVkK7bubcW8giAiwRT3C269qzuDMPm6NYrD8Ptod kocYx3mGndWrdynJ+bUNl+671F2ESGHiB+uXmewPN3EZ/Vsfugu6aYi+9JM4DaJlf3x1 yxzZGVWXt6dQHed5zmx6UuJda9bctsPM89is2pP/W71s2AztgandeZZoc6uCXoJxJ5sG kWzWeoPj0REQb5uXsQhas+vxXgNv7XVQbxztYUtpTcdmR212BoeyP5JhvA7ckMIeFu6+ yiQQ== X-Gm-Message-State: AHQUAuZDOwNluXEQw6YaQOe4YeDTmq60JgfWTir4LwW45iJPGrMYE+fZ IykDuD+ix3ZpOU71VJZwI+d1HeSbGfE= X-Received: by 2002:ac8:2314:: with SMTP id a20mr6523370qta.127.1551363915303; Thu, 28 Feb 2019 06:25:15 -0800 (PST) Received: from renatolg ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id p64sm3673740qkc.62.2019.02.28.06.25.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 06:25:15 -0800 (PST) Date: Thu, 28 Feb 2019 11:25:09 -0300 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, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com, devicetree@vger.kernel.org Subject: [PATCH v4 5/9] staging: iio: ad7780: move regulator to after GPIO init Message-ID: <93cabb081605ac356f2f0d9a9a41d5bc5e63820d.1551358569.git.renatogeh@gmail.com> 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 ad7617a3a141..12aef0f101bc 100644 --- a/drivers/staging/iio/adc/ad7780.c +++ b/drivers/staging/iio/adc/ad7780.c @@ -255,16 +255,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]; @@ -284,7 +274,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) { @@ -295,7 +285,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, @@ -306,10 +296,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.21.0