• Home
  • Raw
  • Download

Lines Matching refs:cldev

217 ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length)  in mei_cldev_send()  argument
219 struct mei_cl *cl = cldev->cl; in mei_cldev_send()
235 ssize_t mei_cldev_recv_nonblock(struct mei_cl_device *cldev, u8 *buf, in mei_cldev_recv_nonblock() argument
238 struct mei_cl *cl = cldev->cl; in mei_cldev_recv_nonblock()
253 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length) in mei_cldev_recv() argument
255 struct mei_cl *cl = cldev->cl; in mei_cldev_recv()
268 struct mei_cl_device *cldev; in mei_cl_bus_rx_work() local
271 cldev = container_of(work, struct mei_cl_device, rx_work); in mei_cl_bus_rx_work()
273 bus = cldev->bus; in mei_cl_bus_rx_work()
275 if (cldev->rx_cb) in mei_cl_bus_rx_work()
276 cldev->rx_cb(cldev); in mei_cl_bus_rx_work()
279 mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); in mei_cl_bus_rx_work()
290 struct mei_cl_device *cldev; in mei_cl_bus_notif_work() local
292 cldev = container_of(work, struct mei_cl_device, notif_work); in mei_cl_bus_notif_work()
294 if (cldev->notif_cb) in mei_cl_bus_notif_work()
295 cldev->notif_cb(cldev); in mei_cl_bus_notif_work()
308 struct mei_cl_device *cldev = cl->cldev; in mei_cl_bus_notify_event() local
310 if (!cldev || !cldev->notif_cb) in mei_cl_bus_notify_event()
316 schedule_work(&cldev->notif_work); in mei_cl_bus_notify_event()
333 struct mei_cl_device *cldev = cl->cldev; in mei_cl_bus_rx_event() local
335 if (!cldev || !cldev->rx_cb) in mei_cl_bus_rx_event()
338 schedule_work(&cldev->rx_work); in mei_cl_bus_rx_event()
353 int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb) in mei_cldev_register_rx_cb() argument
355 struct mei_device *bus = cldev->bus; in mei_cldev_register_rx_cb()
360 if (cldev->rx_cb) in mei_cldev_register_rx_cb()
363 cldev->rx_cb = rx_cb; in mei_cldev_register_rx_cb()
364 INIT_WORK(&cldev->rx_work, mei_cl_bus_rx_work); in mei_cldev_register_rx_cb()
367 ret = mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); in mei_cldev_register_rx_cb()
386 int mei_cldev_register_notif_cb(struct mei_cl_device *cldev, in mei_cldev_register_notif_cb() argument
389 struct mei_device *bus = cldev->bus; in mei_cldev_register_notif_cb()
395 if (cldev->notif_cb) in mei_cldev_register_notif_cb()
398 cldev->notif_cb = notif_cb; in mei_cldev_register_notif_cb()
399 INIT_WORK(&cldev->notif_work, mei_cl_bus_notif_work); in mei_cldev_register_notif_cb()
402 ret = mei_cl_notify_request(cldev->cl, NULL, 1); in mei_cldev_register_notif_cb()
418 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev) in mei_cldev_get_drvdata() argument
420 return dev_get_drvdata(&cldev->dev); in mei_cldev_get_drvdata()
430 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data) in mei_cldev_set_drvdata() argument
432 dev_set_drvdata(&cldev->dev, data); in mei_cldev_set_drvdata()
443 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev) in mei_cldev_uuid() argument
445 return mei_me_cl_uuid(cldev->me_cl); in mei_cldev_uuid()
456 u8 mei_cldev_ver(const struct mei_cl_device *cldev) in mei_cldev_ver() argument
458 return mei_me_cl_ver(cldev->me_cl); in mei_cldev_ver()
469 bool mei_cldev_enabled(struct mei_cl_device *cldev) in mei_cldev_enabled() argument
471 return mei_cl_is_connected(cldev->cl); in mei_cldev_enabled()
483 static bool mei_cl_bus_module_get(struct mei_cl_device *cldev) in mei_cl_bus_module_get() argument
485 return try_module_get(cldev->bus->dev->driver->owner); in mei_cl_bus_module_get()
493 static void mei_cl_bus_module_put(struct mei_cl_device *cldev) in mei_cl_bus_module_put() argument
495 module_put(cldev->bus->dev->driver->owner); in mei_cl_bus_module_put()
521 static int mei_cl_bus_vtag_alloc(struct mei_cl_device *cldev) in mei_cl_bus_vtag_alloc() argument
523 struct mei_cl *cl = cldev->cl; in mei_cl_bus_vtag_alloc()
547 static void mei_cl_bus_vtag_free(struct mei_cl_device *cldev) in mei_cl_bus_vtag_free() argument
549 struct mei_cl *cl = cldev->cl; in mei_cl_bus_vtag_free()
568 int mei_cldev_enable(struct mei_cl_device *cldev) in mei_cldev_enable() argument
570 struct mei_device *bus = cldev->bus; in mei_cldev_enable()
574 cl = cldev->cl; in mei_cldev_enable()
582 cl->cldev = cldev; in mei_cldev_enable()
590 if (!mei_me_cl_is_active(cldev->me_cl)) { in mei_cldev_enable()
591 dev_err(&cldev->dev, "me client is not active\n"); in mei_cldev_enable()
596 ret = mei_cl_bus_vtag_alloc(cldev); in mei_cldev_enable()
600 ret = mei_cl_connect(cl, cldev->me_cl, NULL); in mei_cldev_enable()
602 dev_err(&cldev->dev, "cannot connect\n"); in mei_cldev_enable()
603 mei_cl_bus_vtag_free(cldev); in mei_cldev_enable()
619 static void mei_cldev_unregister_callbacks(struct mei_cl_device *cldev) in mei_cldev_unregister_callbacks() argument
621 if (cldev->rx_cb) { in mei_cldev_unregister_callbacks()
622 cancel_work_sync(&cldev->rx_work); in mei_cldev_unregister_callbacks()
623 cldev->rx_cb = NULL; in mei_cldev_unregister_callbacks()
626 if (cldev->notif_cb) { in mei_cldev_unregister_callbacks()
627 cancel_work_sync(&cldev->notif_work); in mei_cldev_unregister_callbacks()
628 cldev->notif_cb = NULL; in mei_cldev_unregister_callbacks()
640 int mei_cldev_disable(struct mei_cl_device *cldev) in mei_cldev_disable() argument
646 if (!cldev) in mei_cldev_disable()
649 cl = cldev->cl; in mei_cldev_disable()
651 bus = cldev->bus; in mei_cldev_disable()
653 mei_cldev_unregister_callbacks(cldev); in mei_cldev_disable()
657 mei_cl_bus_vtag_free(cldev); in mei_cldev_disable()
688 struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev, in mei_cl_device_find() argument
696 uuid = mei_me_cl_uuid(cldev->me_cl); in mei_cl_device_find()
697 version = mei_me_cl_ver(cldev->me_cl); in mei_cl_device_find()
704 if (cldev->name[0]) in mei_cl_device_find()
705 if (strncmp(cldev->name, id->name, in mei_cl_device_find()
732 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_match() local
736 if (!cldev) in mei_cl_device_match()
739 if (!cldev->do_match) in mei_cl_device_match()
745 found_id = mei_cl_device_find(cldev, cldrv); in mei_cl_device_match()
761 struct mei_cl_device *cldev; in mei_cl_device_probe() local
766 cldev = to_mei_cl_device(dev); in mei_cl_device_probe()
769 if (!cldev) in mei_cl_device_probe()
775 id = mei_cl_device_find(cldev, cldrv); in mei_cl_device_probe()
779 if (!mei_cl_bus_module_get(cldev)) { in mei_cl_device_probe()
780 dev_err(&cldev->dev, "get hw module failed"); in mei_cl_device_probe()
784 ret = cldrv->probe(cldev, id); in mei_cl_device_probe()
786 mei_cl_bus_module_put(cldev); in mei_cl_device_probe()
803 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_remove() local
807 if (!cldev || !dev->driver) in mei_cl_device_remove()
812 ret = cldrv->remove(cldev); in mei_cl_device_remove()
814 mei_cldev_unregister_callbacks(cldev); in mei_cl_device_remove()
816 mei_cl_bus_module_put(cldev); in mei_cl_device_remove()
825 struct mei_cl_device *cldev = to_mei_cl_device(dev); in name_show() local
827 return scnprintf(buf, PAGE_SIZE, "%s", cldev->name); in name_show()
834 struct mei_cl_device *cldev = to_mei_cl_device(dev); in uuid_show() local
835 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in uuid_show()
844 struct mei_cl_device *cldev = to_mei_cl_device(dev); in version_show() local
845 u8 version = mei_me_cl_ver(cldev->me_cl); in version_show()
854 struct mei_cl_device *cldev = to_mei_cl_device(dev); in modalias_show() local
855 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in modalias_show()
856 u8 version = mei_me_cl_ver(cldev->me_cl); in modalias_show()
859 cldev->name, uuid, version); in modalias_show()
866 struct mei_cl_device *cldev = to_mei_cl_device(dev); in max_conn_show() local
867 u8 maxconn = mei_me_cl_max_conn(cldev->me_cl); in max_conn_show()
876 struct mei_cl_device *cldev = to_mei_cl_device(dev); in fixed_show() local
877 u8 fixed = mei_me_cl_fixed(cldev->me_cl); in fixed_show()
886 struct mei_cl_device *cldev = to_mei_cl_device(dev); in vtag_show() local
887 bool vt = mei_me_cl_vt(cldev->me_cl); in vtag_show()
896 struct mei_cl_device *cldev = to_mei_cl_device(dev); in max_len_show() local
897 u32 maxlen = mei_me_cl_max_len(cldev->me_cl); in max_len_show()
926 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_uevent() local
927 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in mei_cl_device_uevent()
928 u8 version = mei_me_cl_ver(cldev->me_cl); in mei_cl_device_uevent()
936 if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name)) in mei_cl_device_uevent()
940 cldev->name, uuid, version)) in mei_cl_device_uevent()
971 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_bus_dev_release() local
973 if (!cldev) in mei_cl_bus_dev_release()
976 mei_me_cl_put(cldev->me_cl); in mei_cl_bus_dev_release()
977 mei_dev_bus_put(cldev->bus); in mei_cl_bus_dev_release()
978 mei_cl_unlink(cldev->cl); in mei_cl_bus_dev_release()
979 kfree(cldev->cl); in mei_cl_bus_dev_release()
980 kfree(cldev); in mei_cl_bus_dev_release()
994 static inline void mei_cl_bus_set_name(struct mei_cl_device *cldev) in mei_cl_bus_set_name() argument
996 dev_set_name(&cldev->dev, "%s-%pUl", in mei_cl_bus_set_name()
997 dev_name(cldev->bus->dev), in mei_cl_bus_set_name()
998 mei_me_cl_uuid(cldev->me_cl)); in mei_cl_bus_set_name()
1012 struct mei_cl_device *cldev; in mei_cl_bus_dev_alloc() local
1015 cldev = kzalloc(sizeof(*cldev), GFP_KERNEL); in mei_cl_bus_dev_alloc()
1016 if (!cldev) in mei_cl_bus_dev_alloc()
1021 kfree(cldev); in mei_cl_bus_dev_alloc()
1025 device_initialize(&cldev->dev); in mei_cl_bus_dev_alloc()
1026 cldev->dev.parent = bus->dev; in mei_cl_bus_dev_alloc()
1027 cldev->dev.bus = &mei_cl_bus_type; in mei_cl_bus_dev_alloc()
1028 cldev->dev.type = &mei_cl_device_type; in mei_cl_bus_dev_alloc()
1029 cldev->bus = mei_dev_bus_get(bus); in mei_cl_bus_dev_alloc()
1030 cldev->me_cl = mei_me_cl_get(me_cl); in mei_cl_bus_dev_alloc()
1031 cldev->cl = cl; in mei_cl_bus_dev_alloc()
1032 mei_cl_bus_set_name(cldev); in mei_cl_bus_dev_alloc()
1033 cldev->is_added = 0; in mei_cl_bus_dev_alloc()
1034 INIT_LIST_HEAD(&cldev->bus_list); in mei_cl_bus_dev_alloc()
1036 return cldev; in mei_cl_bus_dev_alloc()
1049 struct mei_cl_device *cldev) in mei_cl_bus_dev_setup() argument
1051 cldev->do_match = 1; in mei_cl_bus_dev_setup()
1052 mei_cl_bus_dev_fixup(cldev); in mei_cl_bus_dev_setup()
1055 if (cldev->do_match) in mei_cl_bus_dev_setup()
1056 mei_cl_bus_set_name(cldev); in mei_cl_bus_dev_setup()
1058 return cldev->do_match == 1; in mei_cl_bus_dev_setup()
1068 static int mei_cl_bus_dev_add(struct mei_cl_device *cldev) in mei_cl_bus_dev_add() argument
1072 dev_dbg(cldev->bus->dev, "adding %pUL:%02X\n", in mei_cl_bus_dev_add()
1073 mei_me_cl_uuid(cldev->me_cl), in mei_cl_bus_dev_add()
1074 mei_me_cl_ver(cldev->me_cl)); in mei_cl_bus_dev_add()
1075 ret = device_add(&cldev->dev); in mei_cl_bus_dev_add()
1077 cldev->is_added = 1; in mei_cl_bus_dev_add()
1087 static void mei_cl_bus_dev_stop(struct mei_cl_device *cldev) in mei_cl_bus_dev_stop() argument
1089 if (cldev->is_added) in mei_cl_bus_dev_stop()
1090 device_release_driver(&cldev->dev); in mei_cl_bus_dev_stop()
1100 static void mei_cl_bus_dev_destroy(struct mei_cl_device *cldev) in mei_cl_bus_dev_destroy() argument
1103 WARN_ON(!mutex_is_locked(&cldev->bus->cl_bus_lock)); in mei_cl_bus_dev_destroy()
1105 if (!cldev->is_added) in mei_cl_bus_dev_destroy()
1108 device_del(&cldev->dev); in mei_cl_bus_dev_destroy()
1110 list_del_init(&cldev->bus_list); in mei_cl_bus_dev_destroy()
1112 cldev->is_added = 0; in mei_cl_bus_dev_destroy()
1113 put_device(&cldev->dev); in mei_cl_bus_dev_destroy()
1121 static void mei_cl_bus_remove_device(struct mei_cl_device *cldev) in mei_cl_bus_remove_device() argument
1123 mei_cl_bus_dev_stop(cldev); in mei_cl_bus_remove_device()
1124 mei_cl_bus_dev_destroy(cldev); in mei_cl_bus_remove_device()
1134 struct mei_cl_device *cldev, *next; in mei_cl_bus_remove_devices() local
1137 list_for_each_entry_safe(cldev, next, &bus->device_list, bus_list) in mei_cl_bus_remove_devices()
1138 mei_cl_bus_remove_device(cldev); in mei_cl_bus_remove_devices()
1155 struct mei_cl_device *cldev; in mei_cl_bus_dev_init() local
1164 cldev = mei_cl_bus_dev_alloc(bus, me_cl); in mei_cl_bus_dev_init()
1165 if (!cldev) in mei_cl_bus_dev_init()
1169 list_add_tail(&cldev->bus_list, &bus->device_list); in mei_cl_bus_dev_init()
1181 struct mei_cl_device *cldev, *n; in mei_cl_bus_rescan() local
1191 list_for_each_entry_safe(cldev, n, &bus->device_list, bus_list) { in mei_cl_bus_rescan()
1193 if (!mei_me_cl_is_active(cldev->me_cl)) { in mei_cl_bus_rescan()
1194 mei_cl_bus_remove_device(cldev); in mei_cl_bus_rescan()
1198 if (cldev->is_added) in mei_cl_bus_rescan()
1201 if (mei_cl_bus_dev_setup(bus, cldev)) in mei_cl_bus_rescan()
1202 mei_cl_bus_dev_add(cldev); in mei_cl_bus_rescan()
1204 list_del_init(&cldev->bus_list); in mei_cl_bus_rescan()
1205 put_device(&cldev->dev); in mei_cl_bus_rescan()