• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ simple_read_from_buffer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中simple_read_from_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ simple_read_from_buffer函数的具体用法?C++ simple_read_from_buffer怎么用?C++ simple_read_from_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了simple_read_from_buffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: oprofilefs_str_to_user

ssize_t oprofilefs_str_to_user(char const *str, char __user *buf, size_t count, loff_t *offset)
{
	return simple_read_from_buffer(buf, count, offset, str, strlen(str));
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:4,代码来源:oprofilefs.c


示例2: b43legacy_debugfs_read

static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
                                      size_t count, loff_t *ppos)
{
    struct b43legacy_wldev *dev;
    struct b43legacy_debugfs_fops *dfops;
    struct b43legacy_dfs_file *dfile;
    ssize_t uninitialized_var(ret);
    char *buf;
    const size_t bufsize = 1024 * 16; /* 16 KiB buffer */
    const size_t buforder = get_order(bufsize);
    int err = 0;

    if (!count)
        return 0;
    dev = file->private_data;
    if (!dev)
        return -ENODEV;

    mutex_lock(&dev->wl->mutex);
    if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
        err = -ENODEV;
        goto out_unlock;
    }

    dfops = container_of(file->f_op, struct b43legacy_debugfs_fops, fops);
    if (!dfops->read) {
        err = -ENOSYS;
        goto out_unlock;
    }
    dfile = fops_to_dfs_file(dev, dfops);

    if (!dfile->buffer) {
        buf = (char *)__get_free_pages(GFP_KERNEL, buforder);
        if (!buf) {
            err = -ENOMEM;
            goto out_unlock;
        }
        memset(buf, 0, bufsize);
        if (dfops->take_irqlock) {
            spin_lock_irq(&dev->wl->irq_lock);
            ret = dfops->read(dev, buf, bufsize);
            spin_unlock_irq(&dev->wl->irq_lock);
        } else
            ret = dfops->read(dev, buf, bufsize);
        if (ret <= 0) {
            free_pages((unsigned long)buf, buforder);
            err = ret;
            goto out_unlock;
        }
        dfile->data_len = ret;
        dfile->buffer = buf;
    }

    ret = simple_read_from_buffer(userbuf, count, ppos,
                                  dfile->buffer,
                                  dfile->data_len);
    if (*ppos >= dfile->data_len) {
        free_pages((unsigned long)dfile->buffer, buforder);
        dfile->buffer = NULL;
        dfile->data_len = 0;
    }
out_unlock:
    mutex_unlock(&dev->wl->mutex);

    return err ? err : ret;
}
开发者ID:jerem,项目名称:hi35xx-buildroot,代码行数:66,代码来源:debugfs.c


示例3: mtk_hdmi_debug_read

static ssize_t mtk_hdmi_debug_read(struct file *file, char __user *ubuf,
				   size_t count, loff_t *ppos)
{
	return simple_read_from_buffer(ubuf, count, ppos, HELP_INFO,
				       strlen(HELP_INFO));
}
开发者ID:linzhangru,项目名称:Sony-xa-kernel-tuba,代码行数:6,代码来源:mediatek_hdmi_debugfs.c


示例4: read_def_modal_eeprom


//.........这里部分代码省略.........
			pModal = &priv->ah->eeprom.def.modalHeader[1];	\
			len += snprintf(buf + len, size - len, "%20s : %8d%7s", \
					_s, (_val), "|");		\
		}							\
		if (pBase->opCapFlags & AR5416_OPFLAGS_11A) {		\
			pModal = &priv->ah->eeprom.def.modalHeader[0];	\
			len += snprintf(buf + len, size - len, "%9d\n", \
					(_val));			\
		}							\
	} while (0)

	struct ath9k_htc_priv *priv = file->private_data;
	struct base_eep_header *pBase = &priv->ah->eeprom.def.baseEepHeader;
	struct modal_eep_header *pModal = NULL;
	unsigned int len = 0, size = 3500;
	ssize_t retval = 0;
	char *buf;

	buf = kzalloc(size, GFP_KERNEL);
	if (buf == NULL)
		return -ENOMEM;

	len += snprintf(buf + len, size - len,
			"%31s %15s\n", "2G", "5G");
	len += snprintf(buf + len, size - len,
			"%32s %16s\n", "====", "====\n");

	PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
	PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
	PR_EEP("Chain2 Ant. Control", pModal->antCtrlChain[2]);
	PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
	PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
	PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
	PR_EEP("Chain2 Ant. Gain", pModal->antennaGainCh[2]);
	PR_EEP("Switch Settle", pModal->switchSettling);
	PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
	PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
	PR_EEP("Chain2 TxRxAtten", pModal->txRxAttenCh[2]);
	PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
	PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
	PR_EEP("Chain2 RxTxMargin", pModal->rxTxMarginCh[2]);
	PR_EEP("ADC Desired size", pModal->adcDesiredSize);
	PR_EEP("PGA Desired size", pModal->pgaDesiredSize);
	PR_EEP("Chain0 xlna Gain", pModal->xlnaGainCh[0]);
	PR_EEP("Chain1 xlna Gain", pModal->xlnaGainCh[1]);
	PR_EEP("Chain2 xlna Gain", pModal->xlnaGainCh[2]);
	PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
	PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
	PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
	PR_EEP("CCA Threshold)", pModal->thresh62);
	PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
	PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
	PR_EEP("Chain2 NF Threshold", pModal->noiseFloorThreshCh[2]);
	PR_EEP("xpdGain", pModal->xpdGain);
	PR_EEP("External PD", pModal->xpd);
	PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
	PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
	PR_EEP("Chain2 I Coefficient", pModal->iqCalICh[2]);
	PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
	PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
	PR_EEP("Chain2 Q Coefficient", pModal->iqCalQCh[2]);
	PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
	PR_EEP("Chain0 OutputBias", pModal->ob);
	PR_EEP("Chain0 DriverBias", pModal->db);
	PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
	PR_EEP("2chain pwr decrease", pModal->pwrDecreaseFor2Chain);
	PR_EEP("3chain pwr decrease", pModal->pwrDecreaseFor3Chain);
	PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
	PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
	PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
	PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
	PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
	PR_EEP("Chain2 bswAtten", pModal->bswAtten[2]);
	PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
	PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
	PR_EEP("Chain2 bswMargin", pModal->bswMargin[2]);
	PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
	PR_EEP("Chain0 xatten2Db", pModal->xatten2Db[0]);
	PR_EEP("Chain1 xatten2Db", pModal->xatten2Db[1]);
	PR_EEP("Chain2 xatten2Db", pModal->xatten2Db[2]);
	PR_EEP("Chain0 xatten2Margin", pModal->xatten2Margin[0]);
	PR_EEP("Chain1 xatten2Margin", pModal->xatten2Margin[1]);
	PR_EEP("Chain2 xatten2Margin", pModal->xatten2Margin[2]);
	PR_EEP("Chain1 OutputBias", pModal->ob_ch1);
	PR_EEP("Chain1 DriverBias", pModal->db_ch1);
	PR_EEP("LNA Control", pModal->lna_ctl);
	PR_EEP("XPA Bias Freq0", pModal->xpaBiasLvlFreq[0]);
	PR_EEP("XPA Bias Freq1", pModal->xpaBiasLvlFreq[1]);
	PR_EEP("XPA Bias Freq2", pModal->xpaBiasLvlFreq[2]);

	if (len > size)
		len = size;

	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
	kfree(buf);

	return retval;

