summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/magnetometer/hmc5843.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-27 11:32:29 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-27 11:32:29 -0300
commit50953e0640b3473dcb409d5d0d938c2742c93b0d (patch)
tree3b0dc374e61564fbbd8adff92c8fae16fdeb423a /drivers/staging/iio/magnetometer/hmc5843.c
parentf92c97c8bd77992ff8bd6ef29a23dc82dca799cb (diff)
parent626cf236608505d376e4799adb4f7eb00a8594af (diff)
downloadop-kernel-dev-50953e0640b3473dcb409d5d0d938c2742c93b0d.zip
op-kernel-dev-50953e0640b3473dcb409d5d0d938c2742c93b0d.tar.gz
Merge branch 'poll' into staging/for_v3.4
* poll: (5970 commits) poll: add poll_requested_events() and poll_does_not_wait() functions crc32: select an algorithm via Kconfig crc32: add self-test code for crc32c crypto: crc32c should use library implementation crc32: bolt on crc32c crc32: add note about this patchset to crc32.c crc32: optimize loop counter for x86 crc32: add slice-by-8 algorithm to existing code crc32: make CRC_*_BITS definition correspond to actual bit counts crc32: fix mixing of endian-specific types crc32: miscellaneous cleanups crc32: simplify unit test code crc32: move long comment about crc32 fundamentals to Documentation/ crc32: remove two instances of trailing whitespaces checkpatch: check for quoted strings broken across lines checkpatch: whitespace - add/remove blank lines checkpatch: warn on use of yield() checkpatch: add --strict tests for braces, comments and casts checkpatch: add [] to type extensions checkpatch: high precedence operators do not require additional parentheses in #defines ...
Diffstat (limited to 'drivers/staging/iio/magnetometer/hmc5843.c')
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index f2e85a9..91dd3da 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -86,7 +86,7 @@
#define RATE_NOT_USED 0x07
/*
- * Device Configutration
+ * Device Configuration
*/
#define CONF_NORMAL 0x00
#define CONF_POSITIVE_BIAS 0x01
@@ -142,7 +142,7 @@ static s32 hmc5843_configure(struct i2c_client *client,
(operating_mode & 0x03));
}
-/* Return the measurement value from the specified channel */
+/* Return the measurement value from the specified channel */
static int hmc5843_read_measurement(struct iio_dev *indio_dev,
int address,
int *val)
@@ -169,7 +169,7 @@ static int hmc5843_read_measurement(struct iio_dev *indio_dev,
/*
* From the datasheet
* 0 - Continuous-Conversion Mode: In continuous-conversion mode, the
- * device continuously performs conversions an places the result in the
+ * device continuously performs conversions and places the result in the
* data register.
*
* 1 - Single-Conversion Mode : device performs a single measurement,
@@ -588,19 +588,26 @@ static int hmc5843_remove(struct i2c_client *client)
return 0;
}
-static int hmc5843_suspend(struct i2c_client *client, pm_message_t mesg)
+#ifdef CONFIG_PM_SLEEP
+static int hmc5843_suspend(struct device *dev)
{
- hmc5843_configure(client, MODE_SLEEP);
+ hmc5843_configure(to_i2c_client(dev), MODE_SLEEP);
return 0;
}
-static int hmc5843_resume(struct i2c_client *client)
+static int hmc5843_resume(struct device *dev)
{
- struct hmc5843_data *data = i2c_get_clientdata(client);
- hmc5843_configure(client, data->operating_mode);
+ struct hmc5843_data *data = i2c_get_clientdata(to_i2c_client(dev));
+ hmc5843_configure(to_i2c_client(dev), data->operating_mode);
return 0;
}
+static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, hmc5843_suspend, hmc5843_resume);
+#define HMC5843_PM_OPS (&hmc5843_pm_ops)
+#else
+#define HMC5843_PM_OPS NULL
+#endif
+
static const struct i2c_device_id hmc5843_id[] = {
{ "hmc5843", 0 },
{ }
@@ -610,14 +617,13 @@ MODULE_DEVICE_TABLE(i2c, hmc5843_id);
static struct i2c_driver hmc5843_driver = {
.driver = {
.name = "hmc5843",
+ .pm = HMC5843_PM_OPS,
},
.id_table = hmc5843_id,
.probe = hmc5843_probe,
.remove = hmc5843_remove,
.detect = hmc5843_detect,
.address_list = normal_i2c,
- .suspend = hmc5843_suspend,
- .resume = hmc5843_resume,
};
module_i2c_driver(hmc5843_driver);
OpenPOWER on IntegriCloud