summaryrefslogtreecommitdiffstats
path: root/drivers/iio/resolver/ad2s1210.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/resolver/ad2s1210.c')
-rw-r--r--drivers/iio/resolver/ad2s1210.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/iio/resolver/ad2s1210.c b/drivers/iio/resolver/ad2s1210.c
index b681129a99b6..ab860cedecd1 100644
--- a/drivers/iio/resolver/ad2s1210.c
+++ b/drivers/iio/resolver/ad2s1210.c
@@ -46,6 +46,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/bitmap.h>
#include <linux/bits.h>
#include <linux/cleanup.h>
#include <linux/clk.h>
@@ -175,15 +176,14 @@ struct ad2s1210_state {
static int ad2s1210_set_mode(struct ad2s1210_state *st, enum ad2s1210_mode mode)
{
struct gpio_descs *gpios = st->mode_gpios;
- DECLARE_BITMAP(bitmap, 2);
+ DECLARE_BITMAP(bitmap, 2) = { };
if (!gpios)
return mode == st->fixed_mode ? 0 : -EOPNOTSUPP;
- bitmap[0] = mode;
+ bitmap_write(bitmap, mode, 0, 2);
- return gpiod_set_array_value(gpios->ndescs, gpios->desc, gpios->info,
- bitmap);
+ return gpiod_multi_set_value_cansleep(gpios, bitmap);
}
/*
@@ -1427,7 +1427,7 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st)
struct device *dev = &st->sdev->dev;
struct gpio_descs *resolution_gpios;
struct gpio_desc *reset_gpio;
- DECLARE_BITMAP(bitmap, 2);
+ DECLARE_BITMAP(bitmap, 2) = { };
int ret;
/* should not be sampling on startup */
@@ -1471,12 +1471,9 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st)
return dev_err_probe(dev, -EINVAL,
"requires exactly 2 resolution-gpios\n");
- bitmap[0] = st->resolution;
+ bitmap_write(bitmap, st->resolution, 0, 2);
- ret = gpiod_set_array_value(resolution_gpios->ndescs,
- resolution_gpios->desc,
- resolution_gpios->info,
- bitmap);
+ ret = gpiod_multi_set_value_cansleep(resolution_gpios, bitmap);
if (ret < 0)
return dev_err_probe(dev, ret,
"failed to set resolution gpios\n");