#undef PR_EEP
}
开发者ID:gnychis,项目名称:ath9k_htc-backports,代码行数:101,代码来源:htc_drv_debug.c


示例5: read_9287_modal_eeprom

static ssize_t read_9287_modal_eeprom(struct file *file,
				      char __user *user_buf,
				      size_t count, loff_t *ppos)
{
#define PR_EEP(_s, _val)						\
	do {								\
		len += snprintf(buf + len, size - len, "%20s : %10d\n",	\
				_s, (_val));				\
	} while (0)

	struct ath9k_htc_priv *priv = file->private_data;
	struct modal_eep_ar9287_header *pModal = &priv->ah->eeprom.map9287.modalHeader;
	unsigned int len = 0, size = 3000;
	ssize_t retval = 0;
	char *buf;

	buf = kzalloc(size, GFP_KERNEL);
	if (buf == NULL)
		return -ENOMEM;

	PR_EEP("Chain0 Ant. Control", pModal->antCtrlChain[0]);
	PR_EEP("Chain1 Ant. Control", pModal->antCtrlChain[1]);
	PR_EEP("Ant. Common Control", pModal->antCtrlCommon);
	PR_EEP("Chain0 Ant. Gain", pModal->antennaGainCh[0]);
	PR_EEP("Chain1 Ant. Gain", pModal->antennaGainCh[1]);
	PR_EEP("Switch Settle", pModal->switchSettling);
	PR_EEP("Chain0 TxRxAtten", pModal->txRxAttenCh[0]);
	PR_EEP("Chain1 TxRxAtten", pModal->txRxAttenCh[1]);
	PR_EEP("Chain0 RxTxMargin", pModal->rxTxMarginCh[0]);
	PR_EEP("Chain1 RxTxMargin", pModal->rxTxMarginCh[1]);
	PR_EEP("ADC Desired size", pModal->adcDesiredSize);
	PR_EEP("txEndToXpaOff", pModal->txEndToXpaOff);
	PR_EEP("txEndToRxOn", pModal->txEndToRxOn);
	PR_EEP("txFrameToXpaOn", pModal->txFrameToXpaOn);
	PR_EEP("CCA Threshold)", pModal->thresh62);
	PR_EEP("Chain0 NF Threshold", pModal->noiseFloorThreshCh[0]);
	PR_EEP("Chain1 NF Threshold", pModal->noiseFloorThreshCh[1]);
	PR_EEP("xpdGain", pModal->xpdGain);
	PR_EEP("External PD", pModal->xpd);
	PR_EEP("Chain0 I Coefficient", pModal->iqCalICh[0]);
	PR_EEP("Chain1 I Coefficient", pModal->iqCalICh[1]);
	PR_EEP("Chain0 Q Coefficient", pModal->iqCalQCh[0]);
	PR_EEP("Chain1 Q Coefficient", pModal->iqCalQCh[1]);
	PR_EEP("pdGainOverlap", pModal->pdGainOverlap);
	PR_EEP("xPA Bias Level", pModal->xpaBiasLvl);
	PR_EEP("txFrameToDataStart", pModal->txFrameToDataStart);
	PR_EEP("txFrameToPaOn", pModal->txFrameToPaOn);
	PR_EEP("HT40 Power Inc.", pModal->ht40PowerIncForPdadc);
	PR_EEP("Chain0 bswAtten", pModal->bswAtten[0]);
	PR_EEP("Chain1 bswAtten", pModal->bswAtten[1]);
	PR_EEP("Chain0 bswMargin", pModal->bswMargin[0]);
	PR_EEP("Chain1 bswMargin", pModal->bswMargin[1]);
	PR_EEP("HT40 Switch Settle", pModal->swSettleHt40);
	PR_EEP("AR92x7 Version", pModal->version);
	PR_EEP("DriverBias1", pModal->db1);
	PR_EEP("DriverBias2", pModal->db1);
	PR_EEP("CCK OutputBias", pModal->ob_cck);
	PR_EEP("PSK OutputBias", pModal->ob_psk);
	PR_EEP("QAM OutputBias", pModal->ob_qam);
	PR_EEP("PAL_OFF OutputBias", pModal->ob_pal_off);

	if (len > size)
		len = size;

	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
	kfree(buf);

	return retval;

#undef PR_EEP
}
开发者ID:gnychis,项目名称:ath9k_htc-backports,代码行数:71,代码来源:htc_drv_debug.c


