From patchwork Sun Apr 10 19:07:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 8790871 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 C23C39F39A for ; Sun, 10 Apr 2016 19:08:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 903942024D for ; Sun, 10 Apr 2016 19:08:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 870C2201CD for ; Sun, 10 Apr 2016 19:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932385AbcDJTHw (ORCPT ); Sun, 10 Apr 2016 15:07:52 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34049 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932293AbcDJTHt (ORCPT ); Sun, 10 Apr 2016 15:07:49 -0400 Received: by mail-pf0-f194.google.com with SMTP id d184so13365981pfc.1; Sun, 10 Apr 2016 12:07:48 -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=LkxaIzsfb3wmeTAS+L0942/G8ysikbDMoYHH2RKI34c=; b=qAq5xnWD68nFCZjYHQDbiUcCVX4x4YizNaeO16qigfOk572lLxanHNLmoY/pTZZ4kY 5DEYmLEeO1ra7zHmCejEYcdZ06NoU+SV9Ok8xTTn3T/p2mpuaAy0L5nyq0C3dwHJeDZJ rJhqgeKKTkVSDAqLzWHAqQPyXmpuD4YZutDOjnwaITw/QRALkA2MQMlxjQl4a/R3DHje HiRKmxfNCAvLwTynjRqYj5YSMTODGiJbzfzlmk4XiKmj/urDoZZUSc8IxonDM4l1dJat QnyKw0ufr2ReJItFT/fNV1slG4ZM/WEIadWAABhhdf4TdGHwkyt+0yD294EyR0Ro0opE PcqA== 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=LkxaIzsfb3wmeTAS+L0942/G8ysikbDMoYHH2RKI34c=; b=TBn/OATR0PfxX31a8zDJoSs+/Y/+MJO4sDlLf3uFd0jpyY7hlWmZbMP4NWIWz8cgwg iG2n/jpEUy2LtBGqFho4aC3vxQBt9K1Ri3UfCjpbPqkvIOhxLbZ7b1vrrbGgS+p7KVN2 0tyS8oHdTwwlkq19QUc9o9Xj2vFJ43WgIy8RuN77SIFCPP6FQhDAERhfXiAK4A2LkYF8 bqDh8VKWUH+M5dDfHIWD/ZQyBG6ZY2ptCjsXJmifeEZj5j3oMmE/HEEBYL6AzmWl6Bij qcCIvXFxtWVXYIWonXyucCpdtginGaIrPekhXUzK4DXPM9hxfC1RtRKrTSXFKfH0J++1 jFaw== X-Gm-Message-State: AD7BkJKtu0i++MchbKUoxCyvCAbZTBH7zDtEadlIqqlI1jhKQ9R2GKDX9uuRslI5aurGVw== X-Received: by 10.98.70.197 with SMTP id o66mr27807248pfi.84.1460315268070; Sun, 10 Apr 2016 12:07:48 -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 83sm31011720pfn.46.2016.04.10.12.07.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Apr 2016 12:07:47 -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 4/5] iio: health: afe4404: use regmap to retrieve struct device Date: Sun, 10 Apr 2016 12:07:42 -0700 Message-Id: <2dd23e55fa7c2d16c577146eefd4a84046d2b838.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/afe4404.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c index 5096a46..9cd8590 100644 --- a/drivers/iio/health/afe4404.c +++ b/drivers/iio/health/afe4404.c @@ -107,14 +107,12 @@ /** * struct afe4404_data - * @dev - Device structure * @regmap - Register map of the device * @regulator - Pointer to the regulator for the IC * @trig - IIO trigger for this device * @irq - ADC_RDY line interrupt number */ struct afe4404_data { - struct device *dev; struct regmap *regmap; struct regulator *regulator; struct iio_trigger *trig; @@ -534,54 +532,54 @@ static int afe4404_probe(struct i2c_client *client, afe = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); - afe->dev = &client->dev; afe->irq = client->irq; afe->regmap = devm_regmap_init_i2c(client, &afe4404_regmap_config); if (IS_ERR(afe->regmap)) { - dev_err(afe->dev, "Unable to allocate register map\n"); + dev_err(&client->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(&client->dev, "tx_sup"); if (IS_ERR(afe->regulator)) { - dev_err(afe->dev, "Unable to get regulator\n"); + dev_err(&client->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(&client->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(&client->dev, "Unable to reset device\n"); goto disable_reg; } ret = regmap_multi_reg_write(afe->regmap, afe4404_reg_sequences, ARRAY_SIZE(afe4404_reg_sequences)); if (ret) { - dev_err(afe->dev, "Unable to set register defaults\n"); + dev_err(&client->dev, "Unable to set register defaults\n"); goto disable_reg; } indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->dev.parent = afe->dev; + indio_dev->dev.parent = &client->dev; indio_dev->channels = afe4404_channels; indio_dev->num_channels = ARRAY_SIZE(afe4404_channels); indio_dev->name = AFE4404_DRIVER_NAME; indio_dev->info = &afe4404_iio_info; if (afe->irq > 0) { - afe->trig = devm_iio_trigger_alloc(afe->dev, + afe->trig = devm_iio_trigger_alloc(&client->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(&client->dev, + "Unable to allocate IIO trigger\n"); ret = -ENOMEM; goto disable_reg; } @@ -589,21 +587,22 @@ static int afe4404_probe(struct i2c_client *client, iio_trigger_set_drvdata(afe->trig, indio_dev); afe->trig->ops = &afe4404_trigger_ops; - afe->trig->dev.parent = afe->dev; + afe->trig->dev.parent = &client->dev; ret = iio_trigger_register(afe->trig); if (ret) { - dev_err(afe->dev, "Unable to register IIO trigger\n"); + dev_err(&client->dev, + "Unable to register IIO trigger\n"); goto disable_reg; } - ret = devm_request_threaded_irq(afe->dev, afe->irq, + ret = devm_request_threaded_irq(&client->dev, afe->irq, iio_trigger_generic_data_rdy_poll, NULL, IRQF_ONESHOT, AFE4404_DRIVER_NAME, afe->trig); if (ret) { - dev_err(afe->dev, "Unable to request IRQ\n"); + dev_err(&client->dev, "Unable to request IRQ\n"); goto disable_reg; } } @@ -611,13 +610,13 @@ static int afe4404_probe(struct i2c_client *client, ret = iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, afe4404_trigger_handler, NULL); if (ret) { - dev_err(afe->dev, "Unable to setup buffer\n"); + dev_err(&client->dev, "Unable to setup buffer\n"); goto unregister_trigger; } ret = iio_device_register(indio_dev); if (ret) { - dev_err(afe->dev, "Unable to register IIO device\n"); + dev_err(&client->dev, "Unable to register IIO device\n"); goto unregister_triggered_buffer; } @@ -638,6 +637,7 @@ static int afe4404_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct afe4404_data *afe = iio_priv(indio_dev); + struct device *dev = regmap_get_device(afe->regmap); int ret; iio_device_unregister(indio_dev); @@ -649,7 +649,7 @@ static int afe4404_remove(struct i2c_client *client) 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; }