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

C++ devfs_register函数代码示例

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

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



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

示例1: scull_access_init

int scull_access_init(void)
{
    /* assign quantum and quantumset */
    scull_s_device.quantum = scull_quantum;
    scull_s_device.qset    = scull_qset;
    scull_u_device.quantum = scull_quantum;
    scull_u_device.qset    = scull_qset;
    scull_w_device.quantum = scull_quantum;
    scull_w_device.qset    = scull_qset;

    /* Initialize spinlocks */
    spin_lock_init(&scull_s_lock);
    spin_lock_init(&scull_u_lock);
    spin_lock_init(&scull_w_lock);
    spin_lock_init(&scull_c_lock);

    /* and semaphores (used by read and write) */
    sema_init(&scull_s_device.sem, 1);
    sema_init(&scull_u_device.sem, 1);
    sema_init(&scull_w_device.sem, 1);

#ifdef CONFIG_DEVFS_FS
    /* finally, create the devfs entry points */
    scull_s_device.handle =
        devfs_register(scull_devfs_dir, "single",
                       DEVFS_FL_AUTO_DEVNUM,
                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                       &scull_sngl_fops,
                       &scull_s_device);
    scull_u_device.handle =
        devfs_register(scull_devfs_dir, "user",
                       DEVFS_FL_AUTO_DEVNUM,
                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                       &scull_user_fops,
                       &scull_u_device);

    scull_w_device.handle =
        devfs_register(scull_devfs_dir, "wuser",
                       DEVFS_FL_AUTO_DEVNUM,
                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                       &scull_wusr_fops,
                       &scull_w_device);
    scull_priv_handle =
        devfs_register(scull_devfs_dir, "priv",
                       DEVFS_FL_AUTO_DEVNUM,
                       0, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                       &scull_priv_fops,
                       &scull_priv_fops); /* any non-null value */
#endif    
    return 0;
}
开发者ID:dot-Sean,项目名称:linux_drivers,代码行数:51,代码来源:access.c


示例2: scull_p_init

int scull_p_init(void)
{
    int i;

    SET_MODULE_OWNER(&scull_pipe_fops);
    scull_p_devices = kmalloc(scull_p_nr_devs * sizeof(Scull_Pipe),
                              GFP_KERNEL);
    if (scull_p_devices == NULL)
        return -ENOMEM;
    memset(scull_p_devices, 0, scull_p_nr_devs * sizeof(Scull_Pipe));
    for (i = 0; i < scull_p_nr_devs; i++) {
        init_waitqueue_head(&(scull_p_devices[i].inq));
        init_waitqueue_head(&(scull_p_devices[i].outq));
        sema_init(&scull_p_devices[i].sem, 1);
#ifdef CONFIG_DEVFS_FS
        sprintf(pipename, "pipe%i", i);
        scull_p_devices[i].handle =
            devfs_register(scull_devfs_dir, pipename,
                           DEVFS_FL_AUTO_DEVNUM,
                           0, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                           &scull_pipe_fops,
                           scull_p_devices + i);
        if (!scull_p_devices[i].handle) {
            /* ignore errors, at worse we have less devices */
            printk(KERN_WARNING
                   "scull: can't register pipe device nr. %i\n", i);
        }
#endif
    }
#ifdef SCULL_DEBUG
    create_proc_read_entry("scullpipe", 0, NULL, scull_read_p_mem, NULL);
#endif
    return 0;
}
开发者ID:crond,项目名称:dd,代码行数:34,代码来源:pipe.c


示例3: rdm_init

static int rdm_init(void)

