• Home
  • Raw
  • Download

Lines Matching refs:cldev

185 ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length)  in mei_cldev_send()  argument
187 struct mei_cl *cl = cldev->cl; in mei_cldev_send()
205 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length) in mei_cldev_recv() argument
207 struct mei_cl *cl = cldev->cl; in mei_cldev_recv()
224 struct mei_cl_device *cldev; in mei_cl_bus_event_work() local
227 cldev = container_of(work, struct mei_cl_device, event_work); in mei_cl_bus_event_work()
229 bus = cldev->bus; in mei_cl_bus_event_work()
231 if (cldev->event_cb) in mei_cl_bus_event_work()
232 cldev->event_cb(cldev, cldev->events, cldev->event_context); in mei_cl_bus_event_work()
234 cldev->events = 0; in mei_cl_bus_event_work()
237 if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) { in mei_cl_bus_event_work()
239 mei_cl_read_start(cldev->cl, 0, NULL); in mei_cl_bus_event_work()
251 struct mei_cl_device *cldev = cl->cldev; in mei_cl_bus_notify_event() local
253 if (!cldev || !cldev->event_cb) in mei_cl_bus_notify_event()
256 if (!(cldev->events_mask & BIT(MEI_CL_EVENT_NOTIF))) in mei_cl_bus_notify_event()
262 set_bit(MEI_CL_EVENT_NOTIF, &cldev->events); in mei_cl_bus_notify_event()
264 schedule_work(&cldev->event_work); in mei_cl_bus_notify_event()
276 struct mei_cl_device *cldev = cl->cldev; in mei_cl_bus_rx_event() local
278 if (!cldev || !cldev->event_cb) in mei_cl_bus_rx_event()
281 if (!(cldev->events_mask & BIT(MEI_CL_EVENT_RX))) in mei_cl_bus_rx_event()
284 set_bit(MEI_CL_EVENT_RX, &cldev->events); in mei_cl_bus_rx_event()
286 schedule_work(&cldev->event_work); in mei_cl_bus_rx_event()
301 int mei_cldev_register_event_cb(struct mei_cl_device *cldev, in mei_cldev_register_event_cb() argument
305 struct mei_device *bus = cldev->bus; in mei_cldev_register_event_cb()
308 if (cldev->event_cb) in mei_cldev_register_event_cb()
311 cldev->events = 0; in mei_cldev_register_event_cb()
312 cldev->events_mask = events_mask; in mei_cldev_register_event_cb()
313 cldev->event_cb = event_cb; in mei_cldev_register_event_cb()
314 cldev->event_context = context; in mei_cldev_register_event_cb()
315 INIT_WORK(&cldev->event_work, mei_cl_bus_event_work); in mei_cldev_register_event_cb()
317 if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) { in mei_cldev_register_event_cb()
319 ret = mei_cl_read_start(cldev->cl, 0, NULL); in mei_cldev_register_event_cb()
325 if (cldev->events_mask & BIT(MEI_CL_EVENT_NOTIF)) { in mei_cldev_register_event_cb()
327 ret = mei_cl_notify_request(cldev->cl, NULL, event_cb ? 1 : 0); in mei_cldev_register_event_cb()
344 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev) in mei_cldev_get_drvdata() argument
346 return dev_get_drvdata(&cldev->dev); in mei_cldev_get_drvdata()
356 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data) in mei_cldev_set_drvdata() argument
358 dev_set_drvdata(&cldev->dev, data); in mei_cldev_set_drvdata()
369 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev) in mei_cldev_uuid() argument
371 return mei_me_cl_uuid(cldev->me_cl); in mei_cldev_uuid()
382 u8 mei_cldev_ver(const struct mei_cl_device *cldev) in mei_cldev_ver() argument
384 return mei_me_cl_ver(cldev->me_cl); in mei_cldev_ver()
395 bool mei_cldev_enabled(struct mei_cl_device *cldev) in mei_cldev_enabled() argument
397 return cldev->cl && mei_cl_is_connected(cldev->cl); in mei_cldev_enabled()
409 int mei_cldev_enable(struct mei_cl_device *cldev) in mei_cldev_enable() argument
411 struct mei_device *bus = cldev->bus; in mei_cldev_enable()
415 cl = cldev->cl; in mei_cldev_enable()
424 cldev->cl = cl; in mei_cldev_enable()
425 cl->cldev = cldev; in mei_cldev_enable()
434 if (!mei_me_cl_is_active(cldev->me_cl)) { in mei_cldev_enable()
435 dev_err(&cldev->dev, "me client is not active\n"); in mei_cldev_enable()
440 ret = mei_cl_connect(cl, cldev->me_cl, NULL); in mei_cldev_enable()
442 dev_err(&cldev->dev, "cannot connect\n"); in mei_cldev_enable()
459 int mei_cldev_disable(struct mei_cl_device *cldev) in mei_cldev_disable() argument
465 if (!cldev || !cldev->cl) in mei_cldev_disable()
468 cl = cldev->cl; in mei_cldev_disable()
470 bus = cldev->bus; in mei_cldev_disable()
472 cldev->event_cb = NULL; in mei_cldev_disable()
492 cldev->cl = NULL; in mei_cldev_disable()
508 struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev, in mei_cl_device_find() argument
516 uuid = mei_me_cl_uuid(cldev->me_cl); in mei_cl_device_find()
517 version = mei_me_cl_ver(cldev->me_cl); in mei_cl_device_find()
524 if (cldev->name[0]) in mei_cl_device_find()
525 if (strncmp(cldev->name, id->name, in mei_cl_device_find()
552 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_match() local
556 if (!cldev) in mei_cl_device_match()
559 if (!cldev->do_match) in mei_cl_device_match()
565 found_id = mei_cl_device_find(cldev, cldrv); in mei_cl_device_match()
581 struct mei_cl_device *cldev; in mei_cl_device_probe() local
585 cldev = to_mei_cl_device(dev); in mei_cl_device_probe()
588 if (!cldev) in mei_cl_device_probe()
594 id = mei_cl_device_find(cldev, cldrv); in mei_cl_device_probe()
600 return cldrv->probe(cldev, id); in mei_cl_device_probe()
612 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_remove() local
616 if (!cldev || !dev->driver) in mei_cl_device_remove()
619 if (cldev->event_cb) { in mei_cl_device_remove()
620 cldev->event_cb = NULL; in mei_cl_device_remove()
621 cancel_work_sync(&cldev->event_work); in mei_cl_device_remove()
626 ret = cldrv->remove(cldev); in mei_cl_device_remove()
636 struct mei_cl_device *cldev = to_mei_cl_device(dev); in name_show() local
639 len = snprintf(buf, PAGE_SIZE, "%s", cldev->name); in name_show()
648 struct mei_cl_device *cldev = to_mei_cl_device(dev); in uuid_show() local
649 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in uuid_show()
661 struct mei_cl_device *cldev = to_mei_cl_device(dev); in version_show() local
662 u8 version = mei_me_cl_ver(cldev->me_cl); in version_show()
674 struct mei_cl_device *cldev = to_mei_cl_device(dev); in modalias_show() local
675 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in modalias_show()
678 len = snprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid); in modalias_show()
702 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_device_uevent() local
703 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); in mei_cl_device_uevent()
704 u8 version = mei_me_cl_ver(cldev->me_cl); in mei_cl_device_uevent()
712 if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name)) in mei_cl_device_uevent()
716 cldev->name, uuid, version)) in mei_cl_device_uevent()
747 struct mei_cl_device *cldev = to_mei_cl_device(dev); in mei_cl_bus_dev_release() local
749 if (!cldev) in mei_cl_bus_dev_release()
752 mei_me_cl_put(cldev->me_cl); in mei_cl_bus_dev_release()
753 mei_dev_bus_put(cldev->bus); in mei_cl_bus_dev_release()
754 kfree(cldev); in mei_cl_bus_dev_release()
768 static inline void mei_cl_bus_set_name(struct mei_cl_device *cldev) in mei_cl_bus_set_name() argument
770 dev_set_name(&cldev->dev, "%s-%pUl", in mei_cl_bus_set_name()
771 dev_name(cldev->bus->dev), in mei_cl_bus_set_name()
772 mei_me_cl_uuid(cldev->me_cl)); in mei_cl_bus_set_name()
786 struct mei_cl_device *cldev; in mei_cl_bus_dev_alloc() local
788 cldev = kzalloc(sizeof(struct mei_cl_device), GFP_KERNEL); in mei_cl_bus_dev_alloc()
789 if (!cldev) in mei_cl_bus_dev_alloc()
792 device_initialize(&cldev->dev); in mei_cl_bus_dev_alloc()
793 cldev->dev.parent = bus->dev; in mei_cl_bus_dev_alloc()
794 cldev->dev.bus = &mei_cl_bus_type; in mei_cl_bus_dev_alloc()
795 cldev->dev.type = &mei_cl_device_type; in mei_cl_bus_dev_alloc()
796 cldev->bus = mei_dev_bus_get(bus); in mei_cl_bus_dev_alloc()
797 cldev->me_cl = mei_me_cl_get(me_cl); in mei_cl_bus_dev_alloc()
798 mei_cl_bus_set_name(cldev); in mei_cl_bus_dev_alloc()
799 cldev->is_added = 0; in mei_cl_bus_dev_alloc()
800 INIT_LIST_HEAD(&cldev->bus_list); in mei_cl_bus_dev_alloc()
802 return cldev; in mei_cl_bus_dev_alloc()
815 struct mei_cl_device *cldev) in mei_cl_bus_dev_setup() argument
817 cldev->do_match = 1; in mei_cl_bus_dev_setup()
818 mei_cl_bus_dev_fixup(cldev); in mei_cl_bus_dev_setup()
821 if (cldev->do_match) in mei_cl_bus_dev_setup()
822 mei_cl_bus_set_name(cldev); in mei_cl_bus_dev_setup()
824 return cldev->do_match == 1; in mei_cl_bus_dev_setup()
834 static int mei_cl_bus_dev_add(struct mei_cl_device *cldev) in mei_cl_bus_dev_add() argument
838 dev_dbg(cldev->bus->dev, "adding %pUL:%02X\n", in mei_cl_bus_dev_add()
839 mei_me_cl_uuid(cldev->me_cl), in mei_cl_bus_dev_add()
840 mei_me_cl_ver(cldev->me_cl)); in mei_cl_bus_dev_add()
841 ret = device_add(&cldev->dev); in mei_cl_bus_dev_add()
843 cldev->is_added = 1; in mei_cl_bus_dev_add()
853 static void mei_cl_bus_dev_stop(struct mei_cl_device *cldev) in mei_cl_bus_dev_stop() argument
855 if (cldev->is_added) in mei_cl_bus_dev_stop()
856 device_release_driver(&cldev->dev); in mei_cl_bus_dev_stop()
866 static void mei_cl_bus_dev_destroy(struct mei_cl_device *cldev) in mei_cl_bus_dev_destroy() argument
869 WARN_ON(!mutex_is_locked(&cldev->bus->cl_bus_lock)); in mei_cl_bus_dev_destroy()
871 if (!cldev->is_added) in mei_cl_bus_dev_destroy()
874 device_del(&cldev->dev); in mei_cl_bus_dev_destroy()
876 list_del_init(&cldev->bus_list); in mei_cl_bus_dev_destroy()
878 cldev->is_added = 0; in mei_cl_bus_dev_destroy()
879 put_device(&cldev->dev); in mei_cl_bus_dev_destroy()
887 static void mei_cl_bus_remove_device(struct mei_cl_device *cldev) in mei_cl_bus_remove_device() argument
889 mei_cl_bus_dev_stop(cldev); in mei_cl_bus_remove_device()
890 mei_cl_bus_dev_destroy(cldev); in mei_cl_bus_remove_device()
900 struct mei_cl_device *cldev, *next; in mei_cl_bus_remove_devices() local
903 list_for_each_entry_safe(cldev, next, &bus->device_list, bus_list) in mei_cl_bus_remove_devices()
904 mei_cl_bus_remove_device(cldev); in mei_cl_bus_remove_devices()
921 struct mei_cl_device *cldev; in mei_cl_bus_dev_init() local
930 cldev = mei_cl_bus_dev_alloc(bus, me_cl); in mei_cl_bus_dev_init()
931 if (!cldev) in mei_cl_bus_dev_init()
935 list_add_tail(&cldev->bus_list, &bus->device_list); in mei_cl_bus_dev_init()
947 struct mei_cl_device *cldev, *n; in mei_cl_bus_rescan() local
957 list_for_each_entry_safe(cldev, n, &bus->device_list, bus_list) { in mei_cl_bus_rescan()
959 if (!mei_me_cl_is_active(cldev->me_cl)) { in mei_cl_bus_rescan()
960 mei_cl_bus_remove_device(cldev); in mei_cl_bus_rescan()
964 if (cldev->is_added) in mei_cl_bus_rescan()
967 if (mei_cl_bus_dev_setup(bus, cldev)) in mei_cl_bus_rescan()
968 mei_cl_bus_dev_add(cldev); in mei_cl_bus_rescan()
970 list_del_init(&cldev->bus_list); in mei_cl_bus_rescan()
971 put_device(&cldev->dev); in mei_cl_bus_rescan()