示例6: on_cmd_read

ssize_t on_cmd_read(struct file *filp, char __user *user_buf, size_t count,
	loff_t *ppos)
{
	int ret;
	int i, j;
	char *buf;
	int buf_size;
	struct dsi_panel_cmds *pcmds;

	struct mdss_panel_common_pdata *panel_data = filp->private_data;
	if (!panel_data)
		return -ENODEV;

	pcmds = &panel_data->on_cmds;
	if (!pcmds)
		return -EINVAL;

	buf = kzalloc(MAX_ON_CMD_SIZE, GFP_KERNEL);

	strncpy(buf, "qcom,panel-on-cmds = [", 22);
	buf_size = 22;

	for (i = 0; i < pcmds->cmd_cnt; ++i) {
		if (buf_size + 20 +
			(pcmds->cmds[i].dchdr.dlen * 3) >
			MAX_ON_CMD_SIZE - 4) {
			pr_warn("Too many on_commands!(< 32KB)\n");
			ret = -EINVAL;
			goto read_error;
		}

		strncpy(&buf[buf_size], "\r\n", 2);
		buf_size += 2;

		ret = snprintf(&buf[buf_size], 21,
			"%02x %02x %02x %02x %02x %02x %02x",
			pcmds->cmds[i].dchdr.dtype,
			pcmds->cmds[i].dchdr.last,
			pcmds->cmds[i].dchdr.vc,
			pcmds->cmds[i].dchdr.ack,
			pcmds->cmds[i].dchdr.wait,
			(char)(pcmds->cmds[i].dchdr.dlen & 0xff00) >> 8,
			(char)(pcmds->cmds[i].dchdr.dlen & 0x00ff));

		if (ret < 0)
			goto read_error;

		buf_size += ret;

		if (0 < pcmds->cmds[i].dchdr.dlen && pcmds->cmds[i].dchdr.dlen < 3) {
			ret = snprintf(&buf[buf_size], 4, " %02x",
				pcmds->cmds[i].payload[0]);
			if (ret < 0)
				goto read_error;

			buf_size += ret;

			if (pcmds->cmds[i].dchdr.dlen == 2) {
				ret = snprintf(&buf[buf_size], 4, " %02x",
					pcmds->cmds[i].payload[1]);
				if (ret < 0)
					goto read_error;

				buf_size += ret;
			}
		} else if (pcmds->cmds[i].dchdr.dlen > 2) {
			for (j = 0; j < pcmds->cmds[i].dchdr.dlen; ++j) {
				if ((j % 6) == 0) {
					ret = snprintf(&buf[buf_size], 5, "\r\n%02x",
						pcmds->cmds[i].payload[j]);
					if (ret < 0)
						goto read_error;

					buf_size += ret;
				} else {
					ret = snprintf(&buf[buf_size], 4, " %02x",
						pcmds->cmds[i].payload[j]);
					if (ret < 0)
						goto read_error;

					buf_size += ret;
				}
			}
		} else {
			pr_err("Invalid data length!\n");
			ret = -EINVAL;
			goto read_error;
		}
	}

	strncpy(&buf[buf_size], "]", 2);
	buf_size += 2;

	ret = simple_read_from_buffer(user_buf, count, ppos, buf, buf_size);
read_error:
	kfree(buf);

	return ret;
}
开发者ID:jblorenzo,项目名称:mptcp-nexus-a444,代码行数:99,代码来源:mdss_dsi_panel.c


示例7: read_file_base_eeprom


//.........这里部分代码省略.........
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n", "Checksum",
			pBase->checksum);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n", "Length",
			pBase->length);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n", "RegDomain1",
			pBase->regDmn[0]);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n", "RegDomain2",
			pBase->regDmn[1]);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"TX Mask", pBase->txMask);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"RX Mask", pBase->rxMask);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Allow 5GHz",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_11A));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Allow 2GHz",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_11G));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Disable 2GHz HT20",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT20));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Disable 2GHz HT40",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_N_2G_HT40));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Disable 5Ghz HT20",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT20));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Disable 5Ghz HT40",
			!!(pBase->opCapFlags & AR5416_OPFLAGS_N_5G_HT40));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Big Endian",
			!!(pBase->eepMisc & 0x01));
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Cal Bin Major Ver",
			(pBase->binBuildNumber >> 24) & 0xFF);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Cal Bin Minor Ver",
			(pBase->binBuildNumber >> 16) & 0xFF);
	len += snprintf(buf + len, size - len,
			"%20s : %10d\n",
			"Cal Bin Build",
			(pBase->binBuildNumber >> 8) & 0xFF);

	/*
	 * UB91 specific data.
	 */
	if (AR_SREV_9271(priv->ah)) {
		struct base_eep_header_4k *pBase4k =
			&priv->ah->eeprom.map4k.baseEepHeader;

		len += snprintf(buf + len, size - len,
				"%20s : %10d\n",
				"TX Gain type",
				pBase4k->txGainType);
	}

	/*
	 * UB95 specific data.
	 */
	if (priv->ah->hw_version.usbdev == AR9287_USB) {
		struct base_eep_ar9287_header *pBase9287 =
			&priv->ah->eeprom.map9287.baseEepHeader;

		len += snprintf(buf + len, size - len,
				"%20s : %10ddB\n",
				"Power Table Offset",
				pBase9287->pwrTableOffset);

		len += snprintf(buf + len, size - len,
				"%20s : %10d\n",
				"OpenLoop Power Ctrl",
				pBase9287->openLoopPwrCntl);
	}

	len += snprintf(buf + len, size - len, "%20s : %pM\n", "MacAddress",
			pBase->macAddr);
	if (len > size)
		len = size;

	retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
	kfree(buf);

	return retval;
}
开发者ID:gnychis,项目名称:ath9k_htc-backports,代码行数:101,代码来源:htc_drv_debug.c


