samples, tests: cleanup void main usage.

Some samples, tests got missed in the switch from void main() to
int main().  Cleanup those samples/tests to use int main().

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
This commit is contained in:
Kumar Gala 2023-04-28 09:27:46 -05:00 committed by Carles Cufí
parent e1fabfa9a4
commit 340ed20c12
10 changed files with 49 additions and 29 deletions

View file

@ -160,7 +160,7 @@ static void init_bufs(void)
}
}
void main(void)
int main(void)
{
int err;
struct bt_le_ext_adv *pawr_adv;
@ -173,38 +173,40 @@ void main(void)
err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
return 0;
}
/* Create a non-connectable non-scannable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN_NAME, &adv_cb, &pawr_adv);
if (err) {
printk("Failed to create advertising set (err %d)\n", err);
return;
return 0;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(pawr_adv, &per_adv_params);
if (err) {
printk("Failed to set periodic advertising parameters (err %d)\n", err);
return;
return 0;
}
/* Enable Periodic Advertising */
err = bt_le_per_adv_start(pawr_adv);
if (err) {
printk("Failed to enable periodic advertising (err %d)\n", err);
return;
return 0;
}
printk("Start Periodic Advertising\n");
err = bt_le_ext_adv_start(pawr_adv, BT_LE_EXT_ADV_START_DEFAULT);
if (err) {
printk("Failed to start extended advertising (err %d)\n", err);
return;
return 0;
}
while (true) {
k_sleep(K_SECONDS(1));
}
return 0;
}

View file

@ -247,7 +247,7 @@ struct pawr_timing {
static uint8_t num_synced;
void main(void)
int main(void)
{
int err;
struct bt_le_ext_adv *pawr_adv;
@ -263,42 +263,42 @@ void main(void)
err = bt_enable(NULL);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
return 0;
}
/* Create a non-connectable non-scannable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, &adv_cb, &pawr_adv);
if (err) {
printk("Failed to create advertising set (err %d)\n", err);
return;
return 0;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(pawr_adv, &per_adv_params);
if (err) {
printk("Failed to set periodic advertising parameters (err %d)\n", err);
return;
return 0;
}
/* Enable Periodic Advertising */
err = bt_le_per_adv_start(pawr_adv);
if (err) {
printk("Failed to enable periodic advertising (err %d)\n", err);
return;
return 0;
}
printk("Start Periodic Advertising\n");
err = bt_le_ext_adv_start(pawr_adv, BT_LE_EXT_ADV_START_DEFAULT);
if (err) {
printk("Failed to start extended advertising (err %d)\n", err);
return;
return 0;
}
while (num_synced < MAX_SYNCS) {
err = bt_le_scan_start(BT_LE_SCAN_PASSIVE, device_found);
if (err) {
printk("Scanning failed to start (err %d)\n", err);
return;
return 0;
}
printk("Scanning successfully started\n");
@ -368,7 +368,7 @@ void main(void)
disconnect:
err = bt_conn_disconnect(default_conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
if (err) {
return;
return 0;
}
k_sem_take(&sem_disconnected, K_FOREVER);
@ -379,4 +379,6 @@ disconnect:
while (true) {
k_sleep(K_SECONDS(1));
}
return 0;
}

View file

@ -195,7 +195,7 @@ BT_CONN_CB_DEFINE(conn_cb) = {
.disconnected = disconnected,
};
void main(void)
int main(void)
{
struct bt_le_per_adv_sync_transfer_param past_param;
int err;
@ -206,7 +206,7 @@ void main(void)
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
return 0;
}
bt_le_per_adv_sync_cb_register(&sync_callbacks);
@ -218,7 +218,7 @@ void main(void)
if (err) {
printk("PAST subscribe failed (err %d)\n", err);
return;
return 0;
}
do {
@ -231,7 +231,7 @@ void main(void)
if (err && err != -EALREADY) {
printk("Advertising failed to start (err %d)\n", err);
return;
return 0;
}
printk("Waiting for periodic sync...\n");
@ -248,9 +248,11 @@ void main(void)
if (err) {
printk("failed (err %d)\n", err);
return;
return 0;
}
printk("Periodic sync lost.\n");
} while (true);
return 0;
}

View file

@ -8,18 +8,18 @@
#include <zephyr/device.h>
#include <zephyr/drivers/uart.h>
void main(void)
int main(void)
{
char data;
const struct device *uart0 = DEVICE_DT_GET(DT_NODELABEL(pio1_uart0));
const struct device *uart1 = DEVICE_DT_GET(DT_NODELABEL(pio1_uart1));
if (!device_is_ready(uart0)) {
return;
return 0;
}
if (!device_is_ready(uart1)) {
return;
return 0;
}
while (1) {
@ -31,4 +31,6 @@ void main(void)
uart_poll_out(uart1, data);
}
}
return 0;
}

View file

@ -313,7 +313,7 @@ bool port1_policy_check(const struct device *dev,
}
/* usbc.rst check end */
void main(void)
int main(void)
{
const struct device *usbc_port1;
@ -321,7 +321,7 @@ void main(void)
usbc_port1 = DEVICE_DT_GET(PORT1_NODE);
if (!device_is_ready(usbc_port1)) {
LOG_ERR("PORT1 device not ready");
return;
return 0;
}
/* usbc.rst register start */
@ -389,4 +389,6 @@ void main(void)
/* Arbitrary delay */
k_msleep(10);
}
return 0;
}

View file

@ -10,7 +10,7 @@
#include <zephyr/kernel.h>
#include <stdio.h>
void main(void)
int main(void)
{
printf("Waiting...\n");
k_sleep(K_SECONDS(1));
@ -22,4 +22,6 @@ void main(void)
} else {
printf("Error, failed to set boot mode: %d\n", rc);
}
return 0;
}

View file

@ -45,7 +45,9 @@ static struct bst_test_list *install(struct bst_test_list *tests)
bst_test_install_t test_installers[] = {install, NULL};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -421,7 +421,9 @@ bst_test_install_t test_installers[] = {
NULL
};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -280,7 +280,9 @@ static struct bst_test_list *install(struct bst_test_list *tests)
bst_test_install_t test_installers[] = {install, NULL};
void main(void)
int main(void)
{
bst_main();
return 0;
}

View file

@ -673,7 +673,9 @@ static struct bst_test_list *install(struct bst_test_list *tests)
bst_test_install_t test_installers[] = {install, NULL};
void main(void)
int main(void)
{
bst_main();
return 0;
}