boards/boardctl: Uninitialize cdcacm by instance number, not direct pointer

When uninitializing cdcacm via a boardctl ioctl, use the instance number
instead of direct pointer to the driver. The reason for this is, that in
CONFIG_BUILD_KERNEL the applications sercon and serdis can't store the pointer;
they are separate processes which get killed.

The cdcacm driver will search up the driver from the file system when the direct
pointer is not given.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen 2025-09-14 10:03:06 +03:00 committed by Xiang Xiao
parent 2435caa925
commit f66d4a001c

View file

@ -133,7 +133,6 @@ static inline int
case BOARDIOC_USBDEV_CONNECT: /* Connect the CDC/ACM device */
#ifndef CONFIG_CDCACM_COMPOSITE
{
DEBUGASSERT(ctrl->handle != NULL);
ret = cdcacm_initialize(ctrl->instance, ctrl->handle);
}
#endif
@ -141,8 +140,7 @@ static inline int
case BOARDIOC_USBDEV_DISCONNECT: /* Disconnect the CDC/ACM device */
{
DEBUGASSERT(ctrl->handle != NULL && *ctrl->handle != NULL);
cdcacm_uninitialize(*ctrl->handle);
ret = cdcacm_uninitialize_instance(ctrl->instance, NULL);
}
break;