From patchwork Wed Apr 6 05:19:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 8758351 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 E722F9F372 for ; Wed, 6 Apr 2016 05:19:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6C47200D4 for ; Wed, 6 Apr 2016 05:19:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6531F200E7 for ; Wed, 6 Apr 2016 05:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760934AbcDFFT3 (ORCPT ); Wed, 6 Apr 2016 01:19:29 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34018 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760262AbcDFFT2 (ORCPT ); Wed, 6 Apr 2016 01:19:28 -0400 Received: by mail-pa0-f66.google.com with SMTP id hb4so3082003pac.1; Tue, 05 Apr 2016 22:19:27 -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=PjpqsHmvOYAwbX94f8e1pfpvfdy2+a57Mh5E+gJ931U=; b=o+kOkjxGs0q0sJ6d+jVdaZpNtKxEPTVQuCUy7/uZhVY1bKSKaRZRoPAfV3Gp7pJxcg f4mGaBpak+uvNKlQsvbYQNbIfVX32DN1Lzowc0KMOiDdEHFpng1XcNQWaC0Jfq+o6isP grpEGPkDlgYQyvsbud/K1s/5xgzMfcVeU03W6YN49RSW4Nf4LRhUW3MBYmDILhj4PIvt Ufp0pMBJ2r4HfYcUkLBQbye7qinL8tYw/nh+yLUn22cHz4qjXB9Cx/Rly0Mhqvso2mxr LeEHXsa7L59Oyx2V0Bq5iVD3fpfLutl6yiB6wBU2SS7YwN4fdTyJ8WpuyRZ3F+LzAFtj m1GA== 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=PjpqsHmvOYAwbX94f8e1pfpvfdy2+a57Mh5E+gJ931U=; b=WUFj7ZDtJF2FmduXJ9mWEoNJUvNuiSbo8UVGwlNYceQ3s5HWvL2uryHBaYCJzvOrZE 3J1oc72fq63cSkjAjoR+7KxM/rvZF/Mcx6U97x09BHP22Lw9gkRsjVzmORnX/gqS+VMz OpxoXjbvibuD7ZGLIX8o8FE3spK/HMOoCeMaR56Oh1P7Fc2MbolCsbwVOGBDT2f5P1lk bc1tVwtkdOqzlSWyXtPYNGFIrrO1vvO6MVH7aENOzwQJZF7IXFCpHXXf4Y/78FYz65gO hddnhnUtcAETdQk1cWGnvWnheuB/vHQ3xDKQY3UopWe+UXGA+NxijUPnWWa2sp1u9YOX 6Iyw== X-Gm-Message-State: AD7BkJJu+i7yJDpdW9GfTQU++i3tKz5GGlZDW4+3y/F13OpyMtYnm8q4Ac9XOXwgNZ6sVA== X-Received: by 10.66.66.46 with SMTP id c14mr68177263pat.79.1459919966838; Tue, 05 Apr 2016 22:19:26 -0700 (PDT) Received: from d830 (or-67-232-74-92.dhcp.embarqhsd.net. [67.232.74.92]) by smtp.gmail.com with ESMTPSA id a22sm1386321pfj.2.2016.04.05.22.19.26 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 22:19:26 -0700 (PDT) Date: Tue, 5 Apr 2016 22:19:25 -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 6/9] iio: accel: mxc4005: use regmap to retrieve struct device Message-ID: <765e752b36e9b809217ed15aad75efb9593f22ce.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/accel/mxc4005.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/iio/accel/mxc4005.c b/drivers/iio/accel/mxc4005.c index c23f47a..013d511 100644 --- a/drivers/iio/accel/mxc4005.c +++ b/drivers/iio/accel/mxc4005.c @@ -60,7 +60,6 @@ enum mxc4005_range { }; struct mxc4005_data { - struct device *dev; struct mutex mutex; struct regmap *regmap; struct iio_trigger *dready_trig; @@ -140,12 +139,13 @@ static const struct regmap_config mxc4005_regmap_config = { static int mxc4005_read_xyz(struct mxc4005_data *data) { + struct device *dev = regmap_get_device(data->regmap); int ret; ret = regmap_bulk_read(data->regmap, MXC4005_REG_XOUT_UPPER, (u8 *) data->buffer, sizeof(data->buffer)); if (ret < 0) { - dev_err(data->dev, "failed to read axes\n"); + dev_err(dev, "failed to read axes\n"); return ret; } @@ -155,12 +155,13 @@ static int mxc4005_read_xyz(struct mxc4005_data *data) static int mxc4005_read_axis(struct mxc4005_data *data, unsigned int addr) { + struct device *dev = regmap_get_device(data->regmap); __be16 reg; int ret; ret = regmap_bulk_read(data->regmap, addr, (u8 *) ®, sizeof(reg)); if (ret < 0) { - dev_err(data->dev, "failed to read reg %02x\n", addr); + dev_err(dev, "failed to read reg %02x\n", addr); return ret; } @@ -169,13 +170,14 @@ static int mxc4005_read_axis(struct mxc4005_data *data, static int mxc4005_read_scale(struct mxc4005_data *data) { + struct device *dev = regmap_get_device(data->regmap); unsigned int reg; int ret; int i; ret = regmap_read(data->regmap, MXC4005_REG_CONTROL, ®); if (ret < 0) { - dev_err(data->dev, "failed to read reg_control\n"); + dev_err(dev, "failed to read reg_control\n"); return ret; } @@ -189,6 +191,7 @@ static int mxc4005_read_scale(struct mxc4005_data *data) static int mxc4005_set_scale(struct mxc4005_data *data, int val) { + struct device *dev = regmap_get_device(data->regmap); unsigned int reg; int i; int ret; @@ -201,8 +204,7 @@ static int mxc4005_set_scale(struct mxc4005_data *data, int val) MXC4005_REG_CONTROL_MASK_FSR, reg); if (ret < 0) - dev_err(data->dev, - "failed to write reg_control\n"); + dev_err(dev, "failed to write reg_control\n"); return ret; } } @@ -321,13 +323,14 @@ err: static int mxc4005_clr_intr(struct mxc4005_data *data) { + struct device *dev = regmap_get_device(data->regmap); int ret; /* clear interrupt */ ret = regmap_write(data->regmap, MXC4005_REG_INT_CLR1, MXC4005_REG_INT_CLR1_BIT_DRDYC); if (ret < 0) { - dev_err(data->dev, "failed to write to reg_int_clr1\n"); + dev_err(dev, "failed to write to reg_int_clr1\n"); return ret; } @@ -339,6 +342,7 @@ static int mxc4005_set_trigger_state(struct iio_trigger *trig, { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); struct mxc4005_data *data = iio_priv(indio_dev); + struct device *dev = regmap_get_device(data->regmap); int ret; mutex_lock(&data->mutex); @@ -352,7 +356,7 @@ static int mxc4005_set_trigger_state(struct iio_trigger *trig, if (ret < 0) { mutex_unlock(&data->mutex); - dev_err(data->dev, "failed to update reg_int_mask1"); + dev_err(dev, "failed to update reg_int_mask1"); return ret; } @@ -381,16 +385,17 @@ static const struct iio_trigger_ops mxc4005_trigger_ops = { static int mxc4005_chip_init(struct mxc4005_data *data) { + struct device *dev = regmap_get_device(data->regmap); int ret; unsigned int reg; ret = regmap_read(data->regmap, MXC4005_REG_DEVICE_ID, ®); if (ret < 0) { - dev_err(data->dev, "failed to read chip id\n"); + dev_err(dev, "failed to read chip id\n"); return ret; } - dev_dbg(data->dev, "MXC4005 chip id %02x\n", reg); + dev_dbg(dev, "MXC4005 chip id %02x\n", reg); return 0; } @@ -415,7 +420,6 @@ static int mxc4005_probe(struct i2c_client *client, data = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); - data->dev = &client->dev; data->regmap = regmap; ret = mxc4005_chip_init(data);