xref: /dragonfly/sys/dev/drm/include/linux/ratelimit.h (revision 3f2dd94a)
1403e6d2bSFrançois Tigeot /*
2403e6d2bSFrançois Tigeot  * Copyright (c) 2018 François Tigeot <ftigeot@wolfpond.org>
303d7d819SFrançois Tigeot  * Copyright (c) 2019 Jonathan Gray <jsg@openbsd.org>
4403e6d2bSFrançois Tigeot  * All rights reserved.
5403e6d2bSFrançois Tigeot  *
6403e6d2bSFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
7403e6d2bSFrançois Tigeot  * modification, are permitted provided that the following conditions
8403e6d2bSFrançois Tigeot  * are met:
9403e6d2bSFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
10403e6d2bSFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
11403e6d2bSFrançois Tigeot  *    disclaimer.
12403e6d2bSFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
13403e6d2bSFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
14403e6d2bSFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
15403e6d2bSFrançois Tigeot  *
16403e6d2bSFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17403e6d2bSFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18403e6d2bSFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19403e6d2bSFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20403e6d2bSFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21403e6d2bSFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22403e6d2bSFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23403e6d2bSFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24403e6d2bSFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25403e6d2bSFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26403e6d2bSFrançois Tigeot  */
27403e6d2bSFrançois Tigeot 
28403e6d2bSFrançois Tigeot #ifndef _LINUX_RATELIMIT_H_
29403e6d2bSFrançois Tigeot #define _LINUX_RATELIMIT_H_
30403e6d2bSFrançois Tigeot 
31403e6d2bSFrançois Tigeot #include <linux/spinlock.h>
32403e6d2bSFrançois Tigeot 
335b68eeadSFrançois Tigeot #define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
345b68eeadSFrançois Tigeot 	int name __used = 1;
355b68eeadSFrançois Tigeot 
365b68eeadSFrançois Tigeot #define __ratelimit(x)	(1)
375b68eeadSFrançois Tigeot 
38*3f2dd94aSFrançois Tigeot struct ratelimit_state {
39*3f2dd94aSFrançois Tigeot };
40*3f2dd94aSFrançois Tigeot 
41403e6d2bSFrançois Tigeot #endif	/* _LINUX_RATELIMIT_H_ */
42