samples, tests: Switch main return type from void to int

This applies the coccinelle script to another set of files:

   samples/bluetooth/bthome_sensor_template/src/main.c
   samples/boards/stm32/power_mgmt/standby_shutdown/src/main.c
   samples/drivers/smbus/src/main.c
   samples/drivers/virtualization/ivshmem/doorbell/src/ivshmem.c
   samples/fuel_gauge/max17048/src/main.c
   samples/hello_world/src/main.c
   samples/sensor/proximity_polling/src/main.c
   samples/subsys/logging/ble_backend/src/main.c
   tests/drivers/build_all/mfd/src/main.c

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2023-04-13 08:12:31 -07:00 committed by Stephanos Ioannidis
parent 7d4a7d79a8
commit 1d5e644d12
9 changed files with 26 additions and 18 deletions

View file

@ -51,7 +51,7 @@ static void bt_ready(int err)
}
}
void main(void)
int main(void)
{
int err;
int temp = 0;
@ -62,7 +62,7 @@ void main(void)
err = bt_enable(bt_ready);
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
return 0;
}
for (;;) {
@ -78,4 +78,5 @@ void main(void)
}
k_sleep(K_MSEC(BT_GAP_ADV_SLOW_INT_MIN));
}
return 0;
}

View file

@ -88,7 +88,7 @@ void thread_shutdown_standby_mode(void)
K_THREAD_DEFINE(thread_shutdown_standby_mode_id, STACKSIZE, thread_shutdown_standby_mode,
NULL, NULL, NULL, PRIORITY, 0, 0);
void main(void)
int main(void)
{
int ret;
uint32_t cause;
@ -117,14 +117,14 @@ void main(void)
if (!gpio_is_ready_dt(&button)) {
printk("Error: button device %s is not ready\n",
button.port->name);
return;
return 0;
}
ret = gpio_pin_configure_dt(&button, GPIO_INPUT);
if (ret != 0) {
printk("Error %d: failed to configure %s pin %d\n",
ret, button.port->name, button.pin);
return;
return 0;
}
ret = gpio_pin_interrupt_configure_dt(&button,
@ -132,7 +132,7 @@ void main(void)
if (ret != 0) {
printk("Error %d: failed to configure interrupt on %s pin %d\n",
ret, button.port->name, button.pin);
return;
return 0;
}
gpio_init_callback(&button_cb_data, button_pressed, BIT(button.pin));
@ -152,4 +152,5 @@ void main(void)
led_is_on = !led_is_on;
}
return 0;
}

View file

@ -6,7 +6,8 @@
#include <zephyr/kernel.h>
void main(void)
int main(void)
{
printk("Start SMBUS shell sample %s\n", CONFIG_BOARD);
return 0;
}

View file

@ -266,7 +266,7 @@ static void ivshmem_sample_userspace_doorbell(void)
}
#endif /* CONFIG_USERSPACE */
void main(void)
int main(void)
{
#ifdef CONFIG_USERSPACE
ivshmem_sample_userspace_doorbell();
@ -275,4 +275,5 @@ void main(void)
#endif
/* if the code reaches here, it means the setup/loop has failed */
ivshmem_sample_failed();
return 0;
}

View file

@ -11,21 +11,21 @@
void main(void)
int main(void)
{
const struct device *const dev = DEVICE_DT_GET_ANY(maxim_max17048);
int ret = 0;
if (dev == NULL) {
printk("\nError: no device found.\n");
return;
return 0;
}
if (!device_is_ready(dev)) {
printk("\nError: Device \"%s\" is not ready; "
"check the driver initialization logs for errors.\n",
dev->name);
return;
return 0;
}
@ -33,7 +33,7 @@ void main(void)
printk("Found device \"%s\", getting fuel gauge data\n", dev->name);
if (dev == NULL) {
return;
return 0;
}
while (1) {
@ -101,4 +101,5 @@ void main(void)
k_sleep(K_MSEC(5000));
}
return 0;
}

View file

@ -6,8 +6,8 @@
#include <zephyr/kernel.h>
void main(void)
int main(void)
{
printk("Hello World! %s\n", CONFIG_BOARD);
return;
return 0;
}

View file

@ -38,7 +38,7 @@ void print_prox_data(void)
}
}
void main(void)
int main(void)
{
printk("Proximity sensor sample application\n");
printk("Found %d proximity sensor(s): ", ARRAY_SIZE(prox_devices));
@ -51,4 +51,5 @@ void main(void)
k_sleep(K_MSEC(2000));
print_prox_data();
}
return 0;
}

View file

@ -75,7 +75,7 @@ void backend_ble_hook(bool status, void *ctx)
}
void main(void)
int main(void)
{
int err;
@ -84,7 +84,7 @@ void main(void)
err = bt_enable(NULL);
if (err) {
LOG_ERR("Bluetooth init failed (err %d)", err);
return;
return 0;
}
bt_conn_auth_cb_register(&auth_cb_display);
@ -97,4 +97,5 @@ void main(void)
LOG_INF("Uptime %d secs", uptime_secs);
k_sleep(K_MSEC(1000));
}
return 0;
}

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
void main(void)
int main(void)
{
return 0;
}