{

#ifdef  CONFIG_DEVFS_FS
    if(devfs_register_chrdev(rdm_major, RDM_DEVNAME , &rdm_fops)) {
	printk(KERN_WARNING " ps: can't create device node - ps\n");
	return -EIO;
    }

    devfs_handle = devfs_register(NULL, RDM_DEVNAME, DEVFS_FL_DEFAULT, rdm_major, 0, 
				S_IFCHR | S_IRUGO | S_IWUGO, &rdm_fops, NULL);
#else
    int result=0;
    result = register_chrdev(rdm_major, RDM_DEVNAME, &rdm_fops);
    if (result < 0) {
        printk(KERN_WARNING "ps: can't get major %d\n",rdm_major);
        return result;
    }

    if (rdm_major == 0) {
	rdm_major = result; /* dynamic */
    }
#endif

    printk("rdm_major = %d\n", rdm_major);
    return 0;

}
开发者ID:JBTech,项目名称:ralink_rt5350,代码行数:29,代码来源:rdm.c


示例4: s3c2410_adc_init

int __init s3c2410_adc_init(void)
{
	int ret;

	/* normal ADC */
	ADCTSC = 0; //XP_PST(NOP_MODE);

	ret = request_irq(IRQ_ADC_DONE, adcdone_int_handler, SA_INTERRUPT, DEVICE_NAME, NULL);
	if (ret) {
		return ret;
	}

	ret = register_chrdev(0, DEVICE_NAME, &s3c2410_fops);
	if (ret < 0) {
		printk(DEVICE_NAME " can't get major number\n");
		return ret;
	}
	adcMajor=ret;

#ifdef CONFIG_DEVFS_FS
	devfs_adc_dir = devfs_mk_dir(NULL, "adc", NULL);
	devfs_adcraw = devfs_register(devfs_adc_dir, "0raw", DEVFS_FL_DEFAULT,
				adcMajor, ADCRAW_MINOR, S_IFCHR | S_IRUSR | S_IWUSR, &s3c2410_fops, NULL);
#endif
	printk (DEVICE_NAME"\tinitialized\n");

	return 0;
}
开发者ID:AxelLin,项目名称:Drv,代码行数:28,代码来源:s3c2410-adc.c


示例5: info

static void *probe_rio(struct usb_device *dev, unsigned int ifnum,
		       const struct usb_device_id *id)
{
	struct rio_usb_data *rio = &rio_instance;

	info("USB Rio found at address %d", dev->devnum);

	rio->present = 1;
	rio->rio_dev = dev;

	if (!(rio->obuf = (char *) kmalloc(OBUF_SIZE, GFP_KERNEL))) {
		err("probe_rio: Not enough memory for the output buffer");
		return NULL;
	}
	dbg("probe_rio: obuf address:%p", rio->obuf);

	if (!(rio->ibuf = (char *) kmalloc(IBUF_SIZE, GFP_KERNEL))) {
		err("probe_rio: Not enough memory for the input buffer");
		kfree(rio->obuf);
		return NULL;
	}
	dbg("probe_rio: ibuf address:%p", rio->ibuf);

	rio->devfs = devfs_register(usb_devfs_handle, "rio500",
				    DEVFS_FL_DEFAULT, USB_MAJOR,
				    RIO_MINOR,
				    S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
				    S_IWGRP, &usb_rio_fops, NULL);
	if (rio->devfs == NULL)
		dbg("probe_rio: device node registration failed");

	init_MUTEX(&(rio->lock));

	return rio;
}
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:35,代码来源:rio500.c


示例6: memory_devfs_register

