Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1857595ybk; Thu, 21 May 2020 17:35:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8ymOqkQgGDl0RXjWEGrQIA4fJ/H0EiSK5NPpIel4D8QBkqYK/FFfXBz0XLd7Bv/CEo7Za X-Received: by 2002:a17:906:7a4f:: with SMTP id i15mr6116679ejo.71.1590107749944; Thu, 21 May 2020 17:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590107749; cv=none; d=google.com; s=arc-20160816; b=x4Chzr50TIFNND74fYbIrZU+xBDWOZfYgmjBFuWgYCHsIYBwrdygTEkl9IVFi/d32Q Ew49fWVBn+oeZlWMh45xQszkUf5RDKH1ZxO2Esg0FaYmlX5TxKd2P3kCqz1y+KVegn2m BnQSi7lx4CYBd59BocXfqQiveiilPKxmTkaE4H01GlQnx+k3zvLDb4LxxJ9NLd4fUaO4 +LPpYViR5oSCPmA37snNDiWDwba8hJw+MemGKepDu/D1BKkkAQz9YUsANNu/Ps+vW6gj vMOYLRIGubY5sdD/UI6Bplq8GyYzF9UmnrEb/WJhdqHwvMh0l01f61lMs2yXPuWz5UCY aM3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=tlHm+vDU74vAAH8pFnD8C2MrPUQrQQ9/2ZfjXRLwJmk=; b=QhLIUvEhL8nk61nTqi376MbdwhOfd2m7r/m21JED47tb3jzYvCs5DCoAoUhwkwI+G1 xixQbCrGzuagVsOML2V9w/SrNu4anPa/lbTPpBhbicOCB1Es9hGiXOuESdRbIwsbp0D/ perzUt5DGC8+WiFSHjSr7GHddKChNuhhAgtQ+9BA4UW53eYmQZT+m7+VB1GT1oSdiOtV HWLGDIz9FSSMZg10O3PWXl4Yxh52zuRUgpD2oL8eT8x5SQyDEXRVy+Wo/LZZTZoreaZ6 UI6Xmn6EGhPeJCupFrvsZ9PN/NpZILir3YB9XUxoIJeXO3iqYOgIXSastaPAF2KRP+W4 2Cyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si4178997edg.459.2020.05.21.17.35.14; Thu, 21 May 2020 17:35:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbgEVAfG (ORCPT + 99 others); Thu, 21 May 2020 20:35:06 -0400 Received: from mga14.intel.com ([192.55.52.115]:55687 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726966AbgEVAfG (ORCPT ); Thu, 21 May 2020 20:35:06 -0400 IronPort-SDR: GxiEKg4ijquzSC6U1OIbc37JrHQJukVQkFGpiPPYeWKcO5KLZlpO6YkHexT2zdjFSEv9HiBr/u oy7EIK62TjuA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2020 17:35:05 -0700 IronPort-SDR: vORi1FVuDSEANsXk90qM+BLfdumgFm0bZIFj0JAcaMIW46bq5M+cq7/do9r2YFEb1uNBf1kJvf CW6s8YisxE3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,419,1583222400"; d="scan'208";a="300961681" Received: from nsalivat-mobl.amr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.254.98.52]) by orsmga008.jf.intel.com with ESMTP; 21 May 2020 17:35:05 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ 06/10] mesh: Create a queue of pending requests in mesh_init() Date: Thu, 21 May 2020 17:34:57 -0700 Message-Id: <20200522003501.106165-7-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522003501.106165-1-inga.stotland@intel.com> References: <20200522003501.106165-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This removes unnnecessary checking for queue existence every time either Attach(), Create() or Import() methods are called. --- mesh/mesh.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/mesh/mesh.c b/mesh/mesh.c index 8bd7b3978..4a3ba171d 100644 --- a/mesh/mesh.c +++ b/mesh/mesh.c @@ -297,6 +297,8 @@ bool mesh_init(const char *config_dir, const char *mesh_conf_fname, mesh_io_get_caps(mesh.io, &caps); mesh.max_filters = caps.max_num_filters; + pending_queue = l_queue_new(); + return true; } @@ -652,9 +654,6 @@ static struct l_dbus_message *attach_call(struct l_dbus *dbus, sender = l_dbus_message_get_sender(msg); pending_msg = l_dbus_message_ref(msg); - if (!pending_queue) - pending_queue = l_queue_new(); - l_queue_push_tail(pending_queue, pending_msg); status = node_attach(app_path, sender, token, attach_ready_cb, @@ -760,10 +759,8 @@ static struct l_dbus_message *create_network_call(struct l_dbus *dbus, "Bad device UUID"); sender = l_dbus_message_get_sender(msg); - pending_msg = l_dbus_message_ref(msg); - if (!pending_queue) - pending_queue = l_queue_new(); + pending_msg = l_dbus_message_ref(msg); l_queue_push_tail(pending_queue, pending_msg); node_create(app_path, sender, uuid, create_node_ready_cb, @@ -851,11 +848,8 @@ static struct l_dbus_message *import_call(struct l_dbus *dbus, "Bad address"); sender = l_dbus_message_get_sender(msg); - pending_msg = l_dbus_message_ref(msg); - - if (!pending_queue) - pending_queue = l_queue_new(); + pending_msg = l_dbus_message_ref(msg); l_queue_push_tail(pending_queue, pending_msg); if (!node_import(app_path, sender, uuid, dev_key, net_key, net_idx, -- 2.26.2