diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2016-06-10 14:59:09 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-06-10 16:32:33 -0700 |
commit | 54131222e6dc3a26de5cb036e599307666e58fd9 (patch) | |
tree | e5e0e0b153b888658267132d486ea1061893502a /drivers/staging/greybus/connection.c | |
parent | 60fb3405c73ea0bbab942c699496123f9e987c04 (diff) |
greybus: connection: Return bool from gb_connection_intf_find()
This is used only to check if an existing connection already uses the
cport_id or not and doesn't really need to return pointer to the
connection.
While at it, also rename it to suit its purpose.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/connection.c')
-rw-r--r-- | drivers/staging/greybus/connection.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 28076d014177..3cfc4dd134d8 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -21,8 +21,7 @@ static DEFINE_MUTEX(gb_connection_mutex); /* Caller holds gb_connection_mutex. */ -static struct gb_connection * -gb_connection_intf_find(struct gb_interface *intf, u16 cport_id) +static bool gb_connection_cport_in_use(struct gb_interface *intf, u16 cport_id) { struct gb_host_device *hd = intf->hd; struct gb_connection *connection; @@ -30,10 +29,10 @@ gb_connection_intf_find(struct gb_interface *intf, u16 cport_id) list_for_each_entry(connection, &hd->connections, hd_links) { if (connection->intf == intf && connection->intf_cport_id == cport_id) - return connection; + return true; } - return NULL; + return false; } static void gb_connection_get(struct gb_connection *connection) @@ -155,7 +154,7 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, mutex_lock(&gb_connection_mutex); - if (intf && gb_connection_intf_find(intf, cport_id)) { + if (intf && gb_connection_cport_in_use(intf, cport_id)) { dev_err(&intf->dev, "cport %u already in use\n", cport_id); ret = -EBUSY; goto err_unlock; |