drivers: virt: ivshmem: Convert to use DEVICE_DT_GET_ONE
Replace Kconfig (IVSHMEM_DEV_NAME) based named device_get_binding with DEVICE_DT_GET_ONE. Since there is only one driver for ivshmem use the qemu,ivshmem for that. Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
parent
e59ee182f8
commit
ce2635f410
3 changed files with 5 additions and 9 deletions
|
@ -22,10 +22,6 @@ config IVSHMEM
|
||||||
|
|
||||||
if IVSHMEM
|
if IVSHMEM
|
||||||
|
|
||||||
config IVSHMEM_DEV_NAME
|
|
||||||
string
|
|
||||||
default "IVSHMEM"
|
|
||||||
|
|
||||||
module = IVSHMEM
|
module = IVSHMEM
|
||||||
module-str = ivshmem
|
module-str = ivshmem
|
||||||
source "subsys/logging/Kconfig.template.log_config"
|
source "subsys/logging/Kconfig.template.log_config"
|
||||||
|
|
|
@ -49,9 +49,9 @@ static void doorbell_notification_thread(const struct shell *shell)
|
||||||
static bool get_ivshmem(const struct shell *shell)
|
static bool get_ivshmem(const struct shell *shell)
|
||||||
{
|
{
|
||||||
if (ivshmem == NULL) {
|
if (ivshmem == NULL) {
|
||||||
ivshmem = device_get_binding(CONFIG_IVSHMEM_DEV_NAME);
|
ivshmem = DEVICE_DT_GET_ONE(qemu_ivshmem);
|
||||||
if (!ivshmem) {
|
if (!device_is_ready(ivshmem)) {
|
||||||
shell_error(shell, "IVshmem device cannot be found");
|
shell_error(shell, "IVshmem device is not ready");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@ void test_ivshmem_plain(void)
|
||||||
uint16_t vectors;
|
uint16_t vectors;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ivshmem = device_get_binding(CONFIG_IVSHMEM_DEV_NAME);
|
ivshmem = DEVICE_DT_GET_ONE(qemu_ivshmem);
|
||||||
zassert_not_null(ivshmem, "Could not get ivshmem device");
|
zassert_true(device_is_ready(ivshmem), "ivshmem device is not ready");
|
||||||
|
|
||||||
size = ivshmem_get_mem(ivshmem, &mem);
|
size = ivshmem_get_mem(ivshmem, &mem);
|
||||||
zassert_not_equal(size, 0, "Size cannot not be 0");
|
zassert_not_equal(size, 0, "Size cannot not be 0");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue