1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 10:03:50 +01:00

sys/tsrb: fix some style and linter complains

This commit is contained in:
Karl Fessel 2025-10-12 20:34:32 +02:00
parent b04752eb30
commit c06db62666

View File

@ -33,7 +33,7 @@ extern "C" {
#endif #endif
/** /**
* @brief thread-safe ringbuffer struct * @brief thread-safe ringbuffer struct
*/ */
typedef struct tsrb { typedef struct tsrb {
uint8_t *buf; /**< Buffer to operate on. */ uint8_t *buf; /**< Buffer to operate on. */
@ -43,22 +43,22 @@ typedef struct tsrb {
} tsrb_t; } tsrb_t;
/** /**
* @brief Static initializer * @brief Static initializer
* *
* @note The size of the buffer (`sizeof(@p BUF)`) must be a power of two. * @note The size of the buffer (`sizeof(@p BUF)`) must be a power of two.
* *
* @param[in] BUF Buffer to use by tsrb. * @param[in] BUF Buffer to use by tsrb.
*/ */
#define TSRB_INIT(BUF) { (BUF), sizeof (BUF), 0, 0 } #define TSRB_INIT(BUF) { (BUF), sizeof (BUF), 0, 0 }
/** /**
* @brief Initialize a tsrb. * @brief Initialize a tsrb.
* *
* @note The size of the buffer (@p bufsize) must be a power of two. * @note The size of the buffer (@p bufsize) must be a power of two.
* *
* @param[out] rb Datum to initialize. * @param[out] rb Datum to initialize.
* @param[in] buffer Buffer to use by tsrb. * @param[in] buffer Buffer to use by tsrb.
* @param[in] bufsize Size of @p buffer. * @param[in] bufsize Size of @p buffer.
*/ */
static inline void tsrb_init(tsrb_t *rb, uint8_t *buffer, unsigned bufsize) static inline void tsrb_init(tsrb_t *rb, uint8_t *buffer, unsigned bufsize)
{ {
@ -74,8 +74,8 @@ static inline void tsrb_init(tsrb_t *rb, uint8_t *buffer, unsigned bufsize)
} }
/** /**
* @brief Clear a tsrb. * @brief Clear a tsrb.
* @param[out] rb Ringbuffer to operate on * @param[out] rb Ringbuffer to operate on
*/ */
static inline void tsrb_clear(tsrb_t *rb) static inline void tsrb_clear(tsrb_t *rb)
{ {
@ -106,7 +106,7 @@ static inline int tsrb_empty(const tsrb_t *rb)
static inline unsigned int tsrb_avail(const tsrb_t *rb) static inline unsigned int tsrb_avail(const tsrb_t *rb)
{ {
unsigned irq_state = irq_disable(); unsigned irq_state = irq_disable();
int retval = (rb->writes - rb->reads); unsigned int retval = (rb->writes - rb->reads);
irq_restore(irq_state); irq_restore(irq_state);
return retval; return retval;
} }
@ -133,7 +133,7 @@ static inline int tsrb_full(const tsrb_t *rb)
static inline unsigned int tsrb_free(const tsrb_t *rb) static inline unsigned int tsrb_free(const tsrb_t *rb)
{ {
unsigned irq_state = irq_disable(); unsigned irq_state = irq_disable();
int retval = (rb->size - rb->writes + rb->reads); unsigned int retval = (rb->size - rb->writes + rb->reads);
irq_restore(irq_state); irq_restore(irq_state);
return retval; return retval;
} }