Skip to content

Commit b36e67f

Browse files
committed
devices: use device_name_get
Since struct device name field is now optional, use device_name_get. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent ad0a0c6 commit b36e67f

File tree

352 files changed

+1025
-999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+1025
-999
lines changed

boards/arm/nrf9160dk_nrf52840/board.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int reset_pin_configure(void)
124124
gpio_dt_flags_t flags = GET_FLAGS(reset_input, gpios, 0);
125125

126126
if (!device_is_ready(gpio)) {
127-
LOG_ERR("%s is not ready", gpio->name);
127+
LOG_ERR("%s is not ready", device_name_get(gpio));
128128
return -ENODEV;
129129
}
130130

@@ -168,7 +168,7 @@ static int init(const struct device *dev)
168168
gpio_flags_t flags = cfg->flags;
169169

170170
if (!device_is_ready(cfg->gpio)) {
171-
LOG_ERR("%s is not ready", cfg->gpio->name);
171+
LOG_ERR("%s is not ready", device_name_get(cfg->gpio));
172172
return -ENODEV;
173173
}
174174

boards/arm/pinetime_devkit0/key_out.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ static int pinetime_key_out_init(const struct device *arg)
2222

2323
if (!device_is_ready(key_out.port)) {
2424
LOG_ERR("key out gpio device %s is not ready",
25-
key_out.port->name);
25+
device_name_get(key_out.port));
2626
return -ENODEV;
2727
}
2828

2929
ret = gpio_pin_configure_dt(&key_out, GPIO_OUTPUT_ACTIVE);
3030
if (ret != 0) {
3131
LOG_ERR("failed to configure %s pin %d (err %d)",
32-
key_out.port->name, key_out.pin, ret);
32+
device_name_get(key_out.port), key_out.pin, ret);
3333
return ret;
3434
}
3535

doc/kernel/services/threads/workqueue.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ unchanged and the associated error message will not be printed.
301301
{
302302
struct device_info *the_device =
303303
CONTAINER_OF(item, struct device_info, work);
304-
printk("Got error on device %s\n", the_device->name);
304+
printk("Got error on device %s\n", device_name_get(the_device));
305305
}
306306
307307
/* initialize name info for a device */

doc/services/smf/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,22 +422,22 @@ Code::
422422

423423
if (!device_is_ready(button.port)) {
424424
printk("Error: button device %s is not ready\n",
425-
button.port->name);
425+
device_name_get(button.port));
426426
return;
427427
}
428428

429429
ret = gpio_pin_configure_dt(&button, GPIO_INPUT);
430430
if (ret != 0) {
431431
printk("Error %d: failed to configure %s pin %d\n",
432-
ret, button.port->name, button.pin);
432+
ret, device_name_get(button.port), button.pin);
433433
return;
434434
}
435435

436436
ret = gpio_pin_interrupt_configure_dt(&button,
437437
GPIO_INT_EDGE_TO_ACTIVE);
438438
if (ret != 0) {
439439
printk("Error %d: failed to configure interrupt on %s pin %d\n",
440-
ret, button.port->name, button.pin);
440+
ret, device_name_get(button.port), button.pin);
441441
return;
442442
}
443443

drivers/adc/adc_ads1119.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static int ads1119_init(const struct device *dev)
458458

459459
rc = ads1119_read_reg(dev, ADS1119_REG_STATUS, &status);
460460
if (rc) {
461-
LOG_ERR("Could not get %s status", dev->name);
461+
LOG_ERR("Could not get %s status", device_name_get(dev));
462462
return rc;
463463
}
464464

drivers/adc/adc_ads1x1x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static int ads1x1x_init(const struct device *dev)
554554
k_sem_init(&data->acq_sem, 0, 1);
555555

556556
if (!device_is_ready(config->bus.bus)) {
557-
LOG_ERR("I2C bus %s not ready", config->bus.bus->name);
557+
LOG_ERR("I2C bus %s not ready", device_name_get(config->bus.bus));
558558
return -ENODEV;
559559
}
560560

drivers/adc/adc_lmp90xxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ static int lmp90xxx_init(const struct device *dev)
941941
data->ura = LMP90XXX_INVALID_URA;
942942

943943
if (!spi_is_ready(&config->bus)) {
944-
LOG_ERR("SPI bus %s not ready", config->bus.bus->name);
944+
LOG_ERR("SPI bus %s not ready", device_name_get(config->bus.bus));
945945
return -ENODEV;
946946
}
947947

drivers/adc/adc_nrfx_adc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int init_adc(const struct device *dev)
268268

269269
if (result != NRFX_SUCCESS) {
270270
LOG_ERR("Failed to initialize device: %s",
271-
dev->name);
271+
device_name_get(dev));
272272
return -EBUSY;
273273
}
274274

drivers/adc/adc_shell.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static struct adc_hdl {
112112
static struct adc_hdl *get_adc(const char *device_label)
113113
{
114114
for (int i = 0; i < ARRAY_SIZE(adc_list); i++) {
115-
if (!strcmp(device_label, adc_list[i].dev->name)) {
115+
if (!strcmp(device_label, device_name_get(adc_list[i].dev))) {
116116
return &adc_list[i];
117117
}
118118
}
@@ -347,7 +347,7 @@ static int cmd_adc_print(const struct shell *shell, size_t argc, char **argv)
347347
"Acquisition Time: %u\n"
348348
"Channel ID: %u\n"
349349
"Resolution: %u",
350-
adc->dev->name,
350+
device_name_get(adc->dev),
351351
chosen_gain,
352352
chosen_reference,
353353
adc->channel_config.acquisition_time,
@@ -408,7 +408,7 @@ static void cmd_adc_dev_get(size_t idx, struct shell_static_entry *entry)
408408
{
409409
/* -1 because the last element in the list is a "list terminator" */
410410
if (idx < ARRAY_SIZE(adc_list) - 1) {
411-
entry->syntax = adc_list[idx].dev->name;
411+
entry->syntax = device_name_get(adc_list[idx].dev);
412412
entry->handler = NULL;
413413
entry->subcmd = &sub_adc_cmds;
414414
entry->help = "Select subcommand for ADC property label.\n";

drivers/adc/adc_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ static void adc_stm32_isr(const struct device *dev)
939939

940940
adc_context_on_sampling_done(&data->ctx, dev);
941941

942-
LOG_DBG("%s ISR triggered.", dev->name);
942+
LOG_DBG("%s ISR triggered.", device_name_get(dev));
943943
}
944944

945945
static int adc_stm32_read(const struct device *dev,

0 commit comments

Comments
 (0)