Exemplo n.º 1
0
static int __init init_mtdchar(void)
{
    if (register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops)) {
        printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
               MTD_CHAR_MAJOR);
        return -EAGAIN;
    }

    mtd_class = class_create(THIS_MODULE, "mtd");

    if (IS_ERR(mtd_class)) {
        printk(KERN_ERR "Error creating mtd class.\n");
        unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
        return PTR_ERR(mtd_class);
    }

    /* Allocate write buffer. */
    down(&write_kbuf_sem);
    write_kbuf = kmalloc(WRITE_KBUF_SIZE, GFP_KERNEL);
    if (write_kbuf == NULL) {
        up(&write_kbuf_sem);
        class_destroy(mtd_class);
        unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
        return -ENOMEM;
    }
    up(&write_kbuf_sem);

    register_mtd_user(&notifier);
    return 0;
}
/* Init function called during kernel startup */
int __init ckblock_reader_init(void)
{
	register_mtd_user(&mtd_ckblock_notifier);
	memset(&drv_ctx, 0, sizeof(drv_ctx));
	printk(KERN_INFO "####### CK Data block reader initialized (bind=%s)\n",
	       CONFIG_BRCM_CKBLOCK_NAME);
	return 0;
}
Exemplo n.º 3
0
static void add_mtd_concat_notifier(void)
{
	static struct mtd_notifier not = {
		.add = mtd_concat_add,
		.remove = mtd_concat_remove,
	};

	register_mtd_user(&not);
}
static void __init da850evm_init_spi1(struct spi_board_info *info, unsigned len)
{
	int ret;

	ret = spi_register_board_info(info, len);
	if (ret)
		pr_warning("failed to register board info : %d\n", ret);

	ret = da8xx_register_spi(1, &da850evm_spi1_pdata);
	if (ret)
		pr_warning("failed to register spi 1 device : %d\n", ret);

	if (!(system_rev & 0x100))
		register_mtd_user(&spi_notifier);
}
Exemplo n.º 5
0
static int __init init_nve(void)
{
	struct NVE_struct *nve = NULL;
	int error;

	printk("[NVE] init_nve in123.\n");
	my_nve = nve = kzalloc(sizeof(struct NVE_struct), GFP_KERNEL);
	if (nve == NULL) {
		printk("[NVE] failed to allocate driver data.\n");
		return -ENOMEM;
	}
	memset (nve, 0x0, sizeof(struct NVE_struct));
	
	nve->nve_ramdisk= (u_char *)kzalloc(NVE_PARTITION_SIZE, GFP_KERNEL);
	if (nve->nve_ramdisk == NULL) {
		printk("[NVE] failed to allocate ramdisk buffer.\n");
		error = -ENOMEM;
		goto failed_free_driver_data;
	}

	nve->nve_major_number = register_chrdev(0, "nve", &nve_fops);
	if (nve->nve_major_number < 0) {
		printk(KERN_NOTICE "Can't allocate major number for Non-Volatile memory Extension device.\n");
		error = -EAGAIN;
		goto failed_free_ramdisk;
	}

	nve_class = class_create(THIS_MODULE, "nve");

	if (IS_ERR(nve_class)) {
		printk(KERN_ERR "Error creating nve class.\n");
		unregister_chrdev(nve->nve_major_number, "nve");
		error = PTR_ERR(nve_class);
		goto failed_free_ramdisk;
	}

	register_mtd_user(&nve_notifier);
	printk(KERN_NOTICE "init_nve nve_major_number = 0x%x.\n", nve->nve_major_number);
	return 0;
	
failed_free_ramdisk:
	kfree(nve->nve_ramdisk);
	nve->nve_ramdisk = NULL;
failed_free_driver_data:
	kfree(nve);
	my_nve = NULL;
	return error;
}
Exemplo n.º 6
0
static int __init init_mtdchar(void)
{
	if (register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops)) {
		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
		       MTD_CHAR_MAJOR);
		return -EAGAIN;
	}

	mtd_class = class_create(THIS_MODULE, "mtd");

	if (IS_ERR(mtd_class)) {
		printk(KERN_ERR "Error creating mtd class.\n");
		unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
		return PTR_ERR(mtd_class);
	}

	register_mtd_user(&notifier);
	return 0;
}
Exemplo n.º 7
0
static int __init mtdoops_init(void)
{
	struct mtdoops_context *cxt = &oops_cxt;
	int mtd_index;
	char *endp;

	if (strlen(mtddev) == 0) {
		printk(KERN_ERR "mtdoops: mtd device (mtddev=name/number) must be supplied\n");
		return -EINVAL;
	}
	if ((record_size & 4095) != 0) {
		printk(KERN_ERR "mtdoops: record_size must be a multiple of 4096\n");
		return -EINVAL;
	}
	if (record_size < 4096) {
		printk(KERN_ERR "mtdoops: record_size must be over 4096 bytes\n");
		return -EINVAL;
	}

	/* Setup the MTD device to use */
	cxt->mtd_index = -1;
	mtd_index = simple_strtoul(mtddev, &endp, 0);
	if (*endp == '\0')
		cxt->mtd_index = mtd_index;
	if (cxt->mtd_index > MAX_MTD_DEVICES) {
		printk(KERN_ERR "mtdoops: invalid mtd device number (%u) given\n",
				mtd_index);
		return -EINVAL;
	}

	cxt->oops_buf = vmalloc(record_size);
	if (!cxt->oops_buf) {
		printk(KERN_ERR "mtdoops: failed to allocate buffer workspace\n");
		return -ENOMEM;
	}
	memset(cxt->oops_buf, 0xff, record_size);

	INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase);
	INIT_WORK(&cxt->work_write, mtdoops_workfunc_write);

	register_mtd_user(&mtdoops_notifier);
	return 0;
}
Exemplo n.º 8
0
static int __init mtdoops_console_init(void)
{
    struct mtdoops_context *cxt = &oops_cxt;

    cxt->mtd_index = -1;
    cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE);

    if (!cxt->oops_buf) {
        printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n");
        return -ENOMEM;
    }

    INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase);
    INIT_WORK(&cxt->work_write, mtdoops_workfunc_write);

    register_console(&mtdoops_console);
    register_mtd_user(&mtdoops_notifier);
    return 0;
}
static int __init init_mtdchar(void)
{
#ifdef CONFIG_DEVFS_FS
	if (devfs_register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops))
	{
		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
		       MTD_CHAR_MAJOR);
		return -EAGAIN;
	}

	devfs_dir_handle = devfs_mk_dir(NULL, "mtd", NULL);

	register_mtd_user(&notifier);
#else
	if (register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops))
	{
		printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
		       MTD_CHAR_MAJOR);
		return -EAGAIN;
	}
#endif

	return 0;
}
Exemplo n.º 10
0
static void da850_evm_setup_mac_addr(void)
{
	register_mtd_user(&da850evm_spi_notifier);
}
Exemplo n.º 11
0
int __init init_mtdblock(void)
{
	register_mtd_user(&mtdblock_notify);

	return VMM_OK;
}
Exemplo n.º 12
0
static inline void mtdchar_devfs_init(void)
{
	devfs_mk_dir("mtd");
	register_mtd_user(&notifier);
}
Exemplo n.º 13
0
static void __init trxsplit_scan(void)
{
	register_mtd_user(&trxsplit_notifier);
	unregister_mtd_user(&trxsplit_notifier);
}