drivers/gpu/drm/xe/xe_args.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xe/xe_args.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/xe/xe_args.h
Extension
.h
Size
5182 bytes
Lines
171
Domain
Driver Families
Bucket
drivers/gpu
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 _XE_ARGS_H_
#define _XE_ARGS_H_

#include <linux/args.h>

/*
 * Why don't the following macros have the XE prefix?
 *
 * Once we find more potential users outside of the Xe driver, we plan to move
 * all of the following macros unchanged to linux/args.h.
 */

/**
 * CALL_ARGS - Invoke a macro, but allow parameters to be expanded beforehand.
 * @f: name of the macro to invoke
 * @args: arguments for the macro
 *
 * This macro allows calling macros which names might generated or we want to
 * make sure it's arguments will be correctly expanded.
 *
 * Example:
 *
 *	#define foo	X,Y,Z,Q
 *	#define bar	COUNT_ARGS(foo)
 *	#define buz	CALL_ARGS(COUNT_ARGS, foo)
 *
 *	With above definitions bar expands to 1 while buz expands to 4.
 */
#define CALL_ARGS(f, args...)		__CALL_ARGS(f, args)
#define __CALL_ARGS(f, args...)		f(args)

/**
 * DROP_FIRST_ARG - Returns all arguments except the first one.
 * @args: arguments
 *
 * This helper macro allows manipulation the argument list before passing it
 * to the next level macro.
 *
 * Example:
 *
 *	#define foo	X,Y,Z,Q
 *	#define bar	CALL_ARGS(COUNT_ARGS, DROP_FIRST_ARG(foo))
 *
 *	With above definitions bar expands to 3.
 */
#define DROP_FIRST_ARG(args...)		__DROP_FIRST_ARG(args)
#define __DROP_FIRST_ARG(a, b...)	b

/**
 * FIRST_ARG - Returns the first argument.
 * @args: arguments
 *
 * This helper macro allows manipulation the argument list before passing it
 * to the next level macro.
 *
 * Example:
 *
 *	#define foo	X,Y,Z,Q
 *	#define bar	FIRST_ARG(foo)
 *
 *	With above definitions bar expands to X.
 */
#define FIRST_ARG(args...)		__FIRST_ARG(args)
#define __FIRST_ARG(a, b...)		a

/**
 * LAST_ARG - Returns the last argument.
 * @args: arguments
 *
 * This helper macro allows manipulation the argument list before passing it
 * to the next level macro.
 *
 * Like COUNT_ARGS() this macro works up to 12 arguments.
 *
 * Example:
 *
 *	#define foo	X,Y,Z,Q
 *	#define bar	LAST_ARG(foo)
 *
 *	With above definitions bar expands to Q.
 */
#define LAST_ARG(args...)		__LAST_ARG(args)
#define __LAST_ARG(args...)		PICK_ARG(COUNT_ARGS(args), args)

/**
 * PICK_ARG - Returns the n-th argument.
 * @n: argument number to be returned
 * @args: arguments
 *
 * This helper macro allows manipulation the argument list before passing it

Annotation

Implementation Notes