greybus: control: do not assume a control bundle
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 25 Nov 2015 14:59:23 +0000 (15:59 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 25 Nov 2015 23:39:16 +0000 (15:39 -0800)
The control bundle is going away so update the code.

Also remove defensive WARN_ON which would not just warn if our
implementation is broken, but also leak further memory unnecessarily.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/control.c

index ffc07a475845c14e6c37b9c30b440f2d7d7ac0a9..2cc1917adda0bb628c320ff6fb4f70a24aa3c698 100644 (file)
@@ -22,9 +22,8 @@ int gb_control_get_manifest_size_operation(struct gb_interface *intf)
        ret = gb_operation_sync(connection, GB_CONTROL_TYPE_GET_MANIFEST_SIZE,
                                NULL, 0, &response, sizeof(response));
        if (ret) {
-               dev_err(&connection->bundle->dev,
-                       "%s: Manifest size get operation failed (%d)\n",
-                       __func__, ret);
+               dev_err(&connection->intf->dev,
+                               "failed to get manifest size: %d\n", ret);
                return ret;
        }
 
@@ -72,7 +71,7 @@ static int gb_control_connection_init(struct gb_connection *connection)
        connection->private = control;
 
        /* Set interface's control connection */
-       connection->bundle->intf->control = control;
+       connection->intf->control = control;
 
        return 0;
 }
@@ -81,10 +80,7 @@ static void gb_control_connection_exit(struct gb_connection *connection)
 {
        struct gb_control *control = connection->private;
 
-       if (WARN_ON(connection->bundle->intf->control != control))
-               return;
-
-       connection->bundle->intf->control = NULL;
+       connection->intf->control = NULL;
        kfree(control);
 }