本文整理汇总了C++中simple_read_from_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ simple_read_from_buffer函数的具体用法?C++ simple_read_from_buffer怎么用?C++ simple_read_from_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simple_read_from_buffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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));
}
示例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
}
示例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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}