1f08c3bdfSopenharmony_ci
2f08c3bdfSopenharmony_ci#define __kernel __attribute__((address_space(0)))
3f08c3bdfSopenharmony_ci#define __user   __attribute__((address_space(__user)))
4f08c3bdfSopenharmony_ci#define __iomem  __attribute__((address_space(__iomem)))
5f08c3bdfSopenharmony_ci#define __percpu __attribute__((address_space(__percpu)))
6f08c3bdfSopenharmony_ci#define __rcu    __attribute__((address_space(__rcu)))
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_ci
9f08c3bdfSopenharmony_citypedef struct s obj_t;
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_cistatic void expl(obj_t __kernel *k, obj_t __iomem *o,
12f08c3bdfSopenharmony_ci		 obj_t __user *p, obj_t __percpu *pc,
13f08c3bdfSopenharmony_ci		 obj_t __rcu *r)
14f08c3bdfSopenharmony_ci{
15f08c3bdfSopenharmony_ci	(__UINTPTR_TYPE__)(k);	// OK
16f08c3bdfSopenharmony_ci	(unsigned long)(k);	// OK
17f08c3bdfSopenharmony_ci	(void *)(k);		// OK
18f08c3bdfSopenharmony_ci	(obj_t*)(k);		// OK
19f08c3bdfSopenharmony_ci	(obj_t __kernel*)(k);	// OK
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci	(__UINTPTR_TYPE__)(o);	// OK
22f08c3bdfSopenharmony_ci	(unsigned long)(o);	// OK
23f08c3bdfSopenharmony_ci	(void *)(o);
24f08c3bdfSopenharmony_ci	(obj_t*)(o);
25f08c3bdfSopenharmony_ci	(obj_t __iomem*)(o);	// OK
26f08c3bdfSopenharmony_ci
27f08c3bdfSopenharmony_ci	(__UINTPTR_TYPE__)(p);	// OK
28f08c3bdfSopenharmony_ci	(unsigned long)(p);	// OK
29f08c3bdfSopenharmony_ci	(void *)(p);
30f08c3bdfSopenharmony_ci	(obj_t*)(p);
31f08c3bdfSopenharmony_ci	(obj_t __user*)(p);	// OK
32f08c3bdfSopenharmony_ci
33f08c3bdfSopenharmony_ci	(__UINTPTR_TYPE__)(pc);	// OK
34f08c3bdfSopenharmony_ci	(unsigned long)(pc);	// OK
35f08c3bdfSopenharmony_ci	(void *)(pc);
36f08c3bdfSopenharmony_ci	(obj_t*)(pc);
37f08c3bdfSopenharmony_ci	(obj_t __percpu*)(pc);	// OK
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci	(__UINTPTR_TYPE__)(r);	// OK
40f08c3bdfSopenharmony_ci	(unsigned long)(r);	// OK
41f08c3bdfSopenharmony_ci	(void *)(r);
42f08c3bdfSopenharmony_ci	(obj_t*)(r);
43f08c3bdfSopenharmony_ci	(obj_t __rcu*)(r);	// OK
44f08c3bdfSopenharmony_ci}
45f08c3bdfSopenharmony_ci
46f08c3bdfSopenharmony_ci/*
47f08c3bdfSopenharmony_ci * check-name: Waddress-space-from
48f08c3bdfSopenharmony_ci * check-command: sparse -Wno-cast-from-as $file
49f08c3bdfSopenharmony_ci * check-description: Test the removal of AS from a pointer but only
50f08c3bdfSopenharmony_ci *	in the non-strict variant where casts to ulong (or uintptr_t)
51f08c3bdfSopenharmony_ci *	are allowed.
52f08c3bdfSopenharmony_ci *
53f08c3bdfSopenharmony_ci * check-error-start
54f08c3bdfSopenharmony_ciWaddress-space-from.c:23:10: warning: cast removes address space '__iomem' of expression
55f08c3bdfSopenharmony_ciWaddress-space-from.c:24:10: warning: cast removes address space '__iomem' of expression
56f08c3bdfSopenharmony_ciWaddress-space-from.c:29:10: warning: cast removes address space '__user' of expression
57f08c3bdfSopenharmony_ciWaddress-space-from.c:30:10: warning: cast removes address space '__user' of expression
58f08c3bdfSopenharmony_ciWaddress-space-from.c:35:10: warning: cast removes address space '__percpu' of expression
59f08c3bdfSopenharmony_ciWaddress-space-from.c:36:10: warning: cast removes address space '__percpu' of expression
60f08c3bdfSopenharmony_ciWaddress-space-from.c:41:10: warning: cast removes address space '__rcu' of expression
61f08c3bdfSopenharmony_ciWaddress-space-from.c:42:10: warning: cast removes address space '__rcu' of expression
62f08c3bdfSopenharmony_ci * check-error-end
63f08c3bdfSopenharmony_ci */
64