#3436 closed enhancement (fixed)

Remove clock driver Clock_driver_support_shutdown_hardware() hook

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: dev Version: 5
Severity: normal Keywords: qualification
Cc: Blocked By:
Blocking:

Description

Most applications use a clock driver and most BSPs use the clock driver framework provided by clockimpl.h. This framework offers a Clock_driver_support_shutdown_hardware() hook which is used like this.

#ifdef Clock_driver_support_shutdown_hardware
/**
 *  @brief Clock_exit
 *
 *  This routine allows the clock driver to exit by masking the interrupt and
 *  disabling the clock's counter.
 */
void Clock_exit( void )
{
  Clock_driver_support_shutdown_hardware();

  /* do not restore old vector */
}
#endif
...
#ifdef Clock_driver_support_shutdown_hardware
  atexit( Clock_exit );
#endif

The aim is to stop clock tick interrupts at some late point in the exit() procedure.

The use of atexit() pulls in malloc() which pulls in errno. It is incompatible with the intention of the CONFIGURE_DISABLE_NEWLIB_REENTRANCY configuration option.

The exit() function must be called from thread context, so accompanied clock tick interrupts should cause no harm. On the contrary, someone may assume a normal operating system operation, e.g. working timeouts.

Remove the superfluous Clock_driver_support_shutdown_hardware() hook.

Change History (4)

comment:1 Changed on 06/29/18 at 08:16:31 by Sebastian Huber <sebastian.huber@…>

In c765aa0/rtems-docs:

bsp-howto: Mention clock driver hook removal

Update #3436.

comment:2 Changed on 06/29/18 at 09:53:27 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In 7ee59313/rtems:

Remove Clock_driver_support_shutdown_hardware()

The aim of this clock driver hook was to stop clock tick interrupts at
some late point in the exit() procedure.

The use of atexit() pulls in malloc() which pulls in errno. It is
incompatible with the intention of the
CONFIGURE_DISABLE_NEWLIB_REENTRANCY configuration option.

The exit() function must be called from thread context, so accompanied
clock tick interrupts should cause no harm. On the contrary, someone
may assume a normal operating system operation, e.g. working timeouts.

Remove the Clock_driver_support_shutdown_hardware() clock driver hook.

Close #3436.

comment:3 Changed on 12/11/19 at 08:06:32 by Sebastian Huber <sebastian.huber@…>

In a6b2080/rtems:

clock: Remove Clock_exit() from API

This function is no longer supported by the standard clock driver
implementation (clockimpl.h).

Update #3436.

comment:4 Changed on 06/23/21 at 07:16:03 by Sebastian Huber

Keywords: qualification added
Note: See TracTickets for help on using tickets.