]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: interface: avoid I/O to bootrom during removal
authorJohan Hovold <johan@hovoldconsulting.com>
Fri, 27 May 2016 15:26:24 +0000 (17:26 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 27 May 2016 19:19:29 +0000 (12:19 -0700)
Add an interface quirk flag to suppress I/O during interface disable.

This is needed to prevent I/O to the bootrom during controlled
connection tear down (e.g. eject or driver unbind). This will be more
obvious with the new connection tear-down procedure.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/interface.c
drivers/staging/greybus/interface.h

index 0f2b5914eae51aac1c80196ac0401c7fcda94443..2cfb5a46e7d45b94c275f8177a1d20d2ad4a4bd0 100644 (file)
@@ -221,8 +221,8 @@ static int gb_interface_read_and_clear_init_status(struct gb_interface *intf)
         * Check if the interface is executing the quirky ES3 bootrom that,
         * for example, requires E2EFC, CSD and CSV to be disabled.
         */
-       bootrom_quirks = GB_INTERFACE_QUIRK_NO_CPORT_FEATURES;
-
+       bootrom_quirks = GB_INTERFACE_QUIRK_NO_CPORT_FEATURES |
+                               GB_INTERFACE_QUIRK_FORCED_DISABLE;
        switch (init_status) {
        case GB_INIT_BOOTROM_UNIPRO_BOOT_STARTED:
        case GB_INIT_BOOTROM_FALLBACK_UNIPRO_BOOT_STARTED:
@@ -674,6 +674,10 @@ void gb_interface_disable(struct gb_interface *intf)
 
        trace_gb_interface_disable(intf);
 
+       /* Set disconnected flag to avoid I/O during connection tear down. */
+       if (intf->quirks & GB_INTERFACE_QUIRK_FORCED_DISABLE)
+               intf->disconnected = true;
+
        list_for_each_entry_safe(bundle, next, &intf->bundles, links)
                gb_bundle_destroy(bundle);
 
index 51772ccdd467be65a5b9b5143d0af71737f28598..e833f7df025de07a13bf76fe420212b0920a67d0 100644 (file)
@@ -13,6 +13,7 @@
 #define GB_INTERFACE_QUIRK_NO_CPORT_FEATURES           BIT(0)
 #define GB_INTERFACE_QUIRK_NO_INIT_STATUS              BIT(1)
 #define GB_INTERFACE_QUIRK_NO_ARA_IDS                  BIT(2)
+#define GB_INTERFACE_QUIRK_FORCED_DISABLE              BIT(3)
 
 struct gb_interface {
        struct device dev;