ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
[linux/fpc-iii.git] / drivers / iio / gyro / bmg160_i2c.c
blob90126a5a7663399cb7815de8262eb961c8e608ef
1 #include <linux/i2c.h>
2 #include <linux/regmap.h>
3 #include <linux/iio/iio.h>
4 #include <linux/module.h>
5 #include <linux/acpi.h>
7 #include "bmg160.h"
9 static const struct regmap_config bmg160_regmap_i2c_conf = {
10 .reg_bits = 8,
11 .val_bits = 8,
12 .max_register = 0x3f
15 static int bmg160_i2c_probe(struct i2c_client *client,
16 const struct i2c_device_id *id)
18 struct regmap *regmap;
19 const char *name = NULL;
21 regmap = devm_regmap_init_i2c(client, &bmg160_regmap_i2c_conf);
22 if (IS_ERR(regmap)) {
23 dev_err(&client->dev, "Failed to register i2c regmap %d\n",
24 (int)PTR_ERR(regmap));
25 return PTR_ERR(regmap);
28 if (id)
29 name = id->name;
31 return bmg160_core_probe(&client->dev, regmap, client->irq, name);
34 static int bmg160_i2c_remove(struct i2c_client *client)
36 bmg160_core_remove(&client->dev);
38 return 0;
41 static const struct acpi_device_id bmg160_acpi_match[] = {
42 {"BMG0160", 0},
43 {"BMI055B", 0},
44 {},
47 MODULE_DEVICE_TABLE(acpi, bmg160_acpi_match);
49 static const struct i2c_device_id bmg160_i2c_id[] = {
50 {"bmg160", 0},
51 {"bmi055_gyro", 0},
55 MODULE_DEVICE_TABLE(i2c, bmg160_i2c_id);
57 static struct i2c_driver bmg160_i2c_driver = {
58 .driver = {
59 .name = "bmg160_i2c",
60 .acpi_match_table = ACPI_PTR(bmg160_acpi_match),
61 .pm = &bmg160_pm_ops,
63 .probe = bmg160_i2c_probe,
64 .remove = bmg160_i2c_remove,
65 .id_table = bmg160_i2c_id,
67 module_i2c_driver(bmg160_i2c_driver);
69 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
70 MODULE_LICENSE("GPL v2");
71 MODULE_DESCRIPTION("BMG160 I2C Gyro driver");