Lines Matching refs:sfp
299 static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) in pvr2_sysfs_add_control() argument
306 cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,ctl_id); in pvr2_sysfs_add_control()
316 cip->chptr = sfp; in pvr2_sysfs_add_control()
318 if (sfp->item_last) { in pvr2_sysfs_add_control()
319 sfp->item_last->item_next = cip; in pvr2_sysfs_add_control()
321 sfp->item_first = cip; in pvr2_sysfs_add_control()
323 sfp->item_last = cip; in pvr2_sysfs_add_control()
399 ret = sysfs_create_group(&sfp->class_dev->kobj,&cip->grp); in pvr2_sysfs_add_control()
417 static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) in pvr2_sysfs_add_debugifc() argument
431 sfp->debugifc = dip; in pvr2_sysfs_add_debugifc()
432 ret = device_create_file(sfp->class_dev,&dip->attr_debugcmd); in pvr2_sysfs_add_debugifc()
440 ret = device_create_file(sfp->class_dev,&dip->attr_debuginfo); in pvr2_sysfs_add_debugifc()
451 static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) in pvr2_sysfs_tear_down_debugifc() argument
453 if (!sfp->debugifc) return; in pvr2_sysfs_tear_down_debugifc()
454 if (sfp->debugifc->debuginfo_created_ok) { in pvr2_sysfs_tear_down_debugifc()
455 device_remove_file(sfp->class_dev, in pvr2_sysfs_tear_down_debugifc()
456 &sfp->debugifc->attr_debuginfo); in pvr2_sysfs_tear_down_debugifc()
458 if (sfp->debugifc->debugcmd_created_ok) { in pvr2_sysfs_tear_down_debugifc()
459 device_remove_file(sfp->class_dev, in pvr2_sysfs_tear_down_debugifc()
460 &sfp->debugifc->attr_debugcmd); in pvr2_sysfs_tear_down_debugifc()
462 kfree(sfp->debugifc); in pvr2_sysfs_tear_down_debugifc()
463 sfp->debugifc = NULL; in pvr2_sysfs_tear_down_debugifc()
468 static void pvr2_sysfs_add_controls(struct pvr2_sysfs *sfp) in pvr2_sysfs_add_controls() argument
471 cnt = pvr2_hdw_get_ctrl_count(sfp->channel.hdw); in pvr2_sysfs_add_controls()
473 pvr2_sysfs_add_control(sfp,idx); in pvr2_sysfs_add_controls()
478 static void pvr2_sysfs_tear_down_controls(struct pvr2_sysfs *sfp) in pvr2_sysfs_tear_down_controls() argument
481 for (cip1 = sfp->item_first; cip1; cip1 = cip2) { in pvr2_sysfs_tear_down_controls()
484 sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp); in pvr2_sysfs_tear_down_controls()
508 static void class_dev_destroy(struct pvr2_sysfs *sfp) in class_dev_destroy() argument
510 if (!sfp->class_dev) return; in class_dev_destroy()
512 pvr2_sysfs_tear_down_debugifc(sfp); in class_dev_destroy()
514 pvr2_sysfs_tear_down_controls(sfp); in class_dev_destroy()
515 if (sfp->hdw_desc_created_ok) { in class_dev_destroy()
516 device_remove_file(sfp->class_dev, in class_dev_destroy()
517 &sfp->attr_hdw_desc); in class_dev_destroy()
519 if (sfp->hdw_name_created_ok) { in class_dev_destroy()
520 device_remove_file(sfp->class_dev, in class_dev_destroy()
521 &sfp->attr_hdw_name); in class_dev_destroy()
523 if (sfp->bus_info_created_ok) { in class_dev_destroy()
524 device_remove_file(sfp->class_dev, in class_dev_destroy()
525 &sfp->attr_bus_info); in class_dev_destroy()
527 if (sfp->v4l_minor_number_created_ok) { in class_dev_destroy()
528 device_remove_file(sfp->class_dev, in class_dev_destroy()
529 &sfp->attr_v4l_minor_number); in class_dev_destroy()
531 if (sfp->v4l_radio_minor_number_created_ok) { in class_dev_destroy()
532 device_remove_file(sfp->class_dev, in class_dev_destroy()
533 &sfp->attr_v4l_radio_minor_number); in class_dev_destroy()
535 if (sfp->unit_number_created_ok) { in class_dev_destroy()
536 device_remove_file(sfp->class_dev, in class_dev_destroy()
537 &sfp->attr_unit_number); in class_dev_destroy()
539 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); in class_dev_destroy()
540 sfp->class_dev->driver_data = NULL; in class_dev_destroy()
541 device_unregister(sfp->class_dev); in class_dev_destroy()
542 sfp->class_dev = NULL; in class_dev_destroy()
549 struct pvr2_sysfs *sfp; in v4l_minor_number_show() local
550 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in v4l_minor_number_show()
551 if (!sfp) return -EINVAL; in v4l_minor_number_show()
553 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, in v4l_minor_number_show()
561 struct pvr2_sysfs *sfp; in bus_info_show() local
562 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in bus_info_show()
563 if (!sfp) return -EINVAL; in bus_info_show()
565 pvr2_hdw_get_bus_info(sfp->channel.hdw)); in bus_info_show()
572 struct pvr2_sysfs *sfp; in hdw_name_show() local
573 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in hdw_name_show()
574 if (!sfp) return -EINVAL; in hdw_name_show()
576 pvr2_hdw_get_type(sfp->channel.hdw)); in hdw_name_show()
583 struct pvr2_sysfs *sfp; in hdw_desc_show() local
584 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in hdw_desc_show()
585 if (!sfp) return -EINVAL; in hdw_desc_show()
587 pvr2_hdw_get_desc(sfp->channel.hdw)); in hdw_desc_show()
595 struct pvr2_sysfs *sfp; in v4l_radio_minor_number_show() local
596 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in v4l_radio_minor_number_show()
597 if (!sfp) return -EINVAL; in v4l_radio_minor_number_show()
599 pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw, in v4l_radio_minor_number_show()
607 struct pvr2_sysfs *sfp; in unit_number_show() local
608 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in unit_number_show()
609 if (!sfp) return -EINVAL; in unit_number_show()
611 pvr2_hdw_get_unit_number(sfp->channel.hdw)); in unit_number_show()
615 static void class_dev_create(struct pvr2_sysfs *sfp, in class_dev_create() argument
622 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); in class_dev_create()
630 if (pvr2_hdw_get_sn(sfp->channel.hdw)) { in class_dev_create()
632 pvr2_hdw_get_sn(sfp->channel.hdw)); in class_dev_create()
633 } else if (pvr2_hdw_get_unit_number(sfp->channel.hdw) >= 0) { in class_dev_create()
635 pvr2_hdw_get_unit_number(sfp->channel.hdw) + 'a'); in class_dev_create()
643 sfp->class_dev = class_dev; in class_dev_create()
644 class_dev->driver_data = sfp; in class_dev_create()
653 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; in class_dev_create()
654 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; in class_dev_create()
655 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; in class_dev_create()
656 sfp->attr_v4l_minor_number.store = NULL; in class_dev_create()
657 ret = device_create_file(sfp->class_dev, in class_dev_create()
658 &sfp->attr_v4l_minor_number); in class_dev_create()
664 sfp->v4l_minor_number_created_ok = !0; in class_dev_create()
667 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number"; in class_dev_create()
668 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; in class_dev_create()
669 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; in class_dev_create()
670 sfp->attr_v4l_radio_minor_number.store = NULL; in class_dev_create()
671 ret = device_create_file(sfp->class_dev, in class_dev_create()
672 &sfp->attr_v4l_radio_minor_number); in class_dev_create()
678 sfp->v4l_radio_minor_number_created_ok = !0; in class_dev_create()
681 sfp->attr_unit_number.attr.name = "unit_number"; in class_dev_create()
682 sfp->attr_unit_number.attr.mode = S_IRUGO; in class_dev_create()
683 sfp->attr_unit_number.show = unit_number_show; in class_dev_create()
684 sfp->attr_unit_number.store = NULL; in class_dev_create()
685 ret = device_create_file(sfp->class_dev,&sfp->attr_unit_number); in class_dev_create()
691 sfp->unit_number_created_ok = !0; in class_dev_create()
694 sfp->attr_bus_info.attr.name = "bus_info_str"; in class_dev_create()
695 sfp->attr_bus_info.attr.mode = S_IRUGO; in class_dev_create()
696 sfp->attr_bus_info.show = bus_info_show; in class_dev_create()
697 sfp->attr_bus_info.store = NULL; in class_dev_create()
698 ret = device_create_file(sfp->class_dev, in class_dev_create()
699 &sfp->attr_bus_info); in class_dev_create()
705 sfp->bus_info_created_ok = !0; 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 sfp->attr_hdw_desc.attr.name = "device_hardware_description"; in class_dev_create()
723 sfp->attr_hdw_desc.attr.mode = S_IRUGO; in class_dev_create()
724 sfp->attr_hdw_desc.show = hdw_desc_show; in class_dev_create()
725 sfp->attr_hdw_desc.store = NULL; in class_dev_create()
726 ret = device_create_file(sfp->class_dev, in class_dev_create()
727 &sfp->attr_hdw_desc); in class_dev_create()
733 sfp->hdw_desc_created_ok = !0; in class_dev_create()
736 pvr2_sysfs_add_controls(sfp); in class_dev_create()
738 pvr2_sysfs_add_debugifc(sfp); in class_dev_create()
745 struct pvr2_sysfs *sfp; in pvr2_sysfs_internal_check() local
746 sfp = container_of(chp,struct pvr2_sysfs,channel); in pvr2_sysfs_internal_check()
747 if (!sfp->channel.mc_head->disconnect_flag) return; in pvr2_sysfs_internal_check()
748 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_sysfs id=%p",sfp); in pvr2_sysfs_internal_check()
749 class_dev_destroy(sfp); in pvr2_sysfs_internal_check()
750 pvr2_channel_done(&sfp->channel); in pvr2_sysfs_internal_check()
751 kfree(sfp); in pvr2_sysfs_internal_check()
758 struct pvr2_sysfs *sfp; in pvr2_sysfs_create() local
759 sfp = kzalloc(sizeof(*sfp),GFP_KERNEL); in pvr2_sysfs_create()
760 if (!sfp) return sfp; in pvr2_sysfs_create()
761 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_sysfs id=%p",sfp); in pvr2_sysfs_create()
762 pvr2_channel_init(&sfp->channel,mp); in pvr2_sysfs_create()
763 sfp->channel.check_func = pvr2_sysfs_internal_check; in pvr2_sysfs_create()
765 class_dev_create(sfp,class_ptr); in pvr2_sysfs_create()
766 return sfp; in pvr2_sysfs_create()
800 struct pvr2_sysfs *sfp; in debuginfo_show() local
801 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in debuginfo_show()
802 if (!sfp) return -EINVAL; in debuginfo_show()
803 pvr2_hdw_trigger_module_log(sfp->channel.hdw); in debuginfo_show()
804 return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE); in debuginfo_show()
811 struct pvr2_sysfs *sfp; in debugcmd_show() local
812 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in debugcmd_show()
813 if (!sfp) return -EINVAL; in debugcmd_show()
814 return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE); in debugcmd_show()
822 struct pvr2_sysfs *sfp; in debugcmd_store() local
825 sfp = (struct pvr2_sysfs *)class_dev->driver_data; in debugcmd_store()
826 if (!sfp) return -EINVAL; in debugcmd_store()
828 ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count); in debugcmd_store()