static struct discovery_client *discovery_complete(struct btd_adapter *adapter,
						uint8_t status)
{
	struct discovery_client *client = adapter->client;
	DBusMessage *reply;

	if (!client)
		return NULL;

	adapter->client = NULL;

	if (!client->msg)
		return client;

	if (!status) {
		g_dbus_send_reply(dbus_conn, client->msg, DBUS_TYPE_INVALID);
	} else  {
		reply = btd_error_busy(client->msg);
		g_dbus_send_message(dbus_conn, reply);
	}

	dbus_message_unref(client->msg);
	client->msg = NULL;

	return client;
}
static struct discovery_client *discovery_complete(struct btd_adapter *adapter,
						uint8_t status)
{
	struct discovery_client *client = adapter->client;
	DBusMessage *reply;

	if (!client)
		return NULL;

	adapter->client = NULL;

	if (!client->msg)
		return client;

	if (!status) {
		g_dbus_send_reply(dbus_conn, client->msg, DBUS_TYPE_INVALID);
	} else  {
		reply = btd_error_busy(client->msg);
		g_dbus_send_message(dbus_conn, reply);
	}

	dbus_message_unref(client->msg);
	client->msg = NULL;

	return client;
}