Received: by 2002:ab3:72d2:0:b0:1f6:158b:59e2 with SMTP id p18csp16631ltf; Wed, 5 Oct 2022 14:01:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51MP1rtJt/zI8fZrMNDFBRD1jcOFuRMCGuSiNOS/Eug7QxtUfknaBJb/GWov3x58LkE8MF X-Received: by 2002:a17:907:9711:b0:78b:db86:a92d with SMTP id jg17-20020a170907971100b0078bdb86a92dmr1201130ejc.107.1665003688972; Wed, 05 Oct 2022 14:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665003688; cv=none; d=google.com; s=arc-20160816; b=EQhNg/x7RHK9N2H9Jo2XW46hiTbO7hwao7K6SSF6Rp0SyznTo0Cq5xfLaSKMTUTYuF RfFekZI4fnzzixZhalOVJsVG4TXVdMv/lTZ4JJKrLrPjimiWgiQZjvfp/yPCNJVZ6CSw /L/8Jb+1lztP3Pl8Ic19r4TjUeiXX/Y2FUgnipuE80UH9vpvt1Dfk1Vi+mJ21acnDQdI Gdf00q+SHEH/LG6Ego2N0/5BR86qqBaO5Z6o9tn1aB9mwHDU5/xPIf/PgjovYg183xLm CJY4QpWj/JARlkcyRr8zWy8XCGplxRlyMnYiK8MBdtOw2+vjHDK2yQ6F8NVgj9D/OL2Z vL/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vgP5SHVdNP80C3nL9FTSu1fya6GCMP2Z5x77kDUmSWM=; b=hHTHrRi4E22Pznioy7n4dQCY+3GpqDKY1rKoTlgdg5xyi+c8Hr/uSWiMj/y6iJCNQY pXXfujSLYlrZ0JXlWR32HRwqv/CPDJX+UnWvGH6OCi6xwksG8iFSyrU1S/V0lBajshB7 5Cfq7e9JqYyHV7eUW4QZCIhZapOUcub7fZWt/P2Wmj5UkwHuZKOd7jPUpnygeXHKZVIs bqI2FdHhTbZZ4inrP5hXizNQnI/BHx28QnDFUmQvWNjhazp8fuX+FOCPlH6h7MYkxJ3M 3dAzmi5Q6BBaOBomG1t3bX/epgU5B8hbknJl3ZpIVt/vQbUIWkevQNsx0gPQggKNwyDO 3otw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=itQVh6F5; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a509502000000b004485cce26d6si12620853eda.190.2022.10.05.13.59.46; Wed, 05 Oct 2022 14:01:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=itQVh6F5; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbiJEUnR (ORCPT + 99 others); Wed, 5 Oct 2022 16:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbiJEUnQ (ORCPT ); Wed, 5 Oct 2022 16:43:16 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE26B6AA0F for ; Wed, 5 Oct 2022 13:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665002595; x=1696538595; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JAmhBbgVnN+P9UT9XPZJ/VWEAIUVj6QteoZVuMbxOL8=; b=itQVh6F5GtGbXCe66Jb0eJYqZL2+JHb/qVqII8O5rSVKiJPK06W1EHeb echNzym4Pc/je3zoU79RA0n2l3E3TpzfO0RVGgiXDbMVdbYjk/dl6Be+0 nbcjAEZjU6AjJue5h6aABP9ow+1r3yXzPwf28UvOEPLCarxiXx/WsZ/Y6 sIwMXSA2NU9A4GswS8npN5PhNLHPQ8qgLd9QaqPw4DTy7rG/RcHEmLL2T DK4udz57btBfu7wl10pGz/IJ6ydZFHlBPejyQCa9eqnR/PEDjiyBzo5rm DivTQX51sUmX0CodhRWYZ/dqbvHYQffTQqU44aNToEeCtYtLKvcUj9m/T Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="300866593" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="300866593" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 13:43:15 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10491"; a="575559238" X-IronPort-AV: E=Sophos;i="5.95,161,1661842800"; d="scan'208";a="575559238" Received: from orparaju-mobl2.amr.corp.intel.com (HELO istotlan-mobl1.intel.com) ([10.212.143.27]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2022 13:43:15 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, Inga Stotland Subject: [PATCH BlueZ] mesh: Fix mesh to work with MESH_IO_TYPE_UNIT_TEST Date: Wed, 5 Oct 2022 13:43:09 -0700 Message-Id: <20221005204309.65983-1-inga.stotland@intel.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This fixes mesh io flow for MESH_IO_TYPE_UNIT_TEST which got broken after: commit 9966cb8b6999a5f54fc13acbd7e1526512a84342 ("mesh: Add new kernel MGMT based IO transport") --- mesh/main.c | 8 +++++++- mesh/mesh-io.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mesh/main.c b/mesh/main.c index 619b17d88..3bca020a0 100644 --- a/mesh/main.c +++ b/mesh/main.c @@ -137,8 +137,14 @@ static void signal_handler(uint32_t signo, void *user_data) return; l_info("Terminating"); + mesh_cleanup(true); - l_timeout_create(1, kill_to, NULL, NULL); + + if (io_type != MESH_IO_TYPE_UNIT_TEST) + l_timeout_create(1, kill_to, NULL, NULL); + else + l_main_quit(); + terminated = true; } diff --git a/mesh/mesh-io.c b/mesh/mesh-io.c index ae6a82ee4..233f4b328 100644 --- a/mesh/mesh-io.c +++ b/mesh/mesh-io.c @@ -151,7 +151,7 @@ struct mesh_io *mesh_io_new(enum mesh_io_type type, void *opts, default_io->api = api; - if (!api->init(default_io, &default_io->favored_index, user_data)) + if (!api->init(default_io, opts, user_data)) goto fail; return default_io; -- 2.37.3