本文整理汇总了C++中dbg_err函数的典型用法代码示例。如果您正苦于以下问题:C++ dbg_err函数的具体用法?C++ dbg_err怎么用?C++ dbg_err使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbg_err函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vt1603_bat_uboot_env_check
static int vt1603_bat_uboot_env_check(struct vt1603_bat_drvdata *bat_drv)
{
int ret = 0;
int len = 96;
char buf[96] = { 0 };
ret = wmt_getsyspara("wmt.io.bat", buf, &len);
if(ret ||strncmp(buf,"3",1)){
dbg_err(" VT1603A/VT1609 Battery Disabled.\n");
return -EIO;
}
len = sizeof(buf);
memset(buf, 0, sizeof(buf));
ret = wmt_getsyspara("wmt.audio.i2s", buf, &len);
if(ret ||strncmp(buf,"vt1603",6)){
dbg_err("Vt1603 battery invalid, for VT1603 codec disabled.\n");
return -EINVAL;
}
bat_drv->tch_enabled = 0;
len = sizeof(buf);
memset(buf, 0, sizeof(buf));
ret = wmt_getsyspara("wmt.io.touch", buf, &len);
if(!strncmp(buf,"1:vt1603",8) ||!strncmp(buf,"1:vt1609",8) )
bat_drv->tch_enabled = 1;
return 0;
}
示例2: vt1603_bat_init
static int __init vt1603_bat_init(void)
{
int ret = 0;
struct vt1603_bat_drvdata *bat_drv = NULL;
bat_drv = kzalloc(sizeof(*bat_drv), GFP_KERNEL);
if (!bat_drv) {
dbg_err("vt160x: alloc driver data failed\n");
ret = -ENOMEM;
goto out;
}
ret = vt1603_bat_uboot_env_check(bat_drv);
if (ret) {
dbg_err("vt1603x uboot env check failed\n");
goto out;
}
vt1603_bat = bat_drv;
ret = platform_driver_register(&vt1603_bat_driver);
if(ret){
dbg_err("vt160x battery driver register failed!.\n");
goto out;
}
return 0;
out:
kfree(bat_drv);
return ret;
}
示例3: vt1603_bat_work
/*
* vt1603_bat_work - vt1603 battery workqueue routine, switch
* vt1603 working mode to battery detecting
* @work: battery work struct
*/
static void vt1603_bat_work(struct work_struct *work)
{
int tmp = 0;
int timeout, i = 0;
int bat_arrary[DFLT_BAT_VAL_AVG]={0};
struct vt1603_bat_drvdata *bat_drv;
dbg("Enter\n");
bat_drv = container_of(work, struct vt1603_bat_drvdata, work);
if (unlikely(vt1603_get_pen_state(bat_drv) == TS_PENDOWN_STATE)) {
dbg("vt1603 pendown when battery detect\n");
goto out;
}
/* enable sar-adc power and clock */
vt1603_bat_power_up(bat_drv);
/* enable pen down/up to avoid miss irq */
vt1603_bat_pen_manual(bat_drv);
/* switch vt1603 to battery detect mode */
vt1603_switch_to_bat_mode(bat_drv);
/* do conversion use battery manual mode */
vt1603_setbits(bat_drv, VT1603_INTS_REG, BIT0);
vt1603_set_reg8(bat_drv, VT1603_CR_REG, BIT4);
for(i=0; i<DFLT_BAT_VAL_AVG; i++){
timeout = 2000;
while(--timeout && (vt1603_get_reg8(bat_drv, VT1603_INTS_REG) & BIT0)==0)
;
if(timeout){
if(vt1603_get_bat_data(bat_drv,&bat_arrary[i]) < 0)
dbg_err("vt1603 get bat adc data Failed!\n");
}else {
dbg_err("wait adc end timeout ?!\n");
goto out;
}
vt1603_setbits(bat_drv, VT1603_INTS_REG, BIT0);
vt1603_set_reg8(bat_drv, VT1603_CR_REG, BIT4);//start manual ADC mode
}
tmp = vt1603_bat_avg(bat_arrary,DFLT_BAT_VAL_AVG);
bat_drv->bat_new = tmp;
vt1603_fifo_push(&Bat_buf, tmp);
vt1603_fifo_avg(Bat_buf, &tmp);
bat_drv->bat_val = tmp;
//printk(KERN_ERR"reported battery val:%d, new val:%d\n",tmp, bat_drv->bat_new);
out:
vt1603_clrbits(bat_drv, VT1603_INTCR_REG, BIT7);
vt1603_setbits(bat_drv, VT1603_INTS_REG, BIT0 | BIT3);
vt1603_set_reg8(bat_drv, VT1603_CR_REG, BIT1);
mod_timer(&bat_drv->bat_tmr, jiffies + msecs_to_jiffies(DFLT_POLLING_BAT_INTERVAL* 1000));
dbg("Exit\n\n\n");
return ;
}
示例4: validate_vid_hdr
/**
* validate_vid_hdr - check volume identifier header.
* @vid_hdr: the volume identifier header to check
* @sv: information about the volume this logical eraseblock belongs to
* @pnum: physical eraseblock number the VID header came from
*
* This function checks that data stored in @vid_hdr is consistent. Returns
* non-zero if an inconsistency was found and zero if not.
*
* Note, UBI does sanity check of everything it reads from the flash media.
* Most of the checks are done in the I/O sub-system. Here we check that the
* information in the VID header is consistent to the information in other VID
* headers of the same volume.
*/
static int validate_vid_hdr(const struct ubi_vid_hdr *vid_hdr,
const struct ubi_scan_volume *sv, int pnum)
{
int vol_type = vid_hdr->vol_type;
int vol_id = be32_to_cpu(vid_hdr->vol_id);
int used_ebs = be32_to_cpu(vid_hdr->used_ebs);
int data_pad = be32_to_cpu(vid_hdr->data_pad);
if (sv->leb_count != 0) {
int sv_vol_type;
/*
* This is not the first logical eraseblock belonging to this
* volume. Ensure that the data in its VID header is consistent
* to the data in previous logical eraseblock headers.
*/
if (vol_id != sv->vol_id) {
dbg_err("inconsistent vol_id");
goto bad;
}
if (sv->vol_type == UBI_STATIC_VOLUME)
sv_vol_type = UBI_VID_STATIC;
else
sv_vol_type = UBI_VID_DYNAMIC;
if (vol_type != sv_vol_type) {
dbg_err("inconsistent vol_type");
goto bad;
}
if (used_ebs != sv->used_ebs) {
dbg_err("inconsistent used_ebs");
goto bad;
}
if (data_pad != sv->data_pad) {
dbg_err("inconsistent data_pad");
goto bad;
}
}
return 0;
bad:
ubi_err("inconsistent VID header at PEB %d", pnum);
ubi_dbg_dump_vid_hdr(vid_hdr);
ubi_dbg_dump_sv(sv);
return -EINVAL;
}
示例5: sitronix_get_chip_id
static int sitronix_get_chip_id(struct sitronix_data *sitronix)
{
int ret = 0;
uint8_t buffer[3]={CHIP_ID};
ret = sitronix_read(sitronix, buffer, 3);
if (ret < 0){
dbg_err("read Chip ID error (%d)\n", ret);
return ret;
}
if(buffer[0] == 0){
if(buffer[1] + buffer[2] > 32)
sitronix->chip_id = 2;
else
sitronix->chip_id = 0;
}else
sitronix->chip_id = buffer[0];
sitronix->Num_X = buffer[1];
sitronix->Num_Y = buffer[2];
printk("Chip ID = %d, Num_X = %d, Num_Y = %d\n", sitronix->chip_id, sitronix->Num_X, sitronix->Num_Y);
return 0;
}
示例6: vhost_load_allowed_methods
int vhost_load_allowed_methods(const char *m, ec_method_mask_t *pmm)
{
size_t nelems, i;
char **tv = NULL;
dbg_return_if(m == NULL, -1);
dbg_return_if(pmm == NULL, -1);
*pmm = EC_METHOD_MASK_UNSET;
dbg_err_if(u_strtok(m, " \t", &tv, &nelems));
for (i = 0; i < nelems; ++i)
{
if (!strcasecmp(tv[i], "GET"))
*pmm |= EC_GET_MASK;
else if (!strcasecmp(tv[i], "POST"))
*pmm |= EC_POST_MASK;
else if (!strcasecmp(tv[i], "PUT"))
*pmm |= EC_PUT_MASK;
else if (!strcasecmp(tv[i], "DELETE"))
*pmm |= EC_DELETE_MASK;
else
dbg_err("unknown method %s", tv[i]);
}
u_strtok_cleanup(tv, nelems);
return 0;
err:
if (tv)
u_strtok_cleanup(tv, nelems);
return -1;
}
示例7: process_ev_exited_cr
/*
* Course of action when leaving the CS.
*/
int process_ev_exited_cr(void * cookie)
{
generic_message_t msg = {};
char msctext[MAX_MSC_TEXT] = {};
int err = 0;
dbg_msg("Entered DME_EV_EXITED_CRITICAL_REG");
if (fsm_state != PS_EXECUTING) {
dbg_err("Fatal error: DME_EV_EXITED_CRITICAL_REG occurred while not in EXECUTING state.");
return (err = ERR_FATAL);
}
/* inform the supervisor */
supervisor_send_inform_message(DME_EV_EXITED_CRITICAL_REG);
/* Switch state to IDLE */
fsm_state = PS_IDLE;
/* Do whatever IPC deems necessary */
generic_msg_set(&msg, MTYPE_RELEASE, msctext, sizeof(msctext));
err = dme_broadcast_msg((uint8*)&msg, GENERIC_MSG_LEN, msctext);
return err;
}
示例8: do_sync_erase
/**
* do_sync_erase - synchronously erase a physical eraseblock.
* @ubi: UBI device description object
* @pnum: the physical eraseblock number to erase
*
* This function synchronously erases physical eraseblock @pnum and returns
* zero in case of success and a negative error code in case of failure. If
* %-EIO is returned, the physical eraseblock most probably went bad.
*/
static int do_sync_erase(struct ubi_device *ubi, int pnum)
{
int err, retries = 0;
struct erase_info ei;
wait_queue_head_t wq;
dbg_io("erase PEB %d", pnum);
retry:
init_waitqueue_head(&wq);
memset(&ei, 0, sizeof(struct erase_info));
ei.mtd = ubi->mtd;
ei.addr = (loff_t)pnum * ubi->peb_size;
ei.len = ubi->peb_size;
ei.callback = erase_callback;
ei.priv = (unsigned long)&wq;
err = ubi->mtd->erase(ubi->mtd, &ei);
if (err) {
if (retries++ < UBI_IO_RETRIES) {
dbg_io("error %d while erasing PEB %d, retry",
err, pnum);
yield();
goto retry;
}
ubi_err("cannot erase PEB %d, error %d", pnum, err);
ubi_dbg_dump_stack();
return err;
}
err = wait_event_interruptible(wq, ei.state == MTD_ERASE_DONE ||
ei.state == MTD_ERASE_FAILED);
if (err) {
ubi_err("interrupted PEB %d erasure", pnum);
return -EINTR;
}
if (ei.state == MTD_ERASE_FAILED) {
if (retries++ < UBI_IO_RETRIES) {
dbg_io("error while erasing PEB %d, retry", pnum);
yield();
goto retry;
}
ubi_err("cannot erase PEB %d", pnum);
ubi_dbg_dump_stack();
return -EIO;
}
err = ubi_dbg_check_all_ff(ubi, pnum, 0, ubi->peb_size);
if (err)
return err;
if (ubi_dbg_is_erase_failure() && !err) {
dbg_err("cannot erase PEB %d (emulated)", pnum);
return -EIO;
}
return 0;
}
示例9: ubifs_scan_a_node
/**
* ubifs_scan_a_node - scan for a node or padding.
* @c: UBIFS file-system description object
* @buf: buffer to scan
* @len: length of buffer
* @lnum: logical eraseblock number
* @offs: offset within the logical eraseblock
* @quiet: print no messages
*
* This function returns a scanning code to indicate what was scanned.
*/
int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
int offs, int quiet)
{
struct ubifs_ch *ch = buf;
uint32_t magic;
magic = le32_to_cpu(ch->magic);
if (magic == 0xFFFFFFFF) {
dbg_scan("hit empty space");
return SCANNED_EMPTY_SPACE;
}
if (magic != UBIFS_NODE_MAGIC)
return scan_padding_bytes(buf, len);
if (len < UBIFS_CH_SZ)
return SCANNED_GARBAGE;
dbg_scan("scanning %s", dbg_ntype(ch->node_type));
if (ubifs_check_node(c, buf, lnum, offs, quiet, 1))
return SCANNED_A_CORRUPT_NODE;
if (ch->node_type == UBIFS_PAD_NODE) {
struct ubifs_pad_node *pad = buf;
int pad_len = le32_to_cpu(pad->pad_len);
int node_len = le32_to_cpu(ch->len);
/* Validate the padding node */
if (pad_len < 0 ||
offs + node_len + pad_len > c->leb_size) {
if (!quiet) {
ubifs_err("bad pad node at LEB %d:%d",
lnum, offs);
dbg_dump_node(c, pad);
}
return SCANNED_A_BAD_PAD_NODE;
}
/* Make the node pads to 8-byte boundary */
if ((node_len + pad_len) & 7) {
if (!quiet) {
dbg_err("bad padding length %d - %d",
offs, offs + node_len + pad_len);
}
return SCANNED_A_BAD_PAD_NODE;
}
dbg_scan("%d bytes padded, offset now %d",
pad_len, ALIGN(offs + node_len + pad_len, 8));
return node_len + pad_len;
}
return SCANNED_A_NODE;
}
示例10: handle_supervisor_msg
static int handle_supervisor_msg(void * cookie) {
const buff_t * buff = (buff_t *)cookie;
sup_message_t srcmsg = {};
int ret = 0;
if (!buff) {
dbg_err("Message is empty!");
return ERR_RECV_MSG;
}
/* record the time */
clock_gettime(CLOCK_REALTIME, &sup_tstamp);
ret = sup_msg_parse(*buff, &srcmsg);
if (srcmsg.msg_type == DME_SEV_ENDSIMULATION) {
exit_request = TRUE;
return ret;
}
switch(fsm_state) {
case PS_IDLE:
if (srcmsg.msg_type == DME_SEV_SYNCRO) {
sup_syncro.tv_sec = srcmsg.sec_tdelta;
sup_syncro.tv_nsec = srcmsg.nsec_tdelta;
}
else if (srcmsg.msg_type == DME_EV_WANT_CRITICAL_REG) {
critical_region_simulated_duration = srcmsg.sec_tdelta;
ret = handle_event(DME_EV_WANT_CRITICAL_REG, NULL);
}
break;
/* The supervisor should not send a message in these states */
case PS_PENDING:
case PS_EXECUTING:
dbg_msg("Ignoring message from supervisor (not in IDLE state).");
break;
default:
dbg_err("Fatal error: FSM state corrupted");
ret = ERR_FATAL;
break;
}
return ret;
}
示例11: pixcir_auto_clb
static int pixcir_auto_clb(struct pixcir_data *pixcir)
{
int ret;
u8 cmd[2]={0x3a,0x03};
ret = pixcir_write(pixcir, cmd, sizeof(cmd));
if(ret <= 0)
dbg_err("Pixcir initialize failed.\n");
mdelay(500);
return ret;
}
示例12: pixcir_sysfs_create_group
static int pixcir_sysfs_create_group(struct pixcir_data *pixcir, const struct attribute_group *group)
{
int err;
pixcir->kobj = kobject_create_and_add("wmtts", NULL) ;
if(!pixcir->kobj){
dbg_err("kobj create failed.\n");
return -ENOMEM;
}
/* Register sysfs hooks */
err = sysfs_create_group(pixcir->kobj, group);
if (err < 0){
kobject_del(pixcir->kobj);
dbg_err("Create sysfs group failed!\n");
return -ENOMEM;
}
return 0;
}
示例13: pixcir_active
static int pixcir_active(struct pixcir_data *pixcir)
{
int ret;
u8 cmd[3]={0x33,0,0x0a};
ret = pixcir_write(pixcir, cmd, sizeof(cmd));
if(ret <= 0)
dbg_err("Pixcir initialize failed.\n");
return ret;
}
示例14: pixcir_init
static int __init pixcir_init(void)
{
int ret = -ENOMEM;
struct pixcir_data *pixcir=NULL;
pixcir = kzalloc(sizeof(struct pixcir_data), GFP_KERNEL);
if(!pixcir){
dbg_err("mem alloc failed.\n");
return -ENOMEM;
}
pContext = pixcir;
ret = check_touch_env(pixcir);
if(ret < 0)
goto exit_free_mem;
ret = platform_device_register(&pixcir_device);
if(ret){
dbg_err("register platform drivver failed!\n");
goto exit_free_mem;
}
platform_set_drvdata(&pixcir_device, pixcir);
ret = platform_driver_register(&pixcir_driver);
if(ret){
dbg_err("register platform device failed!\n");
goto exit_unregister_pdev;
}
return ret;
exit_unregister_pdev:
platform_device_unregister(&pixcir_device);
exit_free_mem:
kfree(pixcir);
pContext = NULL;
return ret;
}
示例15: ubifs_scanned_corruption
/**
* ubifs_scanned_corruption - print information after UBIFS scanned corruption.
* @c: UBIFS file-system description object
* @lnum: LEB number of corruption
* @offs: offset of corruption
* @buf: buffer containing corruption
*/
void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
void *buf)
{
int len;
ubifs_err("corruption at LEB %d:%d", lnum, offs);
if (dbg_failure_mode)
return;
len = c->leb_size - offs;
if (len > 8192)
len = 8192;
dbg_err("first %d bytes from LEB %d:%d", len, lnum, offs);
print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1);
}