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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'intel-gpio-v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel

Pull intel-gpio fixes from Andy Shevchenko:

- NULL pointer dereference fix in GPIO APCI library

- Restore ACPI handle matching for GPIO devices represented in banks

* tag 'intel-gpio-v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel:
gpiolib: acpi: Fix failed in acpi_gpiochip_find() by adding parent node match
gpiolib: acpi: Move ACPI device NULL check to acpi_can_fallback_to_crs()

+25 -4
+25 -4
drivers/gpio/gpiolib-acpi.c
··· 128 128 129 129 static int acpi_gpiochip_find(struct gpio_chip *gc, const void *data) 130 130 { 131 - return device_match_acpi_handle(&gc->gpiodev->dev, data); 131 + /* First check the actual GPIO device */ 132 + if (device_match_acpi_handle(&gc->gpiodev->dev, data)) 133 + return true; 134 + 135 + /* 136 + * When the ACPI device is artificially split to the banks of GPIOs, 137 + * where each of them is represented by a separate GPIO device, 138 + * the firmware node of the physical device may not be shared among 139 + * the banks as they may require different values for the same property, 140 + * e.g., number of GPIOs in a certain bank. In such case the ACPI handle 141 + * of a GPIO device is NULL and can not be used. Hence we have to check 142 + * the parent device to be sure that there is no match before bailing 143 + * out. 144 + */ 145 + if (gc->parent) 146 + return device_match_acpi_handle(gc->parent, data); 147 + 148 + return false; 132 149 } 133 150 134 151 /** ··· 955 938 static bool acpi_can_fallback_to_crs(struct acpi_device *adev, 956 939 const char *con_id) 957 940 { 941 + /* If there is no ACPI device, there is no _CRS to fall back to */ 942 + if (!adev) 943 + return false; 944 + 958 945 /* Never allow fallback if the device has properties */ 959 946 if (acpi_dev_has_props(adev) || adev->driver_gpios) 960 947 return false; ··· 999 978 } 1000 979 1001 980 /* Then from plain _CRS GPIOs */ 1002 - if (!adev || !can_fallback) 1003 - return ERR_PTR(-ENOENT); 981 + if (can_fallback) 982 + return acpi_get_gpiod_by_index(adev, NULL, idx, info); 1004 983 1005 - return acpi_get_gpiod_by_index(adev, NULL, idx, info); 984 + return ERR_PTR(-ENOENT); 1006 985 } 1007 986 1008 987 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,