Lines Matching refs:sfp

286 static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)  in pvr2_sysfs_add_control()  argument
293 cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,ctl_id); in pvr2_sysfs_add_control()
303 cip->chptr = sfp; in pvr2_sysfs_add_control()
305 if (sfp->item_last) { in pvr2_sysfs_add_control()
306 sfp->item_last->item_next = cip; in pvr2_sysfs_add_control()
308 sfp->item_first = cip; in pvr2_sysfs_add_control()
310 sfp->item_last = cip; in pvr2_sysfs_add_control()
395 ret = sysfs_create_group(&sfp->class_dev->kobj,&cip->grp); in pvr2_sysfs_add_control()
413 static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) in pvr2_sysfs_add_debugifc() argument
429 sfp->debugifc = dip; in pvr2_sysfs_add_debugifc()
430 ret = device_create_file(sfp->class_dev,&dip->attr_debugcmd); in pvr2_sysfs_add_debugifc()
438 ret = device_create_file(sfp->class_dev,&dip->attr_debuginfo); in pvr2_sysfs_add_debugifc()
449 static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) in pvr2_sysfs_tear_down_debugifc() argument
451 if (!sfp->debugifc) return; in pvr2_sysfs_tear_down_debugifc()
452 if (sfp->debugifc->debuginfo_created_ok) { in pvr2_sysfs_tear_down_debugifc()
453 device_remove_file(sfp->class_dev, in pvr2_sysfs_tear_down_debugifc()
454 &sfp->debugifc->attr_debuginfo); in pvr2_sysfs_tear_down_debugifc()
456 if (sfp->debugifc->debugcmd_created_ok) { in pvr2_sysfs_tear_down_debugifc()
457 device_remove_file(sfp->class_dev, in pvr2_sysfs_tear_down_debugifc()
458 &sfp->debugifc->attr_debugcmd); in pvr2_sysfs_tear_down_debugifc()
460 kfree(sfp->debugifc); in pvr2_sysfs_tear_down_debugifc()
461 sfp->debugifc = NULL; in pvr2_sysfs_tear_down_debugifc()
466 static void pvr2_sysfs_add_controls(struct pvr2_sysfs *sfp) in pvr2_sysfs_add_controls() argument
469 cnt = pvr2_hdw_get_ctrl_count(sfp->channel.hdw); in pvr2_sysfs_add_controls()
471 pvr2_sysfs_add_control(sfp,idx); in pvr2_sysfs_add_controls()
476 static void pvr2_sysfs_tear_down_controls(struct pvr2_sysfs *sfp) in pvr2_sysfs_tear_down_controls() argument
479 for (cip1 = sfp->item_first; cip1; cip1 = cip2) { in pvr2_sysfs_tear_down_controls()
482 sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp); in pvr2_sysfs_tear_down_controls()
506 static void class_dev_destroy(struct pvr2_sysfs *sfp) in class_dev_destroy() argument
509 if (!sfp->class_dev) return; in class_dev_destroy()
511 pvr2_sysfs_tear_down_debugifc(sfp); in class_dev_destroy()
513 pvr2_sysfs_tear_down_controls(sfp); in class_dev_destroy()
514 if (sfp->hdw_desc_created_ok) { in class_dev_destroy()
515 device_remove_file(sfp->class_dev, in class_dev_destroy()
516 &sfp->attr_hdw_desc); in class_dev_destroy()
518 if (sfp->hdw_name_created_ok) { in class_dev_destroy()
519 device_remove_file(sfp->class_dev, in class_dev_destroy()
520 &sfp->attr_hdw_name); in class_dev_destroy()
522 if (sfp->bus_info_created_ok) { in class_dev_destroy()
523 device_remove_file(sfp->class_dev, in class_dev_destroy()
524 &sfp->attr_bus_info); in class_dev_destroy()
526 if (sfp->v4l_minor_number_created_ok) { in class_dev_destroy()
527 device_remove_file(sfp->class_dev, in class_dev_destroy()
528 &sfp->attr_v4l_minor_number); in class_dev_destroy()
530 if (sfp->v4l_radio_minor_number_created_ok) { in class_dev_destroy()
531 device_remove_file(sfp->class_dev, in class_dev_destroy()
532 &sfp->attr_v4l_radio_minor_number); in class_dev_destroy()
534 if (sfp->unit_number_created_ok) { in class_dev_destroy()
535 device_remove_file(sfp->class_dev, in class_dev_destroy()
536 &sfp->attr_unit_number); in class_dev_destroy()
538 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); in class_dev_destroy()
539 dev_set_drvdata(sfp->class_dev, NULL); in class_dev_destroy()
540 dev = sfp->class_dev->parent; in class_dev_destroy()
541 sfp->class_dev->parent = NULL; in class_dev_destroy()
543 device_unregister(sfp->class_dev); in class_dev_destroy()
544 sfp->class_dev = NULL; in class_dev_destroy()
551 struct pvr2_sysfs *sfp; in v4l_minor_number_show() local
552 sfp = dev_get_drvdata(class_dev); in v4l_minor_number_show()
553 if (!sfp) return -EINVAL; in v4l_minor_number_show()
555 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, in v4l_minor_number_show()
563 struct pvr2_sysfs *sfp; in bus_info_show() local
564 sfp = dev_get_drvdata(class_dev); in bus_info_show()
565 if (!sfp) return -EINVAL; in bus_info_show()
567 pvr2_hdw_get_bus_info(sfp->channel.hdw)); in bus_info_show()
574 struct pvr2_sysfs *sfp; in hdw_name_show() local
575 sfp = dev_get_drvdata(class_dev); in hdw_name_show()
576 if (!sfp) return -EINVAL; in hdw_name_show()
578 pvr2_hdw_get_type(sfp->channel.hdw)); in hdw_name_show()
585 struct pvr2_sysfs *sfp; in hdw_desc_show() local
586 sfp = dev_get_drvdata(class_dev); in hdw_desc_show()
587 if (!sfp) return -EINVAL; in hdw_desc_show()
589 pvr2_hdw_get_desc(sfp->channel.hdw)); in hdw_desc_show()
597 struct pvr2_sysfs *sfp; in v4l_radio_minor_number_show() local
598 sfp = dev_get_drvdata(class_dev); in v4l_radio_minor_number_show()
599 if (!sfp) return -EINVAL; in v4l_radio_minor_number_show()
601 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, in v4l_radio_minor_number_show()
609 struct pvr2_sysfs *sfp; in unit_number_show() local
610 sfp = dev_get_drvdata(class_dev); in unit_number_show()
611 if (!sfp) return -EINVAL; in unit_number_show()
613 pvr2_hdw_get_unit_number(sfp->channel.hdw)); in unit_number_show()
617 static void class_dev_create(struct pvr2_sysfs *sfp, in class_dev_create() argument
624 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); in class_dev_create()
634 pvr2_hdw_get_device_identifier(sfp->channel.hdw)); in class_dev_create()
638 sfp->class_dev = class_dev; in class_dev_create()
639 dev_set_drvdata(class_dev, sfp); in class_dev_create()
648 sysfs_attr_init(&sfp->attr_v4l_minor_number.attr); in class_dev_create()
649 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; in class_dev_create()
650 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; in class_dev_create()
651 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; in class_dev_create()
652 sfp->attr_v4l_minor_number.store = NULL; in class_dev_create()
653 ret = device_create_file(sfp->class_dev, in class_dev_create()
654 &sfp->attr_v4l_minor_number); in class_dev_create()
660 sfp->v4l_minor_number_created_ok = !0; in class_dev_create()
663 sysfs_attr_init(&sfp->attr_v4l_radio_minor_number.attr); in class_dev_create()
664 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number"; in class_dev_create()
665 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; in class_dev_create()
666 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; in class_dev_create()
667 sfp->attr_v4l_radio_minor_number.store = NULL; in class_dev_create()
668 ret = device_create_file(sfp->class_dev, in class_dev_create()
669 &sfp->attr_v4l_radio_minor_number); in class_dev_create()
675 sfp->v4l_radio_minor_number_created_ok = !0; in class_dev_create()
678 sysfs_attr_init(&sfp->attr_unit_number.attr); in class_dev_create()
679 sfp->attr_unit_number.attr.name = "unit_number"; in class_dev_create()
680 sfp->attr_unit_number.attr.mode = S_IRUGO; in class_dev_create()
681 sfp->attr_unit_number.show = unit_number_show; in class_dev_create()
682 sfp->attr_unit_number.store = NULL; in class_dev_create()
683 ret = device_create_file(sfp->class_dev,&sfp->attr_unit_number); in class_dev_create()
689 sfp->unit_number_created_ok = !0; in class_dev_create()
692 sysfs_attr_init(&sfp->attr_bus_info.attr); in class_dev_create()
693 sfp->attr_bus_info.attr.name = "bus_info_str"; in class_dev_create()
694 sfp->attr_bus_info.attr.mode = S_IRUGO; in class_dev_create()
695 sfp->attr_bus_info.show = bus_info_show; in class_dev_create()
696 sfp->attr_bus_info.store = NULL; in class_dev_create()
697 ret = device_create_file(sfp->class_dev, in class_dev_create()
698 &sfp->attr_bus_info); in class_dev_create()
704 sfp->bus_info_created_ok = !0; in class_dev_create()
707 sysfs_attr_init(&sfp->attr_hdw_name.attr); in class_dev_create()
708 sfp->attr_hdw_name.attr.name = "device_hardware_type"; in class_dev_create()
709 sfp->attr_hdw_name.attr.mode = S_IRUGO; in class_dev_create()
710 sfp->attr_hdw_name.show = hdw_name_show; in class_dev_create()
711 sfp->attr_hdw_name.store = NULL; in class_dev_create()
712 ret = device_create_file(sfp->class_dev, in class_dev_create()
713 &sfp->attr_hdw_name); in class_dev_create()
719 sfp->hdw_name_created_ok = !0; in class_dev_create()
722 sysfs_attr_init(&sfp->attr_hdw_desc.attr); in class_dev_create()
723 sfp->attr_hdw_desc.attr.name = "device_hardware_description"; in class_dev_create()
724 sfp->attr_hdw_desc.attr.mode = S_IRUGO; in class_dev_create()
725 sfp->attr_hdw_desc.show = hdw_desc_show; in class_dev_create()
726 sfp->attr_hdw_desc.store = NULL; in class_dev_create()
727 ret = device_create_file(sfp->class_dev, in class_dev_create()
728 &sfp->attr_hdw_desc); in class_dev_create()
734 sfp->hdw_desc_created_ok = !0; in class_dev_create()
737 pvr2_sysfs_add_controls(sfp); in class_dev_create()
739 pvr2_sysfs_add_debugifc(sfp); in class_dev_create()
746 struct pvr2_sysfs *sfp; in pvr2_sysfs_internal_check() local
747 sfp = container_of(chp,struct pvr2_sysfs,channel); in pvr2_sysfs_internal_check()
748 if (!sfp->channel.mc_head->disconnect_flag) return; in pvr2_sysfs_internal_check()
749 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_sysfs id=%p",sfp); in pvr2_sysfs_internal_check()
750 class_dev_destroy(sfp); in pvr2_sysfs_internal_check()
751 pvr2_channel_done(&sfp->channel); in pvr2_sysfs_internal_check()
752 kfree(sfp); in pvr2_sysfs_internal_check()
759 struct pvr2_sysfs *sfp; in pvr2_sysfs_create() local
760 sfp = kzalloc(sizeof(*sfp),GFP_KERNEL); in pvr2_sysfs_create()
761 if (!sfp) return sfp; in pvr2_sysfs_create()
762 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_sysfs id=%p",sfp); in pvr2_sysfs_create()
763 pvr2_channel_init(&sfp->channel,mp); in pvr2_sysfs_create()
764 sfp->channel.check_func = pvr2_sysfs_internal_check; in pvr2_sysfs_create()
766 class_dev_create(sfp,class_ptr); in pvr2_sysfs_create()
767 return sfp; in pvr2_sysfs_create()
804 struct pvr2_sysfs *sfp; in debuginfo_show() local
805 sfp = dev_get_drvdata(class_dev); in debuginfo_show()
806 if (!sfp) return -EINVAL; in debuginfo_show()
807 pvr2_hdw_trigger_module_log(sfp->channel.hdw); in debuginfo_show()
808 return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); in debuginfo_show()
815 struct pvr2_sysfs *sfp; in debugcmd_show() local
816 sfp = dev_get_drvdata(class_dev); in debugcmd_show()
817 if (!sfp) return -EINVAL; in debugcmd_show()
818 return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); in debugcmd_show()
826 struct pvr2_sysfs *sfp; in debugcmd_store() local
829 sfp = dev_get_drvdata(class_dev); in debugcmd_store()
830 if (!sfp) return -EINVAL; in debugcmd_store()
832 ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); in debugcmd_store()