| @@ -1091,9 +1091,11 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) · 1090 unmodified lines |
| 1091 | if (test_bit(FLAG_ACTIVE_LOW, &desc->flags)) | 1091 | if (test_bit(FLAG_ACTIVE_LOW, &desc->flags)) |
| 1092 | lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW; | 1092 | lineinfo.flags |= GPIOLINE_FLAG_ACTIVE_LOW; |
| 1093 | if (test_bit(FLAG_OPEN_DRAIN, &desc->flags)) | 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 | if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) | 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 | if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) | 1100 | if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) |
| 1099 | return -EFAULT; | 1101 | return -EFAULT; |
| @@ -1371,21 +1373,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 271 unmodified lines |
| 1371 | if (status) | 1373 | if (status) |
| 1372 | goto err_remove_from_list; | 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 | status = gpiochip_alloc_valid_mask(chip); | 1376 | status = gpiochip_alloc_valid_mask(chip); |
| 1379 | if (status) | 1377 | if (status) |
| 1380 | goto err_remove_irqchip_mask; | 1378 | goto err_remove_from_list; |
| 1381 | | | |
| 1382 | status = gpiochip_add_irqchip(chip, lock_key, request_key); | | |
| 1383 | if (status) | | |
| 1384 | goto err_free_gpiochip_mask; | | |
| 1385 | | 1379 | |
| 1386 | status = of_gpiochip_add(chip); | 1380 | status = of_gpiochip_add(chip); |
| 1387 | if (status) | 1381 | if (status) |
| 1388 | goto err_remove_chip; | 1382 | goto err_free_gpiochip_mask; |
| 1389 | | 1383 | |
| 1390 | status = gpiochip_init_valid_mask(chip); | 1384 | status = gpiochip_init_valid_mask(chip); |
| 1391 | if (status) | 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 | machine_gpiochip_add(chip); | 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 | * By first adding the chardev, and then adding the device, | 1417 | * By first adding the chardev, and then adding the device, |
| 1416 | * we get a device node entry in sysfs under | 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 | if (gpiolib_initialized) { | 1424 | if (gpiolib_initialized) { |
| 1423 | status = gpiochip_setup_dev(gdev); | 1425 | status = gpiochip_setup_dev(gdev); |
| 1424 | if (status) | 1426 | if (status) |
| 1425 | goto err_remove_acpi_chip; | 1427 | goto err_remove_irqchip; |
| 1426 | } | 1428 | } |
| 1427 | return 0; | 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 | err_remove_acpi_chip: | 1435 | err_remove_acpi_chip: |
| 1430 | acpi_gpiochip_remove(chip); | 1436 | acpi_gpiochip_remove(chip); |
| 1431 | err_remove_of_chip: | 1437 | err_remove_of_chip: |
| 1432 | gpiochip_free_hogs(chip); | 1438 | gpiochip_free_hogs(chip); |
| 1433 | of_gpiochip_remove(chip); | 1439 | of_gpiochip_remove(chip); |
| 1434 | err_remove_chip: | | |
| 1435 | gpiochip_irqchip_remove(chip); | | |
| 1436 | err_free_gpiochip_mask: | 1440 | err_free_gpiochip_mask: |
| 1437 | gpiochip_free_valid_mask(chip); | 1441 | gpiochip_free_valid_mask(chip); |
| 1438 | err_remove_irqchip_mask: | | |
| 1439 | gpiochip_irqchip_free_valid_mask(chip); | | |
| 1440 | err_remove_from_list: | 1442 | err_remove_from_list: |
| 1441 | spin_lock_irqsave(&gpio_lock, flags); | 1443 | spin_lock_irqsave(&gpio_lock, flags); |
| 1442 | list_del(&gdev->list); | 1444 | list_del(&gdev->list); |