static int amhdmitx_probe(struct platform_device *pdev) { int r; HDMI_DEBUG(); pr_dbg("amhdmitx_probe\n"); r = alloc_chrdev_region(&hdmitx_id, 0, HDMI_TX_COUNT, DEVICE_NAME); if (r < 0) { pr_error("Can't register major for amhdmitx device\n"); return r; } hdmitx_class = class_create(THIS_MODULE, DEVICE_NAME); if (IS_ERR(hdmitx_class)) { unregister_chrdev_region(hdmitx_id, HDMI_TX_COUNT); return -1; //return PTR_ERR(aoe_class); } hdmitx_device.unplug_powerdown=0; hdmitx_device.vic_count=0; hdmitx_device.auth_process_timer=0; hdmitx_device.force_audio_flag=0; if(init_flag&INIT_FLAG_CEC_FUNC){ hdmitx_device.cec_func_flag = 1; } else{ hdmitx_device.cec_func_flag = 0; } if((init_flag&INIT_FLAG_POWERDOWN)&&(hpdmode==2)){ hdmitx_device.mux_hpd_if_pin_high_flag=0; } else{ hdmitx_device.mux_hpd_if_pin_high_flag=1; } hdmitx_device.audio_param_update_flag=0; cdev_init(&(hdmitx_device.cdev), &amhdmitx_fops); hdmitx_device.cdev.owner = THIS_MODULE; cdev_add(&(hdmitx_device.cdev), hdmitx_id, HDMI_TX_COUNT); //hdmitx_dev = device_create(hdmitx_class, NULL, hdmitx_id, "amhdmitx%d", 0); hdmitx_dev = device_create(hdmitx_class, NULL, hdmitx_id, NULL, "amhdmitx%d", 0); //kernel>=2.6.27 device_create_file(hdmitx_dev, &dev_attr_disp_mode); device_create_file(hdmitx_dev, &dev_attr_aud_mode); device_create_file(hdmitx_dev, &dev_attr_edid); device_create_file(hdmitx_dev, &dev_attr_config); device_create_file(hdmitx_dev, &dev_attr_debug); device_create_file(hdmitx_dev, &dev_attr_disp_cap); device_create_file(hdmitx_dev, &dev_attr_log); device_create_file(hdmitx_dev, &dev_attr_cec); if (hdmitx_dev == NULL) { pr_error("device_create create error\n"); class_destroy(hdmitx_class); r = -EEXIST; return r; } vout_register_client(&hdmitx_notifier_nb_v); #ifdef CONFIG_AM_TV_OUTPUT2 vout2_register_client(&hdmitx_notifier_nb_v2); #endif #ifndef DISABLE_AUDIO aout_register_client(&hdmitx_notifier_nb_a); #endif hdmitx_device.task = kthread_run(hdmi_task_handle, &hdmitx_device, "kthread_hdmi"); switch_dev_register(&sdev); if (r < 0){ printk(KERN_ERR "hdmitx: register switch dev failed\n"); return r; } return r; }