Lines Matching refs:cl

60 	struct hsi_client *cl = to_hsi_client(dev);
62 kfree(cl->tx_cfg.channels);
63 kfree(cl->rx_cfg.channels);
64 kfree(cl);
70 struct hsi_client *cl;
73 cl = kzalloc(sizeof(*cl), GFP_KERNEL);
74 if (!cl)
77 cl->tx_cfg = info->tx_cfg;
78 if (cl->tx_cfg.channels) {
79 size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels);
80 cl->tx_cfg.channels = kmemdup(info->tx_cfg.channels, size,
82 if (!cl->tx_cfg.channels)
86 cl->rx_cfg = info->rx_cfg;
87 if (cl->rx_cfg.channels) {
88 size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels);
89 cl->rx_cfg.channels = kmemdup(info->rx_cfg.channels, size,
91 if (!cl->rx_cfg.channels)
95 cl->device.bus = &hsi_bus_type;
96 cl->device.parent = &port->device;
97 cl->device.release = hsi_client_release;
98 dev_set_name(&cl->device, "%s", info->name);
99 cl->device.platform_data = info->platform_data;
101 cl->device.archdata = *info->archdata;
102 if (device_register(&cl->device) < 0) {
104 put_device(&cl->device);
108 return cl;
110 kfree(cl->tx_cfg.channels);
112 kfree(cl);
200 struct hsi_client *cl;
206 cl = kzalloc(sizeof(*cl), GFP_KERNEL);
207 if (!cl)
217 &cl->rx_cfg.mode);
222 &cl->tx_cfg.mode);
226 cl->rx_cfg.mode = mode;
227 cl->tx_cfg.mode = mode;
231 &cl->tx_cfg.speed);
234 cl->rx_cfg.speed = cl->tx_cfg.speed;
237 &cl->rx_cfg.flow);
242 &cl->rx_cfg.arb_mode);
254 cl->rx_cfg.num_channels = cells;
255 cl->tx_cfg.num_channels = cells;
256 cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
257 if (!cl->rx_cfg.channels) {
262 cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL);
263 if (!cl->tx_cfg.channels) {
283 cl->rx_cfg.channels[i] = channel;
284 cl->tx_cfg.channels[i] = channel;
287 cl->rx_cfg.num_hw_channels = max_chan + 1;
288 cl->tx_cfg.num_hw_channels = max_chan + 1;
290 cl->device.bus = &hsi_bus_type;
291 cl->device.parent = &port->device;
292 cl->device.release = hsi_client_release;
293 cl->device.of_node = client;
295 dev_set_name(&cl->device, "%s", name);
296 if (device_register(&cl->device) < 0) {
298 put_device(&cl->device);
304 kfree(cl->tx_cfg.channels);
306 kfree(cl->rx_cfg.channels);
308 kfree(cl);
427 static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused)
560 * @cl: HSI client sending the transfer
577 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg)
579 struct hsi_port *port = hsi_get_port(cl);
581 if (!hsi_port_claimed(cl))
585 msg->cl = cl;
593 * @cl: HSI client that wants to claim its port
598 int hsi_claim_port(struct hsi_client *cl, unsigned int share)
600 struct hsi_port *port = hsi_get_port(cl);
614 cl->pclaimed = 1;
624 * @cl: HSI client which previously claimed its port
626 void hsi_release_port(struct hsi_client *cl)
628 struct hsi_port *port = hsi_get_port(cl);
632 port->release(cl);
633 if (cl->pclaimed)
636 cl->pclaimed = 0;
647 struct hsi_client *cl = container_of(nb, struct hsi_client, nb);
649 (*cl->ehandler)(cl, event);
656 * @cl: HSI client that wants to receive port events
666 int hsi_register_port_event(struct hsi_client *cl,
669 struct hsi_port *port = hsi_get_port(cl);
671 if (!handler || cl->ehandler)
673 if (!hsi_port_claimed(cl))
675 cl->ehandler = handler;
676 cl->nb.notifier_call = hsi_event_notifier_call;
678 return blocking_notifier_chain_register(&port->n_head, &cl->nb);
684 * @cl: HSI client that wants to stop receiving port events
691 int hsi_unregister_port_event(struct hsi_client *cl)
693 struct hsi_port *port = hsi_get_port(cl);
696 WARN_ON(!hsi_port_claimed(cl));
698 err = blocking_notifier_chain_unregister(&port->n_head, &cl->nb);
700 cl->ehandler = NULL;
729 * @cl: HSI client, which uses the channel
738 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name)
742 if (!cl->rx_cfg.channels)
745 for (i = 0; i < cl->rx_cfg.num_channels; i++)
746 if (!strcmp(cl->rx_cfg.channels[i].name, name))
747 return cl->rx_cfg.channels[i].id;