[PATCH rtems6 - v1 06/16] Flashdev: Make mutex name more generic

Kinsey Moore kinsey.moore at oarcorp.com
Thu Jan 4 18:55:08 UTC 2024


On Thu, Jan 4, 2024 at 12:35 PM <berndmoessner80 at gmail.com> wrote:

> From: Bernd Moessner <berndmoessner80 at gmail.com>
>
> ---
>  cpukit/dev/flash/flashdev.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/dev/flash/flashdev.c b/cpukit/dev/flash/flashdev.c
> index 8bd3d11246..0020e8d2c1 100644
> --- a/cpukit/dev/flash/flashdev.c
> +++ b/cpukit/dev/flash/flashdev.c
> @@ -34,6 +34,7 @@
>
>  #include <errno.h>
>  #include <fcntl.h>
> +#include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> @@ -490,7 +491,9 @@ static int rtems_flashdev_do_init(
>    void ( *destroy )( rtems_flashdev *flash )
>  )
>  {
> -  rtems_recursive_mutex_init( &flash->mutex, "RTEMS_FLASHDEV Flash" );
> +  char mtx_name[19];
> +  sprintf(mtx_name, "FDEV_MTX_%08x", (unsigned int) flash);
> +  rtems_recursive_mutex_init( &flash->mutex, (const char*) &mtx_name);
>

None of the other uses of mutexes in cpukit differentiate between various
instantiations and the information you've added here is already available
if you know the mutex address and know that it's a flash mutex.

Is there a reason this needs to differentiate between the various instances
where others don't?

Kinsey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20240104/98f97478/attachment-0001.htm>


More information about the devel mailing list