History

Merge tag 'gpio-v5.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij: "Here is a (hopefully last) set of GPIO fixes for the v5.3 kernel cycle. Two are pretty core: - Fix not reporting open drain/source lines to userspace as "input" - Fix a minor build error found in randconfigs - Fix a chip select quirk on the Freescale SPI - Fix the irqchip initialization semantic order to reflect what it was using the old API" * tag 'gpio-v5.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: Fix irqchip initialization order gpio: of: fix Freescale SPI CS quirk handling gpio: Fix build error of function redefinition gpiolib: never report open-drain/source lines as 'input' to user-space

Linus Torvalds committed 7 years ago

Commit 083f0f22 parents 3614692 48057ed3 files · +20 −42Browse files

Unified · Split

3 files
  1. drivers/gpio/gpiolib-of.c +1 −1
  2. drivers/gpio/gpiolib.c +19 −17
  3. include/linux/gpio.h +0 −24
drivers/gpio/gpiolib-of.c+1−1
@@ -363,7 +363,7 @@ struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id, · 362 unmodified lines
363363 /* Special handling for SPI GPIOs if used */
364364 if (IS_ERR(desc))
365365 desc = of_find_spi_gpio(dev, con_id, &of_flags);
366− if (IS_ERR(desc)) {
366+ if (IS_ERR(desc) && PTR_ERR(desc) != -EPROBE_DEFER) {
367367 /* This quirk looks up flags and all */
368368 desc = of_find_spi_cs_gpio(dev, con_id, idx, flags);
369369 if (!IS_ERR(desc))
drivers/gpio/gpiolib.c+19−17
@@ -1091,9 +1091,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 1090 unmodified lines
10911091 if (test_bit(FLAG_ACTIVE_LOW, &desc->flags))
10921092 lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW;
10931093 if (test_bit(FLAG_OPEN_DRAIN, &desc->flags))
1094− lineinfo.flags |= GPIOLINE_FLAG_OPEN_DRAIN;
1094+ lineinfo.flags |= (GPIOLINE_FLAG_OPEN_DRAIN |
1095+ GPIOLINE_FLAG_IS_OUT);
10951096 if (test_bit(FLAG_OPEN_SOURCE, &desc->flags))
1096− lineinfo.flags |= GPIOLINE_FLAG_OPEN_SOURCE;
1097+ lineinfo.flags |= (GPIOLINE_FLAG_OPEN_SOURCE |
1098+ GPIOLINE_FLAG_IS_OUT);
10971099
10981100 if (copy_to_user(ip, &lineinfo, sizeof(lineinfo)))
10991101 return -EFAULT;
@@ -1371,21 +1373,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 271 unmodified lines
13711373 if (status)
13721374 goto err_remove_from_list;
13731375
1374− status = gpiochip_irqchip_init_valid_mask(chip);
1375− if (status)
1376− goto err_remove_from_list;
1377−
13781376 status = gpiochip_alloc_valid_mask(chip);
13791377 if (status)
1380− goto err_remove_irqchip_mask;
1381−
1382− status = gpiochip_add_irqchip(chip, lock_key, request_key);
1383− if (status)
1384− goto err_free_gpiochip_mask;
1378+ goto err_remove_from_list;
13851379
13861380 status = of_gpiochip_add(chip);
13871381 if (status)
1388− goto err_remove_chip;
1382+ goto err_free_gpiochip_mask;
13891383
13901384 status = gpiochip_init_valid_mask(chip);
13911385 if (status)
@@ -1411,6 +1405,14 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 19 unmodified lines
14111405
14121406 machine_gpiochip_add(chip);
14131407
1408+ status = gpiochip_irqchip_init_valid_mask(chip);
1409+ if (status)
1410+ goto err_remove_acpi_chip;
1411+
1412+ status = gpiochip_add_irqchip(chip, lock_key, request_key);
1413+ if (status)
1414+ goto err_remove_irqchip_mask;
1415+
14141416 /*
14151417 * By first adding the chardev, and then adding the device,
14161418 * we get a device node entry in sysfs under
@@ -1422,21 +1424,21 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 5 unmodified lines
14221424 if (gpiolib_initialized) {
14231425 status = gpiochip_setup_dev(gdev);
14241426 if (status)
1425− goto err_remove_acpi_chip;
1427+ goto err_remove_irqchip;
14261428 }
14271429 return 0;
14281430
1431+err_remove_irqchip:
1432+ gpiochip_irqchip_remove(chip);
1433+err_remove_irqchip_mask:
1434+ gpiochip_irqchip_free_valid_mask(chip);
14291435 err_remove_acpi_chip:
14301436 acpi_gpiochip_remove(chip);
14311437 err_remove_of_chip:
14321438 gpiochip_free_hogs(chip);
14331439 of_gpiochip_remove(chip);
1434−err_remove_chip:
1435− gpiochip_irqchip_remove(chip);
14361440 err_free_gpiochip_mask:
14371441 gpiochip_free_valid_mask(chip);
1438−err_remove_irqchip_mask:
1439− gpiochip_irqchip_free_valid_mask(chip);
14401442 err_remove_from_list:
14411443 spin_lock_irqsave(&gpio_lock, flags);
14421444 list_del(&gdev->list);
include/linux/gpio.h+0−24
@@ -241,30 +241,6 @@ static inline int irq_to_gpio(unsigned irq) · 240 unmodified lines
241241 return -EINVAL;
242242 }
243243
244−static inline int
245−gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
246− unsigned int gpio_offset, unsigned int pin_offset,
247− unsigned int npins)
248−{
249− WARN_ON(1);
250− return -EINVAL;
251−}
252−
253−static inline int
254−gpiochip_add_pingroup_range(struct gpio_chip *chip,
255− struct pinctrl_dev *pctldev,
256− unsigned int gpio_offset, const char *pin_group)
257−{
258− WARN_ON(1);
259− return -EINVAL;
260−}
261−
262−static inline void
263−gpiochip_remove_pin_ranges(struct gpio_chip *chip)
264−{
265− WARN_ON(1);
266−}
267−
268244 static inline int devm_gpio_request(struct device *dev, unsigned gpio,
269245 const char *label)
270246 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t