diff options
| -rw-r--r-- | Documentation/filesystems/configfs/configfs.txt | 2 | ||||
| -rw-r--r-- | drivers/nvme/target/configfs.c | 10 | ||||
| -rw-r--r-- | drivers/target/target_core_fabric_configfs.c | 7 | ||||
| -rw-r--r-- | drivers/usb/gadget/configfs.c | 8 | ||||
| -rw-r--r-- | drivers/usb/gadget/function/uvc_configfs.c | 25 | ||||
| -rw-r--r-- | include/linux/configfs.h | 2 |
6 files changed, 17 insertions, 37 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index 8ec9136aae56..3828e85345ae 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
| @@ -174,7 +174,7 @@ among other things. For that, it needs a type. | |||
| 174 | void (*release)(struct config_item *); | 174 | void (*release)(struct config_item *); |
| 175 | int (*allow_link)(struct config_item *src, | 175 | int (*allow_link)(struct config_item *src, |
| 176 | struct config_item *target); | 176 | struct config_item *target); |
| 177 | int (*drop_link)(struct config_item *src, | 177 | void (*drop_link)(struct config_item *src, |
| 178 | struct config_item *target); | 178 | struct config_item *target); |
| 179 | }; | 179 | }; |
| 180 | 180 | ||
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c index d0f60c36d576..6f5074153dcd 100644 --- a/drivers/nvme/target/configfs.c +++ b/drivers/nvme/target/configfs.c | |||
| @@ -480,7 +480,7 @@ out_free_link: | |||
| 480 | return ret; | 480 | return ret; |
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | static int nvmet_port_subsys_drop_link(struct config_item *parent, | 483 | static void nvmet_port_subsys_drop_link(struct config_item *parent, |
| 484 | struct config_item *target) | 484 | struct config_item *target) |
| 485 | { | 485 | { |
| 486 | struct nvmet_port *port = to_nvmet_port(parent->ci_parent); | 486 | struct nvmet_port *port = to_nvmet_port(parent->ci_parent); |
| @@ -493,7 +493,7 @@ static int nvmet_port_subsys_drop_link(struct config_item *parent, | |||
| 493 | goto found; | 493 | goto found; |
| 494 | } | 494 | } |
| 495 | up_write(&nvmet_config_sem); | 495 | up_write(&nvmet_config_sem); |
| 496 | return -EINVAL; | 496 | return; |
| 497 | 497 | ||
| 498 | found: | 498 | found: |
| 499 | list_del(&p->entry); | 499 | list_del(&p->entry); |
| @@ -502,7 +502,6 @@ found: | |||
| 502 | nvmet_disable_port(port); | 502 | nvmet_disable_port(port); |
| 503 | up_write(&nvmet_config_sem); | 503 | up_write(&nvmet_config_sem); |
| 504 | kfree(p); | 504 | kfree(p); |
| 505 | return 0; | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | static struct configfs_item_operations nvmet_port_subsys_item_ops = { | 507 | static struct configfs_item_operations nvmet_port_subsys_item_ops = { |
| @@ -556,7 +555,7 @@ out_free_link: | |||
| 556 | return ret; | 555 | return ret; |
| 557 | } | 556 | } |
| 558 | 557 | ||
| 559 | static int nvmet_allowed_hosts_drop_link(struct config_item *parent, | 558 | static void nvmet_allowed_hosts_drop_link(struct config_item *parent, |
| 560 | struct config_item *target) | 559 | struct config_item *target) |
| 561 | { | 560 | { |
| 562 | struct nvmet_subsys *subsys = to_subsys(parent->ci_parent); | 561 | struct nvmet_subsys *subsys = to_subsys(parent->ci_parent); |
| @@ -569,14 +568,13 @@ static int nvmet_allowed_hosts_drop_link(struct config_item *parent, | |||
| 569 | goto found; | 568 | goto found; |
| 570 | } | 569 | } |
| 571 | up_write(&nvmet_config_sem); | 570 | up_write(&nvmet_config_sem); |
| 572 | return -EINVAL; | 571 | return; |
| 573 | 572 | ||
| 574 | found: | 573 | found: |
| 575 | list_del(&p->entry); | 574 | list_del(&p->entry); |
| 576 | nvmet_genctr++; | 575 | nvmet_genctr++; |
| 577 | up_write(&nvmet_config_sem); | 576 | up_write(&nvmet_config_sem); |
| 578 | kfree(p); | 577 | kfree(p); |
| 579 | return 0; | ||
| 580 | } | 578 | } |
| 581 | 579 | ||
| 582 | static struct configfs_item_operations nvmet_allowed_hosts_item_ops = { | 580 | static struct configfs_item_operations nvmet_allowed_hosts_item_ops = { |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 31a096aa16ab..d8a16ca6baa5 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
| @@ -137,7 +137,7 @@ static int target_fabric_mappedlun_link( | |||
| 137 | return core_dev_add_initiator_node_lun_acl(se_tpg, lacl, lun, lun_access_ro); | 137 | return core_dev_add_initiator_node_lun_acl(se_tpg, lacl, lun, lun_access_ro); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | static int target_fabric_mappedlun_unlink( | 140 | static void target_fabric_mappedlun_unlink( |
| 141 | struct config_item *lun_acl_ci, | 141 | struct config_item *lun_acl_ci, |
| 142 | struct config_item *lun_ci) | 142 | struct config_item *lun_ci) |
| 143 | { | 143 | { |
| @@ -146,7 +146,7 @@ static int target_fabric_mappedlun_unlink( | |||
| 146 | struct se_lun *lun = container_of(to_config_group(lun_ci), | 146 | struct se_lun *lun = container_of(to_config_group(lun_ci), |
| 147 | struct se_lun, lun_group); | 147 | struct se_lun, lun_group); |
| 148 | 148 | ||
| 149 | return core_dev_del_initiator_node_lun_acl(lun, lacl); | 149 | core_dev_del_initiator_node_lun_acl(lun, lacl); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static struct se_lun_acl *item_to_lun_acl(struct config_item *item) | 152 | static struct se_lun_acl *item_to_lun_acl(struct config_item *item) |
| @@ -669,7 +669,7 @@ out: | |||
| 669 | return ret; | 669 | return ret; |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | static int target_fabric_port_unlink( | 672 | static void target_fabric_port_unlink( |
| 673 | struct config_item *lun_ci, | 673 | struct config_item *lun_ci, |
| 674 | struct config_item *se_dev_ci) | 674 | struct config_item *se_dev_ci) |
| 675 | { | 675 | { |
| @@ -688,7 +688,6 @@ static int target_fabric_port_unlink( | |||
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | core_dev_del_lun(se_tpg, lun); | 690 | core_dev_del_lun(se_tpg, lun); |
| 691 | return 0; | ||
| 692 | } | 691 | } |
| 693 | 692 | ||
| 694 | static void target_fabric_port_release(struct config_item *item) | 693 | static void target_fabric_port_release(struct config_item *item) |
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 3984787f8e97..78c44979dde3 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
| @@ -408,7 +408,7 @@ out: | |||
| 408 | return ret; | 408 | return ret; |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | static int config_usb_cfg_unlink( | 411 | static void config_usb_cfg_unlink( |
| 412 | struct config_item *usb_cfg_ci, | 412 | struct config_item *usb_cfg_ci, |
| 413 | struct config_item *usb_func_ci) | 413 | struct config_item *usb_func_ci) |
| 414 | { | 414 | { |
| @@ -437,12 +437,11 @@ static int config_usb_cfg_unlink( | |||
| 437 | list_del(&f->list); | 437 | list_del(&f->list); |
| 438 | usb_put_function(f); | 438 | usb_put_function(f); |
| 439 | mutex_unlock(&gi->lock); | 439 | mutex_unlock(&gi->lock); |
| 440 | return 0; | 440 | return; |
| 441 | } | 441 | } |
| 442 | } | 442 | } |
| 443 | mutex_unlock(&gi->lock); | 443 | mutex_unlock(&gi->lock); |
| 444 | WARN(1, "Unable to locate function to unbind\n"); | 444 | WARN(1, "Unable to locate function to unbind\n"); |
| 445 | return 0; | ||
| 446 | } | 445 | } |
| 447 | 446 | ||
| 448 | static struct configfs_item_operations gadget_config_item_ops = { | 447 | static struct configfs_item_operations gadget_config_item_ops = { |
| @@ -865,7 +864,7 @@ out: | |||
| 865 | return ret; | 864 | return ret; |
| 866 | } | 865 | } |
| 867 | 866 | ||
| 868 | static int os_desc_unlink(struct config_item *os_desc_ci, | 867 | static void os_desc_unlink(struct config_item *os_desc_ci, |
| 869 | struct config_item *usb_cfg_ci) | 868 | struct config_item *usb_cfg_ci) |
| 870 | { | 869 | { |
| 871 | struct gadget_info *gi = container_of(to_config_group(os_desc_ci), | 870 | struct gadget_info *gi = container_of(to_config_group(os_desc_ci), |
| @@ -878,7 +877,6 @@ static int os_desc_unlink(struct config_item *os_desc_ci, | |||
| 878 | cdev->os_desc_config = NULL; | 877 | cdev->os_desc_config = NULL; |
| 879 | WARN_ON(gi->composite.gadget_driver.udc_name); | 878 | WARN_ON(gi->composite.gadget_driver.udc_name); |
| 880 | mutex_unlock(&gi->lock); | 879 | mutex_unlock(&gi->lock); |
| 881 | return 0; | ||
| 882 | } | 880 | } |
| 883 | 881 | ||
| 884 | static struct configfs_item_operations os_desc_ops = { | 882 | static struct configfs_item_operations os_desc_ops = { |
diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index 31125a4a2658..4e037d2a7a60 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c | |||
| @@ -547,7 +547,7 @@ out: | |||
| 547 | return ret; | 547 | return ret; |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | static int uvcg_control_class_drop_link(struct config_item *src, | 550 | static void uvcg_control_class_drop_link(struct config_item *src, |
| 551 | struct config_item *target) | 551 | struct config_item *target) |
| 552 | { | 552 | { |
| 553 | struct config_item *control, *header; | 553 | struct config_item *control, *header; |
| @@ -555,7 +555,6 @@ static int uvcg_control_class_drop_link(struct config_item *src, | |||
| 555 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; | 555 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; |
| 556 | struct uvc_descriptor_header **class_array; | 556 | struct uvc_descriptor_header **class_array; |
| 557 | struct uvcg_control_header *target_hdr; | 557 | struct uvcg_control_header *target_hdr; |
| 558 | int ret = -EINVAL; | ||
| 559 | 558 | ||
| 560 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ | 559 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ |
| 561 | 560 | ||
| @@ -569,23 +568,17 @@ static int uvcg_control_class_drop_link(struct config_item *src, | |||
| 569 | mutex_lock(&opts->lock); | 568 | mutex_lock(&opts->lock); |
| 570 | 569 | ||
| 571 | class_array = uvcg_get_ctl_class_arr(src, opts); | 570 | class_array = uvcg_get_ctl_class_arr(src, opts); |
| 572 | if (!class_array) | 571 | if (!class_array || opts->refcnt) |
| 573 | goto unlock; | ||
| 574 | if (opts->refcnt) { | ||
| 575 | ret = -EBUSY; | ||
| 576 | goto unlock; | 572 | goto unlock; |
| 577 | } | ||
| 578 | 573 | ||
| 579 | target_hdr = to_uvcg_control_header(target); | 574 | target_hdr = to_uvcg_control_header(target); |
| 580 | --target_hdr->linked; | 575 | --target_hdr->linked; |
| 581 | class_array[0] = NULL; | 576 | class_array[0] = NULL; |
| 582 | ret = 0; | ||
| 583 | 577 | ||
| 584 | unlock: | 578 | unlock: |
| 585 | mutex_unlock(&opts->lock); | 579 | mutex_unlock(&opts->lock); |
| 586 | out: | 580 | out: |
| 587 | mutex_unlock(su_mutex); | 581 | mutex_unlock(su_mutex); |
| 588 | return ret; | ||
| 589 | } | 582 | } |
| 590 | 583 | ||
| 591 | static struct configfs_item_operations uvcg_control_class_item_ops = { | 584 | static struct configfs_item_operations uvcg_control_class_item_ops = { |
| @@ -777,7 +770,7 @@ out: | |||
| 777 | return ret; | 770 | return ret; |
| 778 | } | 771 | } |
| 779 | 772 | ||
| 780 | static int uvcg_streaming_header_drop_link(struct config_item *src, | 773 | static void uvcg_streaming_header_drop_link(struct config_item *src, |
| 781 | struct config_item *target) | 774 | struct config_item *target) |
| 782 | { | 775 | { |
| 783 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; | 776 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; |
| @@ -786,7 +779,6 @@ static int uvcg_streaming_header_drop_link(struct config_item *src, | |||
| 786 | struct uvcg_streaming_header *src_hdr; | 779 | struct uvcg_streaming_header *src_hdr; |
| 787 | struct uvcg_format *target_fmt = NULL; | 780 | struct uvcg_format *target_fmt = NULL; |
| 788 | struct uvcg_format_ptr *format_ptr, *tmp; | 781 | struct uvcg_format_ptr *format_ptr, *tmp; |
| 789 | int ret = -EINVAL; | ||
| 790 | 782 | ||
| 791 | src_hdr = to_uvcg_streaming_header(src); | 783 | src_hdr = to_uvcg_streaming_header(src); |
| 792 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ | 784 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ |
| @@ -811,8 +803,6 @@ static int uvcg_streaming_header_drop_link(struct config_item *src, | |||
| 811 | out: | 803 | out: |
| 812 | mutex_unlock(&opts->lock); | 804 | mutex_unlock(&opts->lock); |
| 813 | mutex_unlock(su_mutex); | 805 | mutex_unlock(su_mutex); |
| 814 | return ret; | ||
| 815 | |||
| 816 | } | 806 | } |
| 817 | 807 | ||
| 818 | static struct configfs_item_operations uvcg_streaming_header_item_ops = { | 808 | static struct configfs_item_operations uvcg_streaming_header_item_ops = { |
| @@ -2051,7 +2041,7 @@ out: | |||
| 2051 | return ret; | 2041 | return ret; |
| 2052 | } | 2042 | } |
| 2053 | 2043 | ||
| 2054 | static int uvcg_streaming_class_drop_link(struct config_item *src, | 2044 | static void uvcg_streaming_class_drop_link(struct config_item *src, |
| 2055 | struct config_item *target) | 2045 | struct config_item *target) |
| 2056 | { | 2046 | { |
| 2057 | struct config_item *streaming, *header; | 2047 | struct config_item *streaming, *header; |
| @@ -2059,7 +2049,6 @@ static int uvcg_streaming_class_drop_link(struct config_item *src, | |||
| 2059 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; | 2049 | struct mutex *su_mutex = &src->ci_group->cg_subsys->su_mutex; |
| 2060 | struct uvc_descriptor_header ***class_array; | 2050 | struct uvc_descriptor_header ***class_array; |
| 2061 | struct uvcg_streaming_header *target_hdr; | 2051 | struct uvcg_streaming_header *target_hdr; |
| 2062 | int ret = -EINVAL; | ||
| 2063 | 2052 | ||
| 2064 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ | 2053 | mutex_lock(su_mutex); /* for navigating configfs hierarchy */ |
| 2065 | 2054 | ||
| @@ -2076,23 +2065,19 @@ static int uvcg_streaming_class_drop_link(struct config_item *src, | |||
| 2076 | if (!class_array || !*class_array) | 2065 | if (!class_array || !*class_array) |
| 2077 | goto unlock; | 2066 | goto unlock; |
| 2078 | 2067 | ||
| 2079 | if (opts->refcnt) { | 2068 | if (opts->refcnt) |
| 2080 | ret = -EBUSY; | ||
| 2081 | goto unlock; | 2069 | goto unlock; |
| 2082 | } | ||
| 2083 | 2070 | ||
| 2084 | target_hdr = to_uvcg_streaming_header(target); | 2071 | target_hdr = to_uvcg_streaming_header(target); |
| 2085 | --target_hdr->linked; | 2072 | --target_hdr->linked; |
| 2086 | kfree(**class_array); | 2073 | kfree(**class_array); |
| 2087 | kfree(*class_array); | 2074 | kfree(*class_array); |
| 2088 | *class_array = NULL; | 2075 | *class_array = NULL; |
| 2089 | ret = 0; | ||
| 2090 | 2076 | ||
| 2091 | unlock: | 2077 | unlock: |
| 2092 | mutex_unlock(&opts->lock); | 2078 | mutex_unlock(&opts->lock); |
| 2093 | out: | 2079 | out: |
| 2094 | mutex_unlock(su_mutex); | 2080 | mutex_unlock(su_mutex); |
| 2095 | return ret; | ||
| 2096 | } | 2081 | } |
| 2097 | 2082 | ||
| 2098 | static struct configfs_item_operations uvcg_streaming_class_item_ops = { | 2083 | static struct configfs_item_operations uvcg_streaming_class_item_ops = { |
diff --git a/include/linux/configfs.h b/include/linux/configfs.h index d9d6a9d77489..9a30b921f740 100644 --- a/include/linux/configfs.h +++ b/include/linux/configfs.h | |||
| @@ -228,7 +228,7 @@ static struct configfs_bin_attribute _pfx##attr_##_name = { \ | |||
| 228 | struct configfs_item_operations { | 228 | struct configfs_item_operations { |
| 229 | void (*release)(struct config_item *); | 229 | void (*release)(struct config_item *); |
| 230 | int (*allow_link)(struct config_item *src, struct config_item *target); | 230 | int (*allow_link)(struct config_item *src, struct config_item *target); |
| 231 | int (*drop_link)(struct config_item *src, struct config_item *target); | 231 | void (*drop_link)(struct config_item *src, struct config_item *target); |
| 232 | }; | 232 | }; |
| 233 | 233 | ||
| 234 | struct configfs_group_operations { | 234 | struct configfs_group_operations { |
