| @@ -1091,9 +1091,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 1090 unmodified lines |
| 1091 | 1091 | if (test_bit(FLAG_ACTIVE_LOW, &desc->flags)) |
| 1092 | 1092 | lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW; |
| 1093 | 1093 | 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); |
| 1095 | 1096 | 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); |
| 1097 | 1099 | |
| 1098 | 1100 | if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) |
| 1099 | 1101 | return -EFAULT; |
| @@ -1371,21 +1373,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 271 unmodified lines |
| 1371 | 1373 | if (status) |
| 1372 | 1374 | goto err_remove_from_list; |
| 1373 | 1375 | |
| 1374 | | − status = gpiochip_irqchip_init_valid_mask(chip); |
| 1375 | | − if (status) |
| 1376 | | − goto err_remove_from_list; |
| 1377 | | − |
| 1378 | 1376 | status = gpiochip_alloc_valid_mask(chip); |
| 1379 | 1377 | 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; |
| 1385 | 1379 | |
| 1386 | 1380 | status = of_gpiochip_add(chip); |
| 1387 | 1381 | if (status) |
| 1388 | | − goto err_remove_chip; |
| 1382 | + goto err_free_gpiochip_mask; |
| 1389 | 1383 | |
| 1390 | 1384 | status = gpiochip_init_valid_mask(chip); |
| 1391 | 1385 | if (status) |
| @@ -1411,6 +1405,14 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 19 unmodified lines |
| 1411 | 1405 | |
| 1412 | 1406 | machine_gpiochip_add(chip); |
| 1413 | 1407 | |
| 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 | + |
| 1414 | 1416 | /* |
| 1415 | 1417 | * By first adding the chardev, and then adding the device, |
| 1416 | 1418 | * 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 |
| 1422 | 1424 | if (gpiolib_initialized) { |
| 1423 | 1425 | status = gpiochip_setup_dev(gdev); |
| 1424 | 1426 | if (status) |
| 1425 | | − goto err_remove_acpi_chip; |
| 1427 | + goto err_remove_irqchip; |
| 1426 | 1428 | } |
| 1427 | 1429 | return 0; |
| 1428 | 1430 | |
| 1431 | +err_remove_irqchip: |
| 1432 | + gpiochip_irqchip_remove(chip); |
| 1433 | +err_remove_irqchip_mask: |
| 1434 | + gpiochip_irqchip_free_valid_mask(chip); |
| 1429 | 1435 | err_remove_acpi_chip: |
| 1430 | 1436 | acpi_gpiochip_remove(chip); |
| 1431 | 1437 | err_remove_of_chip: |
| 1432 | 1438 | gpiochip_free_hogs(chip); |
| 1433 | 1439 | of_gpiochip_remove(chip); |
| 1434 | | −err_remove_chip: |
| 1435 | | − gpiochip_irqchip_remove(chip); |
| 1436 | 1440 | err_free_gpiochip_mask: |
| 1437 | 1441 | gpiochip_free_valid_mask(chip); |
| 1438 | | −err_remove_irqchip_mask: |
| 1439 | | − gpiochip_irqchip_free_valid_mask(chip); |
| 1440 | 1442 | err_remove_from_list: |
| 1441 | 1443 | spin_lock_irqsave(&gpio_lock, flags); |
| 1442 | 1444 | list_del(&gdev->list); |