示例8: diag_dbgfs_read_table

static ssize_t diag_dbgfs_read_table(struct file *file, char __user *ubuf,
				     size_t count, loff_t *ppos)
{
	char *buf;
	int ret = 0;
	int i;
	int bytes_remaining;
	int bytes_in_buffer = 0;
	int bytes_written;
	int buf_size = (DEBUG_BUF_SIZE < count) ? DEBUG_BUF_SIZE : count;

	if (diag_dbgfs_table_index >= diag_max_reg) {
		/* Done. Reset to prepare for future requests */
		diag_dbgfs_table_index = 0;
		return 0;
	}

	buf = kzalloc(sizeof(char) * buf_size, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(buf)) {
		pr_err("diag: %s, Error allocating memory\n", __func__);
		return -ENOMEM;
	}

	bytes_remaining = buf_size;

	if (diag_dbgfs_table_index == 0) {
		bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining,
			"Client ids: Modem: %d, LPASS: %d, "
			"WCNSS: %d, APPS: %d\n",
			MODEM_DATA, LPASS_DATA, WCNSS_DATA, APPS_DATA);
		bytes_in_buffer += bytes_written;
	}

	for (i = diag_dbgfs_table_index; i < diag_max_reg; i++) {
		/* Do not process empty entries in the table */
		if (driver->table[i].process_id == 0)
			continue;

		bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining,
			"i: %3d, cmd_code: %4x, subsys_id: %4x, "
			"client: %2d, cmd_code_lo: %4x, "
			"cmd_code_hi: %4x, process_id: %5d %s\n",
			i,
			driver->table[i].cmd_code,
			driver->table[i].subsys_id,
			driver->table[i].client_id,
			driver->table[i].cmd_code_lo,
			driver->table[i].cmd_code_hi,
			driver->table[i].process_id,
			(diag_find_polling_reg(i) ? "<- Polling cmd reg" : ""));

		bytes_in_buffer += bytes_written;

		/* Check if there is room to add another table entry */
		bytes_remaining = buf_size - bytes_in_buffer;

		if (bytes_remaining < bytes_written)
			break;
	}
	diag_dbgfs_table_index = i+1;

	*ppos = 0;
	ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer);

	kfree(buf);
	return ret;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:67,代码来源:diag_debugfs.c


示例9: diag_dbgfs_read_mempool

