From patchwork Sun Apr 10 19:07:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 8790841 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 839B2C0553 for ; Sun, 10 Apr 2016 19:07:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8AE172024D for ; Sun, 10 Apr 2016 19:07:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62075201CD for ; Sun, 10 Apr 2016 19:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932080AbcDJTHU (ORCPT ); Sun, 10 Apr 2016 15:07:20 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36356 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932066AbcDJTHS (ORCPT ); Sun, 10 Apr 2016 15:07:18 -0400 Received: by mail-pf0-f194.google.com with SMTP id q129so13359166pfb.3; Sun, 10 Apr 2016 12:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NGKUKmmCyrKEYA2pMeMAt0unW25vI10REiKalKBfbH0=; b=hQJGygz4LREZ9dhN31urG49Xc+lGOv17NuX4g7fnHltMyaixQC1NtiDt8khNPw4smh uRTdDKQB+6LaFJUwAKvDwji6Lb4rBFuvY6/bxzWLX9ENhCQC5qlFz9ZmOtZ8C1BiCUad WJCDKj4RW9l9pKRgeXqwTB9jNi8/ziE5rYYc3EhVzncTu/ShnuoeHP1kYpoB8Fa1wOpW P+ArvXgvyBqjCqIK5TdtXDJVXtaaunOo6xPFxnSla95OMcVdsBPoqXLazRpv24pLsL+8 LwzvfCAf4TyDSIyRNus/nNt71Fu2uOwR1HceXApY5M7zOeIu4cWmMbd6ancIfOMaRags S29A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NGKUKmmCyrKEYA2pMeMAt0unW25vI10REiKalKBfbH0=; b=f4BxnJCarrw0xeDkYS1LPC9S31OOTOT70s2Hpj6rNWd+1OyW+fuNplfE6B4rfTDHvP cCojjxQYa7fZFzZ9wBugR6wPGMuSeGAjc3K5+1oCXx5TFPgoUUlLIu4F7uNZrqwo9RMX 19YxYfKWu+FF7GUyVRgAjHJuFanewQENaNn7S9EAhLhyY+lf9QoUZIKxL8XcAamv0hrH U5NaVORHKgtZcLpvsd+6Jam8/WvYWYAJzMIZmmqn8gHeskNEcR+URJe6/fISgx7nF66B 31ogvq73FLqj4KJI1NqPYKnbFPCDlUYd8FkD/CLaSgjpla2zUzS3ibs5meB1hzJcUT9O ntGw== X-Gm-Message-State: AD7BkJIgPIvjAbkR7j5zuSLBYQmL0yyttqltQxjgLX9J74jTe2PD/ZBdRAF4fbI2BTqf9Q== X-Received: by 10.98.79.7 with SMTP id d7mr27308809pfb.77.1460315237287; Sun, 10 Apr 2016 12:07:17 -0700 (PDT) Received: from localhost.localdomain (or-67-232-74-92.dhcp.embarqhsd.net. [67.232.74.92]) by smtp.gmail.com with ESMTPSA id cy2sm16031542pad.18.2016.04.10.12.07.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Apr 2016 12:07:16 -0700 (PDT) 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 v2 3/5] iio: health: afe4403: use regmap to retrieve struct device Date: Sun, 10 Apr 2016 12:07:12 -0700 Message-Id: <566ccb722e22834d934e7897e90a5ebdf39024e2.1460314070.git.amsfield22@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: 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; }