コード例 #1
0
ファイル: main.c プロジェクト: ARMWorks/FA_2451_Linux_Kernel
/**
 * mei_clear_list - removes all callbacks associated with file
 *		from mei_cb_list
 *
 * @dev: device structure.
 * @file: file structure
 * @mei_cb_list: callbacks list
 *
 * mei_clear_list is called to clear resources associated with file
 * when application calls close function or Ctrl-C was pressed
 *
 * returns true if callback removed from the list, false otherwise
 */
static bool mei_clear_list(struct mei_device *dev,
		struct file *file, struct list_head *mei_cb_list)
{
	struct mei_cl_cb *cb_pos = NULL;
	struct mei_cl_cb *cb_next = NULL;
	struct file *file_temp;
	bool removed = false;

	/* list all list member */
	list_for_each_entry_safe(cb_pos, cb_next, mei_cb_list, cb_list) {
		file_temp = (struct file *)cb_pos->file_object;
		/* check if list member associated with a file */
		if (file_temp == file) {
			/* remove member from the list */
			list_del(&cb_pos->cb_list);
			/* check if cb equal to current iamthif cb */
			if (dev->iamthif_current_cb == cb_pos) {
				dev->iamthif_current_cb = NULL;
				/* send flow control to iamthif client */
				mei_send_flow_control(dev, &dev->iamthif_cl);
			}
			/* free all allocated buffers */
			mei_free_cb_private(cb_pos);
			cb_pos = NULL;
			removed = true;
		}
	}
コード例 #2
0
static bool mei_clear_list(struct mei_device *dev,
		struct file *file, struct list_head *mei_cb_list)
{
	struct mei_cl_cb *cb_pos = NULL;
	struct mei_cl_cb *cb_next = NULL;
	struct file *file_temp;
	bool removed = false;

	/*                      */
	list_for_each_entry_safe(cb_pos, cb_next, mei_cb_list, cb_list) {
		file_temp = (struct file *)cb_pos->file_object;
		/*                                             */
		if (file_temp == file) {
			/*                             */
			list_del(&cb_pos->cb_list);
			/*                                         */
			if (dev->iamthif_current_cb == cb_pos) {
				dev->iamthif_current_cb = NULL;
				/*                                     */
				mei_send_flow_control(dev, &dev->iamthif_cl);
			}
			/*                            */
			mei_free_cb_private(cb_pos);
			cb_pos = NULL;
			removed = true;
		}
	}