iio: accel: bmc150: Move struct bmc150_accel_data definition to bmc150-accel.h
authorHans de Goede <hdegoede@redhat.com>
Sun, 23 May 2021 17:00:59 +0000 (19:00 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 9 Jun 2021 19:52:17 +0000 (20:52 +0100)
Further patches to bmc150-accel-i2c.c need to store some extra info
(on top of the second_dev pointer) in the bmc150_accel_data struct,
rather then adding yet more accessor functions for this lets just
move the struct bmc150_accel_data definition to bmc150-accel.h.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210523170103.176958-6-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/bmc150-accel-core.c
drivers/iio/accel/bmc150-accel.h

index 1aec873bee038cdb63dc9bfa13ad6a6684116664..d90874fc3ca0fbd1434468287438304de4eba2b5 100644 (file)
@@ -157,59 +157,6 @@ struct bmc150_accel_chip_info {
        const struct bmc150_scale_info scale_table[4];
 };
 
-struct bmc150_accel_interrupt {
-       const struct bmc150_accel_interrupt_info *info;
-       atomic_t users;
-};
-
-struct bmc150_accel_trigger {
-       struct bmc150_accel_data *data;
-       struct iio_trigger *indio_trig;
-       int (*setup)(struct bmc150_accel_trigger *t, bool state);
-       int intr;
-       bool enabled;
-};
-
-enum bmc150_accel_interrupt_id {
-       BMC150_ACCEL_INT_DATA_READY,
-       BMC150_ACCEL_INT_ANY_MOTION,
-       BMC150_ACCEL_INT_WATERMARK,
-       BMC150_ACCEL_INTERRUPTS,
-};
-
-enum bmc150_accel_trigger_id {
-       BMC150_ACCEL_TRIGGER_DATA_READY,
-       BMC150_ACCEL_TRIGGER_ANY_MOTION,
-       BMC150_ACCEL_TRIGGERS,
-};
-
-struct bmc150_accel_data {
-       struct regmap *regmap;
-       struct regulator_bulk_data regulators[2];
-       struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
-       struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
-       struct mutex mutex;
-       u8 fifo_mode, watermark;
-       s16 buffer[8];
-       /*
-        * Ensure there is sufficient space and correct alignment for
-        * the timestamp if enabled
-        */
-       struct {
-               __le16 channels[3];
-               s64 ts __aligned(8);
-       } scan;
-       u8 bw_bits;
-       u32 slope_dur;
-       u32 slope_thres;
-       u32 range;
-       int ev_enable_state;
-       int64_t timestamp, old_timestamp; /* Only used in hw fifo mode. */
-       const struct bmc150_accel_chip_info *chip_info;
-       struct i2c_client *second_device;
-       struct iio_mount_matrix orientation;
-};
-
 static const struct {
        int val;
        int val2;
index e30c1698f6fbd3e3bc4f9f612cbc55f170f1dea9..f503c5b5801e23652488627d31fb6df9bc5653f2 100644 (file)
@@ -2,7 +2,68 @@
 #ifndef _BMC150_ACCEL_H_
 #define _BMC150_ACCEL_H_
 
+#include <linux/atomic.h>
+#include <linux/iio/iio.h>
+#include <linux/mutex.h>
+#include <linux/regulator/consumer.h>
+
 struct regmap;
+struct i2c_client;
+struct bmc150_accel_chip_info;
+struct bmc150_accel_interrupt_info;
+
+struct bmc150_accel_interrupt {
+       const struct bmc150_accel_interrupt_info *info;
+       atomic_t users;
+};
+
+struct bmc150_accel_trigger {
+       struct bmc150_accel_data *data;
+       struct iio_trigger *indio_trig;
+       int (*setup)(struct bmc150_accel_trigger *t, bool state);
+       int intr;
+       bool enabled;
+};
+
+enum bmc150_accel_interrupt_id {
+       BMC150_ACCEL_INT_DATA_READY,
+       BMC150_ACCEL_INT_ANY_MOTION,
+       BMC150_ACCEL_INT_WATERMARK,
+       BMC150_ACCEL_INTERRUPTS,
+};
+
+enum bmc150_accel_trigger_id {
+       BMC150_ACCEL_TRIGGER_DATA_READY,
+       BMC150_ACCEL_TRIGGER_ANY_MOTION,
+       BMC150_ACCEL_TRIGGERS,
+};
+
+struct bmc150_accel_data {
+       struct regmap *regmap;
+       struct regulator_bulk_data regulators[2];
+       struct bmc150_accel_interrupt interrupts[BMC150_ACCEL_INTERRUPTS];
+       struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
+       struct mutex mutex;
+       u8 fifo_mode, watermark;
+       s16 buffer[8];
+       /*
+        * Ensure there is sufficient space and correct alignment for
+        * the timestamp if enabled
+        */
+       struct {
+               __le16 channels[3];
+               s64 ts __aligned(8);
+       } scan;
+       u8 bw_bits;
+       u32 slope_dur;
+       u32 slope_thres;
+       u32 range;
+       int ev_enable_state;
+       int64_t timestamp, old_timestamp; /* Only used in hw fifo mode. */
+       const struct bmc150_accel_chip_info *chip_info;
+       struct i2c_client *second_device;
+       struct iio_mount_matrix orientation;
+};
 
 enum {
        bmc150,