@@ -55,10 +55,9 @@ static unsigned long intel_security_flags(struct nvdimm *nvdimm,
55
55
{
56
56
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
57
57
unsigned long security_flags = 0 ;
58
- struct {
59
- struct nd_cmd_pkg pkg ;
58
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
60
59
struct nd_intel_get_security_state cmd ;
61
- } nd_cmd = {
60
+ ) nd_cmd = {
62
61
.pkg = {
63
62
.nd_command = NVDIMM_INTEL_GET_SECURITY_STATE ,
64
63
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -120,10 +119,9 @@ static unsigned long intel_security_flags(struct nvdimm *nvdimm,
120
119
static int intel_security_freeze (struct nvdimm * nvdimm )
121
120
{
122
121
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
123
- struct {
124
- struct nd_cmd_pkg pkg ;
122
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
125
123
struct nd_intel_freeze_lock cmd ;
126
- } nd_cmd = {
124
+ ) nd_cmd = {
127
125
.pkg = {
128
126
.nd_command = NVDIMM_INTEL_FREEZE_LOCK ,
129
127
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -153,10 +151,9 @@ static int intel_security_change_key(struct nvdimm *nvdimm,
153
151
unsigned int cmd = ptype == NVDIMM_MASTER ?
154
152
NVDIMM_INTEL_SET_MASTER_PASSPHRASE :
155
153
NVDIMM_INTEL_SET_PASSPHRASE ;
156
- struct {
157
- struct nd_cmd_pkg pkg ;
154
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
158
155
struct nd_intel_set_passphrase cmd ;
159
- } nd_cmd = {
156
+ ) nd_cmd = {
160
157
.pkg = {
161
158
.nd_family = NVDIMM_FAMILY_INTEL ,
162
159
.nd_size_in = ND_INTEL_PASSPHRASE_SIZE * 2 ,
@@ -195,10 +192,9 @@ static int __maybe_unused intel_security_unlock(struct nvdimm *nvdimm,
195
192
const struct nvdimm_key_data * key_data )
196
193
{
197
194
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
198
- struct {
199
- struct nd_cmd_pkg pkg ;
195
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
200
196
struct nd_intel_unlock_unit cmd ;
201
- } nd_cmd = {
197
+ ) nd_cmd = {
202
198
.pkg = {
203
199
.nd_command = NVDIMM_INTEL_UNLOCK_UNIT ,
204
200
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -234,10 +230,9 @@ static int intel_security_disable(struct nvdimm *nvdimm,
234
230
{
235
231
int rc ;
236
232
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
237
- struct {
238
- struct nd_cmd_pkg pkg ;
233
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
239
234
struct nd_intel_disable_passphrase cmd ;
240
- } nd_cmd = {
235
+ ) nd_cmd = {
241
236
.pkg = {
242
237
.nd_command = NVDIMM_INTEL_DISABLE_PASSPHRASE ,
243
238
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -277,10 +272,9 @@ static int __maybe_unused intel_security_erase(struct nvdimm *nvdimm,
277
272
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
278
273
unsigned int cmd = ptype == NVDIMM_MASTER ?
279
274
NVDIMM_INTEL_MASTER_SECURE_ERASE : NVDIMM_INTEL_SECURE_ERASE ;
280
- struct {
281
- struct nd_cmd_pkg pkg ;
275
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
282
276
struct nd_intel_secure_erase cmd ;
283
- } nd_cmd = {
277
+ ) nd_cmd = {
284
278
.pkg = {
285
279
.nd_family = NVDIMM_FAMILY_INTEL ,
286
280
.nd_size_in = ND_INTEL_PASSPHRASE_SIZE ,
@@ -318,10 +312,9 @@ static int __maybe_unused intel_security_query_overwrite(struct nvdimm *nvdimm)
318
312
{
319
313
int rc ;
320
314
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
321
- struct {
322
- struct nd_cmd_pkg pkg ;
315
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
323
316
struct nd_intel_query_overwrite cmd ;
324
- } nd_cmd = {
317
+ ) nd_cmd = {
325
318
.pkg = {
326
319
.nd_command = NVDIMM_INTEL_QUERY_OVERWRITE ,
327
320
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -354,10 +347,9 @@ static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm,
354
347
{
355
348
int rc ;
356
349
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
357
- struct {
358
- struct nd_cmd_pkg pkg ;
350
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
359
351
struct nd_intel_overwrite cmd ;
360
- } nd_cmd = {
352
+ ) nd_cmd = {
361
353
.pkg = {
362
354
.nd_command = NVDIMM_INTEL_OVERWRITE ,
363
355
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -407,10 +399,9 @@ const struct nvdimm_security_ops *intel_security_ops = &__intel_security_ops;
407
399
static int intel_bus_fwa_businfo (struct nvdimm_bus_descriptor * nd_desc ,
408
400
struct nd_intel_bus_fw_activate_businfo * info )
409
401
{
410
- struct {
411
- struct nd_cmd_pkg pkg ;
402
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
412
403
struct nd_intel_bus_fw_activate_businfo cmd ;
413
- } nd_cmd = {
404
+ ) nd_cmd = {
414
405
.pkg = {
415
406
.nd_command = NVDIMM_BUS_INTEL_FW_ACTIVATE_BUSINFO ,
416
407
.nd_family = NVDIMM_BUS_FAMILY_INTEL ,
@@ -518,33 +509,31 @@ static enum nvdimm_fwa_capability intel_bus_fwa_capability(
518
509
static int intel_bus_fwa_activate (struct nvdimm_bus_descriptor * nd_desc )
519
510
{
520
511
struct acpi_nfit_desc * acpi_desc = to_acpi_desc (nd_desc );
521
- struct {
522
- struct nd_cmd_pkg pkg ;
512
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
523
513
struct nd_intel_bus_fw_activate cmd ;
524
- } nd_cmd = {
525
- .pkg = {
526
- .nd_command = NVDIMM_BUS_INTEL_FW_ACTIVATE ,
527
- .nd_family = NVDIMM_BUS_FAMILY_INTEL ,
528
- .nd_size_in = sizeof (nd_cmd .cmd .iodev_state ),
529
- .nd_size_out =
530
- sizeof (struct nd_intel_bus_fw_activate ),
531
- .nd_fw_size =
532
- sizeof (struct nd_intel_bus_fw_activate ),
533
- },
514
+ ) nd_cmd ;
515
+ int rc ;
516
+
517
+ nd_cmd .pkg = (struct nd_cmd_pkg ) {
518
+ .nd_command = NVDIMM_BUS_INTEL_FW_ACTIVATE ,
519
+ .nd_family = NVDIMM_BUS_FAMILY_INTEL ,
520
+ .nd_size_in = sizeof (nd_cmd .cmd .iodev_state ),
521
+ .nd_size_out =
522
+ sizeof (struct nd_intel_bus_fw_activate ),
523
+ .nd_fw_size =
524
+ sizeof (struct nd_intel_bus_fw_activate ),
525
+ };
526
+ nd_cmd .cmd = (struct nd_intel_bus_fw_activate ) {
534
527
/*
535
528
* Even though activate is run from a suspended context,
536
529
* for safety, still ask platform firmware to force
537
530
* quiesce devices by default. Let a module
538
531
* parameter override that policy.
539
532
*/
540
- .cmd = {
541
- .iodev_state = acpi_desc -> fwa_noidle
542
- ? ND_INTEL_BUS_FWA_IODEV_OS_IDLE
543
- : ND_INTEL_BUS_FWA_IODEV_FORCE_IDLE ,
544
- },
533
+ .iodev_state = acpi_desc -> fwa_noidle
534
+ ? ND_INTEL_BUS_FWA_IODEV_OS_IDLE
535
+ : ND_INTEL_BUS_FWA_IODEV_FORCE_IDLE ,
545
536
};
546
- int rc ;
547
-
548
537
switch (intel_bus_fwa_state (nd_desc )) {
549
538
case NVDIMM_FWA_ARMED :
550
539
case NVDIMM_FWA_ARM_OVERFLOW :
@@ -582,10 +571,9 @@ const struct nvdimm_bus_fw_ops *intel_bus_fw_ops = &__intel_bus_fw_ops;
582
571
static int intel_fwa_dimminfo (struct nvdimm * nvdimm ,
583
572
struct nd_intel_fw_activate_dimminfo * info )
584
573
{
585
- struct {
586
- struct nd_cmd_pkg pkg ;
574
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
587
575
struct nd_intel_fw_activate_dimminfo cmd ;
588
- } nd_cmd = {
576
+ ) nd_cmd = {
589
577
.pkg = {
590
578
.nd_command = NVDIMM_INTEL_FW_ACTIVATE_DIMMINFO ,
591
579
.nd_family = NVDIMM_FAMILY_INTEL ,
@@ -688,27 +676,24 @@ static int intel_fwa_arm(struct nvdimm *nvdimm, enum nvdimm_fwa_trigger arm)
688
676
{
689
677
struct nfit_mem * nfit_mem = nvdimm_provider_data (nvdimm );
690
678
struct acpi_nfit_desc * acpi_desc = nfit_mem -> acpi_desc ;
691
- struct {
692
- struct nd_cmd_pkg pkg ;
679
+ TRAILING_OVERLAP (struct nd_cmd_pkg , pkg , nd_payload ,
693
680
struct nd_intel_fw_activate_arm cmd ;
694
- } nd_cmd = {
695
- .pkg = {
696
- .nd_command = NVDIMM_INTEL_FW_ACTIVATE_ARM ,
697
- .nd_family = NVDIMM_FAMILY_INTEL ,
698
- .nd_size_in = sizeof (nd_cmd .cmd .activate_arm ),
699
- .nd_size_out =
700
- sizeof (struct nd_intel_fw_activate_arm ),
701
- .nd_fw_size =
702
- sizeof (struct nd_intel_fw_activate_arm ),
703
- },
704
- .cmd = {
705
- .activate_arm = arm == NVDIMM_FWA_ARM
706
- ? ND_INTEL_DIMM_FWA_ARM
707
- : ND_INTEL_DIMM_FWA_DISARM ,
708
- },
709
- };
681
+ ) nd_cmd ;
710
682
int rc ;
711
683
684
+ nd_cmd .pkg = (struct nd_cmd_pkg ) {
685
+ .nd_command = NVDIMM_INTEL_FW_ACTIVATE_ARM ,
686
+ .nd_family = NVDIMM_FAMILY_INTEL ,
687
+ .nd_size_in = sizeof (nd_cmd .cmd .activate_arm ),
688
+ .nd_size_out = sizeof (struct nd_intel_fw_activate_arm ),
689
+ .nd_fw_size = sizeof (struct nd_intel_fw_activate_arm ),
690
+ };
691
+ nd_cmd .cmd = (struct nd_intel_fw_activate_arm ) {
692
+ .activate_arm = arm == NVDIMM_FWA_ARM ?
693
+ ND_INTEL_DIMM_FWA_ARM :
694
+ ND_INTEL_DIMM_FWA_DISARM ,
695
+ };
696
+
712
697
switch (intel_fwa_state (nvdimm )) {
713
698
case NVDIMM_FWA_INVALID :
714
699
return - ENXIO ;
0 commit comments