Exemplo n.º 1
0
static int acc_probe(void)
{

	int err;

	ACC_LOG("+++++++++++++accel_probe!!\n");

	acc_context_obj = acc_context_alloc_object();
	if (!acc_context_obj) {
		err = -ENOMEM;
		ACC_ERR("unable to allocate devobj!\n");
		goto exit_alloc_data_failed;
	}
	/* init real acceleration driver */
	err = acc_real_driver_init();
	if (err) {
		ACC_ERR("acc real driver init fail\n");
		goto real_driver_init_fail;
	}
	/* init acc common factory mode misc device */
	err = acc_factory_device_init();
	if (err)
		ACC_ERR("acc factory device already registed\n");
	/* init input dev */
	err = acc_input_init(acc_context_obj);
	if (err) {
		ACC_ERR("unable to register acc input device!\n");
		goto exit_alloc_input_dev_failed;
	}

	ACC_LOG("----accel_probe OK !!\n");
	return 0;


 real_driver_init_fail:
 exit_alloc_input_dev_failed:
	kfree(acc_context_obj);

 exit_alloc_data_failed:


	ACC_ERR("----accel_probe fail !!!\n");
	return err;
}
Exemplo n.º 2
0
static int acc_probe(struct platform_device *pdev) 
{

	int err;
	ACC_LOG("+++++++++++++accel_probe!!\n");

	acc_context_obj = acc_context_alloc_object();
	if (!acc_context_obj)
	{
		err = -ENOMEM;
		ACC_ERR("unable to allocate devobj!\n");
		goto exit_alloc_data_failed;
	}

	//init real acceleration driver
    err = acc_real_driver_init();
	if(err)
	{
		ACC_ERR("acc real driver init fail\n");
		goto real_driver_init_fail;
	}

	//init acc common factory mode misc device
	err = acc_factory_device_init();
	if(err)
	{
		ACC_ERR("acc factory device already registed\n");
	}
	//init input dev
	err = acc_input_init(acc_context_obj);
	if(err)
	{
		ACC_ERR("unable to register acc input device!\n");
		goto exit_alloc_input_dev_failed;
	}

#if defined(CONFIG_HAS_EARLYSUSPEND)
    atomic_set(&(acc_context_obj->early_suspend), 0);
	acc_context_obj->early_drv.level    = EARLY_SUSPEND_LEVEL_STOP_DRAWING - 1,
	acc_context_obj->early_drv.suspend  = acc_early_suspend,
	acc_context_obj->early_drv.resume   = acc_late_resume,    
	register_early_suspend(&acc_context_obj->early_drv);
#endif

  
	ACC_LOG("----accel_probe OK !!\n");
	return 0;

	//exit_hwmsen_create_attr_failed:
	//exit_misc_register_failed:    

	//exit_err_sysfs:
	
	if (err)
	{
	   ACC_ERR("sysfs node creation error \n");
	   acc_input_destroy(acc_context_obj);
	}
	
	real_driver_init_fail:
	exit_alloc_input_dev_failed:    
	kfree(acc_context_obj);
	
	exit_alloc_data_failed:
	

	ACC_LOG("----accel_probe fail !!!\n");
	return err;
}