void __init memory_devfs_register (void)
{
    /*  These are never unregistered  */
    static const struct {
	unsigned short minor;
	char *name;
	umode_t mode;
	struct file_operations *fops;
    } list[] = { /* list of minor devices */
	{1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
	{3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
#if defined(CONFIG_ISA) || !defined(__mc68000__)
	{4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
#endif
	{5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
	{7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
	{8, "random",  S_IRUGO | S_IWUSR,           &random_fops},
	{9, "urandom", S_IRUGO | S_IWUSR,           &urandom_fops}
    };
    int i;

    for (i=0; i<(sizeof(list)/sizeof(*list)); i++)
	devfs_register (NULL, list[i].name, DEVFS_FL_NONE,
			MEM_MAJOR, list[i].minor,
			list[i].mode | S_IFCHR,
			list[i].fops, NULL);
}
开发者ID:leonsh,项目名称:eldk30ppc,代码行数:28,代码来源:mem.c


示例7: lvm_fs_create_vg

void lvm_fs_create_vg(vg_t *vg_ptr) {
	struct proc_dir_entry *pde;

	if (!vg_ptr)
		return;

	vg_devfs_handle[vg_ptr->vg_number] =
		devfs_mk_dir(0, vg_ptr->vg_name, NULL);

	ch_devfs_handle[vg_ptr->vg_number] = devfs_register(
		vg_devfs_handle[vg_ptr->vg_number] , "group",
		DEVFS_FL_DEFAULT, LVM_CHAR_MAJOR, vg_ptr->vg_number,
		S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
		&lvm_chr_fops, NULL);

	vg_ptr->vg_dir_pde = create_proc_entry(vg_ptr->vg_name, S_IFDIR,
					       lvm_proc_vg_subdir);

	if((pde = create_proc_entry("group", S_IFREG, vg_ptr->vg_dir_pde))) {
		pde->read_proc = _proc_read_vg;
		pde->data = vg_ptr;
	}

	vg_ptr->lv_subdir_pde =
		create_proc_entry(LVM_LV_SUBDIR, S_IFDIR, vg_ptr->vg_dir_pde);

	vg_ptr->pv_subdir_pde =
		create_proc_entry(LVM_PV_SUBDIR, S_IFDIR, vg_ptr->vg_dir_pde);
}
开发者ID:jameshilliard,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:29,代码来源:lvm-fs.c


示例8: i2s_mod_init

int __init i2s_mod_init(void)
{
	/* register device with kernel */
#ifdef  CONFIG_DEVFS_FS
    if(devfs_register_chrdev(i2sdrv_major, I2SDRV_DEVNAME , &i2s_fops)) {
		printk(KERN_WARNING " i2s: can't create device node - %s\n", I2SDRV_DEVNAME);
		return -EIO;
    }

    devfs_handle = devfs_register(NULL, I2SDRV_DEVNAME, DEVFS_FL_DEFAULT, i2sdrv_major, 0, 
	    S_IFCHR | S_IRUGO | S_IWUGO, &i2s_fops, NULL);
#else
    int result=0;
    result = register_chrdev(i2sdrv_major, I2SDRV_DEVNAME, &i2s_fops);
    if (result < 0) {
		printk(KERN_WARNING "i2s: can't get major %d\n",i2sdrv_major);
        return result;
    }

    if (i2sdrv_major == 0) {
		i2sdrv_major = result; /* dynamic */
    }
#endif

#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)
#else	
	i2smodule_class=class_create(THIS_MODULE, I2SDRV_DEVNAME);
	if (IS_ERR(i2smodule_class)) 
		return -EFAULT;
	device_create(i2smodule_class, NULL, MKDEV(i2sdrv_major, 0), I2SDRV_DEVNAME);
#endif	
	return 0;
}
开发者ID:jhbsz,项目名称:wifiaudio,代码行数:33,代码来源:i2s_ctrl.c


示例9: fpga_init

int __init fpga_init(void)
{
	int ret;

/*	ret = request_irq(IRQ_ADC_DONE, adcdone_int_handler, SA_INTERRUPT, DEVICE_NAME, NULL);
	if (ret) {
		return ret;
	}*/
	s3c2410_fpga_base= (unsigned long) ioremap(FPGA_PHY_START, SZ_4K); 
	if(!s3c2410_fpga_base) {
		printk("ioremap S3C2410 fpga failed\n");
		return -EINVAL;
	}

	ret = register_chrdev(0, DEVICE_NAME, &s3c2410_fops);
	if (ret < 0) {
		printk(DEVICE_NAME " can't get major number\n");
		return ret;
	}
	fpgaMajor=ret;

#ifdef CONFIG_DEVFS_FS
	devfs_fpga_dir = devfs_mk_dir(NULL, "fpga", NULL);
	devfs_fpgaraw = devfs_register(devfs_fpga_dir, "0raw", DEVFS_FL_DEFAULT,
				fpgaMajor, FPGARAW_MINOR, S_IFCHR | S_IRUSR | S_IWUSR, &s3c2410_fops, NULL);
#endif
	printk (DEVICE_NAME"\tdevice initialized\n");

	return 0;
}
开发者ID:AxelLin,项目名称:Drv,代码行数:30,代码来源:s3c2410-fpga.c


示例10: init_module

int __init
init_module(void)
{  
    int rc;

    /* Get our definition */
    _gmodule = gmodule_get();
    if(!_gmodule) return -ENODEV;


    /* Register ourselves */
#ifdef GMODULE_CONFIG_DEVFS_FS
    devfs_handle = devfs_register(NULL, 
				  _gmodule->name, 
				  DEVFS_FL_NONE, 
				  _gmodule->major,
				  _gmodule->minor, 
				  S_IFCHR | S_IRUGO | S_IWUGO,
				  &_gmodule_fops, 
				  NULL);
    if(!devfs_handle) {
	printk(KERN_WARNING "%s: can't register device with devfs", 
	       _gmodule->name);
    }
    rc = 0;
#else
    rc = register_chrdev(_gmodule->major, 
			 _gmodule->name, 
			 &_gmodule_fops);
    if (rc < 0) {
	printk(KERN_WARNING "%s: can't get major %d",
	       _gmodule->name, _gmodule->major);
	return rc;
    }

    if(_gmodule->major == 0) {
	_gmodule->major = rc;
    }
#endif

    /* Specific module Initialization */
    if(_gmodule->init) {
	int rc;
	if((rc = _gmodule->init()) < 0) {
#ifdef GMODULE_CONFIG_DEVFS_FS
            if(devfs_handle) devfs_unregister(devfs_handle);
#else
            unregister_chrdev(_gmodule->major, _gmodule->name);
#endif
	    return rc;
	}
    }

    /* Add a /proc entry, if valid */
    if(_gmodule->pprint) {    
	_gmodule_create_proc();
    }

    return 0; /* succeed */
}
开发者ID:Azure,项目名称:sonic-buildimage,代码行数:60,代码来源:gmodule.c


示例11: ioCluster_init

static void ioCluster_init(struct cluster_s *cluster, uint_t id)
{
    struct device_s *pic;
    int i;

    /* First of all: Initialize TTYs */
    ibmpc_tty_init(&ttys_tbl[0], __tty_addr, 1, 0);   // IRQ 0 is taken by Timer 0

    boot_dmsg("\nSetup Terminal \t\t\t\tOK\n");

    cluster_init(cluster, id, __CPU_NR);

    boot_dmsg("Setup PIC      ");
    pic = kbootMem_calloc(sizeof(*pic));
    ibmpc_pic_init(pic, __pic_addr, 0);
    ibmpc_pic_bind(pic, &ttys_tbl[0]);
    devfs_register(&ttys_tbl[0]);

    for(i=0; i < __CPU_NR; i++)
        arch_cpu_set_irq_entry(&cluster->cpu_tbl[i], 0, &pic->action);

    boot_dmsg("\t\t\t\tOK\nSetup Timer    ");
    rt_timer_init(TIC, 1);
    ibmpc_pic_bind(pic, &rt_timer);

    boot_dmsg("\t\t\t\tOK\nSetup H.D.D    ");
    ibmpc_ata_init(&__sys_blk, (void*)ATA0_DRIVE0, 14);
    ibmpc_pic_bind(pic, &__sys_blk);

    boot_dmsg("\t\t\t\tOK\nActivating IRQs");
    pic->op.icu.set_mask(pic, ICU_MASK, 0, 0);
    boot_dmsg("\t\t\t\tOK\n");
}
开发者ID:walafc0,项目名称:almos-mk,代码行数:33,代码来源:arch_init.c


示例12: xp_sys_hook

inline int xp_sys_hook()
{
	/* Called insmod when inserting the module. */

	/* register the dazuko device */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
	dev_major = register_chrdev(CONFIG_RSBAC_DAZ_DEV_MAJOR, DEVICE_NAME, &fops);

	devfs_mk_cdev(MKDEV(dev_major, CONFIG_RSBAC_DAZ_DEV_MAJOR), S_IFCHR | S_IRUSR | S_IWUSR, DEVICE_NAME);
#else
	#ifdef CONFIG_DEVFS_FS
		dev_major = devfs_register_chrdev(CONFIG_RSBAC_DAZ_DEV_MAJOR, DEVICE_NAME, &fops);
		devfs_register(NULL, DEVICE_NAME, DEVFS_FL_DEFAULT,
			dev_major, 0, S_IFCHR | S_IRUSR | S_IWUSR,
			&fops, NULL);
	#else
		dev_major = register_chrdev(CONFIG_RSBAC_DAZ_DEV_MAJOR, DEVICE_NAME, &fops);
	#endif
#endif
	if (dev_major < 0)
	{
		xp_print("dazuko: unable to register device chrdev, err=%d\n", dev_major);
		return dev_major;
	}

	/* initialization complete */

	return 0;
}
开发者ID:eqmcc,项目名称:dazuko,代码行数:29,代码来源:dazuko_rsbac.c


示例13: wps_led_init

static int __init
wps_led_init(void)
{
#ifndef CONFIG_DEVFS_FS
    int ret_val;
    /*
    * Register the character device (atleast try)
    */
    ret_val = register_chrdev(WPS_LED_MAJOR_NUM, "wps_led", &wps_led_fops);
    /*
    * Negative values signify an error
    */
    if (ret_val < 0) 
    {
        printf("%s failed with %d\n","Sorry, registering the character device wps_led", ret_val);
        return ret_val;
    } 
#else /* CONFIG_DEVFS_FS */
    if ((wps_led_major = devfs_register_chrdev(WPS_LED_MAJOR_NUM, "wps_led", &wps_led_fops)) < 0)
        return wps_led_major;

    wps_leddev_handle = devfs_register(NULL, "wps_led", DEVFS_FL_DEFAULT,
                                    wps_led_major, 0, S_IFCHR | S_IRUGO | S_IWUGO,
                                    &wps_led_fops, NULL);
#endif /* CONFIG_DEVFS_FS */
    return 0;
}
开发者ID:jeremyd2019,项目名称:r6300v2,代码行数:27,代码来源:wps_led.c


示例14: gpio_init

static int __init
gpio_init(void)
{
	if (!(gpio_sih = si_kattach(SI_OSH)))
		return -ENODEV;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	if ((gpio_major = register_chrdev(0, "gpio", &gpio_fops)) < 0)
#else
	if ((gpio_major = devfs_register_chrdev(0, "gpio", &gpio_fops)) < 0)
#endif
		return gpio_major;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
	gpiodev_class = class_create(THIS_MODULE, "gpio");
	if (IS_ERR(gpiodev_class)) {
		printk("Error creating gpio class\n");
		return -1;
	}

	/* Add the device gpio0 */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)
	device_create(gpiodev_class, NULL, MKDEV(gpio_major, 0), NULL, "gpio", 0);
#else
	class_device_create(gpiodev_class, NULL, MKDEV(gpio_major, 0), NULL, "gpio");
#endif /* linux-2.6.36 */
#else
	gpiodev_handle = devfs_register(NULL, "gpio", DEVFS_FL_DEFAULT,
	                                gpio_major, 0, S_IFCHR | S_IRUGO | S_IWUGO,
	                                &gpio_fops, NULL);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) */

	return 0;
}
开发者ID:Antares84,项目名称:asuswrt-merlin,代码行数:33,代码来源:linux_gpio.c


示例15: aviaEXT_init

static int __init aviaEXT_init(void)
{
	if (!(devfs_h = devfs_register(NULL,"dbox/aviaEXT", DEVFS_FL_DEFAULT, 0, 0, 
					S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, &aviaEXT_fops, NULL))){
		printk(KERN_ERR "aviaEXT: could not register with devfs.\n");
		return -EIO;
	}
	return 0;
}
开发者ID:UkCvs,项目名称:commando,代码行数:9,代码来源:aviaEXT.c


示例16: mtd_notify_add

static void mtd_notify_add(struct mtd_info* mtd)
{
	char name[8];

	if (!mtd)
		return;

	sprintf(name, "%d", mtd->index);
	devfs_rw_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
			DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2,
			S_IFCHR | S_IRUGO | S_IWUGO,
			&mtd_fops, NULL);

	sprintf(name, "%dro", mtd->index);
	devfs_ro_handle[mtd->index] = devfs_register(devfs_dir_handle, name,
			DEVFS_FL_DEFAULT, MTD_CHAR_MAJOR, mtd->index*2+1,
			S_IFCHR | S_IRUGO,
			&mtd_fops, NULL);
}
开发者ID:jameshilliard,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:19,代码来源:mtdchar.c


示例17: aud_init_module

/* Initialize the module - Register the character device */
int aud_init_module()
{
    int ret_val;
    int *ver;
    struct aud_ucode_info **uc_ptr;
    devfs_handle_t devfs_handle;
    int i;

    /* Register the character device (atleast try) */
    ret_val = devfs_register_chrdev(MAJOR_NUM_ADEC, DEVICE_NAME_ADEC, &Fops);
    /* Negative values signify an error */
    if (ret_val < 0)
    {
        PDEBUG("AUD: %s failed with %d\n",
               "Sorry, registering the character device ", ret_val);
        return ret_val;
    }

    for(i=0; i < no_devnodes; i++)
    {
      devfs_handle = devfs_find_handle(NULL, devnodes[i].name,
                                0, 0, DEVFS_SPECIAL_CHR,0);
    
      if(devfs_handle == NULL)
      {
        devfs_handle = devfs_register(NULL, devnodes[i].name, DEVFS_FL_DEFAULT,
                                      MAJOR_NUM_ADEC, devnodes[i].minor,
                                      S_IFCHR | S_IRUSR | S_IWUSR,
                                      devnodes[i].fops, NULL);
        devnodes[i].devfs_handle = devfs_handle;
      }
      else
      {
        devnodes[i].devfs_handle = NULL;
      }
    }
    

    /* print version numbers for audio microcode */
    for (uc_ptr = aud_ucode_info; *uc_ptr != NULL; uc_ptr++) {
      if (((*uc_ptr)->ucode[248] != 0) || ((*uc_ptr)->ucode[249] != 0)) {
	ver = (int *)(&(*uc_ptr)->ucode[248]);
	printk(KERN_NOTICE "audio microcode %s **test version** built on %d/%d/%d\n", 
	       (*uc_ptr)->name, (*ver%10000)/100, *ver%100, *ver/10000);
      } else {
	printk(KERN_NOTICE "audio microcode %s ver %d.%d\n", (*uc_ptr)->name,
	       (*uc_ptr)->ucode[250], (*uc_ptr)->ucode[251]);
      }
    }

    //DEMUX_REG_AVCB(&aud_callback, 1, 1);
    PDEBUG("AUD: Initialize adec_dev OK!\n");
    return 0;
}
开发者ID:thefkboss,项目名称:dm500-satip,代码行数:55,代码来源:aud_inf.c


示例18: mulle_nor_init

int mulle_nor_init(void)
{
    int res = mtd_init(mtd0);

    if (res >= 0) {
        /* Register DevFS node */
        devfs_register(&mulle_nor_devfs);
    }

    return res;
}
开发者ID:antoinefaure,项目名称:RIOT,代码行数:11,代码来源:board.c


示例19: snd_info_create_module_entry

snd_info_entry_t *snd_info_create_device(const char *name, unsigned int number, unsigned int mode)
{
#ifdef CONFIG_DEVFS_FS
	char dname[32];
#endif
	unsigned short major = number >> 16;
	unsigned short minor = (unsigned short) number;
	snd_info_entry_t *entry;
	struct proc_dir_entry *p = NULL;

	if (!major)
		major = snd_major;
	if (!mode)
		mode = S_IFCHR | S_IRUGO | S_IWUGO;
	mode &= (snd_device_mode & (S_IRUGO | S_IWUGO)) | S_IFCHR | S_IFBLK;
	entry = snd_info_create_module_entry(THIS_MODULE, name, NULL);
	if (entry == NULL)
		return NULL;
	entry->content = SNDRV_INFO_CONTENT_DEVICE;
	entry->mode = mode;
	entry->c.device.major = major;
	entry->c.device.minor = minor;
	down(&info_mutex);
	p = create_proc_entry(entry->name, entry->mode, snd_proc_dev);
	if (p) {
#ifndef TARGET_OS2
		snd_info_device_entry_prepare(p, entry);
#ifdef LINUX_2_3
		p->proc_fops = &snd_fops;
#else
		p->ops = &snd_info_device_inode_operations;
#endif
#endif
	} else {
		up(&info_mutex);
		snd_info_free_entry(entry);
		return NULL;
	}
	p->gid = snd_device_gid;
	p->uid = snd_device_uid;
	p->data = (void *) entry;
	entry->p = p;
	up(&info_mutex);
#ifdef CONFIG_DEVFS_FS
	if (strncmp(name, "controlC", 8)) {	/* created in sound.c */
		sprintf(dname, "snd/%s", name);
		devfs_register(NULL, dname, DEVFS_FL_DEFAULT,
				major, minor, mode,
				&snd_fops, NULL);
	}
#endif
	return entry;
}
开发者ID:OS2World,项目名称:DRV-UNIAUD,代码行数:53,代码来源:info.c


示例20: h3600_backpaq_fpga_init_module

int __init h3600_backpaq_fpga_init_module(void)    
{    
	int result;    
	printk(KERN_ALERT __FILE__ ": registering char device");    

	/* Register my device driver */
	result = devfs_register_chrdev(0,MODULE_NAME, &h3600_backpaq_fpga_fops);    
	if ( result <= 0 ) {
		printk(" can't get major number\n");
		return result;    
	}    
	if ( h3600_backpaq_fpga_major_num == 0 )
		h3600_backpaq_fpga_major_num = result;
	printk(" %d\n", h3600_backpaq_fpga_major_num);

	/* Clear the default structure */
 	memset(&h3600_backpaq_fpga_data, 0, sizeof(struct h3600_backpaq_fpga_dev_struct));

	/* Create a devfs entry */
#ifdef CONFIG_DEVFS_FS
	devfs_fpga = devfs_register( NULL, FPGA_DEVICE_NAME, DEVFS_FL_DEFAULT,
				       h3600_backpaq_fpga_major_num, FPGA_MINOR,
				       S_IFCHR | S_IRUSR | S_IWUSR, 
				       &h3600_backpaq_fpga_fops, NULL );
#endif

#ifdef CONFIG_PROC_FS
	/* Set up the PROC file system entry */
	proc_backpaq_fpga = create_proc_entry(FPGA_PROC_NAME, 0, NULL);
	if ( !proc_backpaq_fpga ) {
		/* We probably need to create the "backpaq" directory first */
		proc_mkdir(FPGA_PROC_DIR,0);
		proc_backpaq_fpga = create_proc_entry(FPGA_PROC_NAME, 0, NULL);
	}
	
	if ( proc_backpaq_fpga )
		proc_backpaq_fpga->read_proc = proc_h3600_backpaq_read;    
	else {
		printk(KERN_ALERT __FILE__ ": unable to create proc entry %s\n", FPGA_PROC_NAME);
		devfs_unregister( devfs_fpga );
		devfs_unregister_chrdev( h3600_backpaq_fpga_major_num, MODULE_NAME );
		return -ENODEV;
	}
#endif

#ifdef CONFIG_PM
	fpga_backpaq_dev = h3600_backpaq_register_device( H3600_BACKPAQ_FPGA_DEV, 0, 
							  h3600_backpaq_fpga_callback );
	printk(KERN_ALERT __FILE__ ": registered backpaq callback=%p\n", h3600_backpaq_fpga_callback);
#endif

	return 0;    
} 
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:53,代码来源:h3600_backpaq_fpga.c



注:本文中的devfs_register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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