Loading drivers/media/platform/msm/camera/cam_sync/cam_sync.c +1 −3 Original line number Diff line number Diff line Loading @@ -346,9 +346,7 @@ int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj) int cam_sync_destroy(int32_t sync_obj) { cam_sync_deinit_object(sync_dev->sync_table, sync_obj); return 0; return cam_sync_deinit_object(sync_dev->sync_table, sync_obj); } int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms) Loading drivers/media/platform/msm/camera/cam_sync/cam_sync_private.h +2 −2 Original line number Diff line number Diff line Loading @@ -58,11 +58,11 @@ enum sync_type { * enum sync_list_clean_type - Enum to indicate the type of list clean action * to be peformed, i.e. specific sync ID or all list sync ids. * * @SYNC_CLEAN_ID : Specific object to be cleaned in the list * @SYNC_CLEAN_ONE : Specific object to be cleaned in the list * @SYNC_CLEAN_ALL : Clean all objects in the list */ enum sync_list_clean_type { SYNC_LIST_CLEAN_ID, SYNC_LIST_CLEAN_ONE, SYNC_LIST_CLEAN_ALL }; Loading drivers/media/platform/msm/camera/cam_sync/cam_sync_util.c +46 −78 Original line number Diff line number Diff line Loading @@ -144,8 +144,8 @@ int cam_sync_init_group_object(struct sync_table_row *table, child_info = kzalloc(sizeof(*child_info), GFP_ATOMIC); if (!child_info) { cam_sync_util_cleanup_children_list( &row->children_list, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list(row, SYNC_LIST_CLEAN_ALL, 0); return -ENOMEM; } Loading @@ -159,11 +159,10 @@ int cam_sync_init_group_object(struct sync_table_row *table, spin_lock_bh(&sync_dev->row_spinlocks[sync_objs[i]]); parent_info = kzalloc(sizeof(*parent_info), GFP_ATOMIC); if (!parent_info) { cam_sync_util_cleanup_parents_list( &child_row->parents_list, cam_sync_util_cleanup_parents_list(child_row, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list(row, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list( &row->children_list, SYNC_LIST_CLEAN_ALL, 0); spin_unlock_bh(&sync_dev->row_spinlocks[sync_objs[i]]); return -ENOMEM; } Loading Loading @@ -198,12 +197,12 @@ int cam_sync_init_group_object(struct sync_table_row *table, int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) { struct sync_table_row *row = table + idx; struct sync_child_info *child_info, *temp_child, *child_copy_info; struct sync_child_info *child_info, *temp_child; struct sync_callback_info *sync_cb, *temp_cb; struct sync_parent_info *parent_info, *temp_parent, *parent_copy_info; struct sync_parent_info *parent_info, *temp_parent; struct sync_user_payload *upayload_info, *temp_upayload; struct sync_table_row *child_row = NULL, *parent_row = NULL; struct list_head child_copy_list, parent_copy_list; struct list_head temp_child_list, temp_parent_list; if (!table || idx <= 0 || idx >= CAM_SYNC_MAX_OBJS) return -EINVAL; Loading @@ -217,67 +216,38 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) return -EINVAL; } /* Objects child and parent objects will be added into this list */ INIT_LIST_HEAD(&child_copy_list); INIT_LIST_HEAD(&parent_copy_list); /* Object's child and parent objects will be added into this list */ INIT_LIST_HEAD(&temp_child_list); INIT_LIST_HEAD(&temp_parent_list); list_for_each_entry_safe(child_info, temp_child, &row->children_list, list) { if (child_info->sync_id <= 0) continue; child_copy_info = kzalloc(sizeof(*child_copy_info), GFP_ATOMIC); if (!child_copy_info) { /* No free memory, clean up the child_copy_list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, struct sync_child_info, list); list_del_init(&child_info->list); kfree(child_info); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); goto deinit; } child_copy_info->sync_id = child_info->sync_id; list_add_tail(&child_copy_info->list, &child_copy_list); list_add_tail(&child_info->list, &temp_child_list); } list_for_each_entry_safe(parent_info, temp_parent, &row->parents_list, list) { if (parent_info->sync_id <= 0) continue; parent_copy_info = kzalloc(sizeof(*parent_copy_info), GFP_ATOMIC); if (!parent_copy_info) { /* No free memory, clean up the parent_copy_list */ while (!list_empty(&parent_copy_list)) { parent_info = list_first_entry( &parent_copy_list, struct sync_parent_info, list); list_del_init(&parent_info->list); kfree(parent_info); } /* No free memory, clean up the child_copy_list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, struct sync_child_info, list); list_del_init(&child_info->list); kfree(child_info); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); goto deinit; } parent_copy_info->sync_id = parent_info->sync_id; list_add_tail(&parent_copy_info->list, &parent_copy_list); list_add_tail(&parent_info->list, &temp_parent_list); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); /* Cleanup the child to parent link from child list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, while (!list_empty(&temp_child_list)) { child_info = list_first_entry(&temp_child_list, struct sync_child_info, list); child_row = sync_dev->sync_table + child_info->sync_id; spin_lock_bh(&sync_dev->row_spinlocks[child_info->sync_id]); if (child_row->state == CAM_SYNC_STATE_INVALID) { spin_unlock_bh(&sync_dev->row_spinlocks[ child_info->sync_id]); Loading @@ -286,20 +256,23 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) continue; } cam_sync_util_cleanup_parents_list(&child_row->parents_list, SYNC_LIST_CLEAN_ID, idx); cam_sync_util_cleanup_parents_list(child_row, SYNC_LIST_CLEAN_ONE, idx); spin_unlock_bh(&sync_dev->row_spinlocks[child_info->sync_id]); list_del_init(&child_info->list); kfree(child_info); } /* Cleanup the parent to child link */ while (!list_empty(&parent_copy_list)) { parent_info = list_first_entry(&parent_copy_list, while (!list_empty(&temp_parent_list)) { parent_info = list_first_entry(&temp_parent_list, struct sync_parent_info, list); parent_row = sync_dev->sync_table + parent_info->sync_id; spin_lock_bh(&sync_dev->row_spinlocks[parent_info->sync_id]); if (parent_row->state == CAM_SYNC_STATE_INVALID) { spin_unlock_bh(&sync_dev->row_spinlocks[ parent_info->sync_id]); Loading @@ -308,21 +281,16 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) continue; } cam_sync_util_cleanup_children_list(&parent_row->children_list, SYNC_LIST_CLEAN_ID, idx); cam_sync_util_cleanup_children_list(parent_row, SYNC_LIST_CLEAN_ONE, idx); spin_unlock_bh(&sync_dev->row_spinlocks[parent_info->sync_id]); list_del_init(&parent_info->list); kfree(parent_info); } deinit: spin_lock_bh(&sync_dev->row_spinlocks[idx]); cam_sync_util_cleanup_children_list(&row->children_list, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_parents_list(&row->parents_list, SYNC_LIST_CLEAN_ALL, 0); list_for_each_entry_safe(upayload_info, temp_upayload, &row->user_payload_list, list) { list_del_init(&upayload_info->list); Loading Loading @@ -457,7 +425,7 @@ int cam_sync_util_get_state(int current_state, return result; } void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_children_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj) { struct sync_child_info *child_info = NULL; Loading @@ -465,8 +433,8 @@ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, uint32_t curr_sync_obj; list_for_each_entry_safe(child_info, temp_child_info, list_to_clean, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ID) && temp_child_info, &row->children_list, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (child_info->sync_id != sync_obj)) continue; Loading @@ -474,13 +442,13 @@ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, list_del_init(&child_info->list); kfree(child_info); if ((list_clean_type == SYNC_LIST_CLEAN_ID) && if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (curr_sync_obj == sync_obj)) break; } } void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_parents_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj) { struct sync_parent_info *parent_info = NULL; Loading @@ -488,8 +456,8 @@ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, uint32_t curr_sync_obj; list_for_each_entry_safe(parent_info, temp_parent_info, list_to_clean, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ID) && temp_parent_info, &row->parents_list, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (parent_info->sync_id != sync_obj)) continue; Loading @@ -497,7 +465,7 @@ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, list_del_init(&parent_info->list); kfree(parent_info); if ((list_clean_type == SYNC_LIST_CLEAN_ID) && if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (curr_sync_obj == sync_obj)) break; } Loading drivers/media/platform/msm/camera/cam_sync/cam_sync_util.h +6 −6 Original line number Diff line number Diff line Loading @@ -140,26 +140,26 @@ int cam_sync_util_get_state(int current_state, /** * @brief: Function to clean up the children of a sync object * @param list_to_clean : List to clean up * @row : Row whose child list to clean * @list_clean_type : Clean specific object or clean all objects * @sync_obj : Sync object to be clean if list clean type is * SYNC_LIST_CLEAN_ID * SYNC_LIST_CLEAN_ONE * * @return None */ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_children_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj); /** * @brief: Function to clean up the parents of a sync object * @param list_to_clean : List to clean up * @row : Row whose parent list to clean * @list_clean_type : Clean specific object or clean all objects * @sync_obj : Sync object to be clean if list clean type is * SYNC_LIST_CLEAN_ID * SYNC_LIST_CLEAN_ONE * * @return None */ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_parents_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj); #endif /* __CAM_SYNC_UTIL_H__ */ Loading
drivers/media/platform/msm/camera/cam_sync/cam_sync.c +1 −3 Original line number Diff line number Diff line Loading @@ -346,9 +346,7 @@ int cam_sync_merge(int32_t *sync_obj, uint32_t num_objs, int32_t *merged_obj) int cam_sync_destroy(int32_t sync_obj) { cam_sync_deinit_object(sync_dev->sync_table, sync_obj); return 0; return cam_sync_deinit_object(sync_dev->sync_table, sync_obj); } int cam_sync_wait(int32_t sync_obj, uint64_t timeout_ms) Loading
drivers/media/platform/msm/camera/cam_sync/cam_sync_private.h +2 −2 Original line number Diff line number Diff line Loading @@ -58,11 +58,11 @@ enum sync_type { * enum sync_list_clean_type - Enum to indicate the type of list clean action * to be peformed, i.e. specific sync ID or all list sync ids. * * @SYNC_CLEAN_ID : Specific object to be cleaned in the list * @SYNC_CLEAN_ONE : Specific object to be cleaned in the list * @SYNC_CLEAN_ALL : Clean all objects in the list */ enum sync_list_clean_type { SYNC_LIST_CLEAN_ID, SYNC_LIST_CLEAN_ONE, SYNC_LIST_CLEAN_ALL }; Loading
drivers/media/platform/msm/camera/cam_sync/cam_sync_util.c +46 −78 Original line number Diff line number Diff line Loading @@ -144,8 +144,8 @@ int cam_sync_init_group_object(struct sync_table_row *table, child_info = kzalloc(sizeof(*child_info), GFP_ATOMIC); if (!child_info) { cam_sync_util_cleanup_children_list( &row->children_list, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list(row, SYNC_LIST_CLEAN_ALL, 0); return -ENOMEM; } Loading @@ -159,11 +159,10 @@ int cam_sync_init_group_object(struct sync_table_row *table, spin_lock_bh(&sync_dev->row_spinlocks[sync_objs[i]]); parent_info = kzalloc(sizeof(*parent_info), GFP_ATOMIC); if (!parent_info) { cam_sync_util_cleanup_parents_list( &child_row->parents_list, cam_sync_util_cleanup_parents_list(child_row, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list(row, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_children_list( &row->children_list, SYNC_LIST_CLEAN_ALL, 0); spin_unlock_bh(&sync_dev->row_spinlocks[sync_objs[i]]); return -ENOMEM; } Loading Loading @@ -198,12 +197,12 @@ int cam_sync_init_group_object(struct sync_table_row *table, int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) { struct sync_table_row *row = table + idx; struct sync_child_info *child_info, *temp_child, *child_copy_info; struct sync_child_info *child_info, *temp_child; struct sync_callback_info *sync_cb, *temp_cb; struct sync_parent_info *parent_info, *temp_parent, *parent_copy_info; struct sync_parent_info *parent_info, *temp_parent; struct sync_user_payload *upayload_info, *temp_upayload; struct sync_table_row *child_row = NULL, *parent_row = NULL; struct list_head child_copy_list, parent_copy_list; struct list_head temp_child_list, temp_parent_list; if (!table || idx <= 0 || idx >= CAM_SYNC_MAX_OBJS) return -EINVAL; Loading @@ -217,67 +216,38 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) return -EINVAL; } /* Objects child and parent objects will be added into this list */ INIT_LIST_HEAD(&child_copy_list); INIT_LIST_HEAD(&parent_copy_list); /* Object's child and parent objects will be added into this list */ INIT_LIST_HEAD(&temp_child_list); INIT_LIST_HEAD(&temp_parent_list); list_for_each_entry_safe(child_info, temp_child, &row->children_list, list) { if (child_info->sync_id <= 0) continue; child_copy_info = kzalloc(sizeof(*child_copy_info), GFP_ATOMIC); if (!child_copy_info) { /* No free memory, clean up the child_copy_list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, struct sync_child_info, list); list_del_init(&child_info->list); kfree(child_info); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); goto deinit; } child_copy_info->sync_id = child_info->sync_id; list_add_tail(&child_copy_info->list, &child_copy_list); list_add_tail(&child_info->list, &temp_child_list); } list_for_each_entry_safe(parent_info, temp_parent, &row->parents_list, list) { if (parent_info->sync_id <= 0) continue; parent_copy_info = kzalloc(sizeof(*parent_copy_info), GFP_ATOMIC); if (!parent_copy_info) { /* No free memory, clean up the parent_copy_list */ while (!list_empty(&parent_copy_list)) { parent_info = list_first_entry( &parent_copy_list, struct sync_parent_info, list); list_del_init(&parent_info->list); kfree(parent_info); } /* No free memory, clean up the child_copy_list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, struct sync_child_info, list); list_del_init(&child_info->list); kfree(child_info); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); goto deinit; } parent_copy_info->sync_id = parent_info->sync_id; list_add_tail(&parent_copy_info->list, &parent_copy_list); list_add_tail(&parent_info->list, &temp_parent_list); } spin_unlock_bh(&sync_dev->row_spinlocks[idx]); /* Cleanup the child to parent link from child list */ while (!list_empty(&child_copy_list)) { child_info = list_first_entry(&child_copy_list, while (!list_empty(&temp_child_list)) { child_info = list_first_entry(&temp_child_list, struct sync_child_info, list); child_row = sync_dev->sync_table + child_info->sync_id; spin_lock_bh(&sync_dev->row_spinlocks[child_info->sync_id]); if (child_row->state == CAM_SYNC_STATE_INVALID) { spin_unlock_bh(&sync_dev->row_spinlocks[ child_info->sync_id]); Loading @@ -286,20 +256,23 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) continue; } cam_sync_util_cleanup_parents_list(&child_row->parents_list, SYNC_LIST_CLEAN_ID, idx); cam_sync_util_cleanup_parents_list(child_row, SYNC_LIST_CLEAN_ONE, idx); spin_unlock_bh(&sync_dev->row_spinlocks[child_info->sync_id]); list_del_init(&child_info->list); kfree(child_info); } /* Cleanup the parent to child link */ while (!list_empty(&parent_copy_list)) { parent_info = list_first_entry(&parent_copy_list, while (!list_empty(&temp_parent_list)) { parent_info = list_first_entry(&temp_parent_list, struct sync_parent_info, list); parent_row = sync_dev->sync_table + parent_info->sync_id; spin_lock_bh(&sync_dev->row_spinlocks[parent_info->sync_id]); if (parent_row->state == CAM_SYNC_STATE_INVALID) { spin_unlock_bh(&sync_dev->row_spinlocks[ parent_info->sync_id]); Loading @@ -308,21 +281,16 @@ int cam_sync_deinit_object(struct sync_table_row *table, uint32_t idx) continue; } cam_sync_util_cleanup_children_list(&parent_row->children_list, SYNC_LIST_CLEAN_ID, idx); cam_sync_util_cleanup_children_list(parent_row, SYNC_LIST_CLEAN_ONE, idx); spin_unlock_bh(&sync_dev->row_spinlocks[parent_info->sync_id]); list_del_init(&parent_info->list); kfree(parent_info); } deinit: spin_lock_bh(&sync_dev->row_spinlocks[idx]); cam_sync_util_cleanup_children_list(&row->children_list, SYNC_LIST_CLEAN_ALL, 0); cam_sync_util_cleanup_parents_list(&row->parents_list, SYNC_LIST_CLEAN_ALL, 0); list_for_each_entry_safe(upayload_info, temp_upayload, &row->user_payload_list, list) { list_del_init(&upayload_info->list); Loading Loading @@ -457,7 +425,7 @@ int cam_sync_util_get_state(int current_state, return result; } void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_children_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj) { struct sync_child_info *child_info = NULL; Loading @@ -465,8 +433,8 @@ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, uint32_t curr_sync_obj; list_for_each_entry_safe(child_info, temp_child_info, list_to_clean, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ID) && temp_child_info, &row->children_list, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (child_info->sync_id != sync_obj)) continue; Loading @@ -474,13 +442,13 @@ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, list_del_init(&child_info->list); kfree(child_info); if ((list_clean_type == SYNC_LIST_CLEAN_ID) && if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (curr_sync_obj == sync_obj)) break; } } void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_parents_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj) { struct sync_parent_info *parent_info = NULL; Loading @@ -488,8 +456,8 @@ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, uint32_t curr_sync_obj; list_for_each_entry_safe(parent_info, temp_parent_info, list_to_clean, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ID) && temp_parent_info, &row->parents_list, list) { if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (parent_info->sync_id != sync_obj)) continue; Loading @@ -497,7 +465,7 @@ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, list_del_init(&parent_info->list); kfree(parent_info); if ((list_clean_type == SYNC_LIST_CLEAN_ID) && if ((list_clean_type == SYNC_LIST_CLEAN_ONE) && (curr_sync_obj == sync_obj)) break; } Loading
drivers/media/platform/msm/camera/cam_sync/cam_sync_util.h +6 −6 Original line number Diff line number Diff line Loading @@ -140,26 +140,26 @@ int cam_sync_util_get_state(int current_state, /** * @brief: Function to clean up the children of a sync object * @param list_to_clean : List to clean up * @row : Row whose child list to clean * @list_clean_type : Clean specific object or clean all objects * @sync_obj : Sync object to be clean if list clean type is * SYNC_LIST_CLEAN_ID * SYNC_LIST_CLEAN_ONE * * @return None */ void cam_sync_util_cleanup_children_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_children_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj); /** * @brief: Function to clean up the parents of a sync object * @param list_to_clean : List to clean up * @row : Row whose parent list to clean * @list_clean_type : Clean specific object or clean all objects * @sync_obj : Sync object to be clean if list clean type is * SYNC_LIST_CLEAN_ID * SYNC_LIST_CLEAN_ONE * * @return None */ void cam_sync_util_cleanup_parents_list(struct list_head *list_to_clean, void cam_sync_util_cleanup_parents_list(struct sync_table_row *row, uint32_t list_clean_type, uint32_t sync_obj); #endif /* __CAM_SYNC_UTIL_H__ */