Commit e9de2fe2 authored by Jan Kiszka's avatar Jan Kiszka

cobalt/rtdm: Remove rtdm_ratelimit()

This should have been used only by rtdm_printk_ratelimited which was
switched to xnclock_ratelimit.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 45d2ca6f
......@@ -1214,28 +1214,6 @@ void rtdm_mutex_destroy(rtdm_mutex_t *mutex);
#define rtdm_printk(format, ...) printk(format, ##__VA_ARGS__)
struct rtdm_ratelimit_state {
rtdm_lock_t lock; /* protect the state */
nanosecs_abs_t interval;
int burst;
int printed;
int missed;
nanosecs_abs_t begin;
};
int rtdm_ratelimit(struct rtdm_ratelimit_state *rs, const char *func);
#define DEFINE_RTDM_RATELIMIT_STATE(name, interval_init, burst_init) \
struct rtdm_ratelimit_state name = { \
.lock = RTDM_LOCK_UNLOCKED((name).lock), \
.interval = interval_init, \
.burst = burst_init, \
}
/* We use the Linux defaults */
#define DEF_RTDM_RATELIMIT_INTERVAL 5000000000LL
#define DEF_RTDM_RATELIMIT_BURST 10
#define rtdm_printk_ratelimited(fmt, ...) do { \
if (xnclock_ratelimit()) \
printk(fmt, ##__VA_ARGS__); \
......
......@@ -2106,52 +2106,6 @@ int rtdm_munmap(void *ptr, size_t len)
}
EXPORT_SYMBOL_GPL(rtdm_munmap);
/**
* @brief Enforces a rate limit
*
* This function enforces a rate limit: not more than @a rs->burst callbacks
* in every @a rs->interval.
*
* @param[in,out] rs rtdm_ratelimit_state data
* @param[in] func name of calling function
*
* @return 0 means callback will be suppressed and 1 means go ahead and do it
*
* @coretags{unrestricted}
*/
int rtdm_ratelimit(struct rtdm_ratelimit_state *rs, const char *func)
{
rtdm_lockctx_t lock_ctx;
int ret;
if (!rs->interval)
return 1;
rtdm_lock_get_irqsave(&rs->lock, lock_ctx);
if (!rs->begin)
rs->begin = rtdm_clock_read();
if (rtdm_clock_read() >= rs->begin + rs->interval) {
if (rs->missed)
printk(KERN_WARNING "%s: %d callbacks suppressed\n",
func, rs->missed);
rs->begin = 0;
rs->printed = 0;
rs->missed = 0;
}
if (rs->burst && rs->burst > rs->printed) {
rs->printed++;
ret = 1;
} else {
rs->missed++;
ret = 0;
}
rtdm_lock_put_irqrestore(&rs->lock, lock_ctx);
return ret;
}
EXPORT_SYMBOL_GPL(rtdm_ratelimit);
int rtdm_get_iovec(struct rtdm_fd *fd, struct iovec **iovp,
const struct user_msghdr *msg,
struct iovec *iov_fast)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment