remove single-called kdbus_conn_find_peer() function
authorKay Sievers <kay@vrfy.org>
Thu, 24 Apr 2014 11:27:37 +0000 (13:27 +0200)
committerKay Sievers <kay@vrfy.org>
Thu, 24 Apr 2014 11:29:39 +0000 (13:29 +0200)
connection.c
connection.h

index 58fec790f208398d9a621747826199c382bc5dcc..d9695ba39f65d2f3bb0906bb80cfa5e70de7f3c2 100644 (file)
@@ -1528,30 +1528,6 @@ bool kdbus_conn_active(const struct kdbus_conn *conn)
        return !conn->disconnected;
 }
 
-/**
- * kdbus_conn_find_peer() - find a connection peer with a given id
- * @conn_src:          The source connection
- * @id:                 The 64-bit connection id of the destination
- *
- * Finds a connection peer with a given id. The returned connection
- * is on the same bus of the source connection and it is ref'ed.
- * Returns NULL if the peer can't be found.
- *
- * On success caller must ensure to unref the returned connection.
- */
-struct kdbus_conn *kdbus_conn_find_peer(struct kdbus_conn *conn_src,
-                                       u64 id)
-{
-       struct kdbus_conn *conn_dst;
-       struct kdbus_bus *bus = conn_src->bus;
-
-       mutex_lock(&bus->lock);
-       conn_dst = kdbus_bus_find_conn_by_id(bus, id);
-       mutex_unlock(&bus->lock);
-
-       return conn_dst;
-}
-
 static void __kdbus_conn_free(struct kref *kref)
 {
        struct kdbus_conn *conn = container_of(kref, struct kdbus_conn, kref);
@@ -1717,12 +1693,14 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn,
                else if (entry->conn)
                        owner_conn = kdbus_conn_ref(entry->conn);
        } else {
-               owner_conn = kdbus_conn_find_peer(conn, cmd_info->id);
-       }
+               mutex_lock(&conn->bus->lock);
+               owner_conn = kdbus_bus_find_conn_by_id(conn->bus, cmd_info->id);
+               mutex_unlock(&conn->bus->lock);
 
-       if (!owner_conn) {
-               ret = -ENXIO;
-               goto exit;
+               if (!owner_conn) {
+                       ret = -ENXIO;
+                       goto exit;
+               }
        }
 
        info.size = sizeof(info);
index dde1347b02bdc1b0a4bdd674bfab50bf47b96c43..46f7b6ea0be982e0c3795b6b21cb0dcf3c3c9cad 100644 (file)
@@ -106,8 +106,6 @@ struct kdbus_conn *kdbus_conn_ref(struct kdbus_conn *conn);
 struct kdbus_conn *kdbus_conn_unref(struct kdbus_conn *conn);
 int kdbus_conn_disconnect(struct kdbus_conn *conn, bool ensure_queue_empty);
 bool kdbus_conn_active(const struct kdbus_conn *conn);
-struct kdbus_conn *kdbus_conn_find_peer(struct kdbus_conn *conn_src,
-                                       u64 id);
 
 int kdbus_cmd_msg_recv(struct kdbus_conn *conn,
                       struct kdbus_cmd_recv *recv);