void vf_ppmgr_init_receiver(void) { vf_receiver_init(&ppmgr_vf_recv, RECEIVER_NAME, &ppmgr_vf_receiver, NULL); }
static int d2d3_probe(struct platform_device *pdev) { int ret = 0; struct d2d3_dev_s *devp; struct resource *res; /* kmalloc d2d3 dev */ devp = kmalloc(sizeof(struct d2d3_dev_s), GFP_KERNEL); if (!devp) { printk("[d2d3]%s: failed to allocate memory for d2d3 device.\n",__func__); ret = -ENOMEM; goto failed_kmalloc_devp; } memset(devp,0,sizeof(d2d3_dev_t)); d2d3_devp = devp; //spin_lock_init(&d2d3_devp->buf_lock); d2d3_devp->flag = D2D3_BYPASS; /*disable hw&path*/ d2d3_enable_hw(false); d2d3_enable_path(false,&d2d3_devp->param); /*create cdev and register with sysfs*/ ret = d2d3_add_cdev(&devp->cdev, &d2d3_fops,0); if (ret) { printk("[d2d3]%s: failed to add device.\n",__func__); /* @todo do with error */ goto failed_add_cdev; } /*create the udev node /dev/...*/ devp->dev = d2d3_create_device(&pdev->dev,0); if (devp->dev == NULL) { printk("[d2d3]%s: device_create create error.\n",__func__); ret = -EEXIST; goto failed_create_device; } ret = device_create_file(devp->dev, &dev_attr_debug); if(ret < 0){ printk(KERN_ERR "[d2d3]%s: failed create device attr file.\n",__func__); goto failed_create_device_file; } #ifdef CONFIG_USE_OF res = &memobj; ret = find_reserve_block(pdev->dev.of_node->name,0); if(ret < 0){ pr_err("\nd2d3 memory resource undefined.\n"); return -EFAULT; } printk("[d2d3]%s: hhhhhhhhhhhhhh[%d].\n",__func__,__LINE__); res->start = (phys_addr_t)get_reserve_block_addr(ret); res->end = res->start+ (phys_addr_t)get_reserve_block_size(ret)-1; #else /* get device memory */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { pr_err("[d2d3]%s: can't get memory resource.\n",__func__); ret = -EFAULT; goto failed_get_resource; } #endif devp->mem_start = res->start; devp->mem_size = res->end - res->start + 1; printk("[d2d3]%s: mem_start = 0x%x, mem_size = 0x%x.\n",__func__, devp->mem_start,devp->mem_size); #ifdef CONFIG_USE_OF if (pdev->dev.of_node) { ret = of_property_read_u32(pdev->dev.of_node,"irq",&(res->start)); if(ret) { pr_err("don't find d2d3 match irq\n"); goto failed_get_resource; } res->end = res->start; res->flags = IORESOURCE_IRQ; } #else /*get d2d3's irq*/ res = platform_get_resource(pdev,IORESOURCE_MEM,0); if (!res) { pr_err("[d2d3]%s: can't get irq resource.\n",__func__); ret = -EFAULT; goto failed_get_resource; } #endif devp->irq = res->start; sprintf(devp->vfm_name,"%s",VFM_NAME); platform_set_drvdata(pdev,(void *)devp); dev_set_drvdata(devp->dev,(void *)devp); vf_receiver_init(&d2d3_vf_recv, devp->vfm_name, &d2d3_vf_receiver, NULL); vf_reg_receiver(&d2d3_vf_recv); vf_provider_init(&d2d3_vf_prov, devp->vfm_name, &d2d3_vf_provider, NULL); return ret; failed_get_resource: device_remove_file(&pdev->dev,&dev_attr_debug); failed_create_device_file: device_del(&pdev->dev); failed_create_device: cdev_del(&devp->cdev); failed_add_cdev: kfree(devp); failed_kmalloc_devp: return ret; }