From patchwork Wed Apr 6 05:20:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 8758371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F40799F372 for ; Wed, 6 Apr 2016 05:20:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A67D200D6 for ; Wed, 6 Apr 2016 05:20:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF7F720145 for ; Wed, 6 Apr 2016 05:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760441AbcDFFUE (ORCPT ); Wed, 6 Apr 2016 01:20:04 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34161 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754909AbcDFFUD (ORCPT ); Wed, 6 Apr 2016 01:20:03 -0400 Received: by mail-pa0-f68.google.com with SMTP id hb4so3083097pac.1; Tue, 05 Apr 2016 22:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NGKUKmmCyrKEYA2pMeMAt0unW25vI10REiKalKBfbH0=; b=skYA3cjEIwVEXVP3gtU3SpqsQAuk5uFi5Q4cZym5bQ4pyip3BOH0xPl/FM5ErANl/R X+8gSK/diaYtZuLRovYEnoj4AGmHWBBiDv65wJAkmWGYUH6Px5pIZCn3/G/wCMoErktT GbwDsnRacce6MZhdjWITWTzuiyBbRzLrCnxlUyJf5nTc0ZmJY3oGEIMZQR/GQeul41uU Q52xqPtTq//QwWOas5SRGNq+oyWEcQBb3UrdwwiSG795algmTk6OIEM5KuMsZaLCserN sMfjZn/Q04McNAe9agHTrgRgmNpN9GoIp9NQ9TDSRZP0VxJTD+Ae9TqPrsiVV9yI8jKU J5Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NGKUKmmCyrKEYA2pMeMAt0unW25vI10REiKalKBfbH0=; b=IzgOVBXkxS/QdQnS4UhCCvCYxtRPltH0/RT7T/KZxmdcA4zTS1/Oea6Gib6VDJk1Ys uJ2YTJnBPmlT2z+m9PQqCK6vklPN3qw0Gt/O77T0pdh9Cn1ZZt1fF2jlI6H+4MQfdykN zxtlDkiAcy2SEzeyGZBDwUWX4hs1Q3kH3eJMavfdUyJBlEWnie0ma/iDX99+oU3Inj/l evEqe7Qw98biOLqhOK5Cxs3GoIz+a3iUZrRpS+CgcnMfUXXkB68cCWW609cdP4MMZT8C vQJLgj+znJAGt30CCTbfLyuvZbfVW4nCVNnfpXtfIFx0MUuuK+sOoybq1OvjV20cm3xJ G1Tg== X-Gm-Message-State: AD7BkJLpQ7kzqh05/TtQXDtvsnekLEtCYIqf1OgrSqf+kqtu4+MrstevwWpUJz9SNmiTOw== X-Received: by 10.67.30.163 with SMTP id kf3mr68389251pad.45.1459920001611; Tue, 05 Apr 2016 22:20:01 -0700 (PDT) Received: from d830 (or-67-232-74-92.dhcp.embarqhsd.net. [67.232.74.92]) by smtp.gmail.com with ESMTPSA id bk8sm1388281pac.3.2016.04.05.22.20.00 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 22:20:00 -0700 (PDT) Date: Tue, 5 Apr 2016 22:20:00 -0700 From: Alison Schofield To: jic23@kernel.org Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, kgene@kernel.org, k.kozlowski@samsung.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 7/9] iio: health: afe4403: use regmap to retrieve struct device Message-ID: <7150183b87729a0d287cf270f58de85079d40468.1459918214.git.amsfield22@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver includes struct regmap and struct device in its global data. Remove the struct device and use regmap API to retrieve device info. Patch created using Coccinelle plus manual edits. Signed-off-by: Alison Schofield --- drivers/iio/health/afe4403.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c index 88e43f8..71b8f70 100644 --- a/drivers/iio/health/afe4403.c +++ b/drivers/iio/health/afe4403.c @@ -104,7 +104,6 @@ /** * struct afe4403_data - * @dev - Device structure * @spi - SPI device handle * @regmap - Register map of the device * @regulator - Pointer to the regulator for the IC @@ -112,7 +111,6 @@ * @irq - ADC_RDY line interrupt number */ struct afe4403_data { - struct device *dev; struct spi_device *spi; struct regmap *regmap; struct regulator *regulator; @@ -562,55 +560,54 @@ static int afe4403_probe(struct spi_device *spi) afe = iio_priv(indio_dev); spi_set_drvdata(spi, indio_dev); - afe->dev = &spi->dev; afe->spi = spi; afe->irq = spi->irq; afe->regmap = devm_regmap_init_spi(spi, &afe4403_regmap_config); if (IS_ERR(afe->regmap)) { - dev_err(afe->dev, "Unable to allocate register map\n"); + dev_err(&spi->dev, "Unable to allocate register map\n"); return PTR_ERR(afe->regmap); } - afe->regulator = devm_regulator_get(afe->dev, "tx_sup"); + afe->regulator = devm_regulator_get(&spi->dev, "tx_sup"); if (IS_ERR(afe->regulator)) { - dev_err(afe->dev, "Unable to get regulator\n"); + dev_err(&spi->dev, "Unable to get regulator\n"); return PTR_ERR(afe->regulator); } ret = regulator_enable(afe->regulator); if (ret) { - dev_err(afe->dev, "Unable to enable regulator\n"); + dev_err(&spi->dev, "Unable to enable regulator\n"); return ret; } ret = regmap_write(afe->regmap, AFE440X_CONTROL0, AFE440X_CONTROL0_SW_RESET); if (ret) { - dev_err(afe->dev, "Unable to reset device\n"); + dev_err(&spi->dev, "Unable to reset device\n"); goto err_disable_reg; } ret = regmap_multi_reg_write(afe->regmap, afe4403_reg_sequences, ARRAY_SIZE(afe4403_reg_sequences)); if (ret) { - dev_err(afe->dev, "Unable to set register defaults\n"); + dev_err(&spi->dev, "Unable to set register defaults\n"); goto err_disable_reg; } indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->dev.parent = afe->dev; + indio_dev->dev.parent = &spi->dev; indio_dev->channels = afe4403_channels; indio_dev->num_channels = ARRAY_SIZE(afe4403_channels); indio_dev->name = AFE4403_DRIVER_NAME; indio_dev->info = &afe4403_iio_info; if (afe->irq > 0) { - afe->trig = devm_iio_trigger_alloc(afe->dev, + afe->trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d", indio_dev->name, indio_dev->id); if (!afe->trig) { - dev_err(afe->dev, "Unable to allocate IIO trigger\n"); + dev_err(&spi->dev, "Unable to allocate IIO trigger\n"); ret = -ENOMEM; goto err_disable_reg; } @@ -618,21 +615,21 @@ static int afe4403_probe(struct spi_device *spi) iio_trigger_set_drvdata(afe->trig, indio_dev); afe->trig->ops = &afe4403_trigger_ops; - afe->trig->dev.parent = afe->dev; + afe->trig->dev.parent = &spi->dev; ret = iio_trigger_register(afe->trig); if (ret) { - dev_err(afe->dev, "Unable to register IIO trigger\n"); + dev_err(&spi->dev, "Unable to register IIO trigger\n"); goto err_disable_reg; } - ret = devm_request_threaded_irq(afe->dev, afe->irq, + ret = devm_request_threaded_irq(&spi->dev, afe->irq, iio_trigger_generic_data_rdy_poll, NULL, IRQF_ONESHOT, AFE4403_DRIVER_NAME, afe->trig); if (ret) { - dev_err(afe->dev, "Unable to request IRQ\n"); + dev_err(&spi->dev, "Unable to request IRQ\n"); goto err_trig; } } @@ -640,13 +637,13 @@ static int afe4403_probe(struct spi_device *spi) ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, afe4403_trigger_handler, NULL); if (ret) { - dev_err(afe->dev, "Unable to setup buffer\n"); + dev_err(&spi->dev, "Unable to setup buffer\n"); goto err_trig; } ret = iio_device_register(indio_dev); if (ret) { - dev_err(afe->dev, "Unable to register IIO device\n"); + dev_err(&spi->dev, "Unable to register IIO device\n"); goto err_buff; } @@ -667,6 +664,7 @@ static int afe4403_remove(struct spi_device *spi) { struct iio_dev *indio_dev = spi_get_drvdata(spi); struct afe4403_data *afe = iio_priv(indio_dev); + struct device *dev = regmap_get_device(afe->regmap); int ret; iio_device_unregister(indio_dev); @@ -678,7 +676,7 @@ static int afe4403_remove(struct spi_device *spi) ret = regulator_disable(afe->regulator); if (ret) { - dev_err(afe->dev, "Unable to disable regulator\n"); + dev_err(dev, "Unable to disable regulator\n"); return ret; }