Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

greybus: svc: refactor interface re-enable

Add interface re-enable helper that is used during mode switch to
disable and re-enable (enumerate) an interface.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
844fcbfe deba0c03

+19 -7
+19 -7
drivers/staging/greybus/svc.c
··· 665 665 return 0; 666 666 } 667 667 668 + static void gb_svc_intf_reenable(struct gb_svc *svc, struct gb_interface *intf) 669 + { 670 + int ret; 671 + 672 + /* Mark as disconnected to prevent I/O during disable. */ 673 + intf->disconnected = true; 674 + gb_interface_disable(intf); 675 + intf->disconnected = false; 676 + 677 + ret = gb_interface_enable(intf); 678 + if (ret) { 679 + dev_err(&svc->dev, "failed to enable interface %u: %d\n", 680 + intf->interface_id, ret); 681 + 682 + gb_interface_deactivate(intf); 683 + } 684 + } 685 + 668 686 static void gb_svc_process_intf_hotplug(struct gb_operation *operation) 669 687 { 670 688 struct gb_svc_intf_hotplug_request *request; ··· 704 686 dev_info(&svc->dev, "mode switch detected on interface %u\n", 705 687 intf_id); 706 688 707 - /* Mark as disconnected to prevent I/O during disable. */ 708 - intf->disconnected = true; 709 - gb_interface_disable(intf); 710 - intf->disconnected = false; 711 - 712 - goto enable_interface; 689 + return gb_svc_intf_reenable(svc, intf); 713 690 } 714 691 715 692 intf = gb_interface_create(hd, intf_id); ··· 726 713 if (ret) 727 714 goto err_interface_deactivate; 728 715 729 - enable_interface: 730 716 ret = gb_interface_enable(intf); 731 717 if (ret) { 732 718 dev_err(&svc->dev, "failed to enable interface %u: %d\n",