Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'ib-array-bitmaps' into devel

+399 -189
+15
Documentation/driver-api/gpio/board.rst
··· 193 193 194 194 The line will be hogged as soon as the gpiochip is created or - in case the 195 195 chip was created earlier - when the hog table is registered. 196 + 197 + Arrays of pins 198 + -------------- 199 + In addition to requesting pins belonging to a function one by one, a device may 200 + also request an array of pins assigned to the function. The way those pins are 201 + mapped to the device determines if the array qualifies for fast bitmap 202 + processing. If yes, a bitmap is passed over get/set array functions directly 203 + between a caller and a respective .get/set_multiple() callback of a GPIO chip. 204 + 205 + In order to qualify for fast bitmap processing, the pin mapping must meet the 206 + following requirements: 207 + - it must belong to the same chip as other 'fast' pins of the function, 208 + - its index within the function must match its hardware number within the chip. 209 + 210 + Open drain and open source pins are excluded from fast bitmap output processing.
+33 -13
Documentation/driver-api/gpio/consumer.rst
··· 109 109 enum gpiod_flags flags) 110 110 111 111 This function returns a struct gpio_descs which contains an array of 112 - descriptors:: 112 + descriptors. It also contains a pointer to a gpiolib private structure which, 113 + if passed back to get/set array functions, may speed up I/O proocessing:: 113 114 114 115 struct gpio_descs { 116 + struct gpio_array *info; 115 117 unsigned int ndescs; 116 118 struct gpio_desc *desc[]; 117 119 } ··· 325 323 326 324 int gpiod_get_array_value(unsigned int array_size, 327 325 struct gpio_desc **desc_array, 328 - int *value_array); 326 + struct gpio_array *array_info, 327 + unsigned long *value_bitmap); 329 328 int gpiod_get_raw_array_value(unsigned int array_size, 330 329 struct gpio_desc **desc_array, 331 - int *value_array); 330 + struct gpio_array *array_info, 331 + unsigned long *value_bitmap); 332 332 int gpiod_get_array_value_cansleep(unsigned int array_size, 333 333 struct gpio_desc **desc_array, 334 - int *value_array); 334 + struct gpio_array *array_info, 335 + unsigned long *value_bitmap); 335 336 int gpiod_get_raw_array_value_cansleep(unsigned int array_size, 336 337 struct gpio_desc **desc_array, 337 - int *value_array); 338 + struct gpio_array *array_info, 339 + unsigned long *value_bitmap); 338 340 339 341 void gpiod_set_array_value(unsigned int array_size, 340 342 struct gpio_desc **desc_array, 341 - int *value_array) 343 + struct gpio_array *array_info, 344 + unsigned long *value_bitmap) 342 345 void gpiod_set_raw_array_value(unsigned int array_size, 343 346 struct gpio_desc **desc_array, 344 - int *value_array) 347 + struct gpio_array *array_info, 348 + unsigned long *value_bitmap) 345 349 void gpiod_set_array_value_cansleep(unsigned int array_size, 346 350 struct gpio_desc **desc_array, 347 - int *value_array) 351 + struct gpio_array *array_info, 352 + unsigned long *value_bitmap) 348 353 void gpiod_set_raw_array_value_cansleep(unsigned int array_size, 349 354 struct gpio_desc **desc_array, 350 - int *value_array) 355 + struct gpio_array *array_info, 356 + unsigned long *value_bitmap) 351 357 352 358 The array can be an arbitrary set of GPIOs. The functions will try to access 353 359 GPIOs belonging to the same bank or chip simultaneously if supported by the ··· 366 356 The functions take three arguments: 367 357 * array_size - the number of array elements 368 358 * desc_array - an array of GPIO descriptors 369 - * value_array - an array to store the GPIOs' values (get) or 370 - an array of values to assign to the GPIOs (set) 359 + * array_info - optional information obtained from gpiod_array_get() 360 + * value_bitmap - a bitmap to store the GPIOs' values (get) or 361 + a bitmap of values to assign to the GPIOs (set) 371 362 372 363 The descriptor array can be obtained using the gpiod_get_array() function 373 364 or one of its variants. If the group of descriptors returned by that function ··· 377 366 378 367 struct gpio_descs *my_gpio_descs = gpiod_get_array(...); 379 368 gpiod_set_array_value(my_gpio_descs->ndescs, my_gpio_descs->desc, 380 - my_gpio_values); 369 + my_gpio_descs->info, my_gpio_value_bitmap); 381 370 382 371 It is also possible to access a completely arbitrary array of descriptors. The 383 372 descriptors may be obtained using any combination of gpiod_get() and 384 373 gpiod_get_array(). Afterwards the array of descriptors has to be setup 385 - manually before it can be passed to one of the above functions. 374 + manually before it can be passed to one of the above functions. In that case, 375 + array_info should be set to NULL. 386 376 387 377 Note that for optimal performance GPIOs belonging to the same chip should be 388 378 contiguous within the array of descriptors. 379 + 380 + Still better performance may be achieved if array indexes of the descriptors 381 + match hardware pin numbers of a single chip. If an array passed to a get/set 382 + array function matches the one obtained from gpiod_get_array() and array_info 383 + associated with the array is also passed, the function may take a fast bitmap 384 + processing path, passing the value_bitmap argument directly to the respective 385 + .get/set_multiple() callback of the chip. That allows for utilization of GPIO 386 + banks as data I/O ports without much loss of performance. 389 387 390 388 The return value of gpiod_get_array_value() and its variants is 0 on success 391 389 or negative on error. Note the difference to gpiod_get_value(), which returns
+20 -39
drivers/auxdisplay/hd44780.c
··· 62 62 /* write to an LCD panel register in 8 bit GPIO mode */ 63 63 static void hd44780_write_gpio8(struct hd44780 *hd, u8 val, unsigned int rs) 64 64 { 65 - int values[10]; /* for DATA[0-7], RS, RW */ 66 - unsigned int i, n; 65 + DECLARE_BITMAP(values, 10); /* for DATA[0-7], RS, RW */ 66 + unsigned int n; 67 67 68 - for (i = 0; i < 8; i++) 69 - values[PIN_DATA0 + i] = !!(val & BIT(i)); 70 - values[PIN_CTRL_RS] = rs; 71 - n = 9; 72 - if (hd->pins[PIN_CTRL_RW]) { 73 - values[PIN_CTRL_RW] = 0; 74 - n++; 75 - } 68 + values[0] = val; 69 + __assign_bit(8, values, rs); 70 + n = hd->pins[PIN_CTRL_RW] ? 10 : 9; 76 71 77 72 /* Present the data to the port */ 78 - gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA0], values); 73 + gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA0], NULL, values); 79 74 80 75 hd44780_strobe_gpio(hd); 81 76 } ··· 78 83 /* write to an LCD panel register in 4 bit GPIO mode */ 79 84 static void hd44780_write_gpio4(struct hd44780 *hd, u8 val, unsigned int rs) 80 85 { 81 - int values[10]; /* for DATA[0-7], RS, RW, but DATA[0-3] is unused */ 82 - unsigned int i, n; 86 + DECLARE_BITMAP(values, 6); /* for DATA[4-7], RS, RW */ 87 + unsigned int n; 83 88 84 89 /* High nibble + RS, RW */ 85 - for (i = 4; i < 8; i++) 86 - values[PIN_DATA0 + i] = !!(val & BIT(i)); 87 - values[PIN_CTRL_RS] = rs; 88 - n = 5; 89 - if (hd->pins[PIN_CTRL_RW]) { 90 - values[PIN_CTRL_RW] = 0; 91 - n++; 92 - } 90 + values[0] = val >> 4; 91 + __assign_bit(4, values, rs); 92 + n = hd->pins[PIN_CTRL_RW] ? 6 : 5; 93 93 94 94 /* Present the data to the port */ 95 - gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], 96 - &values[PIN_DATA4]); 95 + gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); 97 96 98 97 hd44780_strobe_gpio(hd); 99 98 100 99 /* Low nibble */ 101 - for (i = 0; i < 4; i++) 102 - values[PIN_DATA4 + i] = !!(val & BIT(i)); 100 + values[0] &= ~0x0fUL; 101 + values[0] |= val & 0x0f; 103 102 104 103 /* Present the data to the port */ 105 - gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], 106 - &values[PIN_DATA4]); 104 + gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); 107 105 108 106 hd44780_strobe_gpio(hd); 109 107 } ··· 143 155 /* Send 4-bits of a command to the LCD panel in raw 4 bit GPIO mode */ 144 156 static void hd44780_write_cmd_raw_gpio4(struct charlcd *lcd, int cmd) 145 157 { 146 - int values[10]; /* for DATA[0-7], RS, RW, but DATA[0-3] is unused */ 158 + DECLARE_BITMAP(values, 6); /* for DATA[4-7], RS, RW */ 147 159 struct hd44780 *hd = lcd->drvdata; 148 - unsigned int i, n; 160 + unsigned int n; 149 161 150 162 /* Command nibble + RS, RW */ 151 - for (i = 0; i < 4; i++) 152 - values[PIN_DATA4 + i] = !!(cmd & BIT(i)); 153 - values[PIN_CTRL_RS] = 0; 154 - n = 5; 155 - if (hd->pins[PIN_CTRL_RW]) { 156 - values[PIN_CTRL_RW] = 0; 157 - n++; 158 - } 163 + values[0] = cmd & 0x0f; 164 + n = hd->pins[PIN_CTRL_RW] ? 6 : 5; 159 165 160 166 /* Present the data to the port */ 161 - gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], 162 - &values[PIN_DATA4]); 167 + gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4], NULL, values); 163 168 164 169 hd44780_strobe_gpio(hd); 165 170 }
+7 -13
drivers/bus/ts-nbus.c
··· 110 110 */ 111 111 static void ts_nbus_reset_bus(struct ts_nbus *ts_nbus) 112 112 { 113 - int i; 114 - int values[8]; 113 + DECLARE_BITMAP(values, 8); 115 114 116 - for (i = 0; i < 8; i++) 117 - values[i] = 0; 115 + values[0] = 0; 118 116 119 - gpiod_set_array_value_cansleep(8, ts_nbus->data->desc, values); 117 + gpiod_set_array_value_cansleep(8, ts_nbus->data->desc, 118 + ts_nbus->data->info, values); 120 119 gpiod_set_value_cansleep(ts_nbus->csn, 0); 121 120 gpiod_set_value_cansleep(ts_nbus->strobe, 0); 122 121 gpiod_set_value_cansleep(ts_nbus->ale, 0); ··· 156 157 static void ts_nbus_write_byte(struct ts_nbus *ts_nbus, u8 byte) 157 158 { 158 159 struct gpio_descs *gpios = ts_nbus->data; 159 - int i; 160 - int values[8]; 160 + DECLARE_BITMAP(values, 8); 161 161 162 - for (i = 0; i < 8; i++) 163 - if (byte & BIT(i)) 164 - values[i] = 1; 165 - else 166 - values[i] = 0; 162 + values[0] = byte; 167 163 168 - gpiod_set_array_value_cansleep(8, gpios->desc, values); 164 + gpiod_set_array_value_cansleep(8, gpios->desc, gpios->info, values); 169 165 } 170 166 171 167 /*
+10 -6
drivers/gpio/gpio-max3191x.c
··· 313 313 314 314 static void gpiod_set_array_single_value_cansleep(unsigned int ndescs, 315 315 struct gpio_desc **desc, 316 + struct gpio_array *info, 316 317 int value) 317 318 { 318 - int i, *values; 319 + unsigned long *values; 319 320 320 - values = kmalloc_array(ndescs, sizeof(*values), GFP_KERNEL); 321 + values = bitmap_alloc(ndescs, GFP_KERNEL); 321 322 if (!values) 322 323 return; 323 324 324 - for (i = 0; i < ndescs; i++) 325 - values[i] = value; 325 + if (value) 326 + bitmap_fill(values, ndescs); 327 + else 328 + bitmap_zero(values, ndescs); 326 329 327 - gpiod_set_array_value_cansleep(ndescs, desc, values); 330 + gpiod_set_array_value_cansleep(ndescs, desc, info, values); 328 331 kfree(values); 329 332 } 330 333 ··· 400 397 if (max3191x->modesel_pins) 401 398 gpiod_set_array_single_value_cansleep( 402 399 max3191x->modesel_pins->ndescs, 403 - max3191x->modesel_pins->desc, max3191x->mode); 400 + max3191x->modesel_pins->desc, 401 + max3191x->modesel_pins->info, max3191x->mode); 404 402 405 403 max3191x->ignore_uv = device_property_read_bool(dev, 406 404 "maxim,ignore-undervoltage");
+220 -45
drivers/gpio/gpiolib.c
··· 427 427 struct linehandle_state *lh = filep->private_data; 428 428 void __user *ip = (void __user *)arg; 429 429 struct gpiohandle_data ghd; 430 - int vals[GPIOHANDLES_MAX]; 430 + DECLARE_BITMAP(vals, GPIOHANDLES_MAX); 431 431 int i; 432 432 433 433 if (cmd == GPIOHANDLE_GET_LINE_VALUES_IOCTL) { ··· 436 436 true, 437 437 lh->numdescs, 438 438 lh->descs, 439 + NULL, 439 440 vals); 440 441 if (ret) 441 442 return ret; 442 443 443 444 memset(&ghd, 0, sizeof(ghd)); 444 445 for (i = 0; i < lh->numdescs; i++) 445 - ghd.values[i] = vals[i]; 446 + ghd.values[i] = test_bit(i, vals); 446 447 447 448 if (copy_to_user(ip, &ghd, sizeof(ghd))) 448 449 return -EFAULT; ··· 462 461 463 462 /* Clamp all values to [0,1] */ 464 463 for (i = 0; i < lh->numdescs; i++) 465 - vals[i] = !!ghd.values[i]; 464 + __assign_bit(i, vals, ghd.values[i]); 466 465 467 466 /* Reuse the array setting function */ 468 467 return gpiod_set_array_value_complex(false, 469 468 true, 470 469 lh->numdescs, 471 470 lh->descs, 471 + NULL, 472 472 vals); 473 473 } 474 474 return -EINVAL; ··· 2815 2813 int gpiod_get_array_value_complex(bool raw, bool can_sleep, 2816 2814 unsigned int array_size, 2817 2815 struct gpio_desc **desc_array, 2818 - int *value_array) 2816 + struct gpio_array *array_info, 2817 + unsigned long *value_bitmap) 2819 2818 { 2820 - int i = 0; 2819 + int err, i = 0; 2820 + 2821 + /* 2822 + * Validate array_info against desc_array and its size. 2823 + * It should immediately follow desc_array if both 2824 + * have been obtained from the same gpiod_get_array() call. 2825 + */ 2826 + if (array_info && array_info->desc == desc_array && 2827 + array_size <= array_info->size && 2828 + (void *)array_info == desc_array + array_info->size) { 2829 + if (!can_sleep) 2830 + WARN_ON(array_info->chip->can_sleep); 2831 + 2832 + err = gpio_chip_get_multiple(array_info->chip, 2833 + array_info->get_mask, 2834 + value_bitmap); 2835 + if (err) 2836 + return err; 2837 + 2838 + if (!raw && !bitmap_empty(array_info->invert_mask, array_size)) 2839 + bitmap_xor(value_bitmap, value_bitmap, 2840 + array_info->invert_mask, array_size); 2841 + 2842 + if (bitmap_full(array_info->get_mask, array_size)) 2843 + return 0; 2844 + 2845 + i = find_first_zero_bit(array_info->get_mask, array_size); 2846 + } else { 2847 + array_info = NULL; 2848 + } 2821 2849 2822 2850 while (i < array_size) { 2823 2851 struct gpio_chip *chip = desc_array[i]->gdev->chip; ··· 2878 2846 int hwgpio = gpio_chip_hwgpio(desc); 2879 2847 2880 2848 __set_bit(hwgpio, mask); 2881 - i++; 2849 + 2850 + if (array_info) 2851 + find_next_zero_bit(array_info->get_mask, 2852 + array_size, i); 2853 + else 2854 + i++; 2882 2855 } while ((i < array_size) && 2883 2856 (desc_array[i]->gdev->chip == chip)); 2884 2857 ··· 2894 2857 return ret; 2895 2858 } 2896 2859 2897 - for (j = first; j < i; j++) { 2860 + for (j = first; j < i; ) { 2898 2861 const struct gpio_desc *desc = desc_array[j]; 2899 2862 int hwgpio = gpio_chip_hwgpio(desc); 2900 2863 int value = test_bit(hwgpio, bits); 2901 2864 2902 2865 if (!raw && test_bit(FLAG_ACTIVE_LOW, &desc->flags)) 2903 2866 value = !value; 2904 - value_array[j] = value; 2867 + __assign_bit(j, value_bitmap, value); 2905 2868 trace_gpio_value(desc_to_gpio(desc), 1, value); 2869 + 2870 + if (array_info) 2871 + find_next_zero_bit(array_info->get_mask, i, j); 2872 + else 2873 + j++; 2906 2874 } 2907 2875 2908 2876 if (mask != fastpath) ··· 2966 2924 2967 2925 /** 2968 2926 * gpiod_get_raw_array_value() - read raw values from an array of GPIOs 2969 - * @array_size: number of elements in the descriptor / value arrays 2927 + * @array_size: number of elements in the descriptor array / value bitmap 2970 2928 * @desc_array: array of GPIO descriptors whose values will be read 2971 - * @value_array: array to store the read values 2929 + * @array_info: information on applicability of fast bitmap processing path 2930 + * @value_bitmap: bitmap to store the read values 2972 2931 * 2973 2932 * Read the raw values of the GPIOs, i.e. the values of the physical lines 2974 2933 * without regard for their ACTIVE_LOW status. Return 0 in case of success, ··· 2979 2936 * and it will complain if the GPIO chip functions potentially sleep. 2980 2937 */ 2981 2938 int gpiod_get_raw_array_value(unsigned int array_size, 2982 - struct gpio_desc **desc_array, int *value_array) 2939 + struct gpio_desc **desc_array, 2940 + struct gpio_array *array_info, 2941 + unsigned long *value_bitmap) 2983 2942 { 2984 2943 if (!desc_array) 2985 2944 return -EINVAL; 2986 2945 return gpiod_get_array_value_complex(true, false, array_size, 2987 - desc_array, value_array); 2946 + desc_array, array_info, 2947 + value_bitmap); 2988 2948 } 2989 2949 EXPORT_SYMBOL_GPL(gpiod_get_raw_array_value); 2990 2950 2991 2951 /** 2992 2952 * gpiod_get_array_value() - read values from an array of GPIOs 2993 - * @array_size: number of elements in the descriptor / value arrays 2953 + * @array_size: number of elements in the descriptor array / value bitmap 2994 2954 * @desc_array: array of GPIO descriptors whose values will be read 2995 - * @value_array: array to store the read values 2955 + * @array_info: information on applicability of fast bitmap processing path 2956 + * @value_bitmap: bitmap to store the read values 2996 2957 * 2997 2958 * Read the logical values of the GPIOs, i.e. taking their ACTIVE_LOW status 2998 2959 * into account. Return 0 in case of success, else an error code. ··· 3005 2958 * and it will complain if the GPIO chip functions potentially sleep. 3006 2959 */ 3007 2960 int gpiod_get_array_value(unsigned int array_size, 3008 - struct gpio_desc **desc_array, int *value_array) 2961 + struct gpio_desc **desc_array, 2962 + struct gpio_array *array_info, 2963 + unsigned long *value_bitmap) 3009 2964 { 3010 2965 if (!desc_array) 3011 2966 return -EINVAL; 3012 2967 return gpiod_get_array_value_complex(false, false, array_size, 3013 - desc_array, value_array); 2968 + desc_array, array_info, 2969 + value_bitmap); 3014 2970 } 3015 2971 EXPORT_SYMBOL_GPL(gpiod_get_array_value); 3016 2972 ··· 3106 3056 int gpiod_set_array_value_complex(bool raw, bool can_sleep, 3107 3057 unsigned int array_size, 3108 3058 struct gpio_desc **desc_array, 3109 - int *value_array) 3059 + struct gpio_array *array_info, 3060 + unsigned long *value_bitmap) 3110 3061 { 3111 3062 int i = 0; 3063 + 3064 + /* 3065 + * Validate array_info against desc_array and its size. 3066 + * It should immediately follow desc_array if both 3067 + * have been obtained from the same gpiod_get_array() call. 3068 + */ 3069 + if (array_info && array_info->desc == desc_array && 3070 + array_size <= array_info->size && 3071 + (void *)array_info == desc_array + array_info->size) { 3072 + if (!can_sleep) 3073 + WARN_ON(array_info->chip->can_sleep); 3074 + 3075 + if (!raw && !bitmap_empty(array_info->invert_mask, array_size)) 3076 + bitmap_xor(value_bitmap, value_bitmap, 3077 + array_info->invert_mask, array_size); 3078 + 3079 + gpio_chip_set_multiple(array_info->chip, array_info->set_mask, 3080 + value_bitmap); 3081 + 3082 + if (bitmap_full(array_info->set_mask, array_size)) 3083 + return 0; 3084 + 3085 + i = find_first_zero_bit(array_info->set_mask, array_size); 3086 + } else { 3087 + array_info = NULL; 3088 + } 3112 3089 3113 3090 while (i < array_size) { 3114 3091 struct gpio_chip *chip = desc_array[i]->gdev->chip; ··· 3162 3085 do { 3163 3086 struct gpio_desc *desc = desc_array[i]; 3164 3087 int hwgpio = gpio_chip_hwgpio(desc); 3165 - int value = value_array[i]; 3088 + int value = test_bit(i, value_bitmap); 3166 3089 3167 - if (!raw && test_bit(FLAG_ACTIVE_LOW, &desc->flags)) 3090 + /* 3091 + * Pins applicable for fast input but not for 3092 + * fast output processing may have been already 3093 + * inverted inside the fast path, skip them. 3094 + */ 3095 + if (!raw && !(array_info && 3096 + test_bit(i, array_info->invert_mask)) && 3097 + test_bit(FLAG_ACTIVE_LOW, &desc->flags)) 3168 3098 value = !value; 3169 3099 trace_gpio_value(desc_to_gpio(desc), 0, value); 3170 3100 /* ··· 3190 3106 __clear_bit(hwgpio, bits); 3191 3107 count++; 3192 3108 } 3193 - i++; 3109 + 3110 + if (array_info) 3111 + find_next_zero_bit(array_info->set_mask, 3112 + array_size, i); 3113 + else 3114 + i++; 3194 3115 } while ((i < array_size) && 3195 3116 (desc_array[i]->gdev->chip == chip)); 3196 3117 /* push collected bits to outputs */ ··· 3270 3181 3271 3182 /** 3272 3183 * gpiod_set_raw_array_value() - assign values to an array of GPIOs 3273 - * @array_size: number of elements in the descriptor / value arrays 3184 + * @array_size: number of elements in the descriptor array / value bitmap 3274 3185 * @desc_array: array of GPIO descriptors whose values will be assigned 3275 - * @value_array: array of values to assign 3186 + * @array_info: information on applicability of fast bitmap processing path 3187 + * @value_bitmap: bitmap of values to assign 3276 3188 * 3277 3189 * Set the raw values of the GPIOs, i.e. the values of the physical lines 3278 3190 * without regard for their ACTIVE_LOW status. ··· 3282 3192 * complain if the GPIO chip functions potentially sleep. 3283 3193 */ 3284 3194 int gpiod_set_raw_array_value(unsigned int array_size, 3285 - struct gpio_desc **desc_array, int *value_array) 3195 + struct gpio_desc **desc_array, 3196 + struct gpio_array *array_info, 3197 + unsigned long *value_bitmap) 3286 3198 { 3287 3199 if (!desc_array) 3288 3200 return -EINVAL; 3289 3201 return gpiod_set_array_value_complex(true, false, array_size, 3290 - desc_array, value_array); 3202 + desc_array, array_info, value_bitmap); 3291 3203 } 3292 3204 EXPORT_SYMBOL_GPL(gpiod_set_raw_array_value); 3293 3205 3294 3206 /** 3295 3207 * gpiod_set_array_value() - assign values to an array of GPIOs 3296 - * @array_size: number of elements in the descriptor / value arrays 3208 + * @array_size: number of elements in the descriptor array / value bitmap 3297 3209 * @desc_array: array of GPIO descriptors whose values will be assigned 3298 - * @value_array: array of values to assign 3210 + * @array_info: information on applicability of fast bitmap processing path 3211 + * @value_bitmap: bitmap of values to assign 3299 3212 * 3300 3213 * Set the logical values of the GPIOs, i.e. taking their ACTIVE_LOW status 3301 3214 * into account. ··· 3307 3214 * complain if the GPIO chip functions potentially sleep. 3308 3215 */ 3309 3216 void gpiod_set_array_value(unsigned int array_size, 3310 - struct gpio_desc **desc_array, int *value_array) 3217 + struct gpio_desc **desc_array, 3218 + struct gpio_array *array_info, 3219 + unsigned long *value_bitmap) 3311 3220 { 3312 3221 if (!desc_array) 3313 3222 return; 3314 3223 gpiod_set_array_value_complex(false, false, array_size, desc_array, 3315 - value_array); 3224 + array_info, value_bitmap); 3316 3225 } 3317 3226 EXPORT_SYMBOL_GPL(gpiod_set_array_value); 3318 3227 ··· 3582 3487 3583 3488 /** 3584 3489 * gpiod_get_raw_array_value_cansleep() - read raw values from an array of GPIOs 3585 - * @array_size: number of elements in the descriptor / value arrays 3490 + * @array_size: number of elements in the descriptor array / value bitmap 3586 3491 * @desc_array: array of GPIO descriptors whose values will be read 3587 - * @value_array: array to store the read values 3492 + * @array_info: information on applicability of fast bitmap processing path 3493 + * @value_bitmap: bitmap to store the read values 3588 3494 * 3589 3495 * Read the raw values of the GPIOs, i.e. the values of the physical lines 3590 3496 * without regard for their ACTIVE_LOW status. Return 0 in case of success, ··· 3595 3499 */ 3596 3500 int gpiod_get_raw_array_value_cansleep(unsigned int array_size, 3597 3501 struct gpio_desc **desc_array, 3598 - int *value_array) 3502 + struct gpio_array *array_info, 3503 + unsigned long *value_bitmap) 3599 3504 { 3600 3505 might_sleep_if(extra_checks); 3601 3506 if (!desc_array) 3602 3507 return -EINVAL; 3603 3508 return gpiod_get_array_value_complex(true, true, array_size, 3604 - desc_array, value_array); 3509 + desc_array, array_info, 3510 + value_bitmap); 3605 3511 } 3606 3512 EXPORT_SYMBOL_GPL(gpiod_get_raw_array_value_cansleep); 3607 3513 3608 3514 /** 3609 3515 * gpiod_get_array_value_cansleep() - read values from an array of GPIOs 3610 - * @array_size: number of elements in the descriptor / value arrays 3516 + * @array_size: number of elements in the descriptor array / value bitmap 3611 3517 * @desc_array: array of GPIO descriptors whose values will be read 3612 - * @value_array: array to store the read values 3518 + * @array_info: information on applicability of fast bitmap processing path 3519 + * @value_bitmap: bitmap to store the read values 3613 3520 * 3614 3521 * Read the logical values of the GPIOs, i.e. taking their ACTIVE_LOW status 3615 3522 * into account. Return 0 in case of success, else an error code. ··· 3621 3522 */ 3622 3523 int gpiod_get_array_value_cansleep(unsigned int array_size, 3623 3524 struct gpio_desc **desc_array, 3624 - int *value_array) 3525 + struct gpio_array *array_info, 3526 + unsigned long *value_bitmap) 3625 3527 { 3626 3528 might_sleep_if(extra_checks); 3627 3529 if (!desc_array) 3628 3530 return -EINVAL; 3629 3531 return gpiod_get_array_value_complex(false, true, array_size, 3630 - desc_array, value_array); 3532 + desc_array, array_info, 3533 + value_bitmap); 3631 3534 } 3632 3535 EXPORT_SYMBOL_GPL(gpiod_get_array_value_cansleep); 3633 3536 ··· 3671 3570 3672 3571 /** 3673 3572 * gpiod_set_raw_array_value_cansleep() - assign values to an array of GPIOs 3674 - * @array_size: number of elements in the descriptor / value arrays 3573 + * @array_size: number of elements in the descriptor array / value bitmap 3675 3574 * @desc_array: array of GPIO descriptors whose values will be assigned 3676 - * @value_array: array of values to assign 3575 + * @array_info: information on applicability of fast bitmap processing path 3576 + * @value_bitmap: bitmap of values to assign 3677 3577 * 3678 3578 * Set the raw values of the GPIOs, i.e. the values of the physical lines 3679 3579 * without regard for their ACTIVE_LOW status. ··· 3683 3581 */ 3684 3582 int gpiod_set_raw_array_value_cansleep(unsigned int array_size, 3685 3583 struct gpio_desc **desc_array, 3686 - int *value_array) 3584 + struct gpio_array *array_info, 3585 + unsigned long *value_bitmap) 3687 3586 { 3688 3587 might_sleep_if(extra_checks); 3689 3588 if (!desc_array) 3690 3589 return -EINVAL; 3691 3590 return gpiod_set_array_value_complex(true, true, array_size, desc_array, 3692 - value_array); 3591 + array_info, value_bitmap); 3693 3592 } 3694 3593 EXPORT_SYMBOL_GPL(gpiod_set_raw_array_value_cansleep); 3695 3594 ··· 3713 3610 3714 3611 /** 3715 3612 * gpiod_set_array_value_cansleep() - assign values to an array of GPIOs 3716 - * @array_size: number of elements in the descriptor / value arrays 3613 + * @array_size: number of elements in the descriptor array / value bitmap 3717 3614 * @desc_array: array of GPIO descriptors whose values will be assigned 3718 - * @value_array: array of values to assign 3615 + * @array_info: information on applicability of fast bitmap processing path 3616 + * @value_bitmap: bitmap of values to assign 3719 3617 * 3720 3618 * Set the logical values of the GPIOs, i.e. taking their ACTIVE_LOW status 3721 3619 * into account. ··· 3725 3621 */ 3726 3622 void gpiod_set_array_value_cansleep(unsigned int array_size, 3727 3623 struct gpio_desc **desc_array, 3728 - int *value_array) 3624 + struct gpio_array *array_info, 3625 + unsigned long *value_bitmap) 3729 3626 { 3730 3627 might_sleep_if(extra_checks); 3731 3628 if (!desc_array) 3732 3629 return; 3733 3630 gpiod_set_array_value_complex(false, true, array_size, desc_array, 3734 - value_array); 3631 + array_info, value_bitmap); 3735 3632 } 3736 3633 EXPORT_SYMBOL_GPL(gpiod_set_array_value_cansleep); 3737 3634 ··· 4352 4247 { 4353 4248 struct gpio_desc *desc; 4354 4249 struct gpio_descs *descs; 4355 - int count; 4250 + struct gpio_array *array_info = NULL; 4251 + struct gpio_chip *chip; 4252 + int count, bitmap_size; 4356 4253 4357 4254 count = gpiod_count(dev, con_id); 4358 4255 if (count < 0) ··· 4370 4263 gpiod_put_array(descs); 4371 4264 return ERR_CAST(desc); 4372 4265 } 4266 + 4373 4267 descs->desc[descs->ndescs] = desc; 4268 + 4269 + chip = gpiod_to_chip(desc); 4270 + /* 4271 + * Select a chip of first array member 4272 + * whose index matches its pin hardware number 4273 + * as a candidate for fast bitmap processing. 4274 + */ 4275 + if (!array_info && gpio_chip_hwgpio(desc) == descs->ndescs) { 4276 + struct gpio_descs *array; 4277 + 4278 + bitmap_size = BITS_TO_LONGS(chip->ngpio > count ? 4279 + chip->ngpio : count); 4280 + 4281 + array = kzalloc(struct_size(descs, desc, count) + 4282 + struct_size(array_info, invert_mask, 4283 + 3 * bitmap_size), GFP_KERNEL); 4284 + if (!array) { 4285 + gpiod_put_array(descs); 4286 + return ERR_PTR(-ENOMEM); 4287 + } 4288 + 4289 + memcpy(array, descs, 4290 + struct_size(descs, desc, descs->ndescs + 1)); 4291 + kfree(descs); 4292 + 4293 + descs = array; 4294 + array_info = (void *)(descs->desc + count); 4295 + array_info->get_mask = array_info->invert_mask + 4296 + bitmap_size; 4297 + array_info->set_mask = array_info->get_mask + 4298 + bitmap_size; 4299 + 4300 + array_info->desc = descs->desc; 4301 + array_info->size = count; 4302 + array_info->chip = chip; 4303 + bitmap_set(array_info->get_mask, descs->ndescs, 4304 + count - descs->ndescs); 4305 + bitmap_set(array_info->set_mask, descs->ndescs, 4306 + count - descs->ndescs); 4307 + descs->info = array_info; 4308 + } 4309 + /* 4310 + * Unmark members which don't qualify for fast bitmap 4311 + * processing (different chip, not in hardware order) 4312 + */ 4313 + if (array_info && (chip != array_info->chip || 4314 + gpio_chip_hwgpio(desc) != descs->ndescs)) { 4315 + __clear_bit(descs->ndescs, array_info->get_mask); 4316 + __clear_bit(descs->ndescs, array_info->set_mask); 4317 + } else if (array_info) { 4318 + /* Exclude open drain or open source from fast output */ 4319 + if (gpiochip_line_is_open_drain(chip, descs->ndescs) || 4320 + gpiochip_line_is_open_source(chip, descs->ndescs)) 4321 + __clear_bit(descs->ndescs, 4322 + array_info->set_mask); 4323 + /* Identify 'fast' pins which require invertion */ 4324 + if (gpiod_is_active_low(desc)) 4325 + __set_bit(descs->ndescs, 4326 + array_info->invert_mask); 4327 + } 4328 + 4374 4329 descs->ndescs++; 4375 4330 } 4331 + if (array_info) 4332 + dev_dbg(dev, 4333 + "GPIO array info: chip=%s, size=%d, get_mask=%lx, set_mask=%lx, invert_mask=%lx\n", 4334 + array_info->chip->label, array_info->size, 4335 + *array_info->get_mask, *array_info->set_mask, 4336 + *array_info->invert_mask); 4376 4337 return descs; 4377 4338 } 4378 4339 EXPORT_SYMBOL_GPL(gpiod_get_array);
+13 -2
drivers/gpio/gpiolib.h
··· 183 183 } 184 184 #endif 185 185 186 + struct gpio_array { 187 + struct gpio_desc **desc; 188 + unsigned int size; 189 + struct gpio_chip *chip; 190 + unsigned long *get_mask; 191 + unsigned long *set_mask; 192 + unsigned long invert_mask[]; 193 + }; 194 + 186 195 struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip, u16 hwnum); 187 196 int gpiod_get_array_value_complex(bool raw, bool can_sleep, 188 197 unsigned int array_size, 189 198 struct gpio_desc **desc_array, 190 - int *value_array); 199 + struct gpio_array *array_info, 200 + unsigned long *value_bitmap); 191 201 int gpiod_set_array_value_complex(bool raw, bool can_sleep, 192 202 unsigned int array_size, 193 203 struct gpio_desc **desc_array, 194 - int *value_array); 204 + struct gpio_array *array_info, 205 + unsigned long *value_bitmap); 195 206 196 207 /* This is just passed between gpiolib and devres */ 197 208 struct gpio_desc *gpiod_get_from_of_node(struct device_node *node,
+5 -9
drivers/i2c/muxes/i2c-mux-gpio.c
··· 22 22 struct i2c_mux_gpio_platform_data data; 23 23 unsigned gpio_base; 24 24 struct gpio_desc **gpios; 25 - int *values; 26 25 }; 27 26 28 27 static void i2c_mux_gpio_set(const struct gpiomux *mux, unsigned val) 29 28 { 30 - int i; 29 + DECLARE_BITMAP(values, BITS_PER_TYPE(val)); 31 30 32 - for (i = 0; i < mux->data.n_gpios; i++) 33 - mux->values[i] = (val >> i) & 1; 31 + values[0] = val; 34 32 35 - gpiod_set_array_value_cansleep(mux->data.n_gpios, 36 - mux->gpios, mux->values); 33 + gpiod_set_array_value_cansleep(mux->data.n_gpios, mux->gpios, NULL, 34 + values); 37 35 } 38 36 39 37 static int i2c_mux_gpio_select(struct i2c_mux_core *muxc, u32 chan) ··· 180 182 return -EPROBE_DEFER; 181 183 182 184 muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 183 - mux->data.n_gpios * sizeof(*mux->gpios) + 184 - mux->data.n_gpios * sizeof(*mux->values), 0, 185 + mux->data.n_gpios * sizeof(*mux->gpios), 0, 185 186 i2c_mux_gpio_select, NULL); 186 187 if (!muxc) { 187 188 ret = -ENOMEM; 188 189 goto alloc_failed; 189 190 } 190 191 mux->gpios = muxc->priv; 191 - mux->values = (int *)(mux->gpios + mux->data.n_gpios); 192 192 muxc->priv = mux; 193 193 194 194 platform_set_drvdata(pdev, muxc);
+4 -9
drivers/mmc/core/pwrseq_simple.c
··· 40 40 struct gpio_descs *reset_gpios = pwrseq->reset_gpios; 41 41 42 42 if (!IS_ERR(reset_gpios)) { 43 - int i, *values; 43 + DECLARE_BITMAP(values, BITS_PER_TYPE(value)); 44 44 int nvalues = reset_gpios->ndescs; 45 45 46 - values = kmalloc_array(nvalues, sizeof(int), GFP_KERNEL); 47 - if (!values) 48 - return; 46 + values[0] = value; 49 47 50 - for (i = 0; i < nvalues; i++) 51 - values[i] = value; 52 - 53 - gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc, values); 54 - kfree(values); 48 + gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc, 49 + reset_gpios->info, values); 55 50 } 56 51 } 57 52
+4 -8
drivers/mux/gpio.c
··· 17 17 18 18 struct mux_gpio { 19 19 struct gpio_descs *gpios; 20 - int *val; 21 20 }; 22 21 23 22 static int mux_gpio_set(struct mux_control *mux, int state) 24 23 { 25 24 struct mux_gpio *mux_gpio = mux_chip_priv(mux->chip); 26 - int i; 25 + DECLARE_BITMAP(values, BITS_PER_TYPE(state)); 27 26 28 - for (i = 0; i < mux_gpio->gpios->ndescs; i++) 29 - mux_gpio->val[i] = (state >> i) & 1; 27 + values[0] = state; 30 28 31 29 gpiod_set_array_value_cansleep(mux_gpio->gpios->ndescs, 32 30 mux_gpio->gpios->desc, 33 - mux_gpio->val); 31 + mux_gpio->gpios->info, values); 34 32 35 33 return 0; 36 34 } ··· 56 58 if (pins < 0) 57 59 return pins; 58 60 59 - mux_chip = devm_mux_chip_alloc(dev, 1, sizeof(*mux_gpio) + 60 - pins * sizeof(*mux_gpio->val)); 61 + mux_chip = devm_mux_chip_alloc(dev, 1, sizeof(*mux_gpio)); 61 62 if (IS_ERR(mux_chip)) 62 63 return PTR_ERR(mux_chip); 63 64 64 65 mux_gpio = mux_chip_priv(mux_chip); 65 - mux_gpio->val = (int *)(mux_gpio + 1); 66 66 mux_chip->ops = &mux_gpio_ops; 67 67 68 68 mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW);
+4 -7
drivers/net/phy/mdio-mux-gpio.c
··· 20 20 struct mdio_mux_gpio_state { 21 21 struct gpio_descs *gpios; 22 22 void *mux_handle; 23 - int values[]; 24 23 }; 25 24 26 25 static int mdio_mux_gpio_switch_fn(int current_child, int desired_child, 27 26 void *data) 28 27 { 29 28 struct mdio_mux_gpio_state *s = data; 30 - unsigned int n; 29 + DECLARE_BITMAP(values, BITS_PER_TYPE(desired_child)); 31 30 32 31 if (current_child == desired_child) 33 32 return 0; 34 33 35 - for (n = 0; n < s->gpios->ndescs; n++) 36 - s->values[n] = (desired_child >> n) & 1; 34 + values[0] = desired_child; 37 35 38 36 gpiod_set_array_value_cansleep(s->gpios->ndescs, s->gpios->desc, 39 - s->values); 37 + s->gpios->info, values); 40 38 41 39 return 0; 42 40 } ··· 49 51 if (IS_ERR(gpios)) 50 52 return PTR_ERR(gpios); 51 53 52 - s = devm_kzalloc(&pdev->dev, struct_size(s, values, gpios->ndescs), 53 - GFP_KERNEL); 54 + s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); 54 55 if (!s) { 55 56 gpiod_put_array(gpios); 56 57 return -ENOMEM;
+5 -4
drivers/pcmcia/soc_common.c
··· 351 351 352 352 if (ret == 0) { 353 353 struct gpio_desc *descs[2]; 354 - int values[2], n = 0; 354 + DECLARE_BITMAP(values, 2); 355 + int n = 0; 355 356 356 357 if (skt->gpio_reset) { 357 358 descs[n] = skt->gpio_reset; 358 - values[n++] = !!(state->flags & SS_RESET); 359 + __assign_bit(n++, values, state->flags & SS_RESET); 359 360 } 360 361 if (skt->gpio_bus_enable) { 361 362 descs[n] = skt->gpio_bus_enable; 362 - values[n++] = !!(state->flags & SS_OUTPUT_ENA); 363 + __assign_bit(n++, values, state->flags & SS_OUTPUT_ENA); 363 364 } 364 365 365 366 if (n) 366 - gpiod_set_array_value_cansleep(n, descs, values); 367 + gpiod_set_array_value_cansleep(n, descs, NULL, values); 367 368 368 369 /* 369 370 * This really needs a better solution. The IRQ
+9 -10
drivers/phy/motorola/phy-mapphone-mdm6600.c
··· 157 157 */ 158 158 static void phy_mdm6600_cmd(struct phy_mdm6600 *ddata, int val) 159 159 { 160 - int values[PHY_MDM6600_NR_CMD_LINES]; 161 - int i; 160 + DECLARE_BITMAP(values, PHY_MDM6600_NR_CMD_LINES); 162 161 163 - val &= (1 << PHY_MDM6600_NR_CMD_LINES) - 1; 164 - for (i = 0; i < PHY_MDM6600_NR_CMD_LINES; i++) 165 - values[i] = (val & BIT(i)) >> i; 162 + values[0] = val; 166 163 167 164 gpiod_set_array_value_cansleep(PHY_MDM6600_NR_CMD_LINES, 168 - ddata->cmd_gpios->desc, values); 165 + ddata->cmd_gpios->desc, 166 + ddata->cmd_gpios->info, values); 169 167 } 170 168 171 169 /** ··· 174 176 { 175 177 struct phy_mdm6600 *ddata; 176 178 struct device *dev; 177 - int values[PHY_MDM6600_NR_STATUS_LINES]; 179 + DECLARE_BITMAP(values, PHY_MDM6600_NR_STATUS_LINES); 178 180 int error, i, val = 0; 179 181 180 182 ddata = container_of(work, struct phy_mdm6600, status_work.work); ··· 182 184 183 185 error = gpiod_get_array_value_cansleep(PHY_MDM6600_NR_STATUS_LINES, 184 186 ddata->status_gpios->desc, 187 + ddata->status_gpios->info, 185 188 values); 186 189 if (error) 187 190 return; 188 191 189 192 for (i = 0; i < PHY_MDM6600_NR_STATUS_LINES; i++) { 190 - val |= values[i] << i; 193 + val |= test_bit(i, values) << i; 191 194 dev_dbg(ddata->dev, "XXX %s: i: %i values[i]: %i val: %i\n", 192 - __func__, i, values[i], val); 195 + __func__, i, test_bit(i, values), val); 193 196 } 194 - ddata->status = val; 197 + ddata->status = values[0]; 195 198 196 199 dev_info(dev, "modem status: %i %s\n", 197 200 ddata->status,
+3 -5
drivers/staging/iio/adc/ad7606.c
··· 202 202 long mask) 203 203 { 204 204 struct ad7606_state *st = iio_priv(indio_dev); 205 - int values[3]; 205 + DECLARE_BITMAP(values, 3); 206 206 int ret, i; 207 207 208 208 switch (mask) { ··· 227 227 if (ret < 0) 228 228 return ret; 229 229 230 - values[0] = (ret >> 0) & 1; 231 - values[1] = (ret >> 1) & 1; 232 - values[2] = (ret >> 2) & 1; 230 + values[0] = ret; 233 231 234 232 mutex_lock(&st->lock); 235 - gpiod_set_array_value(ARRAY_SIZE(values), st->gpio_os->desc, 233 + gpiod_set_array_value(3, st->gpio_os->desc, st->gpio_os->info, 236 234 values); 237 235 st->oversampling = val; 238 236 mutex_unlock(&st->lock);
+4 -3
drivers/tty/serial/serial_mctrl_gpio.c
··· 40 40 { 41 41 enum mctrl_gpio_idx i; 42 42 struct gpio_desc *desc_array[UART_GPIO_MAX]; 43 - int value_array[UART_GPIO_MAX]; 43 + DECLARE_BITMAP(values, UART_GPIO_MAX); 44 44 unsigned int count = 0; 45 45 46 46 if (gpios == NULL) ··· 49 49 for (i = 0; i < UART_GPIO_MAX; i++) 50 50 if (gpios->gpio[i] && mctrl_gpios_desc[i].dir_out) { 51 51 desc_array[count] = gpios->gpio[i]; 52 - value_array[count] = !!(mctrl & mctrl_gpios_desc[i].mctrl); 52 + __assign_bit(count, values, 53 + mctrl & mctrl_gpios_desc[i].mctrl); 53 54 count++; 54 55 } 55 - gpiod_set_array_value(count, desc_array, value_array); 56 + gpiod_set_array_value(count, desc_array, NULL, values); 56 57 } 57 58 EXPORT_SYMBOL_GPL(mctrl_gpio_set); 58 59
+43 -16
include/linux/gpio/consumer.h
··· 18 18 struct gpio_desc; 19 19 20 20 /** 21 + * Opaque descriptor for a structure of GPIO array attributes. This structure 22 + * is attached to struct gpiod_descs obtained from gpiod_get_array() and can be 23 + * passed back to get/set array functions in order to activate fast processing 24 + * path if applicable. 25 + */ 26 + struct gpio_array; 27 + 28 + /** 21 29 * Struct containing an array of descriptors that can be obtained using 22 30 * gpiod_get_array(). 23 31 */ 24 32 struct gpio_descs { 33 + struct gpio_array *info; 25 34 unsigned int ndescs; 26 35 struct gpio_desc *desc[]; 27 36 }; ··· 113 104 /* Value get/set from non-sleeping context */ 114 105 int gpiod_get_value(const struct gpio_desc *desc); 115 106 int gpiod_get_array_value(unsigned int array_size, 116 - struct gpio_desc **desc_array, int *value_array); 107 + struct gpio_desc **desc_array, 108 + struct gpio_array *array_info, 109 + unsigned long *value_bitmap); 117 110 void gpiod_set_value(struct gpio_desc *desc, int value); 118 111 void gpiod_set_array_value(unsigned int array_size, 119 - struct gpio_desc **desc_array, int *value_array); 112 + struct gpio_desc **desc_array, 113 + struct gpio_array *array_info, 114 + unsigned long *value_bitmap); 120 115 int gpiod_get_raw_value(const struct gpio_desc *desc); 121 116 int gpiod_get_raw_array_value(unsigned int array_size, 122 117 struct gpio_desc **desc_array, 123 - int *value_array); 118 + struct gpio_array *array_info, 119 + unsigned long *value_bitmap); 124 120 void gpiod_set_raw_value(struct gpio_desc *desc, int value); 125 121 int gpiod_set_raw_array_value(unsigned int array_size, 126 122 struct gpio_desc **desc_array, 127 - int *value_array); 123 + struct gpio_array *array_info, 124 + unsigned long *value_bitmap); 128 125 129 126 /* Value get/set from sleeping context */ 130 127 int gpiod_get_value_cansleep(const struct gpio_desc *desc); 131 128 int gpiod_get_array_value_cansleep(unsigned int array_size, 132 129 struct gpio_desc **desc_array, 133 - int *value_array); 130 + struct gpio_array *array_info, 131 + unsigned long *value_bitmap); 134 132 void gpiod_set_value_cansleep(struct gpio_desc *desc, int value); 135 133 void gpiod_set_array_value_cansleep(unsigned int array_size, 136 134 struct gpio_desc **desc_array, 137 - int *value_array); 135 + struct gpio_array *array_info, 136 + unsigned long *value_bitmap); 138 137 int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc); 139 138 int gpiod_get_raw_array_value_cansleep(unsigned int array_size, 140 139 struct gpio_desc **desc_array, 141 - int *value_array); 140 + struct gpio_array *array_info, 141 + unsigned long *value_bitmap); 142 142 void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value); 143 143 int gpiod_set_raw_array_value_cansleep(unsigned int array_size, 144 144 struct gpio_desc **desc_array, 145 - int *value_array); 145 + struct gpio_array *array_info, 146 + unsigned long *value_bitmap); 146 147 147 148 int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); 148 149 int gpiod_set_transitory(struct gpio_desc *desc, bool transitory); ··· 349 330 } 350 331 static inline int gpiod_get_array_value(unsigned int array_size, 351 332 struct gpio_desc **desc_array, 352 - int *value_array) 333 + struct gpio_array *array_info, 334 + unsigned long *value_bitmap) 353 335 { 354 336 /* GPIO can never have been requested */ 355 337 WARN_ON(1); ··· 363 343 } 364 344 static inline void gpiod_set_array_value(unsigned int array_size, 365 345 struct gpio_desc **desc_array, 366 - int *value_array) 346 + struct gpio_array *array_info, 347 + unsigned long *value_bitmap) 367 348 { 368 349 /* GPIO can never have been requested */ 369 350 WARN_ON(1); ··· 377 356 } 378 357 static inline int gpiod_get_raw_array_value(unsigned int array_size, 379 358 struct gpio_desc **desc_array, 380 - int *value_array) 359 + struct gpio_array *array_info, 360 + unsigned long *value_bitmap) 381 361 { 382 362 /* GPIO can never have been requested */ 383 363 WARN_ON(1); ··· 391 369 } 392 370 static inline int gpiod_set_raw_array_value(unsigned int array_size, 393 371 struct gpio_desc **desc_array, 394 - int *value_array) 372 + struct gpio_array *array_info, 373 + unsigned long *value_bitmap) 395 374 { 396 375 /* GPIO can never have been requested */ 397 376 WARN_ON(1); ··· 407 384 } 408 385 static inline int gpiod_get_array_value_cansleep(unsigned int array_size, 409 386 struct gpio_desc **desc_array, 410 - int *value_array) 387 + struct gpio_array *array_info, 388 + unsigned long *value_bitmap) 411 389 { 412 390 /* GPIO can never have been requested */ 413 391 WARN_ON(1); ··· 421 397 } 422 398 static inline void gpiod_set_array_value_cansleep(unsigned int array_size, 423 399 struct gpio_desc **desc_array, 424 - int *value_array) 400 + struct gpio_array *array_info, 401 + unsigned long *value_bitmap) 425 402 { 426 403 /* GPIO can never have been requested */ 427 404 WARN_ON(1); ··· 435 410 } 436 411 static inline int gpiod_get_raw_array_value_cansleep(unsigned int array_size, 437 412 struct gpio_desc **desc_array, 438 - int *value_array) 413 + struct gpio_array *array_info, 414 + unsigned long *value_bitmap) 439 415 { 440 416 /* GPIO can never have been requested */ 441 417 WARN_ON(1); ··· 450 424 } 451 425 static inline int gpiod_set_raw_array_value_cansleep(unsigned int array_size, 452 426 struct gpio_desc **desc_array, 453 - int *value_array) 427 + struct gpio_array *array_info, 428 + unsigned long *value_bitmap) 454 429 { 455 430 /* GPIO can never have been requested */ 456 431 WARN_ON(1);