linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging:iio:magnetometer:ak8975: remove 'mode' attribute
@ 2012-05-31 13:14 Leed Aguilar
  2012-05-31 14:30 ` Laxman Dewangan
  0 siblings, 1 reply; 3+ messages in thread
From: Leed Aguilar @ 2012-05-31 13:14 UTC (permalink / raw)
  To: linux-iio; +Cc: leed.aguilar, Jonathan Cameron, Laxman Dewangan

The raw data reading process (ak8975_read_axis) sets the
single measurement mode to take a sample and once the
conversion is completed the device enters into power-down
mode automatically, therefore there is no need to enable
a flag for this to happen.

Signed-off-by: Leed Aguilar <leed.aguilar@ti.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/staging/iio/magnetometer/ak8975.c |   73 -----------------------------
 1 files changed, 0 insertions(+), 73 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c
index b06bd2d..d271289 100644
--- a/drivers/staging/iio/magnetometer/ak8975.c
+++ b/drivers/staging/iio/magnetometer/ak8975.c
@@ -92,7 +92,6 @@ struct ak8975_data {
 	struct mutex		lock;
 	u8			asa[3];
 	long			raw_to_gauss[3];
-	bool			mode;
 	u8			reg_cache[AK8975_MAX_REGS];
 	int			eoc_gpio;
 	int			eoc_irq;
@@ -247,60 +246,6 @@ static int ak8975_setup(struct i2c_client *client)
 	return 0;
 }
 
-/*
- * Shows the device's mode.  0 = off, 1 = on.
- */
-static ssize_t show_mode(struct device *dev, struct device_attribute *devattr,
-			 char *buf)
-{
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct ak8975_data *data = iio_priv(indio_dev);
-
-	return sprintf(buf, "%u\n", data->mode);
-}
-
-/*
- * Sets the device's mode.  0 = off, 1 = on.  The device's mode must be on
- * for the magn raw attributes to be available.
- */
-static ssize_t store_mode(struct device *dev, struct device_attribute *devattr,
-			  const char *buf, size_t count)
-{
-	struct iio_dev *indio_dev = dev_get_drvdata(dev);
-	struct ak8975_data *data = iio_priv(indio_dev);
-	struct i2c_client *client = data->client;
-	bool value;
-	int ret;
-
-	/* Convert mode string and do some basic sanity checking on it.
-	   only 0 or 1 are valid. */
-	ret = strtobool(buf, &value);
-	if (ret < 0)
-		return ret;
-
-	mutex_lock(&data->lock);
-
-	/* Write the mode to the device. */
-	if (data->mode != value) {
-		ret = ak8975_write_data(client,
-					AK8975_REG_CNTL,
-					(u8)value,
-					AK8975_REG_CNTL_MODE_MASK,
-					AK8975_REG_CNTL_MODE_SHIFT);
-
-		if (ret < 0) {
-			dev_err(&client->dev, "Error in setting mode\n");
-			mutex_unlock(&data->lock);
-			return ret;
-		}
-		data->mode = value;
-	}
-
-	mutex_unlock(&data->lock);
-
-	return count;
-}
-
 static int wait_conversion_complete_gpio(struct ak8975_data *data)
 {
 	struct i2c_client *client = data->client;
@@ -368,12 +313,6 @@ static int ak8975_read_axis(struct iio_dev *indio_dev, int index, int *val)
 
 	mutex_lock(&data->lock);
 
-	if (data->mode == 0) {
-		dev_err(&client->dev, "Operating mode is in power down mode\n");
-		ret = -EBUSY;
-		goto exit;
-	}
-
 	/* Set up the device for taking a sample. */
 	ret = ak8975_write_data(client,
 				AK8975_REG_CNTL,
@@ -464,19 +403,7 @@ static const struct iio_chan_spec ak8975_channels[] = {
 	AK8975_CHANNEL(X, 0), AK8975_CHANNEL(Y, 1), AK8975_CHANNEL(Z, 2),
 };
 
-static IIO_DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 0);
-
-static struct attribute *ak8975_attr[] = {
-	&iio_dev_attr_mode.dev_attr.attr,
-	NULL
-};
-
-static struct attribute_group ak8975_attr_group = {
-	.attrs = ak8975_attr,
-};
-
 static const struct iio_info ak8975_info = {
-	.attrs = &ak8975_attr_group,
 	.read_raw = &ak8975_read_raw,
 	.driver_module = THIS_MODULE,
 };
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging:iio:magnetometer:ak8975: remove 'mode' attribute
  2012-05-31 13:14 [PATCH] staging:iio:magnetometer:ak8975: remove 'mode' attribute Leed Aguilar
@ 2012-05-31 14:30 ` Laxman Dewangan
  2012-06-01  8:00   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Laxman Dewangan @ 2012-05-31 14:30 UTC (permalink / raw)
  To: Leed Aguilar; +Cc: linux-iio@vger.kernel.org, Jonathan Cameron

On Thursday 31 May 2012 06:44 PM, Leed Aguilar wrote:
> The raw data reading process (ak8975_read_axis) sets the
> single measurement mode to take a sample and once the
> conversion is completed the device enters into power-down
> mode automatically, therefore there is no need to enable
> a flag for this to happen.
>
> Signed-off-by: Leed Aguilar<leed.aguilar@ti.com>
> Cc: Jonathan Cameron<jic23@kernel.org>
> Cc: Laxman Dewangan<ldewangan@nvidia.com>
> ---

Acked-by: Laxman Dewanagan <ldewangan@nvidia.com>


Looks good to me.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging:iio:magnetometer:ak8975: remove 'mode' attribute
  2012-05-31 14:30 ` Laxman Dewangan
@ 2012-06-01  8:00   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2012-06-01  8:00 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: Leed Aguilar, linux-iio@vger.kernel.org

On 5/31/2012 3:30 PM, Laxman Dewangan wrote:
> On Thursday 31 May 2012 06:44 PM, Leed Aguilar wrote:
>> The raw data reading process (ak8975_read_axis) sets the
>> single measurement mode to take a sample and once the
>> conversion is completed the device enters into power-down
>> mode automatically, therefore there is no need to enable
>> a flag for this to happen.
>>
>> Signed-off-by: Leed Aguilar<leed.aguilar@ti.com>
>> Cc: Jonathan Cameron<jic23@kernel.org>
>> Cc: Laxman Dewangan<ldewangan@nvidia.com>
>> ---
>
> Acked-by: Laxman Dewanagan <ldewangan@nvidia.com>
Acked-by: Jonathan Cameron <jic23@kernel.org

Please send a copy with the acks to GregKH@linuxfoundation.org
>
>
> Looks good to me.
>
> ----------------------------------------------------------------------------------- 
>
> This email message is for the sole use of the intended recipient(s) 
> and may contain
> confidential information.  Any unauthorized review, use, disclosure or 
> distribution
> is prohibited.  If you are not the intended recipient, please contact 
> the sender by
> reply email and destroy all copies of the original message.
> ----------------------------------------------------------------------------------- 
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-06-01  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 13:14 [PATCH] staging:iio:magnetometer:ak8975: remove 'mode' attribute Leed Aguilar
2012-05-31 14:30 ` Laxman Dewangan
2012-06-01  8:00   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).