hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/usb/gadget/function/f_acm.c
....@@ -425,9 +425,11 @@
425425 /* we know alt == 0, so this is an activation or a reset */
426426
427427 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
+ }
431433
432434 if (!acm->notify->desc)
433435 if (config_ep_by_speed(cdev->gadget, f, acm->notify))
....@@ -723,6 +725,20 @@
723725 kfree(acm);
724726 }
725727
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
+
726742 static struct usb_function *acm_alloc_func(struct usb_function_instance *fi)
727743 {
728744 struct f_serial_opts *opts;
....@@ -750,6 +766,8 @@
750766 acm->port_num = opts->port_num;
751767 acm->port.func.unbind = acm_unbind;
752768 acm->port.func.free_func = acm_free_func;
769
+ acm->port.func.resume = acm_resume;
770
+ acm->port.func.suspend = acm_suspend;
753771
754772 return &acm->port.func;
755773 }
....@@ -771,6 +789,24 @@
771789 .release = acm_attr_release,
772790 };
773791
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
+
774810 static ssize_t f_acm_port_num_show(struct config_item *item, char *page)
775811 {
776812 return sprintf(page, "%u\n", to_f_serial_opts(item)->port_num);
....@@ -779,6 +815,9 @@
779815 CONFIGFS_ATTR_RO(f_acm_, port_num);
780816
781817 static struct configfs_attribute *acm_attrs[] = {
818
+#ifdef CONFIG_U_SERIAL_CONSOLE
819
+ &f_acm_attr_console,
820
+#endif
782821 &f_acm_attr_port_num,
783822 NULL,
784823 };