static int __devexit seport_platform_remove(struct platform_device *pdev) { struct seport_config *cfg; if (!pdev) return -1; cfg = pdev->dev.platform_data; if (seport_plug_detect_interrupt_enabled) seport_platform_unregister_plug_detect_gpio_callback(NULL); if (seport_button_detect_interrupt_enabled) seport_platform_unregister_button_gpio_callback(); gpio_free(cfg->headset_detect_enable_pin); gpio_free(cfg->plug_detect_read_pin); gpio_free(cfg->button_detect_pin); gpio_free(cfg->rid_ping_enable_pin); #if defined(CONFIG_SEPORT_VIDEO_OUT) gpio_free(cfg->video_out_switch); #endif oem_rapi_client_close(); /* Deregistering ADIE services. */ seport_platform_register_mic_bias_client(0); return 0; }
int setup_platform(struct power_ops *platform_ops, event_callback_t fn) { int ret = 0; printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Setting up platform\n"); if (platform_ops == NULL) { ret = -EINVAL; goto setup_exit; } rpc_client = oem_rapi_client_init(); if (rpc_client == NULL) { printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Failed initialize oem rapi client\n"); ret = -EPERM; goto setup_exit; } event_fn = fn; platform_ops->set_ovp = msm_set_ovp; platform_ops->get_battery_voltage = msm_get_battery_voltage; platform_ops->get_battery_current = msm_get_battery_current; platform_ops->get_battery_thermistor = msm_get_battery_id; platform_ops->sync_platform = msm_sync_platform; platform_ops->notify_platform = msm_notify_platform; platform_ops->platform_callbacks = msm_platform_callbacks; platform_ops->notify_platform_boot_charging_info = msm_notify_platform_boot_charging_info; ret = platform_driver_register(&semc_power_platform_driver); if (ret) { printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Failed register platform driver\n"); goto setup_exit_close_client; } msm_chg_rpc_register_semc_callback(msm_set_usb_connected); setup_exit: return ret; setup_exit_close_client: oem_rapi_client_close(); return ret; }
static int __exit bdata_remove(struct platform_device *pdev) { struct data_info *di = platform_get_drvdata(pdev); pr_info("%s: remove\n", SEMC_BDATA_NAME); clear_platform_callbacks(di); oem_rapi_client_close(); #ifdef DEBUG_FS semc_battery_remove_attrs(di->bdata_ps.dev); #endif power_supply_unregister(&di->bdata_ps); kfree(di); return 0; }
static char* lis3df_rpc(AccelerometerAxisOffset* offset, uint32_t event) { struct msm_rpc_client* mrc; struct oem_rapi_client_streaming_func_arg arg; struct oem_rapi_client_streaming_func_ret ret; int out_len; char* input = kzalloc(Buff_Size, GFP_KERNEL); char* output = kzalloc(Buff_Size, GFP_KERNEL); switch(event){ case OEM_RAPI_CLIENT_EVENT_ACCELEROMETER_AXIS_OFFSET_SET: snprintf(input, Buff_Size, "%hd %hd %hd", offset->X, offset->Y, offset->Z); case OEM_RAPI_CLIENT_EVENT_ACCELEROMETER_AXIS_OFFSET_GET: arg.event = event; break; default: kfree(input); kfree(output); return NULL; } arg.cb_func = NULL; arg.handle = (void *)0; arg.in_len = strlen(input) + 1; arg.input = input; arg.output_valid = 1; arg.out_len_valid = 1; arg.output_size = Buff_Size; ret.output = output; ret.out_len = &out_len; mrc = oem_rapi_client_init(); oem_rapi_client_streaming_function(mrc, &arg, &ret); oem_rapi_client_close(); #if debug pr_info("LIS3DF: %s, AXIS %s .. %s\n", __func__, (event == OEM_RAPI_CLIENT_EVENT_ACCELEROMETER_AXIS_OFFSET_GET) ? "GET" : "SET", ret.output); #endif kfree(input); return ret.output; }
static int __devexit tricolor_led_remove(struct platform_device *pdev) { struct tricolor_led_data *tricolor_led; int i; printk(KERN_ERR "tricolor_led_remove: remove\n"); tricolor_led = platform_get_drvdata(pdev); for (i = 0; i < 4; i++) { device_remove_file(tricolor_led->leds[i].dev, &dev_attr_blink); led_classdev_unregister(&tricolor_led->leds[i]); } /* close tricolor_led->rpc_client */ oem_rapi_client_close(); tricolor_led->rpc_client = NULL; kfree(tricolor_led); return 0; }
int teardown_platform(void) { int ret = 0; printk(KERN_INFO SEMC_POWER_PLATFORM_NAME ": Closing down platform\n"); if (work_pending(&cutoff_level_work)) cancel_work_sync(&cutoff_level_work); if (work_pending(&bdata_change_work)) cancel_work_sync(&bdata_change_work); msm_platform_callbacks(0); oem_rapi_client_close(); rpc_client = NULL; msm_chg_rpc_unregister_semc_callback(); platform_driver_unregister(&semc_power_platform_driver); return ret; }
static int debug_release(struct inode *ip, struct file *fp) { return oem_rapi_client_close(); }
static void __exit lg_fw_helper_exit(void) { oem_rapi_client_close(); }
static void __exit msm_rpc_client_exit(void) { oem_rapi_client_close(); misc_deregister(&misc_rpc_client); }
static int tricolor_led_probe(struct platform_device *pdev) { int ret = 0; int i, j; struct tricolor_led_data *tricolor_led; printk(KERN_ERR "tricolor leds and flashlight: probe init \n"); tricolor_led = kzalloc(sizeof(struct tricolor_led_data), GFP_KERNEL); if (tricolor_led == NULL) { printk(KERN_ERR "tricolor_led_probe: no memory for device\n"); ret = -ENOMEM; goto err; } memset(tricolor_led, 0, sizeof(struct tricolor_led_data)); spin_lock_init(&tricolor_led->led_lock); /* initialize tricolor_led->pc_client */ tricolor_led->rpc_client = oem_rapi_client_init(); ret = IS_ERR(tricolor_led->rpc_client); if (ret) { printk(KERN_ERR "[tricolor-led] cannot initialize rpc_client!\n"); tricolor_led->rpc_client = NULL; goto err_init_rpc_client; } tricolor_led->leds[0].name = "red"; tricolor_led->leds[0].brightness_set = led_brightness_set_tricolor; tricolor_led->leds[1].name = "green"; tricolor_led->leds[1].brightness_set = led_brightness_set_tricolor; tricolor_led->leds[2].name = "blue"; tricolor_led->leds[2].brightness_set = led_brightness_set_tricolor; tricolor_led->leds[3].name = "flashlight"; tricolor_led->leds[3].brightness_set = led_brightness_set_flash; for (i = 0; i < 4; i++) { /* red, green, blue, flashlight */ ret = led_classdev_register(&pdev->dev, &tricolor_led->leds[i]); if (ret) { printk(KERN_ERR "tricolor_led: led_classdev_register failed\n"); goto err_led_classdev_register_failed; } } for (i = 0; i < 4; i++) { ret = device_create_file(tricolor_led->leds[i].dev, &dev_attr_blink); if (ret) { printk(KERN_ERR "tricolor_led: device_create_file failed\n"); goto err_out_attr_blink; } } dev_set_drvdata(&pdev->dev, tricolor_led); return 0; err_out_attr_blink: for (j = 0; j < i; j++) device_remove_file(tricolor_led->leds[j].dev, &dev_attr_blink); i = 4; err_led_classdev_register_failed: for (j = 0; j < i; j++) led_classdev_unregister(&tricolor_led->leds[j]); err_init_rpc_client: /* If above errors occurred, close pdata->rpc_client */ if (tricolor_led->rpc_client) { oem_rapi_client_close(); printk(KERN_ERR "tri-color-led: oem_rapi_client_close\n"); } kfree(tricolor_led); err: return ret; }