return gpio_mockup_ranges[index * 2 + 1];
}
-static int __gpio_mockup_get(struct gpio_chip *gc, unsigned int offset)
+static int __gpio_mockup_get(struct gpio_mockup_chip *chip,
+ unsigned int offset)
{
- struct gpio_mockup_chip *chip = gpiochip_get_data(gc);
-
return chip->lines[offset].value;
}
int val;
mutex_lock(&chip->lock);
- val = __gpio_mockup_get(gc, offset);
+ val = __gpio_mockup_get(chip, offset);
mutex_unlock(&chip->lock);
return val;
mutex_lock(&chip->lock);
for_each_set_bit(bit, mask, gc->ngpio) {
- val = __gpio_mockup_get(gc, bit);
+ val = __gpio_mockup_get(chip, bit);
__assign_bit(bit, bits, val);
}
mutex_unlock(&chip->lock);
return 0;
}
-static void __gpio_mockup_set(struct gpio_chip *gc,
+static void __gpio_mockup_set(struct gpio_mockup_chip *chip,
unsigned int offset, int value)
{
- struct gpio_mockup_chip *chip = gpiochip_get_data(gc);
-
chip->lines[offset].value = !!value;
}
struct gpio_mockup_chip *chip = gpiochip_get_data(gc);
mutex_lock(&chip->lock);
- __gpio_mockup_set(gc, offset, value);
+ __gpio_mockup_set(chip, offset, value);
mutex_unlock(&chip->lock);
}
mutex_lock(&chip->lock);
for_each_set_bit(bit, mask, gc->ngpio)
- __gpio_mockup_set(gc, bit, test_bit(bit, bits));
+ __gpio_mockup_set(chip, bit, test_bit(bit, bits));
mutex_unlock(&chip->lock);
}
mutex_lock(&chip->lock);
chip->lines[offset].dir = GPIO_MOCKUP_DIR_OUT;
- __gpio_mockup_set(gc, offset, value);
+ __gpio_mockup_set(chip, offset, value);
mutex_unlock(&chip->lock);
return 0;