Skip to content

Commit 985f842

Browse files
kltsengAnas Nashif
authored andcommitted
samples: drivers: change hard-coded device name
Change to use the device name defined by driver's Kconfig for device binding, instead of hard-coding it which is not portable. Jira: ZEP-1764 Change-Id: I0dc9aa2cdf426af71f1ed6dcef1ec7cec19f4c3e Signed-off-by: Kuo-Lang Tseng <[email protected]> (cherry picked from commit e90aa43)
1 parent c594083 commit 985f842

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

samples/drivers/aio_comparator/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static void cb(void *param)
5252
struct device *aio_cmp_dev;
5353
struct cb_data_t *p = (struct cb_data_t *)param;
5454

55-
aio_cmp_dev = device_get_binding("AIO_CMP_0");
55+
aio_cmp_dev = device_get_binding(CONFIG_AIO_COMPARATOR_0_NAME);
5656

5757
printf("*** %s triggered %s.\n", p->name,
5858
(p->pol == AIO_CMP_POL_RISE) ? "rising" : "falling");
@@ -72,7 +72,7 @@ void main(void)
7272
int i, ret;
7373
int cnt = 0;
7474

75-
aio_cmp_dev = device_get_binding("AIO_CMP_0");
75+
aio_cmp_dev = device_get_binding(CONFIG_AIO_COMPARATOR_0_NAME);
7676
if (!aio_cmp_dev) {
7777
printf("AIO device driver not found\n");
7878
return;

samples/drivers/soc_flash_nrf5/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void main(void)
3535
printf("\nNordic nRF5 Flash Testing\n");
3636
printf("=========================\n");
3737

38-
flash_dev = device_get_binding("NRF5_FLASH");
38+
flash_dev = device_get_binding(CONFIG_SOC_FLASH_NRF5_DEV_NAME);
3939

4040
if (!flash_dev) {
4141
printf("Nordic nRF5 flash driver was not found!\n");

samples/drivers/spi_flash/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void main(void)
2323
printf("\nW25QXXDV SPI flash testing\n");
2424
printf("==========================\n");
2525

26-
flash_dev = device_get_binding("W25QXXDV");
26+
flash_dev = device_get_binding(CONFIG_SPI_FLASH_W25QXXDV_DRV_NAME);
2727

2828
if (!flash_dev) {
2929
printf("SPI flash driver was not found!\n");

samples/drivers/spi_fujitsu_fram/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int read_bytes(struct device *dev, uint16_t addr,
111111
void main(void)
112112
{
113113
struct spi_config config = { 0 };
114-
struct device *spi_mst_1 = device_get_binding("SPI_1");
114+
struct device *spi_mst_1 = device_get_binding(CONFIG_SPI_1_NAME);
115115
int err;
116116

117117
printk("fujitsu FRAM example application\n");

0 commit comments

Comments
 (0)