#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:
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 (2)

comment:1 Changed on Jun 29, 2018 at 8:16:31 AM by Sebastian Huber <sebastian.huber@…>

In c765aa0/rtems-docs:

bsp-howto: Mention clock driver hook removal

Update #3436.

comment:2 Changed on Jun 29, 2018 at 9:53:27 AM 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.

Note: See TracTickets for help on using tickets.