Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372191

[PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device

Path csiph.com!news.freedyn.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Alison Schofield <amsfield22@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device
Date Wed, 06 Apr 2016 07:20:02 +0200
Message-ID <rkO2K-7uk-13@gated-at.bofh.it> (permalink)
References <rkO2K-7uk-9@gated-at.bofh.it>
X-Original-To jic23@kernel.org
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=qi+A9b7KZmK24frGQYWkoVa8UmlEr3YlW5YPSrcVaPA=; b=MTIuQppdRKtdPqd8As/xuYpTFk2osWzUtO8YGrrvTghkLKvWzQ/2R7CLaVgbPaF6yC cJsaHz3GFGqGMRHVxrJdlD/NxwwJHfO91QSL5+c/WPMxAQTdcOuYOiQ+E2vGZCpiE5XH gl3V9TEtioAlPbOxTxhmcMF8xyGnLSs1q5k26/wzk6ptf1SdAd6HaHAgiqAhZ/vLzXEY M61CwzYQI9Hm5Yb/NYd3rcKrd+TLE0OVE7w3j2h02pJiPVeo4jJ+jogzvSzA5g9+Y4W7 m+eiPNiVN9vpIUX4RCuYVgLgv9YWXgIGOUroOBUzQySk/Y5YVNnlMfeQPL7E0BqWS5LL WMGg==
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=qi+A9b7KZmK24frGQYWkoVa8UmlEr3YlW5YPSrcVaPA=; b=QNFyNNUuiH5iGY9W9QjY+e8Jer+g5rCxup1knf9LnEcqw+tiTV8m2aYYfFgimXiQZU 0TGmJ4A1Ce+Bkit7MN0yP9e03H0MiN4OKGWu784Cg606iRqW7fntf4wJTuJ015u8sKX4 OkYZvCKI/dt3En79t7s0OjIOPHeTN4hi3AEIj8WI3CYDMtE8VZmV0+l9KJrsHYsngbAZ QobwZOiqc+5XGcCwjerxXvsAOUNt5gJFIoYwFoLwPPa7D+l825/H3KBt1j3OPzYutdne eoNUnNz+PRZnzPuR/f+RTqa8ag7h5VfkTto/eJiznV+mcH9nMaRyTREasNlm8U5EvOUd J5zw==
X-Gm-Message-State AD7BkJIXkPA+3LCEJhrQ/ge3sKcpAMyEXn9jpUL1SrMN+mC9J4/+9hY4YAefq957XeoFnA==
X-Received by 10.66.55.70 with SMTP id q6mr66518001pap.126.1459919925618; Tue, 05 Apr 2016 22:18:45 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-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
X-Original-Date Tue, 5 Apr 2016 22:18:44 -0700
X-Original-Message-ID <acaeee6c3c1f99900614baf99ab31e6e5b515970.1459918214.git.amsfield22@gmail.com>
X-Original-References <cover.1459918214.git.amsfield22@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1372191

Show key headers only | View raw


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 <amsfield22@gmail.com>
---
 drivers/iio/accel/mma7455_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/accel/mma7455_core.c b/drivers/iio/accel/mma7455_core.c
index c633cc2..c902f54 100644
--- a/drivers/iio/accel/mma7455_core.c
+++ b/drivers/iio/accel/mma7455_core.c
@@ -55,11 +55,11 @@
 
 struct mma7455_data {
 	struct regmap *regmap;
-	struct device *dev;
 };
 
 static int mma7455_drdy(struct mma7455_data *mma7455)
 {
+	struct device *dev = regmap_get_device(mma7455->regmap);
 	unsigned int reg;
 	int tries = 3;
 	int ret;
@@ -75,7 +75,7 @@ static int mma7455_drdy(struct mma7455_data *mma7455)
 		msleep(20);
 	}
 
-	dev_warn(mma7455->dev, "data not ready\n");
+	dev_warn(dev, "data not ready\n");
 
 	return -EIO;
 }
@@ -260,7 +260,6 @@ int mma7455_core_probe(struct device *dev, struct regmap *regmap,
 	dev_set_drvdata(dev, indio_dev);
 	mma7455 = iio_priv(indio_dev);
 	mma7455->regmap = regmap;
-	mma7455->dev = dev;
 
 	indio_dev->info = &mma7455_info;
 	indio_dev->name = name;
-- 
2.1.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device Alison Schofield <amsfield22@gmail.com> - 2016-04-06 07:20 +0200
  Re: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct device Joachim Eastwood <manabian@gmail.com> - 2016-04-06 09:40 +0200
    Re: [PATCH 5/9] iio: accel: mma7455: use regmap to retrieve struct  device Jonathan Cameron <jic23@kernel.org> - 2016-04-10 16:00 +0200

csiph-web