summaryrefslogtreecommitdiff
path: root/include/linux/once_lite.h
blob: 236592c4eeb1a486a39e9a222295e043a901a7ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_ONCE_LITE_H
#define _LINUX_ONCE_LITE_H

#include <linux/types.h>

/* Call a function once. Similar to DO_ONCE(), but does not use jump label
 * patching via static keys.
 */
#define DO_ONCE_LITE(func, ...)						\
	DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)

#define __ONCE_LITE_IF(condition)					\
	({								\
		static bool __section(".data..once") __already_done;	\
		bool __ret_cond = !!(condition);			\
		bool __ret_once = false;				\
									\
		if (unlikely(__ret_cond) && unlikely(!__already_done)) {\
			__already_done = true;				\
			__ret_once = true;				\
		}							\
		unlikely(__ret_once);					\
	})

#define DO_ONCE_LITE_IF(condition, func, ...)				\
	({								\
		bool __ret_do_once = !!(condition);			\
									\
		if (__ONCE_LITE_IF(__ret_do_once))			\
			func(__VA_ARGS__);				\
									\
		unlikely(__ret_do_once);				\
	})

#endif /* _LINUX_ONCE_LITE_H */
7a9eccf09440848d1c63e9f4c77eaa58'>can: peak_pcmcia: fix error return codePeter Senna Tschudin 2012-10-04can: peak_pci: fix error return codePeter Senna Tschudin 2012-09-22can: sja1000: Add support for listen-only mode and one-shot modeAndreas Larsson 2012-08-24can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharingSven Schmitt 2012-07-20can: mark bittiming_const pointer in struct can_priv as constMarc Kleine-Budde 2012-05-22Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jik...Linus Torvalds 2012-04-18Fix "the the" in various KconfigMasanari Iida 2012-04-16net/can: use module_pci_driverAxel Lin 2012-03-03can: sja1000: add support for PEAK-System PCMCIA cardStephane Grosjean 2012-03-03can: peak_pci: add support of some new PEAK-System PCI cardsStephane Grosjean 2012-02-26Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller 2012-02-20can: sja1000: fix isr hang when hw is unplugged under loadOliver Hartkopp 2012-02-04Merge branch 'master' of git://gitorious.org/linux-can/linux-can-nextDavid S. Miller 2012-02-03can: replace the dev_dbg/info/err/... with the new netdev_xxx macrosWolfgang Grandegger 2012-02-03can: plx_pci: add support for IXXAT PCI cardsJames Kime 2012-02-03can: peak_pci: Fix the way channels are linked togetherStephane Grosjean 2011-11-29can: sja1000_isa: convert to platform driver to support x86_64 systemsWolfgang Grandegger 2011-11-29can: sja1000_isa: fix "limited range" compiler warningsWolfgang Grandegger 2011-11-29net/can: convert drivers/net/can/* to use module_platform_driver()Axel Lin 2011-11-21net, sja1000: Don't include version.h in peak_pci.c when not neededJesper Juhl 2011-10-25Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-nextLinus Torvalds 2011-10-17can: remove references to berlios mailinglistMarc Kleine-Budde 2011-09-28can/sja1000: add driver for EMS PCMCIA cardOliver Hartkopp 2011-09-27doc: fix broken referencesPaul Bolle 2011-09-21can/sja1000: driver for PEAK PCAN PCI/PCIe cardsWolfgang Grandegger 2011-08-13drivers/net/can/sja1000/plx_pci.c: eliminate double freeJulia Lawall 2011-06-29net: include io.h in sja1000_of_platform.c for iounmap etcStephen Rothwell 2011-06-06net: remove interrupt.h inclusion from netdevice.hAlexey Dobriyan 2011-05-05can: fix SJA1000 dlc for RTR packetsKurt Van Dijck