spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / s390 / include / asm / chpid.h
blob8e88e2221771bf41f2c379d460da4e8fd3499cdd
1 /*
2 * drivers/s390/cio/chpid.h
4 * Copyright IBM Corp. 2007
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */
8 #ifndef _ASM_S390_CHPID_H
9 #define _ASM_S390_CHPID_H
11 #include <linux/string.h>
12 #include <linux/types.h>
14 #define __MAX_CHPID 255
16 struct chp_id {
17 u8 reserved1;
18 u8 cssid;
19 u8 reserved2;
20 u8 id;
21 } __attribute__((packed));
23 #ifdef __KERNEL__
24 #include <asm/cio.h>
26 static inline void chp_id_init(struct chp_id *chpid)
28 memset(chpid, 0, sizeof(struct chp_id));
31 static inline int chp_id_is_equal(struct chp_id *a, struct chp_id *b)
33 return (a->id == b->id) && (a->cssid == b->cssid);
36 static inline void chp_id_next(struct chp_id *chpid)
38 if (chpid->id < __MAX_CHPID)
39 chpid->id++;
40 else {
41 chpid->id = 0;
42 chpid->cssid++;
46 static inline int chp_id_is_valid(struct chp_id *chpid)
48 return (chpid->cssid <= __MAX_CSSID);
52 #define chp_id_for_each(c) \
53 for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c))
54 #endif /* __KERNEL */
56 #endif /* _ASM_S390_CHPID_H */