这篇教程C++ DPRINTK函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DPRINTK函数的典型用法代码示例。如果您正苦于以下问题:C++ DPRINTK函数的具体用法?C++ DPRINTK怎么用?C++ DPRINTK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DPRINTK函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pdcspath_hwpath_writestatic ssize_tpdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t count){ struct hardware_path hwpath; unsigned short i; char in[count+1], *temp; struct device *dev; int ret; if (!entry || !buf || !count) return -EINVAL; memset(in, 0, count+1); strncpy(in, buf, count); memset(&hwpath, 0xff, sizeof(hwpath)); if (!(temp = strrchr(in, '/'))) return -EINVAL; hwpath.mod = simple_strtoul(temp+1, NULL, 10); in[temp-in] = '/0'; DPRINTK("%s: mod: %d/n", __func__, hwpath.mod); for (i=5; ((temp = strrchr(in, '/'))) && (temp-in > 0) && (likely(i)); i--) { hwpath.bc[i] = simple_strtoul(temp+1, NULL, 10); in[temp-in] = '/0'; DPRINTK("%s: bc[%d]: %d/n", __func__, i, hwpath.bc[i]); } hwpath.bc[i] = simple_strtoul(in, NULL, 10); DPRINTK("%s: bc[%d]: %d/n", __func__, i, hwpath.bc[i]); if (!(dev = hwpath_to_device((struct hardware_path *)&hwpath))) { printk(KERN_WARNING "%s: attempt to set invalid /"%s/" " "hardware path: %s/n", __func__, entry->name, buf); return -EINVAL; } write_lock(&entry->rw_lock); entry->ready = 0; entry->dev = dev; pdcspath_store(entry); sysfs_remove_link(&entry->kobj, "device"); ret = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); WARN_ON(ret); write_unlock(&entry->rw_lock); printk(KERN_INFO PDCS_PREFIX ": changed /"%s/" path to /"%s/"/n", entry->name, buf); return count;}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:64,
示例2: ncp_file_readstatic ssize_tncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos){ struct dentry *dentry = file->f_dentry; struct inode *inode = dentry->d_inode; size_t already_read = 0; off_t pos; size_t bufsize; int error; void* freepage; size_t freelen; DPRINTK("ncp_file_read: enter %s/%s/n", dentry->d_parent->d_name.name, dentry->d_name.name); if (!ncp_conn_valid(NCP_SERVER(inode))) return -EIO; if (!S_ISREG(inode->i_mode)) { DPRINTK("ncp_file_read: read from non-file, mode %07o/n", inode->i_mode); return -EINVAL; } pos = *ppos; if ((ssize_t) count < 0) { return -EINVAL; } if (!count) return 0; if (pos > inode->i_sb->s_maxbytes) return 0; if (pos + count > inode->i_sb->s_maxbytes) { count = inode->i_sb->s_maxbytes - pos; } error = ncp_make_open(inode, O_RDONLY); if (error) { DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d/n", error); return error; } bufsize = NCP_SERVER(inode)->buffer_size; error = -EIO; freelen = ncp_read_bounce_size(bufsize); freepage = vmalloc(freelen); if (!freepage) goto outrel; error = 0; /* First read in as much as possible for each bufsize. */ while (already_read < count) { int read_this_time; size_t to_read = min_t(unsigned int, bufsize - (pos % bufsize), count - already_read); error = ncp_read_bounce(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, pos, to_read, buf, &read_this_time, freepage, freelen); if (error) { error = -EIO; /* NW errno -> Linux errno */ break; } pos += read_this_time; buf += read_this_time; already_read += read_this_time; if (read_this_time != to_read) { break; } } vfree(freepage); *ppos = pos; if (!IS_RDONLY(inode)) { inode->i_atime = CURRENT_TIME; } DPRINTK("ncp_file_read: exit %s/%s/n", dentry->d_parent->d_name.name, dentry->d_name.name);outrel: ncp_inode_close(inode); return already_read ? already_read : error;}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:87,
示例3: ncp_releasestatic int ncp_release(struct inode *inode, struct file *file) { if (ncp_make_closed(inode)) { DPRINTK("ncp_release: failed to close/n"); } return 0;}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:6,
示例4: parport_readssize_t parport_read (struct parport *port, void *buffer, size_t len){#ifndef CONFIG_PARPORT_1284 printk (KERN_ERR "parport: IEEE1284 not supported in this kernel/n"); return -ENODEV;#else int mode = port->physport->ieee1284.mode; int addr = mode & IEEE1284_ADDR; size_t (*fn) (struct parport *, void *, size_t, int); /* Ignore the device-ID-request bit and the address bit. */ mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR); /* Use the mode we're in. */ switch (mode) { case IEEE1284_MODE_COMPAT: /* if we can tri-state use BYTE mode instead of NIBBLE mode, * if that fails, revert to NIBBLE mode -- ought to store somewhere * the device's ability to do BYTE mode reverse transfers, so we don't * end up needlessly calling negotiate(BYTE) repeately.. (fb) */ if ((port->physport->modes & PARPORT_MODE_TRISTATE) && !parport_negotiate (port, IEEE1284_MODE_BYTE)) { /* got into BYTE mode OK */ DPRINTK (KERN_DEBUG "%s: Using byte mode/n", port->name); fn = port->ops->byte_read_data; break; } if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) { return -EIO; } /* fall through to NIBBLE */ case IEEE1284_MODE_NIBBLE: DPRINTK (KERN_DEBUG "%s: Using nibble mode/n", port->name); fn = port->ops->nibble_read_data; break; case IEEE1284_MODE_BYTE: DPRINTK (KERN_DEBUG "%s: Using byte mode/n", port->name); fn = port->ops->byte_read_data; break; case IEEE1284_MODE_EPP: DPRINTK (KERN_DEBUG "%s: Using EPP mode/n", port->name); if (addr) { fn = port->ops->epp_read_addr; } else { fn = port->ops->epp_read_data; } break; case IEEE1284_MODE_EPPSWE: DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode/n", port->name); if (addr) { fn = parport_ieee1284_epp_read_addr; } else { fn = parport_ieee1284_epp_read_data; } break; case IEEE1284_MODE_ECP: case IEEE1284_MODE_ECPRLE: DPRINTK (KERN_DEBUG "%s: Using ECP mode/n", port->name); fn = port->ops->ecp_read_data; break; case IEEE1284_MODE_ECPSWE: DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode/n", port->name); fn = parport_ieee1284_ecp_read_data; break; default: DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x/n", port->name, port->physport->ieee1284.mode); return -ENOSYS; } return (*fn) (port, buffer, len, 0);#endif /* IEEE1284 support */}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:80,
示例5: stmhdmi_send_data_packetstatic int stmhdmi_send_data_packet(struct stm_hdmi *dev, unsigned long arg){ stm_meta_data_result_t res; stm_meta_data_t *metadata; stm_hdmi_info_frame_t *iframe; struct stmhdmiio_data_packet packet; if (copy_from_user(&packet,(void*)arg,sizeof(packet))) return -EFAULT; if((metadata = kzalloc(sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t),GFP_KERNEL)) == 0) return -ENOMEM; metadata->size = sizeof(stm_meta_data_t)+sizeof(stm_hdmi_info_frame_t); metadata->release = (void(*)(struct stm_meta_data_s*))kfree; metadata->presentationTime = ((TIME64)packet.timestamp.tv_sec * USEC_PER_SEC) + (TIME64)packet.timestamp.tv_usec; switch(packet.type) { case HDMI_ACP_PACKET_TYPE: { /* * Don't allow the configuration of ACP packets unless the * connected TV has the supports AI flag set in its EDID. */ if((dev->edid_info.display_type != STM_DISPLAY_HDMI) || (dev->edid_info.hdmi_vsdb_flags & STM_HDMI_VSDB_SUPPORTS_AI) == 0) { DPRINTK("Not Sending ACP Datapacket, sink does not support AI/n"); kfree(metadata); return -EPERM; } DPRINTK("Sending ACP Datapacket/n"); metadata->type = STM_METADATA_TYPE_ACP_DATA; break; } case HDMI_VENDOR_INFOFRAME_TYPE: { DPRINTK("Sending vendor IFrame/n"); metadata->type = STM_METADATA_TYPE_VENDOR_IFRAME; break; } case HDMI_NTSC_INFOFRAME_TYPE: { DPRINTK("Sending NTSC IFrame/n"); metadata->type = STM_METADATA_TYPE_NTSC_IFRAME; break; } case HDMI_GAMUT_DATA_PACKET_TYPE: { DPRINTK("Sending Color Gamut Datapacket/n"); metadata->type = STM_METADATA_TYPE_COLOR_GAMUT_DATA; break; } default: { DPRINTK("Unsupported Datapacket/n"); kfree(metadata); return -EINVAL; } } iframe = (stm_hdmi_info_frame_t*)&metadata->data[0]; iframe->type = packet.type; iframe->version = packet.version; iframe->length = packet.length; /* * Note: we cannot use packet.length to size the memcpy as this is only * valid for real InfoFrames not arbitrary HDMI data island packets. */ memcpy(&iframe->data[0],&packet.data[0],28); if(stm_display_output_queue_metadata(dev->hdmi_output, metadata, &res)<0) { kfree(metadata); if(signal_pending(current)) return -ERESTARTSYS; else return -EIO; } return stmhdmi_convert_metadata_result_to_errno(res);}
开发者ID:Niptok,项目名称:tdt-amiko,代码行数:86,
示例6: assign_addrsstatic int assign_addrs(struct parport *port){ unsigned char s; unsigned char daisy; int thisdev = numdevs; int detected; char *deviceid; parport_data_forward(port); parport_write_data(port, 0xaa); udelay(2); parport_write_data(port, 0x55); udelay(2); parport_write_data(port, 0x00); udelay(2); parport_write_data(port, 0xff); udelay(2); s = parport_read_status(port) & (PARPORT_STATUS_BUSY | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); if (s != (PARPORT_STATUS_BUSY | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { DPRINTK(KERN_DEBUG "%s: assign_addrs: aa5500ff(%02x)/n", port->name, s); return 0; } parport_write_data(port, 0x87); udelay(2); s = parport_read_status(port) & (PARPORT_STATUS_BUSY | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR); if (s != (PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR)) { DPRINTK(KERN_DEBUG "%s: assign_addrs: aa5500ff87(%02x)/n", port->name, s); return 0; } parport_write_data(port, 0x78); udelay(2); s = parport_read_status(port); for (daisy = 0; (s & (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT)) == (PARPORT_STATUS_PAPEROUT|PARPORT_STATUS_SELECT) && daisy < 4; ++daisy) { parport_write_data(port, daisy); udelay(2); parport_frob_control(port, PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); udelay(1); parport_frob_control(port, PARPORT_CONTROL_STROBE, 0); udelay(1); add_dev(numdevs++, port, daisy); /* See if this device thought it was the last in the * chain. */ if (!(s & PARPORT_STATUS_BUSY)) break; /* We are seeing pass through status now. We see last_dev from next device or if last_dev does not work status lines from some non-daisy chain device. */ s = parport_read_status(port); } parport_write_data(port, 0xff); udelay(2); detected = numdevs - thisdev; DPRINTK(KERN_DEBUG "%s: Found %d daisy-chained devices/n", port->name, detected); /* Ask the new devices to introduce themselves. */ deviceid = kmalloc(1024, GFP_KERNEL); if (!deviceid) return 0; for (daisy = 0; thisdev < numdevs; thisdev++, daisy++) parport_device_id(thisdev, deviceid, 1024); kfree(deviceid); return detected;}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:83,
示例7: parport_negotiateint parport_negotiate (struct parport *port, int mode){#ifndef CONFIG_PARPORT_1284 if (mode == IEEE1284_MODE_COMPAT) return 0; printk (KERN_ERR "parport: IEEE1284 not supported in this kernel/n"); return -1;#else int m = mode & ~IEEE1284_ADDR; int r; unsigned char xflag; port = port->physport; /* Is there anything to do? */ if (port->ieee1284.mode == mode) return 0; /* Is the difference just an address-or-not bit? */ if ((port->ieee1284.mode & ~IEEE1284_ADDR) == (mode & ~IEEE1284_ADDR)){ port->ieee1284.mode = mode; return 0; } /* Go to compability forward idle mode */ if (port->ieee1284.mode != IEEE1284_MODE_COMPAT) parport_ieee1284_terminate (port); if (mode == IEEE1284_MODE_COMPAT) /* Compatibility mode: no negotiation. */ return 0; switch (mode) { case IEEE1284_MODE_ECPSWE: m = IEEE1284_MODE_ECP; break; case IEEE1284_MODE_EPPSL: case IEEE1284_MODE_EPPSWE: m = IEEE1284_MODE_EPP; break; case IEEE1284_MODE_BECP: return -ENOSYS; /* FIXME (implement BECP) */ } if (mode & IEEE1284_EXT_LINK) m = 1<<7; /* request extensibility link */ port->ieee1284.phase = IEEE1284_PH_NEGOTIATION; /* Start off with nStrobe and nAutoFd high, and nSelectIn low */ parport_frob_control (port, PARPORT_CONTROL_STROBE | PARPORT_CONTROL_AUTOFD | PARPORT_CONTROL_SELECT, PARPORT_CONTROL_SELECT); udelay(1); /* Event 0: Set data */ parport_data_forward (port); parport_write_data (port, m); udelay (400); /* Shouldn't need to wait this long. */ /* Event 1: Set nSelectIn high, nAutoFd low */ parport_frob_control (port, PARPORT_CONTROL_SELECT | PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_AUTOFD); /* Event 2: PError, Select, nFault go high, nAck goes low */ if (parport_wait_peripheral (port, PARPORT_STATUS_ERROR | PARPORT_STATUS_SELECT | PARPORT_STATUS_PAPEROUT | PARPORT_STATUS_ACK, PARPORT_STATUS_ERROR | PARPORT_STATUS_SELECT | PARPORT_STATUS_PAPEROUT)) { /* Timeout */ parport_frob_control (port, PARPORT_CONTROL_SELECT | PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_SELECT); DPRINTK (KERN_DEBUG "%s: Peripheral not IEEE1284 compliant (0x%02X)/n", port->name, parport_read_status (port)); port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; return -1; /* Not IEEE1284 compliant */ } /* Event 3: Set nStrobe low */ parport_frob_control (port, PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE); /* Event 4: Set nStrobe and nAutoFd high */ udelay (5); parport_frob_control (port, PARPORT_CONTROL_STROBE | PARPORT_CONTROL_AUTOFD, 0);//.........这里部分代码省略.........
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:101,
示例8: pdcspath_hwpath_write/** * pdcspath_hwpath_write - This function handles hardware path modifying. * @entry: An allocated and populated pdscpath_entry struct. * @buf: The input buffer to read from. * @count: The number of bytes to be read. * * We will call this function to change the current hardware path. * Hardware paths are to be given '/'-delimited, without brackets. * We make sure that the provided path actually maps to an existing * device, BUT nothing would prevent some foolish user to set the path to some * PCI bridge or even a CPU... * A better work around would be to make sure we are at the end of a device tree * for instance, but it would be IMHO beyond the simple scope of that driver. * The aim is to provide a facility. Data correctness is left to userland. */static ssize_tpdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t count){ struct hardware_path hwpath; unsigned short i; char in[count+1], *temp; struct device *dev; int ret; if (!entry || !buf || !count) return -EINVAL; /* We'll use a local copy of buf */ memset(in, 0, count+1); strncpy(in, buf, count); /* Let's clean up the target. 0xff is a blank pattern */ memset(&hwpath, 0xff, sizeof(hwpath)); /* First, pick the mod field (the last one of the input string) */ if (!(temp = strrchr(in, '/'))) return -EINVAL; hwpath.mod = simple_strtoul(temp+1, NULL, 10); in[temp-in] = '/0'; /* truncate the remaining string. just precaution */ DPRINTK("%s: mod: %d/n", __func__, hwpath.mod); /* Then, loop for each delimiter, making sure we don't have too many. we write the bc fields in a down-top way. No matter what, we stop before writing the last field. If there are too many fields anyway, then the user is a moron and it'll be caught up later when we'll check the consistency of the given hwpath. */ for (i=5; ((temp = strrchr(in, '/'))) && (temp-in > 0) && (likely(i)); i--) { hwpath.bc[i] = simple_strtoul(temp+1, NULL, 10); in[temp-in] = '/0'; DPRINTK("%s: bc[%d]: %d/n", __func__, i, hwpath.bc[i]); } /* Store the final field */ hwpath.bc[i] = simple_strtoul(in, NULL, 10); DPRINTK("%s: bc[%d]: %d/n", __func__, i, hwpath.bc[i]); /* Now we check that the user isn't trying to lure us */ if (!(dev = hwpath_to_device((struct hardware_path *)&hwpath))) { printk(KERN_WARNING "%s: attempt to set invalid /"%s/" " "hardware path: %s/n", __func__, entry->name, buf); return -EINVAL; } /* So far so good, let's get in deep */ write_lock(&entry->rw_lock); entry->ready = 0; entry->dev = dev; /* Now, dive in. Write back to the hardware */ pdcspath_store(entry); /* Update the symlink to the real device */ sysfs_remove_link(&entry->kobj, "device"); ret = sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device"); WARN_ON(ret); write_unlock(&entry->rw_lock); printk(KERN_INFO PDCS_PREFIX ": changed /"%s/" path to /"%s/"/n", entry->name, buf); return count;}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:84,
示例9: pdcs_auto_write/** * pdcs_auto_write - This function handles autoboot/search flag modifying. * @buf: The input buffer to read from. * @count: The number of bytes to be read. * @knob: The PF_AUTOBOOT or PF_AUTOSEARCH flag * * We will call this function to change the current autoboot flag. * We expect a precise syntax: * /"n/" (n == 0 or 1) to toggle AutoBoot Off or On */static ssize_t pdcs_auto_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count, int knob){ struct pdcspath_entry *pathentry; unsigned char flags; char in[count+1], *temp; char c; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!buf || !count) return -EINVAL; /* We'll use a local copy of buf */ memset(in, 0, count+1); strncpy(in, buf, count); /* Current flags are stored in primary boot path entry */ pathentry = &pdcspath_entry_primary; /* Be nice to the existing flag record */ read_lock(&pathentry->rw_lock); flags = pathentry->devpath.flags; read_unlock(&pathentry->rw_lock); DPRINTK("%s: flags before: 0x%X/n", __func__, flags); temp = skip_spaces(in); c = *temp++ - '0'; if ((c != 0) && (c != 1)) goto parse_error; if (c == 0) flags &= ~knob; else flags |= knob; DPRINTK("%s: flags after: 0x%X/n", __func__, flags); /* So far so good, let's get in deep */ write_lock(&pathentry->rw_lock); /* Change the path entry flags first */ pathentry->devpath.flags = flags; /* Now, dive in. Write back to the hardware */ pdcspath_store(pathentry); write_unlock(&pathentry->rw_lock); printk(KERN_INFO PDCS_PREFIX ": changed /"%s/" to /"%s/"/n", (knob & PF_AUTOBOOT) ? "autoboot" : "autosearch", (flags & knob) ? "On" : "Off"); return count;parse_error: printk(KERN_WARNING "%s: Parse error: expect /"n/" (n == 0 or 1)/n", __func__); return -EINVAL;}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:71,
示例10: backend_changed/* * Callback received when the hotplug scripts have placed the physical-device * node. Read it and the mode node, and create a vbd. If the frontend is * ready, connect. */static void backend_changed(struct xenbus_watch *watch, const char **vec, unsigned int len){ int err; unsigned major; unsigned minor; struct backend_info *be = container_of(watch, struct backend_info, backend_watch); struct xenbus_device *dev = be->dev; int cdrom = 0; char *device_type; DPRINTK(""); err = xenbus_scanf(XBT_NIL, dev->nodename, "physical-device", "%x:%x", &major, &minor); if (XENBUS_EXIST_ERR(err)) { /* * Since this watch will fire once immediately after it is * registered, we expect this. Ignore it, and wait for the * hotplug scripts. */ return; } if (err != 2) { xenbus_dev_fatal(dev, err, "reading physical-device"); return; } if ((be->major || be->minor) && ((be->major != major) || (be->minor != minor))) { pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported./n", be->major, be->minor, major, minor); return; } be->mode = xenbus_read(XBT_NIL, dev->nodename, "mode", NULL); if (IS_ERR(be->mode)) { err = PTR_ERR(be->mode); be->mode = NULL; xenbus_dev_fatal(dev, err, "reading mode"); return; } device_type = xenbus_read(XBT_NIL, dev->otherend, "device-type", NULL); if (!IS_ERR(device_type)) { cdrom = strcmp(device_type, "cdrom") == 0; kfree(device_type); } if (be->major == 0 && be->minor == 0) { /* Front end dir is a number, which is used as the handle. */ char *p = strrchr(dev->otherend, '/') + 1; long handle; err = strict_strtoul(p, 0, &handle); if (err) return; be->major = major; be->minor = minor; err = xen_vbd_create(be->blkif, handle, major, minor, (NULL == strchr(be->mode, 'w')), cdrom); if (err) { be->major = 0; be->minor = 0; xenbus_dev_fatal(dev, err, "creating vbd structure"); return; } err = xenvbd_sysfs_addif(dev); if (err) { xen_vbd_free(&be->blkif->vbd); be->major = 0; be->minor = 0; xenbus_dev_fatal(dev, err, "creating sysfs entries"); return; } /* We're potentially connected now */ xen_update_blkif_status(be->blkif); }}
开发者ID:Ricky310711,项目名称:RTL_KERNEL,代码行数:89,
示例11: connect/* * Write the physical details regarding the block device to the store, and * switch to Connected state. */static void connect(struct backend_info *be){ struct xenbus_transaction xbt; int err; struct xenbus_device *dev = be->dev; DPRINTK("%s", dev->otherend); /* Supply the information about the device the frontend needs */again: err = xenbus_transaction_start(&xbt); if (err) { xenbus_dev_fatal(dev, err, "starting transaction"); return; } err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); if (err) goto abort; err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", (unsigned long long)vbd_sz(&be->blkif->vbd)); if (err) { xenbus_dev_fatal(dev, err, "writing %s/sectors", dev->nodename); goto abort; } /* FIXME: use a typename instead */ err = xenbus_printf(xbt, dev->nodename, "info", "%u", be->blkif->vbd.type | (be->blkif->vbd.readonly ? VDISK_READONLY : 0)); if (err) { xenbus_dev_fatal(dev, err, "writing %s/info", dev->nodename); goto abort; } err = xenbus_printf(xbt, dev->nodename, "sector-size", "%lu", (unsigned long) bdev_logical_block_size(be->blkif->vbd.bdev)); if (err) { xenbus_dev_fatal(dev, err, "writing %s/sector-size", dev->nodename); goto abort; } err = xenbus_transaction_end(xbt, 0); if (err == -EAGAIN) goto again; if (err) xenbus_dev_fatal(dev, err, "ending transaction"); err = xenbus_switch_state(dev, XenbusStateConnected); if (err) xenbus_dev_fatal(dev, err, "switching to Connected state", dev->nodename); return;abort: xenbus_transaction_end(xbt, 1);}
开发者ID:Ricky310711,项目名称:RTL_KERNEL,代码行数:65,
示例12: probe/* * Called whenever the USB subsystem thinks we could be the right driver * to handle this device */static int probe(struct usb_interface *intf, const struct usb_device_id *id){ int alt_set, endp; int found = 0; int i, j; int struct_size; struct usb_host_interface *host_interf; struct usb_interface_descriptor *interf_desc; struct usb_host_endpoint *host_endpoint; struct ttusbir_device *ttusbir; DPRINTK("Module ttusbir probe/n"); /* To reduce memory fragmentation we use only one allocation */ struct_size = sizeof(struct ttusbir_device) + (sizeof(struct urb *) * num_urbs) + (sizeof(char *) * num_urbs) + (num_urbs * 128); ttusbir = kzalloc(struct_size, GFP_KERNEL); if (!ttusbir) return -ENOMEM; ttusbir->urb = (struct urb **)((char *)ttusbir + sizeof(struct ttusbir_device)); ttusbir->buffer = (char **)((char *)ttusbir->urb + (sizeof(struct urb *) * num_urbs)); for (i = 0; i < num_urbs; i++) ttusbir->buffer[i] = (char *)ttusbir->buffer + (sizeof(char *)*num_urbs) + (i * 128); ttusbir->usb_driver = &usb_driver; ttusbir->alt_setting = -1; /* @TODO check if error can be returned */ ttusbir->udev = usb_get_dev(interface_to_usbdev(intf)); ttusbir->interf = intf; ttusbir->last_pulse = 0x00; ttusbir->last_num = 0; /* * Now look for interface setting we can handle * We are searching for the alt setting where end point * 0x82 has max packet size 16 */ for (alt_set = 0; alt_set < intf->num_altsetting && !found; alt_set++) { host_interf = &intf->altsetting[alt_set]; interf_desc = &host_interf->desc; for (endp = 0; endp < interf_desc->bNumEndpoints; endp++) { host_endpoint = &host_interf->endpoint[endp]; if ((host_endpoint->desc.bEndpointAddress == 0x82) && (host_endpoint->desc.wMaxPacketSize == 0x10)) { ttusbir->alt_setting = alt_set; ttusbir->endpoint = endp; found = 1; break; } } } if (ttusbir->alt_setting != -1) DPRINTK("alt setting: %d/n", ttusbir->alt_setting); else { err("Could not find alternate setting/n"); kfree(ttusbir); return -EINVAL; } /* OK lets setup this interface setting */ usb_set_interface(ttusbir->udev, 0, ttusbir->alt_setting); /* Store device info in interface structure */ usb_set_intfdata(intf, ttusbir); /* Register as a LIRC driver */ if (lirc_buffer_init(&ttusbir->rbuf, sizeof(lirc_t), 256) < 0) { err("Could not get memory for LIRC data buffer/n"); usb_set_intfdata(intf, NULL); kfree(ttusbir); return -ENOMEM; } strcpy(ttusbir->driver.name, "TTUSBIR"); ttusbir->driver.minor = -1; ttusbir->driver.code_length = 1; ttusbir->driver.sample_rate = 0; ttusbir->driver.data = ttusbir; ttusbir->driver.add_to_buf = NULL; ttusbir->driver.rbuf = &ttusbir->rbuf; ttusbir->driver.set_use_inc = set_use_inc; ttusbir->driver.set_use_dec = set_use_dec; ttusbir->driver.fops = NULL; ttusbir->driver.dev = &intf->dev; ttusbir->driver.owner = THIS_MODULE; ttusbir->driver.features = LIRC_CAN_REC_MODE2; ttusbir->minor = lirc_register_driver(&ttusbir->driver); if (ttusbir->minor < 0) { err("Error registering as LIRC driver/n"); usb_set_intfdata(intf, NULL); lirc_buffer_free(&ttusbir->rbuf);//.........这里部分代码省略.........
开发者ID:Albinoman887,项目名称:lirc,代码行数:101,
示例13: ixgbe_check_options//.........这里部分代码省略......... *aflags &= ~IXGBE_FLAG_MSI_CAPABLE; } }#endif } { /* Multiple Queue Support */ static struct ixgbe_option opt = { .type = enable_option, .name = "Multiple Queue Support", .err = "defaulting to Enabled", .def = OPTION_ENABLED };#ifdef module_param_array if (num_MQ > bd) {#endif unsigned int mq = MQ[bd]; ixgbe_validate_option(&mq, &opt); if (mq) *aflags |= IXGBE_FLAG_MQ_CAPABLE; else *aflags &= ~IXGBE_FLAG_MQ_CAPABLE;#ifdef module_param_array } else { if (opt.def == OPTION_ENABLED) *aflags |= IXGBE_FLAG_MQ_CAPABLE; else *aflags &= ~IXGBE_FLAG_MQ_CAPABLE; }#endif /* Check Interoperability */ if ((*aflags & IXGBE_FLAG_MQ_CAPABLE) && !(*aflags & IXGBE_FLAG_MSIX_CAPABLE)) { DPRINTK(PROBE, INFO, "Multiple queues are not supported while MSI-X " "is disabled. Disabling Multiple Queues./n"); *aflags &= ~IXGBE_FLAG_MQ_CAPABLE; } }#if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE) { /* Direct Cache Access (DCA) */ static struct ixgbe_option opt = { .type = range_option, .name = "Direct Cache Access (DCA)", .err = "defaulting to Enabled", .def = IXGBE_MAX_DCA, .arg = { .r = { .min = OPTION_DISABLED, .max = IXGBE_MAX_DCA} } }; unsigned int dca = opt.def;#ifdef module_param_array if (num_DCA > bd) {#endif dca = DCA[bd]; ixgbe_validate_option(&dca, &opt); if (!dca) *aflags &= ~IXGBE_FLAG_DCA_CAPABLE; /* Check Interoperability */ if (!(*aflags & IXGBE_FLAG_DCA_CAPABLE)) { DPRINTK(PROBE, INFO, "DCA is disabled/n"); *aflags &= ~IXGBE_FLAG_DCA_ENABLED; } if (dca == IXGBE_MAX_DCA) {
开发者ID:StevenLeRoux,项目名称:PF_RING,代码行数:67,
示例14: pdcs_auto_writestatic ssize_t pdcs_auto_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count, int knob){ struct pdcspath_entry *pathentry; unsigned char flags; char in[count+1], *temp; char c; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!buf || !count) return -EINVAL; memset(in, 0, count+1); strncpy(in, buf, count); pathentry = &pdcspath_entry_primary; read_lock(&pathentry->rw_lock); flags = pathentry->devpath.flags; read_unlock(&pathentry->rw_lock); DPRINTK("%s: flags before: 0x%X/n", __func__, flags); temp = skip_spaces(in); c = *temp++ - '0'; if ((c != 0) && (c != 1)) goto parse_error; if (c == 0) flags &= ~knob; else flags |= knob; DPRINTK("%s: flags after: 0x%X/n", __func__, flags); write_lock(&pathentry->rw_lock); pathentry->devpath.flags = flags; pdcspath_store(pathentry); write_unlock(&pathentry->rw_lock); printk(KERN_INFO PDCS_PREFIX ": changed /"%s/" to /"%s/"/n", (knob & PF_AUTOBOOT) ? "autoboot" : "autosearch", (flags & knob) ? "On" : "Off"); return count;parse_error: printk(KERN_WARNING "%s: Parse error: expect /"n/" (n == 0 or 1)/n", __func__); return -EINVAL;}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:61,
示例15: xenbus_probe_initstatic int xenbus_probe_init(void){ int err = 0; unsigned long page = 0; DPRINTK(""); if (!is_running_on_xen()) return -ENODEV; /* Register ourselves with the kernel bus subsystem */ xenbus_frontend.error = bus_register(&xenbus_frontend.bus); if (xenbus_frontend.error) printk(KERN_WARNING "XENBUS: Error registering frontend bus: %i/n", xenbus_frontend.error); xenbus_backend_bus_register(); /* * Domain0 doesn't have a store_evtchn or store_mfn yet. */ if (is_initial_xendomain()) { struct evtchn_alloc_unbound alloc_unbound; /* Allocate page. */ page = get_zeroed_page(GFP_KERNEL); if (!page) return -ENOMEM; xen_store_mfn = xen_start_info->store_mfn = pfn_to_mfn(virt_to_phys((void *)page) >> PAGE_SHIFT); /* Next allocate a local port which xenstored can bind to */ alloc_unbound.dom = DOMID_SELF; alloc_unbound.remote_dom = DOMID_SELF; err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &alloc_unbound); if (err == -ENOSYS) goto err; BUG_ON(err); xen_store_evtchn = xen_start_info->store_evtchn = alloc_unbound.port;#if defined(CONFIG_PROC_FS) && defined(CONFIG_XEN_PRIVILEGED_GUEST) /* And finally publish the above info in /proc/xen */ xsd_kva_intf = create_xen_proc_entry("xsd_kva", 0600); if (xsd_kva_intf) { memcpy(&xsd_kva_fops, xsd_kva_intf->proc_fops, sizeof(xsd_kva_fops)); xsd_kva_fops.mmap = xsd_kva_mmap; xsd_kva_intf->proc_fops = &xsd_kva_fops; xsd_kva_intf->read_proc = xsd_kva_read; } xsd_port_intf = create_xen_proc_entry("xsd_port", 0400); if (xsd_port_intf) xsd_port_intf->read_proc = xsd_port_read;#endif xen_store_interface = mfn_to_virt(xen_store_mfn); } else {
开发者ID:Jinjian0609,项目名称:UVP-Tools,代码行数:61,
示例16: pdp_demuxstatic int pdp_demux(void){ int ret; u8 ch; size_t len; struct pdp_info *dev = NULL; struct pdp_hdr hdr; DPRINTK(2, "BEGIN/n"); /* read header */ ret = dpram_read(dpram_filp, &hdr, sizeof(hdr)); if (ret < 0) { EPRINTK("pdp_demux() dpram_read ret : %d/n",ret); return ret; } len = hdr.len - sizeof(struct pdp_hdr); /* check header */ dev = pdp_get_dev(hdr.id); if (dev == NULL) { EPRINTK("invalid id: %u, there is no existing device./n", hdr.id); ret = -ENODEV; goto err; } /* read data */ switch (dev->type) { case DEV_TYPE_NET: ret = vnet_recv(dev, len,hdr.id); break; case DEV_TYPE_SERIAL: ret = vs_read(dev, len,hdr.id); break; default: ret = -1; } if (ret < 0) { goto err; } /* check stop byte */ ret = dpram_read(dpram_filp, &ch, sizeof(ch)); if (ret < 0 || ch != 0x7e) { return ret; } DPRINTK(2, "END/n"); return 0; err: /* flush the remaining data including stop byte. */ dpram_flush_rx(dpram_filp, len + 1); return ret;}
开发者ID:voku,项目名称:I5700-kernel-2.6.32.9,代码行数:63,
示例17: nx_enable_nicinline int nx_enable_nic(struct unm_adapter_s *adapter){ int version; int err; int ctx; int ring; struct net_device *netdev = adapter->netdev; unsigned long flags;#if 0 initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ adapter->ahw.xg_linkup = 0; adapter->procCmdBufCounter = 0; adapter->lastCmdConsumer = 0; adapter->cmdProducer = 0; UNM_WRITE_LOCK_IRQS(&adapter->adapter_lock, flags); unm_nic_pci_change_crbwindow(adapter, 1); UNM_WRITE_UNLOCK_IRQR(&adapter->adapter_lock, flags); unm_nic_update_cmd_producer(adapter, 0); unm_nic_update_cmd_consumer(adapter, 0); /* do this before waking up pegs so that we have valid dummy dma addr*/ err = initialize_adapter_offload(adapter); if (check_hw_init(adapter)!= 0) { printk("%s: hw init failed/n",unm_nic_driver_name); } version = (_UNM_NIC_LINUX_MAJOR << 16) | ((_UNM_NIC_LINUX_MINOR << 8)) | (_UNM_NIC_LINUX_SUBVERSION); UNM_NIC_PCI_WRITE_32(version, CRB_NORMALIZE(adapter, CRB_DRIVER_VERSION)); UNM_NIC_PCI_WRITE_32(1, CRB_NORMALIZE(adapter, UNM_ROMUSB_GLB_PEGTUNE_DONE)); err = init_firmware (adapter); if (err != 0) { printk(KERN_ERR "%s: Failed to init firmware/n", unm_nic_driver_name); return -EIO; } err = unm_nic_hw_resources (adapter); if (err) { DPRINTK(1, ERR, "Error in setting hw resources:" "%d/n", err); return err; } if ((nx_setup_vlan_buffers(adapter)) != 0) { unm_nic_free_hw_resources(adapter); nx_free_vlan_buffers(adapter); return -ENOMEM; } /*for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) { unm_post_rx_buffers(adapter, ring); }*/ if ((nx_setup_vmkbounce_buffers(adapter)) != 0) { nx_free_vmkbounce_buffers(adapter); nx_free_vlan_buffers(adapter); unm_nic_free_hw_resources(adapter); return -ENOMEM; } read_lock(&adapter->adapter_lock); unm_nic_enable_all_int(adapter); read_unlock(&adapter->adapter_lock); if (unm_nic_macaddr_set (adapter, adapter->mac_addr)!=0) { return -EIO; } if (unm_nic_init_port (adapter) != 0) { printk(KERN_ERR "%s: Failed to initialize the port %d/n", unm_nic_driver_name, adapter->portnum); return -EIO; } unm_nic_set_multi(netdev); netif_start_queue(netdev); adapter->state = PORT_UP;#endif return 0;}
开发者ID:loginab,项目名称:esxdrivers,代码行数:90,
示例18: pdp_activatestatic int pdp_activate(pdp_arg_t *pdp_arg, unsigned type, unsigned flags){ int ret; struct pdp_info *dev; struct net_device *net; DPRINTK(2, "BEGIN/n"); DPRINTK(1, "id: %d/n", pdp_arg->id); dev = kmalloc(sizeof(struct pdp_info) + MAX_PDP_PACKET_LEN, GFP_KERNEL); if (dev == NULL) { EPRINTK("out of memory/n"); return -ENOMEM; } memset(dev, 0, sizeof(struct pdp_info)); /* @[email C++ DPRINT_DBG函数代码示例 C++ DPRINTFN函数代码示例
|