static int __init mhl_pf_switch_init(void) { int rc = 0; pr_info("%s:\n", __func__); mhl_info = NULL; isDiscoveryCalled = false; notify_usb_online = NULL; device_discovery_cb = NULL; context_cb = NULL; mhl_info = kzalloc(sizeof(*mhl_info), GFP_KERNEL); if (!mhl_info) { pr_err("%s: FAILED: cannot alloc platform_switch\n", __func__); rc = -ENOMEM; goto failed_probe; } mhl_info->notify = mhl_pf_switch_device_discovery; if (msm_register_usb_ext_notification(mhl_info) != 0) { pr_err("%s: register for usb notifcn failed\n", __func__); rc = -EPROBE_DEFER; goto failed_probe; } return 0; failed_probe: mhl_pf_swtich_resource_free(); return rc; }
static int mhl_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { int rc = 0; pr_debug("%s:\n", __func__); mhl_info = NULL; isDiscoveryCalled = false; notify_usb_online = NULL; device_discovery_cb = NULL; context_cb = NULL; mhl_i2c_client = client; mhl_info = kzalloc(sizeof(*mhl_info), GFP_KERNEL); if (!mhl_info) { pr_err("%s: FAILED: cannot alloc platform_switch\n", __func__); rc = -ENOMEM; goto failed_probe; } if (client->dev.of_node) { rc = mhl_tx_get_dt_data(&client->dev); if (rc) { pr_err("%s:device tree error\n", __func__); goto failed_probe; } rc = mhl_pf_gpio_config_init(); if (rc) { pr_err("%s:device tree error\n", __func__); goto failed_probe; } } else pr_err("%s: dev.of_node is null\n", __func__); mhl_info->notify = mhl_pf_switch_device_discovery; if (msm_register_usb_ext_notification(mhl_info) != 0) { pr_err("%s: register for usb notifcn failed\n", __func__); rc = -EPROBE_DEFER; goto failed_probe; } return 0; failed_probe: mhl_pf_swtich_resource_free(); return rc; }
static int mhl_i2c_remove(struct i2c_client *client) { pr_debug("%s:\n", __func__); /* * All gpio will be released. All release needing gpio * must be released before this API call */ mhl_pf_gpio_config_release(); mhl_pf_swtich_resource_free(); return 0; }
static void __exit mhl_pf_switch_exit(void) { pr_info("%s:\n", __func__); mhl_pf_swtich_resource_free(); }