int diag_hsic_init() { int i; int err = 0; struct diag_hsic_info *ch = NULL; char wq_name[DIAG_HSIC_NAME_SZ + DIAG_HSIC_STRING_SZ]; for (i = 0; i < NUM_HSIC_DEV; i++) { ch = &diag_hsic[i]; spin_lock_init(&ch->lock); INIT_WORK(&(ch->read_work), hsic_read_work_fn); INIT_WORK(&(ch->open_work), hsic_open_work_fn); INIT_WORK(&(ch->close_work), hsic_close_work_fn); strlcpy(wq_name, "DIAG_HSIC_", DIAG_HSIC_STRING_SZ); strlcat(wq_name, ch->name, sizeof(ch->name)); ch->hsic_wq = create_singlethread_workqueue(wq_name); if (!ch->hsic_wq) goto fail; err = diagfwd_bridge_register(ch->dev_id, ch->id, &diag_hsic_fwd_ops); if (err) { pr_err("diag: Unable to register HSIC channel %d with bridge, err: %d\n", i, err); goto fail; } } err = platform_driver_register(&msm_hsic_ch_driver); if (err) { pr_err("diag: could not register HSIC device, err: %d\n", err); goto fail; } return 0; fail: diag_hsic_exit(); return -ENOMEM; }
int diag_smux_init() { int i; int err = 0; struct diag_smux_info *ch = NULL; char wq_name[DIAG_SMUX_NAME_SZ + 11]; for (i = 0; i < NUM_SMUX_DEV; i++) { ch = &diag_smux[i]; strlcpy(wq_name, "DIAG_SMUX_", 11); strlcat(wq_name, ch->name, sizeof(ch->name)); ch->smux_wq = create_singlethread_workqueue(wq_name); if (!ch->smux_wq) { err = -ENOMEM; goto fail; } err = diagfwd_bridge_register(ch->dev_id, ch->id, &diag_smux_fwd_ops); if (err) { pr_err("diag: Unable to register SMUX ch %d with bridge\n", ch->id); goto fail; } } err = platform_driver_register(&msm_diagfwd_smux_driver); if (err) { pr_err("diag: Unable to register SMUX device, err: %d\n", err); goto fail; } return 0; fail: diag_smux_exit(); return err; }