gpio-max3191x.c (c13aca79ff3c4af5fd31a5b2743a90eba6e36a26) | gpio-max3191x.c (b9762bebc6332b40c33e03dea03e30fa12d9e3ed) |
---|---|
1/* 2 * gpio-max3191x.c - GPIO driver for Maxim MAX3191x industrial serializer 3 * 4 * Copyright (C) 2017 KUNBUS GmbH 5 * 6 * The MAX3191x makes 8 digital 24V inputs available via SPI. 7 * Multiple chips can be daisy-chained, the spec does not impose 8 * a limit on the number of chips and neither does this driver. --- 301 unchanged lines hidden (view full) --- 310 mutex_unlock(&max3191x->lock); 311 return 0; 312} 313 314static void gpiod_set_array_single_value_cansleep(unsigned int ndescs, 315 struct gpio_desc **desc, 316 int value) 317{ | 1/* 2 * gpio-max3191x.c - GPIO driver for Maxim MAX3191x industrial serializer 3 * 4 * Copyright (C) 2017 KUNBUS GmbH 5 * 6 * The MAX3191x makes 8 digital 24V inputs available via SPI. 7 * Multiple chips can be daisy-chained, the spec does not impose 8 * a limit on the number of chips and neither does this driver. --- 301 unchanged lines hidden (view full) --- 310 mutex_unlock(&max3191x->lock); 311 return 0; 312} 313 314static void gpiod_set_array_single_value_cansleep(unsigned int ndescs, 315 struct gpio_desc **desc, 316 int value) 317{ |
318 int i, *values; | 318 unsigned long *values; |
319 | 319 |
320 values = kmalloc_array(ndescs, sizeof(*values), GFP_KERNEL); | 320 values = bitmap_alloc(ndescs, GFP_KERNEL); |
321 if (!values) 322 return; 323 | 321 if (!values) 322 return; 323 |
324 for (i = 0; i < ndescs; i++) 325 values[i] = value; | 324 if (value) 325 bitmap_fill(values, ndescs); 326 else 327 bitmap_zero(values, ndescs); |
326 327 gpiod_set_array_value_cansleep(ndescs, desc, values); 328 kfree(values); 329} 330 331static struct gpio_descs *devm_gpiod_get_array_optional_count( 332 struct device *dev, const char *con_id, 333 enum gpiod_flags flags, unsigned int expected) --- 164 unchanged lines hidden --- | 328 329 gpiod_set_array_value_cansleep(ndescs, desc, values); 330 kfree(values); 331} 332 333static struct gpio_descs *devm_gpiod_get_array_optional_count( 334 struct device *dev, const char *con_id, 335 enum gpiod_flags flags, unsigned int expected) --- 164 unchanged lines hidden --- |