2007-04-27 18:01:26 +04:00
/*
* drivers / s390 / cio / chpid . h
*
* Copyright IBM Corp . 2007
* Author ( s ) : Peter Oberparleiter < peter . oberparleiter @ de . ibm . com >
*/
2007-04-27 18:01:31 +04:00
# ifndef _ASM_S390_CHPID_H
2011-12-13 13:26:45 +04:00
# define _ASM_S390_CHPID_H
2007-04-27 18:01:26 +04:00
# include <linux/string.h>
[S390] types: add/fix types.h include in header files
/include/asm/chpid.h:12: include of <linux/types.h> is preferred over <asm/types.h>
/include/asm/chsc.h:15: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/cmb.h:28: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/dasd.h:195: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/kvm.h:16: include of <linux/types.h> is preferred over <asm/types.h>
/include/asm/kvm.h:30: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/qeth.h:24: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/schid.h:5: found __[us]{8,16,32,64} type without #include <linux/types.h>
/include/asm/swab.h:12: include of <linux/types.h> is preferred over <asm/types.h>
/include/asm/swab.h:19: found __[us]{8,16,32,64} type without #include <linux/types.h>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-01-09 14:14:52 +03:00
# include <linux/types.h>
2007-04-27 18:01:31 +04:00
# define __MAX_CHPID 255
2007-04-27 18:01:26 +04:00
struct chp_id {
u8 reserved1 ;
u8 cssid ;
u8 reserved2 ;
u8 id ;
} __attribute__ ( ( packed ) ) ;
2008-07-17 19:16:42 +04:00
# ifdef __KERNEL__
# include <asm/cio.h>
2007-04-27 18:01:26 +04:00
static inline void chp_id_init ( struct chp_id * chpid )
{
memset ( chpid , 0 , sizeof ( struct chp_id ) ) ;
}
static inline int chp_id_is_equal ( struct chp_id * a , struct chp_id * b )
{
return ( a - > id = = b - > id ) & & ( a - > cssid = = b - > cssid ) ;
}
static inline void chp_id_next ( struct chp_id * chpid )
{
if ( chpid - > id < __MAX_CHPID )
chpid - > id + + ;
else {
chpid - > id = 0 ;
chpid - > cssid + + ;
}
}
static inline int chp_id_is_valid ( struct chp_id * chpid )
{
return ( chpid - > cssid < = __MAX_CSSID ) ;
}
# define chp_id_for_each(c) \
for ( chp_id_init ( c ) ; chp_id_is_valid ( c ) ; chp_id_next ( c ) )
2008-07-14 11:59:05 +04:00
# endif /* __KERNEL */
2007-04-27 18:01:26 +04:00
2007-04-27 18:01:31 +04:00
# endif /* _ASM_S390_CHPID_H */