File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 22
22
23
23
#include <linux/compiler.h>
24
24
25
+ #include <linux/build_bug.h> /* static_assert */
26
+ #include <linux/stddef.h> /* offsetof */
27
+
25
28
/* general boundary defintions */
26
29
#define SENSEINFOBYTES 32 /* may vary between hbas */
27
30
#define SG_ENTRIES_IN_CMD 32 /* Max SG entries excluding chain blocks */
@@ -454,6 +457,15 @@ struct CommandList {
454
457
atomic_t refcount ; /* Must be last to avoid memset in hpsa_cmd_init() */
455
458
} __aligned (COMMANDLIST_ALIGNMENT );
456
459
460
+ /*
461
+ * Make sure our embedded atomic variable is aligned. Otherwise we break atomic
462
+ * operations on architectures that don't support unaligned atomics like IA64.
463
+ *
464
+ * The assert guards against reintroductin against unwanted __packed to
465
+ * the struct CommandList.
466
+ */
467
+ static_assert (offsetof(struct CommandList , refcount ) % __alignof__(atomic_t ) == 0 );
468
+
457
469
/* Max S/G elements in I/O accelerator command */
458
470
#define IOACCEL1_MAXSGENTRIES 24
459
471
#define IOACCEL2_MAXSGENTRIES 28
You can’t perform that action at this time.
0 commit comments