static ssize_t diag_dbgfs_read_mempool(struct file *file, char __user *ubuf,
						size_t count, loff_t *ppos)
{
	char *buf = NULL;
	int ret = 0, i = 0;

	buf = kzalloc(sizeof(char) * DEBUG_BUF_SIZE, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(buf)) {
		pr_err("diag: %s, Error allocating memory\n", __func__);
		return -ENOMEM;
	}

	ret = scnprintf(buf, DEBUG_BUF_SIZE,
		"POOL_TYPE_COPY: [0x%p : 0x%p] count = %d\n"
		"POOL_TYPE_HDLC: [0x%p : 0x%p] count = %d\n"
		"POOL_TYPE_USER: [0x%p : 0x%p] count = %d\n"
		"POOL_TYPE_WRITE_STRUCT: [0x%p : 0x%p] count = %d\n"
		"POOL_TYPE_DCI: [0x%p : 0x%p] count = %d\n",
		driver->diagpool,
		diag_pools_array[POOL_COPY_IDX],
		driver->count,
		driver->diag_hdlc_pool,
		diag_pools_array[POOL_HDLC_IDX],
		driver->count_hdlc_pool,
		driver->diag_user_pool,
		diag_pools_array[POOL_USER_IDX],
		driver->count_user_pool,
		driver->diag_write_struct_pool,
		diag_pools_array[POOL_WRITE_STRUCT_IDX],
		driver->count_write_struct_pool,
		driver->diag_dci_pool,
		diag_pools_array[POOL_DCI_IDX],
		driver->count_dci_pool);

	for (i = 0; i < MAX_HSIC_CH; i++) {
		if (!diag_hsic[i].hsic_inited)
			continue;
		ret += scnprintf(buf+ret, DEBUG_BUF_SIZE-ret,
				"POOL_TYPE_HSIC_%d: [0x%p : 0x%p] count = %d\n",
				i+1,
				diag_hsic[i].diag_hsic_pool,
				diag_pools_array[POOL_HSIC_IDX + i],
				diag_hsic[i].count_hsic_pool);
	}

	for (i = 0; i < MAX_HSIC_CH; i++) {
		if (!diag_hsic[i].hsic_inited)
			continue;
		ret += scnprintf(buf+ret, DEBUG_BUF_SIZE-ret,
				"POOL_TYPE_HSIC_%d_WRITE: [0x%p : 0x%p] count = %d\n",
				i+1,
				diag_hsic[i].diag_hsic_write_pool,
				diag_pools_array[POOL_HSIC_WRITE_IDX + i],
				diag_hsic[i].count_hsic_write_pool);
	}

	ret = simple_read_from_buffer(ubuf, count, ppos, buf, ret);

	kfree(buf);
	return ret;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:61,代码来源:diag_debugfs.c


示例10: diag_dbgfs_read_workpending

static ssize_t diag_dbgfs_read_workpending(struct file *file,
				char __user *ubuf, size_t count, loff_t *ppos)
{
	char *buf;
	int ret;

	buf = kzalloc(sizeof(char) * DEBUG_BUF_SIZE, GFP_KERNEL);
	if (!buf) {
		pr_err("diag: %s, Error allocating memory\n", __func__);
		return -ENOMEM;
	}

	ret = scnprintf(buf, DEBUG_BUF_SIZE,
		"Pending status for work_stucts:\n"
		"diag_drain_work: %d\n"
		"Modem data diag_read_smd_work: %d\n"
		"LPASS data diag_read_smd_work: %d\n"
		"RIVA data diag_read_smd_work: %d\n"
		"Modem cntl diag_read_smd_work: %d\n"
		"LPASS cntl diag_read_smd_work: %d\n"
		"RIVA cntl diag_read_smd_work: %d\n"
		"Modem dci diag_read_smd_work: %d\n"
		"Modem data diag_notify_update_smd_work: %d\n"
		"LPASS data diag_notify_update_smd_work: %d\n"
		"RIVA data diag_notify_update_smd_work: %d\n"
		"Modem cntl diag_notify_update_smd_work: %d\n"
		"LPASS cntl diag_notify_update_smd_work: %d\n"
		"RIVA cntl diag_notify_update_smd_work: %d\n"
		"Modem dci diag_notify_update_smd_work: %d\n",
		work_pending(&(driver->diag_drain_work)),
		work_pending(&(driver->smd_data[MODEM_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[LPASS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[WCNSS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[MODEM_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[LPASS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_cntl[WCNSS_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_dci[MODEM_DATA].
							diag_read_smd_work)),
		work_pending(&(driver->smd_data[MODEM_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_data[LPASS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_data[WCNSS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[MODEM_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[LPASS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_cntl[WCNSS_DATA].
						diag_notify_update_smd_work)),
		work_pending(&(driver->smd_dci[MODEM_DATA].
						diag_notify_update_smd_work)));

#ifdef CONFIG_DIAG_OVER_USB
	ret += scnprintf(buf+ret, DEBUG_BUF_SIZE,
		"diag_proc_hdlc_work: %d\n"
		"diag_read_work: %d\n",
		work_pending(&(driver->diag_proc_hdlc_work)),
		work_pending(&(driver->diag_read_work)));
#endif
	ret = simple_read_from_buffer(ubuf, count, ppos, buf, ret);

	kfree(buf);
	return ret;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:71,代码来源:diag_debugfs.c


示例11: diag_dbgfs_read_status


//.........这里部分代码省略.........
		"RIVA hdlc encoding: %d\n"
		"Modem CMD hdlc encoding: %d\n"
		"Modem DATA in_buf_1_size: %d\n"
		"Modem DATA in_buf_2_size: %d\n"
		"ADSP DATA in_buf_1_size: %d\n"
		"ADSP DATA in_buf_2_size: %d\n"
		"RIVA DATA in_buf_1_size: %d\n"
		"RIVA DATA in_buf_2_size: %d\n"
		"Modem DATA in_buf_1_raw_size: %d\n"
		"Modem DATA in_buf_2_raw_size: %d\n"
		"ADSP DATA in_buf_1_raw_size: %d\n"
		"ADSP DATA in_buf_2_raw_size: %d\n"
		"RIVA DATA in_buf_1_raw_size: %d\n"
		"RIVA DATA in_buf_2_raw_size: %d\n"
		"Modem CMD in_buf_1_size: %d\n"
		"Modem CMD in_buf_1_raw_size: %d\n"
		"Modem CNTL in_buf_1_size: %d\n"
		"ADSP CNTL in_buf_1_size: %d\n"
		"RIVA CNTL in_buf_1_size: %d\n"
		"Modem DCI in_buf_1_size: %d\n"
		"Modem DCI CMD in_buf_1_size: %d\n"
		"logging_mode: %d\n"
		"real_time_mode: %d\n",
		(unsigned int)driver->smd_data[MODEM_DATA].ch,
		(unsigned int)driver->smd_data[LPASS_DATA].ch,
		(unsigned int)driver->smd_data[WCNSS_DATA].ch,
		(unsigned int)driver->smd_dci[MODEM_DATA].ch,
		(unsigned int)driver->smd_cntl[MODEM_DATA].ch,
		(unsigned int)driver->smd_cntl[LPASS_DATA].ch,
		(unsigned int)driver->smd_cntl[WCNSS_DATA].ch,
		(unsigned int)driver->smd_cmd[MODEM_DATA].ch,
		(unsigned int)driver->smd_dci_cmd[MODEM_DATA].ch,
		chk_config_get_id(),
		chk_apps_only(),
		chk_apps_master(),
		chk_polling_response(),
		driver->polling_reg_flag,
		driver->use_device_tree,
		driver->supports_separate_cmdrsp,
		driver->separate_cmdrsp[MODEM_DATA],
		driver->separate_cmdrsp[LPASS_DATA],
		driver->separate_cmdrsp[WCNSS_DATA],
		driver->smd_data[MODEM_DATA].in_busy_1,
		driver->smd_data[MODEM_DATA].in_busy_2,
		driver->smd_data[LPASS_DATA].in_busy_1,
		driver->smd_data[LPASS_DATA].in_busy_2,
		driver->smd_data[WCNSS_DATA].in_busy_1,
		driver->smd_data[WCNSS_DATA].in_busy_2,
		driver->smd_dci[MODEM_DATA].in_busy_1,
		driver->smd_cmd[MODEM_DATA].in_busy_1,
		driver->smd_cmd[MODEM_DATA].in_busy_2,
		driver->smd_dci_cmd[MODEM_DATA].in_busy_1,
		driver->peripheral_supports_stm[MODEM_DATA],
		driver->peripheral_supports_stm[LPASS_DATA],
		driver->peripheral_supports_stm[WCNSS_DATA],
		driver->stm_state[MODEM_DATA],
		driver->stm_state[LPASS_DATA],
		driver->stm_state[WCNSS_DATA],
		driver->stm_state[APPS_DATA],
		driver->stm_state_requested[MODEM_DATA],
		driver->stm_state_requested[LPASS_DATA],
		driver->stm_state_requested[WCNSS_DATA],
		driver->stm_state_requested[APPS_DATA],
		driver->supports_apps_hdlc_encoding,
		driver->smd_data[MODEM_DATA].encode_hdlc,
		driver->smd_data[LPASS_DATA].encode_hdlc,
		driver->smd_data[WCNSS_DATA].encode_hdlc,
		driver->smd_cmd[MODEM_DATA].encode_hdlc,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_2_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[MODEM_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[LPASS_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_data[WCNSS_DATA].buf_in_2_raw_size,
		(unsigned int)driver->smd_cmd[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cmd[MODEM_DATA].buf_in_1_raw_size,
		(unsigned int)driver->smd_cntl[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cntl[LPASS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_cntl[WCNSS_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci[MODEM_DATA].buf_in_1_size,
		(unsigned int)driver->smd_dci_cmd[MODEM_DATA].buf_in_1_size,
		driver->logging_mode,
		driver->real_time_mode);

#ifdef CONFIG_DIAG_OVER_USB
	ret += scnprintf(buf+ret, DEBUG_BUF_SIZE,
		"usb_connected: %d\n",
		driver->usb_connected);
#endif
	ret = simple_read_from_buffer(ubuf, count, ppos, buf, ret);

	kfree(buf);
	return ret;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:101,代码来源:diag_debugfs.c


示例12: diag_dbgfs_read_dcistats

static ssize_t diag_dbgfs_read_dcistats(struct file *file,
				char __user *ubuf, size_t count, loff_t *ppos)
{
	char *buf = NULL;
	int bytes_remaining, bytes_written = 0, bytes_in_buf = 0, i = 0;
	struct diag_dci_data_info *temp_data = dci_data_smd;
	int buf_size = (DEBUG_BUF_SIZE < count) ? DEBUG_BUF_SIZE : count;

	if (diag_dbgfs_dci_finished) {
		diag_dbgfs_dci_finished = 0;
		return 0;
	}

	buf = kzalloc(sizeof(char) * buf_size, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(buf)) {
		pr_err("diag: %s, Error allocating memory\n", __func__);
		return -ENOMEM;
	}

	bytes_remaining = buf_size;

	if (diag_dbgfs_dci_data_index == 0) {
		bytes_written =
			scnprintf(buf, buf_size,
			"number of clients: %d\n"
			"dci proc active: %d\n"
			"dci real time vote: %d\n",
			driver->num_dci_client,
			(driver->proc_active_mask & DIAG_PROC_DCI) ? 1 : 0,
			(driver->proc_rt_vote_mask & DIAG_PROC_DCI) ? 1 : 0);
		bytes_in_buf += bytes_written;
		bytes_remaining -= bytes_written;
#ifdef CONFIG_DIAG_OVER_USB
		bytes_written = scnprintf(buf+bytes_in_buf, bytes_remaining,
			"usb_connected: %d\n",
			driver->usb_connected);
		bytes_in_buf += bytes_written;
		bytes_remaining -= bytes_written;
#endif
		if (driver->dci_device) {
			bytes_written = scnprintf(buf+bytes_in_buf,
						  bytes_remaining,
				"dci power active, relax: %lu, %lu\n",
				driver->dci_device->power.wakeup->active_count,
				driver->dci_device->power.wakeup->relax_count);
			bytes_in_buf += bytes_written;
			bytes_remaining -= bytes_written;
		}
		if (driver->dci_cmd_device) {
			bytes_written = scnprintf(buf+bytes_in_buf,
						  bytes_remaining,
				"dci cmd power active, relax: %lu, %lu\n",
				driver->dci_cmd_device->power.wakeup->
						  active_count,
				driver->dci_cmd_device->power.wakeup->
						  relax_count);
			bytes_in_buf += bytes_written;
			bytes_remaining -= bytes_written;
		}
	}
	temp_data += diag_dbgfs_dci_data_index;
	for (i = diag_dbgfs_dci_data_index; i < DIAG_DCI_DEBUG_CNT; i++) {
		if (temp_data->iteration != 0) {
			bytes_written = scnprintf(
				buf + bytes_in_buf, bytes_remaining,
				"i %-10ld\t"
				"s %-10d\t"
				"c %-10d\t"
				"t %-15s\n",
				temp_data->iteration,
				temp_data->data_size,
				temp_data->ch_type,
				temp_data->time_stamp);
			bytes_in_buf += bytes_written;
			bytes_remaining -= bytes_written;
			/* Check if there is room for another entry */
			if (bytes_remaining < bytes_written)
				break;
		}
		temp_data++;
	}

	diag_dbgfs_dci_data_index = (i >= DIAG_DCI_DEBUG_CNT) ? 0 : i + 1;
	bytes_written = simple_read_from_buffer(ubuf, count, ppos, buf,
								bytes_in_buf);
	kfree(buf);
	diag_dbgfs_dci_finished = 1;
	return bytes_written;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:89,代码来源:diag_debugfs.c


示例13: max17047_debugfs_read_registers

static ssize_t max17047_debugfs_read_registers(struct file *filp,
	char __user *buffer, size_t count, loff_t *ppos)
{
	struct max17047_fuelgauge_data *fuelgauge_data = filp->private_data;
	struct i2c_client *client = NULL;
	u8 i2c_data[2];
	int reg = 0;
	char *buf;
	size_t len = 0;
	ssize_t ret;

	if (!fuelgauge_data) {
		pr_err("%s : fuelgauge_data is null\n", __func__);
		return 0;
	}

	client = fuelgauge_data->client;

	if (*ppos != 0)
		return 0;

	if (count < sizeof(buf))
		return -ENOSPC;

	buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	reg = MAX17047_REG_STATUS;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"status(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = MAX17047_REG_CONFIG;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"config(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = MAX17047_REG_RCOMP;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"rcomp(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = MAX17047_REG_CGAIN;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"cgain(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = MAX17047_REG_SALRT_TH;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"salrt(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = MAX17047_REG_MISCCFG;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"misc(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = 0x39;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"tempc0(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = 0x0F;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"remCap(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	reg = 0x10;
	max17047_i2c_read(client, reg, i2c_data);
	len += snprintf(buf + len, PAGE_SIZE - len,
		"fullCap(0x%x)=%02x%02x ", reg, i2c_data[1], i2c_data[0]);

	len += snprintf(buf + len, PAGE_SIZE - len, "\n");

	ret = simple_read_from_buffer(buffer, len, ppos, buf, PAGE_SIZE);
	kfree(buf);

	return ret;
}
开发者ID:SaMioalz,项目名称:GT-N7000-ICS-3.0.y,代码行数:80,代码来源:max17047_fuelgauge.c


示例14: power_power_events_read

static ssize_t power_power_events_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
{
	return simple_read_from_buffer(ubuf, cnt, ppos, pwr_buf, POWER_BUFFER_SIZE);
}
开发者ID:Proshivalskiy,项目名称:MT6582_kernel_source,代码行数:4,代码来源:mali_kernel_sysfs.c


示例15: rtc_getdevice_dbg_read

static ssize_t rtc_getdevice_dbg_read(struct file *file, char __user *buf,
			  size_t count, loff_t *ppos)
{
	int n = 0;
	static char *buffer;
	static char *swap_buf;
	const int debug_bufmax = 1024;
	int swap_count = 0;
	int rc = 0;
	int dev_count = 0;
	int dev_id = 0;
	struct msm_cad_endpoints *msm_cad_epts = the_snd.cad_epts;
	struct cad_endpoint *cad_epts;

	buffer = kmalloc(sizeof(char) * 1024, GFP_KERNEL);
	if (buffer == NULL) {
		MM_ERR("Memory allocation failed for buffer failed\n");
		return -EFAULT;
	}

	swap_buf = kmalloc(sizeof(char) * 1024, GFP_KERNEL);
	if (swap_buf == NULL) {
		MM_ERR("Memory allocation failed for swap buffer failed\n");
		kfree(buffer);
		return -EFAULT;
	}

	if (msm_cad_epts->num <= 0) {
		dev_count = 0;
		n = scnprintf(buffer, debug_bufmax, "DEV_NO:0x%x\n",
				msm_cad_epts->num);
	} else {
		for (dev_id = 0; dev_id < msm_cad_epts->num; dev_id++) {
			cad_epts = &msm_cad_epts->endpoints[dev_id];
			if (IS_ERR(cad_epts)) {
				MM_ERR("invalid snd endpoint for dev_id %d\n",
					dev_id);
				rc = PTR_ERR(cad_epts);
				continue;
			}

			if ((cad_epts->id != curr_dev.tx_dev) &&
				(cad_epts->id != curr_dev.rx_dev))
				continue;

			n += scnprintf(swap_buf + n, debug_bufmax - n,
					"ACDB_ID:0x%x;CAPB:0x%x\n",
					cad_epts->id,
					cad_epts->capability);
			dev_count++;
			MM_DBG("RTC Get Device %x Capb %x Dev Count %x\n",
					dev_id, cad_epts->capability,
					dev_count);

		}
	}
	swap_count = scnprintf(buffer, debug_bufmax, \
			"DEV_NO:0x%x\n", dev_count);

	memcpy(buffer+swap_count, swap_buf, n*sizeof(char));
	n = n+swap_count;

	buffer[n] = 0;
	rc =  simple_read_from_buffer(buf, count, ppos, buffer, n);
	kfree(buffer);
	kfree(swap_buf);
	return rc;
}
开发者ID:prototype-U,项目名称:gal_core_kernel,代码行数:68,代码来源:snd_cad.c


示例16: diag_dbgfs_read_bridge


//.........这里部分代码省略.........

	buf = kzalloc(sizeof(char) * buf_size, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(buf)) {
		pr_err("diag: %s, Error allocating memory\n", __func__);
		return -ENOMEM;
	}

	bytes_remaining = buf_size;

	/* Only one smux for now */
	bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining,
		"Values for SMUX instance: 0\n"
		"smux ch: %d\n"
		"smux enabled %d\n"
		"smux in busy %d\n"
		"smux connected %d\n\n",
		driver->lcid,
		driver->diag_smux_enabled,
		driver->in_busy_smux,
		driver->smux_connected);

	bytes_in_buffer += bytes_written;
	bytes_remaining = buf_size - bytes_in_buffer;

	bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining,
		"HSIC diag_disconnect_work: %d\n",
		work_pending(&(driver->diag_disconnect_work)));

	bytes_in_buffer += bytes_written;
	bytes_remaining = buf_size - bytes_in_buffer;

	for (i = 0; i < MAX_HSIC_CH; i++) {
		if (diag_hsic[i].hsic_inited) {
			/* Check if there is room to add another HSIC entry */
			if (bytes_remaining < bytes_hsic_inited)
				break;
			bytes_written = scnprintf(buf+bytes_in_buffer,
							bytes_remaining,
			"Values for HSIC Instance: %d\n"
			"hsic ch: %d\n"
			"hsic_inited: %d\n"
			"hsic enabled: %d\n"
			"hsic_opened: %d\n"
			"hsic_suspend: %d\n"
			"in_busy_hsic_read_on_device: %d\n"
			"in_busy_hsic_write: %d\n"
			"count_hsic_pool: %d\n"
			"count_hsic_write_pool: %d\n"
			"diag_hsic_pool: %x\n"
			"diag_hsic_write_pool: %x\n"
			"HSIC write_len: %d\n"
			"num_hsic_buf_tbl_entries: %d\n"
			"HSIC usb_connected: %d\n"
			"HSIC diag_read_work: %d\n"
			"diag_read_hsic_work: %d\n"
			"diag_usb_read_complete_work: %d\n\n",
			i,
			diag_hsic[i].hsic_ch,
			diag_hsic[i].hsic_inited,
			diag_hsic[i].hsic_device_enabled,
			diag_hsic[i].hsic_device_opened,
			diag_hsic[i].hsic_suspend,
			diag_hsic[i].in_busy_hsic_read_on_device,
			diag_hsic[i].in_busy_hsic_write,
			diag_hsic[i].count_hsic_pool,
			diag_hsic[i].count_hsic_write_pool,
			(unsigned int)diag_hsic[i].diag_hsic_pool,
			(unsigned int)diag_hsic[i].diag_hsic_write_pool,
			diag_bridge[i].write_len,
			diag_hsic[i].num_hsic_buf_tbl_entries,
			diag_bridge[i].usb_connected,
			work_pending(&(diag_bridge[i].diag_read_work)),
			work_pending(&(diag_hsic[i].diag_read_hsic_work)),
			work_pending(&(diag_bridge[i].usb_read_complete_work)));
			if (bytes_written > bytes_hsic_inited)
				bytes_hsic_inited = bytes_written;
		} else {
			/* Check if there is room to add another HSIC entry */
			if (bytes_remaining < bytes_hsic_not_inited)
				break;
			bytes_written = scnprintf(buf+bytes_in_buffer,
				bytes_remaining,
				"HSIC Instance: %d has not been initialized\n\n",
				i);
			if (bytes_written > bytes_hsic_not_inited)
				bytes_hsic_not_inited = bytes_written;
		}

		bytes_in_buffer += bytes_written;

		bytes_remaining = buf_size - bytes_in_buffer;
	}

	*ppos = 0;
	ret = simple_read_from_buffer(ubuf, count, ppos, buf, bytes_in_buffer);

	diag_dbgfs_finished = 1;
	kfree(buf);
	return ret;
}
开发者ID:Hani-K,项目名称:H-Vitamin,代码行数:101,代码来源:diag_debugfs.c


示例17: wil_bf_debugfs_show

static int wil_bf_debugfs_show(struct seq_file *s, void *data)
{
	int rc;
	int i;
	struct wil6210_priv *wil = s->private;
	struct wmi_notify_req_cmd cmd = {
		.interval_usec = 0,
	};
	struct {
		struct wil6210_mbox_hdr_wmi wmi;
		struct wmi_notify_req_done_event evt;
	} __packed reply;

	for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
		u32 status;

		cmd.cid = i;
		rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd),
			      WMI_NOTIFY_REQ_DONE_EVENTID, &reply,
			      sizeof(reply), 20);
		/* if reply is all-0, ignore this CID */
		if (rc || is_all_zeros(&reply.evt, sizeof(reply.evt)))
			continue;

		status = le32_to_cpu(reply.evt.status);
		seq_printf(s, "CID %d {\n"
			   "  TSF = 0x%016llx\n"
			   "  TxMCS = %2d TxTpt = %4d\n"
			   "  SQI = %4d\n"
			   "  Status = 0x%08x %s\n"
			   "  Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n"
			   "  Goodput(rx:tx) %4d:%4d\n"
			   "}\n",
			   i,
			   le64_to_cpu(reply.evt.tsf),
			   le16_to_cpu(reply.evt.bf_mcs),
			   le32_to_cpu(reply.evt.tx_tpt),
			   reply.evt.sqi,
			   status, wil_bfstatus_str(status),
			   le16_to_cpu(reply.evt.my_rx_sector),
			   le16_to_cpu(reply.evt.my_tx_sector),
			   le16_to_cpu(reply.evt.other_rx_sector),
			   le16_to_cpu(reply.evt.other_tx_sector),
			   le32_to_cpu(reply.evt.rx_goodput),
			   le32_to_cpu(reply.evt.tx_goodput));
	}
	return 0;
}

static int wil_bf_seq_open(struct inode *inode, struct file *file)
{
	return single_open(file, wil_bf_debugfs_show, inode->i_private);
}

static const struct file_operations fops_bf = {
	.open		= wil_bf_seq_open,
	.release	= single_release,
	.read		= seq_read,
	.llseek		= seq_lseek,
};

/*---------SSID------------*/
static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf,
				  size_t count, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	struct wireless_dev *wdev = wil_to_wdev(wil);

	return simple_read_from_buffer(user_buf, count, ppos,
				       wdev->ssid, wdev->ssid_len);
}

static ssize_t wil_write_file_ssid(stru 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ simple_release_fs函数代码示例发布时间:2022-05-30
下一篇:
C++ simple_prompt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap