staticinttransfer_queue(structxdma_engine*engine,structxdma_transfer*transfer){int rv =0;structxdma_transfer*transfer_started;structxdma_dev*xdev;unsignedlong flags;if(!engine){pr_err("dma engine NULL\n");return-EINVAL;}if(!engine->xdev){pr_err("Invalid xdev\n");return-EINVAL;}if(!transfer){pr_err("%s Invalid DMA transfer\n", engine->name);return-EINVAL;}if(transfer->desc_num ==0){pr_err("%s void descriptors in the transfer list\n",engine->name);return-EINVAL;}dbg_tfr("%s (transfer=0x%p).\n",__func__, transfer);xdev = engine->xdev;if(xdma_device_flag_check(xdev, XDEV_FLAG_OFFLINE)){pr_info("dev 0x%p offline, transfer 0x%p not queued.\n", xdev,transfer);return-EBUSY;}/* lock the engine state */spin_lock_irqsave(&engine->lock, flags);engine->prev_cpu =get_cpu();put_cpu();/* engine is being shutdown; do not accept new transfers */if(engine->shutdown & ENGINE_SHUTDOWN_REQUEST){pr_info("engine %s offline, transfer 0x%p not queued.\n",engine->name, transfer);rv =-EBUSY;goto shutdown;}/* mark the transfer as submitted */transfer->state = TRANSFER_STATE_SUBMITTED;/* add transfer to the tail of the engine transfer queue */list_add_tail(&transfer->entry,&engine->transfer_list);/* engine is idle? */if(!engine->running){/* start engine */dbg_tfr("%s(): starting %s engine.\n",__func__, engine->name);transfer_started =engine_start(engine);if(!transfer_started){pr_err("Failed to start dma engine\n");goto shutdown;}dbg_tfr("transfer=0x%p started %s engine with transfer 0x%p.\n",transfer, engine->name, transfer_started);}else{dbg_tfr("transfer=0x%p queued, with %s engine running.\n",transfer, engine->name);}shutdown:/* unlock the engine state */dbg_tfr("engine->running = %d\n", engine->running);spin_unlock_irqrestore(&engine->lock, flags);return rv;}/* transfer_queue() - Queue a DMA transfer on the engine** @engine DMA engine doing the transfer* @transfer DMA transfer submitted to the engine** Takes and releases the engine spinlock*/staticinttransfer_queue(structxdma_engine*engine,structxdma_transfer*transfer){int rv =0;structxdma_transfer*transfer_started;structxdma_dev*xdev;unsignedlong flags;if(!engine){pr_err("dma engine NULL\n");return-EINVAL;}if(!engine->xdev){pr_err("Invalid xdev\n");return-EINVAL;}if(!transfer){pr_err("%s Invalid DMA transfer\n", engine->name);return-EINVAL;}if(transfer->desc_num ==0){pr_err("%s void descriptors in the transfer list\n",engine->name);return-EINVAL;}dbg_tfr("%s (transfer=0x%p).\n",__func__, transfer);xdev = engine->xdev;if(xdma_device_flag_check(xdev, XDEV_FLAG_OFFLINE)){pr_info("dev 0x%p offline, transfer 0x%p not queued.\n", xdev,transfer);return-EBUSY;}/* lock the engine state */spin_lock_irqsave(&engine->lock, flags);engine->prev_cpu =get_cpu();put_cpu();/* engine is being shutdown; do not accept new transfers */if(engine->shutdown & ENGINE_SHUTDOWN_REQUEST){pr_info("engine %s offline, transfer 0x%p not queued.\n",engine->name, transfer);rv =-EBUSY;goto shutdown;}/* mark the transfer as submitted */transfer->state = TRANSFER_STATE_SUBMITTED;/* add transfer to the tail of the engine transfer queue */list_add_tail(&transfer->entry,&engine->transfer_list);/* engine is idle? */if(!engine->running){/* start engine */dbg_tfr("%s(): starting %s engine.\n",__func__, engine->name);transfer_started =engine_start(engine);if(!transfer_started){pr_err("Failed to start dma engine\n");goto shutdown;}dbg_tfr("transfer=0x%p started %s engine with transfer 0x%p.\n",transfer, engine->name, transfer_started);}else{dbg_tfr("transfer=0x%p queued, with %s engine running.\n",transfer, engine->name);}shutdown:/* unlock the engine state */dbg_tfr("engine->running = %d\n", engine->running);spin_unlock_irqrestore(&engine->lock, flags);return rv;}