Skip to content

Commit de6e933

Browse files
committed
Merge tag 'gpio-fixes-for-v5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: "A single fix for gpio-sim and two patches for GPIO ACPI pulled from Andy: - fix the set/get_multiple() callbacks in gpio-sim - use correct format characters in gpiolib-acpi - use an unsigned type for pins in gpiolib-acpi" * tag 'gpio-fixes-for-v5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: gpio: sim: fix setting and getting multiple lines gpiolib: acpi: Convert type for pin to be unsigned gpiolib: acpi: use correct format characters
2 parents 70a0cec + 0ebb4fb commit de6e933

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

drivers/gpio/gpio-sim.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static int gpio_sim_get_multiple(struct gpio_chip *gc,
134134
struct gpio_sim_chip *chip = gpiochip_get_data(gc);
135135

136136
mutex_lock(&chip->lock);
137-
bitmap_copy(bits, chip->value_map, gc->ngpio);
137+
bitmap_replace(bits, bits, chip->value_map, mask, gc->ngpio);
138138
mutex_unlock(&chip->lock);
139139

140140
return 0;
@@ -146,7 +146,7 @@ static void gpio_sim_set_multiple(struct gpio_chip *gc,
146146
struct gpio_sim_chip *chip = gpiochip_get_data(gc);
147147

148148
mutex_lock(&chip->lock);
149-
bitmap_copy(chip->value_map, bits, gc->ngpio);
149+
bitmap_replace(chip->value_map, chip->value_map, bits, mask, gc->ngpio);
150150
mutex_unlock(&chip->lock);
151151
}
152152

drivers/gpio/gpiolib-acpi.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
108108
* controller does not have GPIO chip registered at the moment. This is to
109109
* support probe deferral.
110110
*/
111-
static struct gpio_desc *acpi_get_gpiod(char *path, int pin)
111+
static struct gpio_desc *acpi_get_gpiod(char *path, unsigned int pin)
112112
{
113113
struct gpio_chip *chip;
114114
acpi_handle handle;
@@ -136,7 +136,7 @@ static struct gpio_desc *acpi_get_gpiod(char *path, int pin)
136136
* as it is intended for use outside of the GPIO layer (in a similar fashion to
137137
* gpiod_get_index() for example) it also holds a reference to the GPIO device.
138138
*/
139-
struct gpio_desc *acpi_get_and_request_gpiod(char *path, int pin, char *label)
139+
struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label)
140140
{
141141
struct gpio_desc *gpio;
142142
int ret;
@@ -317,11 +317,12 @@ static struct gpio_desc *acpi_request_own_gpiod(struct gpio_chip *chip,
317317
return desc;
318318
}
319319

320-
static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
320+
static bool acpi_gpio_in_ignore_list(const char *controller_in, unsigned int pin_in)
321321
{
322322
const char *controller, *pin_str;
323-
int len, pin;
323+
unsigned int pin;
324324
char *endp;
325+
int len;
325326

326327
controller = ignore_wake;
327328
while (controller) {
@@ -354,13 +355,13 @@ static bool acpi_gpio_in_ignore_list(const char *controller_in, int pin_in)
354355
static bool acpi_gpio_irq_is_wake(struct device *parent,
355356
struct acpi_resource_gpio *agpio)
356357
{
357-
int pin = agpio->pin_table[0];
358+
unsigned int pin = agpio->pin_table[0];
358359

359360
if (agpio->wake_capable != ACPI_WAKE_CAPABLE)
360361
return false;
361362

362363
if (acpi_gpio_in_ignore_list(dev_name(parent), pin)) {
363-
dev_info(parent, "Ignoring wakeup on pin %d\n", pin);
364+
dev_info(parent, "Ignoring wakeup on pin %u\n", pin);
364365
return false;
365366
}
366367

@@ -378,7 +379,8 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
378379
struct acpi_gpio_event *event;
379380
irq_handler_t handler = NULL;
380381
struct gpio_desc *desc;
381-
int ret, pin, irq;
382+
unsigned int pin;
383+
int ret, irq;
382384

383385
if (!acpi_gpio_get_irq_resource(ares, &agpio))
384386
return AE_OK;
@@ -387,8 +389,8 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
387389
pin = agpio->pin_table[0];
388390

389391
if (pin <= 255) {
390-
char ev_name[5];
391-
sprintf(ev_name, "_%c%02hhX",
392+
char ev_name[8];
393+
sprintf(ev_name, "_%c%02X",
392394
agpio->triggering == ACPI_EDGE_SENSITIVE ? 'E' : 'L',
393395
pin);
394396
if (ACPI_SUCCESS(acpi_get_handle(handle, ev_name, &evt_handle)))
@@ -1098,7 +1100,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
10981100

10991101
length = min_t(u16, agpio->pin_table_length, pin_index + bits);
11001102
for (i = pin_index; i < length; ++i) {
1101-
int pin = agpio->pin_table[i];
1103+
unsigned int pin = agpio->pin_table[i];
11021104
struct acpi_gpio_connection *conn;
11031105
struct gpio_desc *desc;
11041106
bool found;

include/linux/gpio/consumer.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ void acpi_dev_remove_driver_gpios(struct acpi_device *adev);
688688
int devm_acpi_dev_add_driver_gpios(struct device *dev,
689689
const struct acpi_gpio_mapping *gpios);
690690

691-
struct gpio_desc *acpi_get_and_request_gpiod(char *path, int pin, char *label);
691+
struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin, char *label);
692692

693693
#else /* CONFIG_GPIOLIB && CONFIG_ACPI */
694694

@@ -705,6 +705,12 @@ static inline int devm_acpi_dev_add_driver_gpios(struct device *dev,
705705
return -ENXIO;
706706
}
707707

708+
static inline struct gpio_desc *acpi_get_and_request_gpiod(char *path, unsigned int pin,
709+
char *label)
710+
{
711+
return ERR_PTR(-ENOSYS);
712+
}
713+
708714
#endif /* CONFIG_GPIOLIB && CONFIG_ACPI */
709715

710716

0 commit comments

Comments
 (0)