From patchwork Wed Apr 6 05:20:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 8758401 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 2C8A79F372 for ; Wed, 6 Apr 2016 05:21:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A998200D6 for ; Wed, 6 Apr 2016 05:20:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1716C200BE for ; Wed, 6 Apr 2016 05:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760768AbcDFFU4 (ORCPT ); Wed, 6 Apr 2016 01:20:56 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36150 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754167AbcDFFUz (ORCPT ); Wed, 6 Apr 2016 01:20:55 -0400 Received: by mail-pf0-f194.google.com with SMTP id q129so3206038pfb.3; Tue, 05 Apr 2016 22:20:50 -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=LkxaIzsfb3wmeTAS+L0942/G8ysikbDMoYHH2RKI34c=; b=pMKn8xJqXoVaEiFsh97CJdJCc2M3q2ufyGX4Lj01G+Z121uf6XdqezUak5xzJmF0TN do//PE2mZqk+QgouVXZeZ2yJZ3whXriYuUiXMJyNuI/ROxgHESmdmjb9x0k0+2J5bozN r0plrb9GoLVRWPb2J0NV/BYvfYcybp1G+JN4kRrlcgK7btx9/KjhqiEh9deDCGWVe414 VD0MmDkGSrwaLGELWCNkhnsx4r7fnSo/IdzjF/NcfTfnddHwBxoMqpWG2/aQqK7pLrSS 6tmzT0xe6s/vkGvwT5irMXRsfonTPclfKDMX/rWcmf8JtptHPCkLD2aQrRBh0u5rmmvr dFiQ== 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=LkxaIzsfb3wmeTAS+L0942/G8ysikbDMoYHH2RKI34c=; b=HkRxJhAErgPRaskIRWH2xpKmr1jhDVzJ2YdH8UGevDXbvpo0/amuOhl5DWvqfRXueR E6gXj7XUesBndUgbGEunL7Xo4GPadcKf+ZwEIXgiTamBm0Nz6s81GyQPC/ZL4d37z66M IKzLQlW0rNXO3VtoNpdo9gzG205fvBKNdPFGHRXwitnEX/Ao+hxql6TQuQI66hpjnSr0 F8SGajlQkKATFIp6K2uV7czlyYpKGpDlNLGvil4HYfoT+KMaZn/aq4E0rMqgT9xCZZU4 NHNfaSDvpQ9TEQHGM+AsUHx+USI2WxBhEGjS6qmuiCrHbvdWX9+j4xLTLGR8I9dymWUA jvQg== X-Gm-Message-State: AD7BkJLN7e6H3lnRrgPnzGgp2D26ZHIpCJ4bKHrILVt98svUBPpaLc98e9XZxsNDWQfq0w== X-Received: by 10.98.67.199 with SMTP id l68mr35050507pfi.18.1459920048642; Tue, 05 Apr 2016 22:20:48 -0700 (PDT) Received: from d830 (or-67-232-74-92.dhcp.embarqhsd.net. [67.232.74.92]) by smtp.gmail.com with ESMTPSA id c4sm1377752pat.19.2016.04.05.22.20.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 22:20:48 -0700 (PDT) Date: Tue, 5 Apr 2016 22:20:47 -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 8/9] iio: health: afe4404: use regmap to retrieve struct device Message-ID: 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/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; }