mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap
Commit b9762bebc6 ("gpiolib: Pass bitmaps, not integer arrays, to
get/set array") changed the way GPIO values are passed to
gpiod_get/set_array_value() and friends. The new code introduced into
mmc_pwrseq_simple_set_gpios_value() incorrectly interpretes the 'value'
argument as a bitmap of GPIO values and assigns it directly to the
'values' bitmap variable passed to gpiod_set_array_value_cansleep()
instead of filling that bitmap with bits equal to the 'value' argument.
As a result, only member 0 of the array is handled correctly.
Moreover, wrong assumption is taken about the 'values' bitmap size not
exceding the number of bits of the 'value' argument type.
Fix it.
Signed-off-by: Janusz Krzysztofik <[email protected]>
Tested-by: Marek Szyprowski <[email protected]>
Acked-by: Ulf Hansson <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
a7c0b4b80f
commit
9c9f1ddee7
1 changed files with 11 additions and 2 deletions
|
|
@ -40,13 +40,22 @@ static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
|
|||
struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
|
||||
|
||||
if (!IS_ERR(reset_gpios)) {
|
||||
DECLARE_BITMAP(values, BITS_PER_TYPE(value));
|
||||
unsigned long *values;
|
||||
int nvalues = reset_gpios->ndescs;
|
||||
|
||||
values[0] = value;
|
||||
values = bitmap_alloc(nvalues, GFP_KERNEL);
|
||||
if (!values)
|
||||
return;
|
||||
|
||||
if (value)
|
||||
bitmap_fill(values, nvalues);
|
||||
else
|
||||
bitmap_zero(values, nvalues);
|
||||
|
||||
gpiod_set_array_value_cansleep(nvalues, reset_gpios->desc,
|
||||
reset_gpios->info, values);
|
||||
|
||||
kfree(values);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue