Lines Matching refs:cl
73 struct hsi_client *cl = to_hsi_client(dev); in hsi_client_release() local
75 kfree(cl->tx_cfg.channels); in hsi_client_release()
76 kfree(cl->rx_cfg.channels); in hsi_client_release()
77 kfree(cl); in hsi_client_release()
83 struct hsi_client *cl; in hsi_new_client() local
86 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_new_client()
87 if (!cl) in hsi_new_client()
90 cl->tx_cfg = info->tx_cfg; in hsi_new_client()
91 if (cl->tx_cfg.channels) { in hsi_new_client()
92 size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels); in hsi_new_client()
93 cl->tx_cfg.channels = kzalloc(size , GFP_KERNEL); in hsi_new_client()
94 if (!cl->tx_cfg.channels) in hsi_new_client()
96 memcpy(cl->tx_cfg.channels, info->tx_cfg.channels, size); in hsi_new_client()
99 cl->rx_cfg = info->rx_cfg; in hsi_new_client()
100 if (cl->rx_cfg.channels) { in hsi_new_client()
101 size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels); in hsi_new_client()
102 cl->rx_cfg.channels = kzalloc(size , GFP_KERNEL); in hsi_new_client()
103 if (!cl->rx_cfg.channels) in hsi_new_client()
105 memcpy(cl->rx_cfg.channels, info->rx_cfg.channels, size); in hsi_new_client()
108 cl->device.bus = &hsi_bus_type; in hsi_new_client()
109 cl->device.parent = &port->device; in hsi_new_client()
110 cl->device.release = hsi_client_release; in hsi_new_client()
111 dev_set_name(&cl->device, "%s", info->name); in hsi_new_client()
112 cl->device.platform_data = info->platform_data; in hsi_new_client()
114 cl->device.archdata = *info->archdata; in hsi_new_client()
115 if (device_register(&cl->device) < 0) { in hsi_new_client()
117 put_device(&cl->device); in hsi_new_client()
120 return cl; in hsi_new_client()
122 kfree(cl->tx_cfg.channels); in hsi_new_client()
124 kfree(cl); in hsi_new_client()
212 struct hsi_client *cl; in hsi_add_client_from_dt() local
218 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_add_client_from_dt()
219 if (!cl) in hsi_add_client_from_dt()
226 dev_set_name(&cl->device, "%s", name); in hsi_add_client_from_dt()
231 &cl->rx_cfg.mode); in hsi_add_client_from_dt()
236 &cl->tx_cfg.mode); in hsi_add_client_from_dt()
240 cl->rx_cfg.mode = mode; in hsi_add_client_from_dt()
241 cl->tx_cfg.mode = mode; in hsi_add_client_from_dt()
245 &cl->tx_cfg.speed); in hsi_add_client_from_dt()
248 cl->rx_cfg.speed = cl->tx_cfg.speed; in hsi_add_client_from_dt()
251 &cl->rx_cfg.flow); in hsi_add_client_from_dt()
256 &cl->rx_cfg.arb_mode); in hsi_add_client_from_dt()
268 cl->rx_cfg.num_channels = cells; in hsi_add_client_from_dt()
269 cl->tx_cfg.num_channels = cells; in hsi_add_client_from_dt()
271 cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
272 if (!cl->rx_cfg.channels) { in hsi_add_client_from_dt()
277 cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
278 if (!cl->tx_cfg.channels) { in hsi_add_client_from_dt()
298 cl->rx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
299 cl->tx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
302 cl->rx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
303 cl->tx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
305 cl->device.bus = &hsi_bus_type; in hsi_add_client_from_dt()
306 cl->device.parent = &port->device; in hsi_add_client_from_dt()
307 cl->device.release = hsi_client_release; in hsi_add_client_from_dt()
308 cl->device.of_node = client; in hsi_add_client_from_dt()
310 if (device_register(&cl->device) < 0) { in hsi_add_client_from_dt()
312 put_device(&cl->device); in hsi_add_client_from_dt()
318 kfree(cl->tx_cfg.channels); in hsi_add_client_from_dt()
320 kfree(cl->rx_cfg.channels); in hsi_add_client_from_dt()
322 kfree(cl); in hsi_add_client_from_dt()
441 static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) in hsi_dummy_cl()
591 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) in hsi_async() argument
593 struct hsi_port *port = hsi_get_port(cl); in hsi_async()
595 if (!hsi_port_claimed(cl)) in hsi_async()
599 msg->cl = cl; in hsi_async()
612 int hsi_claim_port(struct hsi_client *cl, unsigned int share) in hsi_claim_port() argument
614 struct hsi_port *port = hsi_get_port(cl); in hsi_claim_port()
628 cl->pclaimed = 1; in hsi_claim_port()
640 void hsi_release_port(struct hsi_client *cl) in hsi_release_port() argument
642 struct hsi_port *port = hsi_get_port(cl); in hsi_release_port()
646 port->release(cl); in hsi_release_port()
647 if (cl->pclaimed) in hsi_release_port()
650 cl->pclaimed = 0; in hsi_release_port()
661 struct hsi_client *cl = container_of(nb, struct hsi_client, nb); in hsi_event_notifier_call() local
663 (*cl->ehandler)(cl, event); in hsi_event_notifier_call()
680 int hsi_register_port_event(struct hsi_client *cl, in hsi_register_port_event() argument
683 struct hsi_port *port = hsi_get_port(cl); in hsi_register_port_event()
685 if (!handler || cl->ehandler) in hsi_register_port_event()
687 if (!hsi_port_claimed(cl)) in hsi_register_port_event()
689 cl->ehandler = handler; in hsi_register_port_event()
690 cl->nb.notifier_call = hsi_event_notifier_call; in hsi_register_port_event()
692 return atomic_notifier_chain_register(&port->n_head, &cl->nb); in hsi_register_port_event()
705 int hsi_unregister_port_event(struct hsi_client *cl) in hsi_unregister_port_event() argument
707 struct hsi_port *port = hsi_get_port(cl); in hsi_unregister_port_event()
710 WARN_ON(!hsi_port_claimed(cl)); in hsi_unregister_port_event()
712 err = atomic_notifier_chain_unregister(&port->n_head, &cl->nb); in hsi_unregister_port_event()
714 cl->ehandler = NULL; in hsi_unregister_port_event()
752 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name) in hsi_get_channel_id_by_name() argument
756 if (!cl->rx_cfg.channels) in hsi_get_channel_id_by_name()
759 for (i = 0; i < cl->rx_cfg.num_channels; i++) in hsi_get_channel_id_by_name()
760 if (!strcmp(cl->rx_cfg.channels[i].name, name)) in hsi_get_channel_id_by_name()
761 return cl->rx_cfg.channels[i].id; in hsi_get_channel_id_by_name()