.. | .. |
---|
425 | 425 | /* we know alt == 0, so this is an activation or a reset */ |
---|
426 | 426 | |
---|
427 | 427 | if (intf == acm->ctrl_id) { |
---|
428 | | - dev_vdbg(&cdev->gadget->dev, |
---|
429 | | - "reset acm control interface %d\n", intf); |
---|
430 | | - usb_ep_disable(acm->notify); |
---|
| 428 | + if (acm->notify->enabled) { |
---|
| 429 | + dev_vdbg(&cdev->gadget->dev, |
---|
| 430 | + "reset acm control interface %d\n", intf); |
---|
| 431 | + usb_ep_disable(acm->notify); |
---|
| 432 | + } |
---|
431 | 433 | |
---|
432 | 434 | if (!acm->notify->desc) |
---|
433 | 435 | if (config_ep_by_speed(cdev->gadget, f, acm->notify)) |
---|
.. | .. |
---|
723 | 725 | kfree(acm); |
---|
724 | 726 | } |
---|
725 | 727 | |
---|
| 728 | +static void acm_resume(struct usb_function *f) |
---|
| 729 | +{ |
---|
| 730 | + struct f_acm *acm = func_to_acm(f); |
---|
| 731 | + |
---|
| 732 | + gserial_resume(&acm->port); |
---|
| 733 | +} |
---|
| 734 | + |
---|
| 735 | +static void acm_suspend(struct usb_function *f) |
---|
| 736 | +{ |
---|
| 737 | + struct f_acm *acm = func_to_acm(f); |
---|
| 738 | + |
---|
| 739 | + gserial_suspend(&acm->port); |
---|
| 740 | +} |
---|
| 741 | + |
---|
726 | 742 | static struct usb_function *acm_alloc_func(struct usb_function_instance *fi) |
---|
727 | 743 | { |
---|
728 | 744 | struct f_serial_opts *opts; |
---|
.. | .. |
---|
750 | 766 | acm->port_num = opts->port_num; |
---|
751 | 767 | acm->port.func.unbind = acm_unbind; |
---|
752 | 768 | acm->port.func.free_func = acm_free_func; |
---|
| 769 | + acm->port.func.resume = acm_resume; |
---|
| 770 | + acm->port.func.suspend = acm_suspend; |
---|
753 | 771 | |
---|
754 | 772 | return &acm->port.func; |
---|
755 | 773 | } |
---|
.. | .. |
---|
771 | 789 | .release = acm_attr_release, |
---|
772 | 790 | }; |
---|
773 | 791 | |
---|
| 792 | +#ifdef CONFIG_U_SERIAL_CONSOLE |
---|
| 793 | + |
---|
| 794 | +static ssize_t f_acm_console_store(struct config_item *item, |
---|
| 795 | + const char *page, size_t count) |
---|
| 796 | +{ |
---|
| 797 | + return gserial_set_console(to_f_serial_opts(item)->port_num, |
---|
| 798 | + page, count); |
---|
| 799 | +} |
---|
| 800 | + |
---|
| 801 | +static ssize_t f_acm_console_show(struct config_item *item, char *page) |
---|
| 802 | +{ |
---|
| 803 | + return gserial_get_console(to_f_serial_opts(item)->port_num, page); |
---|
| 804 | +} |
---|
| 805 | + |
---|
| 806 | +CONFIGFS_ATTR(f_acm_, console); |
---|
| 807 | + |
---|
| 808 | +#endif /* CONFIG_U_SERIAL_CONSOLE */ |
---|
| 809 | + |
---|
774 | 810 | static ssize_t f_acm_port_num_show(struct config_item *item, char *page) |
---|
775 | 811 | { |
---|
776 | 812 | return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num); |
---|
.. | .. |
---|
779 | 815 | CONFIGFS_ATTR_RO(f_acm_, port_num); |
---|
780 | 816 | |
---|
781 | 817 | static struct configfs_attribute *acm_attrs[] = { |
---|
| 818 | +#ifdef CONFIG_U_SERIAL_CONSOLE |
---|
| 819 | + &f_acm_attr_console, |
---|
| 820 | +#endif |
---|
782 | 821 | &f_acm_attr_port_num, |
---|
783 | 822 | NULL, |
---|
784 | 823 | }; |
---|