/** * @brief Removes from the model the item of the specified resource element. * @param element_id Id of the resource element to remove. */ void ResourceModel::remove_element(const QString& element_id) { const QModelIndex& index = get_element_index(element_id); if (!index.isValid()) { return; } removeRow(index.row(), index.parent()); items.remove(element_id); }
static ssize_t mhi_dbgfs_chan_read(struct file *fp, char __user *buf, size_t count, loff_t *offp) { int amnt_copied = 0; struct mhi_chan_ctxt *chan_ctxt; struct mhi_device_ctxt *mhi_dev_ctxt = &mhi_devices.device_list[0].mhi_ctxt; uintptr_t v_wp_index; uintptr_t v_rp_index; int valid_chan = 0; struct mhi_chan_ctxt *cc_list; struct mhi_client_handle *client_handle; if (NULL == mhi_dev_ctxt) return -EIO; cc_list = mhi_dev_ctxt->mhi_ctrl_seg->mhi_cc_list; *offp = (u32)(*offp) % MHI_MAX_CHANNELS; while (!valid_chan) { client_handle = mhi_dev_ctxt->client_handle_list[*offp]; if (*offp == (MHI_MAX_CHANNELS - 1)) msleep(1000); if (!VALID_CHAN_NR(*offp) || !cc_list[*offp].mhi_trb_ring_base_addr || !client_handle) { *offp += 1; *offp = (u32)(*offp) % MHI_MAX_CHANNELS; continue; } valid_chan = 1; } chan_ctxt = &cc_list[*offp]; get_element_index(&mhi_dev_ctxt->mhi_local_chan_ctxt[*offp], mhi_dev_ctxt->mhi_local_chan_ctxt[*offp].rp, &v_rp_index); get_element_index(&mhi_dev_ctxt->mhi_local_chan_ctxt[*offp], mhi_dev_ctxt->mhi_local_chan_ctxt[*offp].wp, &v_wp_index); amnt_copied = scnprintf(mhi_dev_ctxt->chan_info, MHI_LOG_SIZE, "%s0x%x %s %d %s 0x%x %s 0x%llx %s %p %s %p %s %lu %s %p %s %lu %s %d %s %d\n", "chan:", (unsigned int)*offp, "pkts from dev:", mhi_dev_ctxt->counters.chan_pkts_xferd[*offp], "state:", chan_ctxt->mhi_chan_state, "p_base:", chan_ctxt->mhi_trb_ring_base_addr, "v_base:", mhi_dev_ctxt->mhi_local_chan_ctxt[*offp].base, "v_wp:", mhi_dev_ctxt->mhi_local_chan_ctxt[*offp].wp, "index:", v_wp_index, "v_rp:", mhi_dev_ctxt->mhi_local_chan_ctxt[*offp].rp, "index:", v_rp_index, "pkts_queued", get_nr_avail_ring_elements( &mhi_dev_ctxt->mhi_local_chan_ctxt[*offp]), "/", client_handle->chan_info.max_desc); *offp += 1; if (amnt_copied < count) return amnt_copied - copy_to_user(buf, mhi_dev_ctxt->chan_info, amnt_copied); else return -ENOMEM; }
static ssize_t mhi_dbgfs_ev_read(struct file *fp, char __user *buf, size_t count, loff_t *offp) { int amnt_copied = 0; int event_ring_index = 0; struct mhi_event_ctxt *ev_ctxt; uintptr_t v_wp_index; uintptr_t v_rp_index; uintptr_t device_p_rp_index; struct mhi_device_ctxt *mhi_dev_ctxt = &mhi_devices.device_list[0].mhi_ctxt; if (NULL == mhi_dev_ctxt) return -EIO; *offp = (u32)(*offp) % mhi_dev_ctxt->mmio_info.nr_event_rings; event_ring_index = *offp; ev_ctxt = &mhi_dev_ctxt->mhi_ctrl_seg->mhi_ec_list[event_ring_index]; if (*offp == (mhi_dev_ctxt->mmio_info.nr_event_rings - 1)) msleep(1000); get_element_index(&mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index], mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].rp, &v_rp_index); get_element_index(&mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index], mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].wp, &v_wp_index); get_element_index(&mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index], mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].wp, &v_wp_index); get_element_index(&mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index], (void *)dma_to_virt(NULL, ev_ctxt->mhi_event_read_ptr), &device_p_rp_index); amnt_copied = scnprintf(mhi_dev_ctxt->chan_info, MHI_LOG_SIZE, "%s 0x%d %s %02x %s 0x%08x %s 0x%08x %s 0x%llx %s %llx %s %lu %s %p %s %p %s %lu %s %p %s %lu\n", "Event Context ", (unsigned int)event_ring_index, "Intmod_T", MHI_GET_EV_CTXT(EVENT_CTXT_INTMODT, ev_ctxt), "MSI Vector", ev_ctxt->mhi_msi_vector, "MSI RX Count", mhi_dev_ctxt->counters.msi_counter[*offp], "p_base:", ev_ctxt->mhi_event_ring_base_addr, "p_rp:", ev_ctxt->mhi_event_read_ptr, "index:", device_p_rp_index, "v_base:", mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].base, "v_wp:", mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].wp, "index:", v_wp_index, "v_rp:", mhi_dev_ctxt->mhi_local_event_ctxt[event_ring_index].rp, "index:", v_rp_index); *offp += 1; if (amnt_copied < count) return amnt_copied - copy_to_user(buf, mhi_dev_ctxt->chan_info, amnt_copied); else return -ENOMEM; }