drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
Extension
.h
Size
1199 bytes
Lines
45
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef __ASSERT_SUPPORT_H_INCLUDED__
#define __ASSERT_SUPPORT_H_INCLUDED__

/* Compile time assertion */
#ifndef CT_ASSERT
#define CT_ASSERT(cnd) ((void)sizeof(char[(cnd) ? 1 :  -1]))
#endif /* CT_ASSERT */

#include <linux/bug.h>

/* TODO: it would be cleaner to use this:
 * #define assert(cnd) BUG_ON(cnd)
 * but that causes many compiler warnings (==errors) under Android
 * because it seems that the BUG_ON() macro is not seen as a check by
 * gcc like the BUG() macro is.
 */
#define assert(cnd) \
	do { \
		if (!(cnd)) \
			BUG(); \
	} while (0)

#ifndef PIPE_GENERATION
/* Deprecated OP___assert, this is still used in ~1000 places
 * in the code. This will be removed over time.
 * The implementation for the pipe generation tool is in see support.isp.h
 */
#define OP___assert(cnd) assert(cnd)

static inline void compile_time_assert(unsigned int cond)
{
	/* Call undefined function if cond is false */
	void _compile_time_assert(void);
	if (!cond) _compile_time_assert();
}
#endif /* PIPE_GENERATION */

#endif /* __ASSERT_SUPPORT_H_INCLUDED__ */

Annotation

Implementation Notes