Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: cavium/nitrox - Fix sparse warnings

This patch fixes all the sparse warnings in cavium/nitrox:

- Fix endianness warnings by adding the correct markers to unions.
- Add missing header inclusions for prototypes.
- Move nitrox_sriov_configure prototype into the isr header file.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+26 -21
+5 -5
drivers/crypto/cavium/nitrox/nitrox_aead.c
··· 45 45 46 46 /* fill crypto context */ 47 47 fctx = nctx->u.fctx; 48 - flags.f = be64_to_cpu(fctx->flags.f); 48 + flags.fu = be64_to_cpu(fctx->flags.f); 49 49 flags.w0.aes_keylen = aes_keylen; 50 - fctx->flags.f = cpu_to_be64(flags.f); 50 + fctx->flags.f = cpu_to_be64(flags.fu); 51 51 52 52 /* copy enc key to context */ 53 53 memset(&fctx->crypto, 0, sizeof(fctx->crypto)); ··· 63 63 struct flexi_crypto_context *fctx = nctx->u.fctx; 64 64 union fc_ctx_flags flags; 65 65 66 - flags.f = be64_to_cpu(fctx->flags.f); 66 + flags.fu = be64_to_cpu(fctx->flags.f); 67 67 flags.w0.mac_len = authsize; 68 - fctx->flags.f = cpu_to_be64(flags.f); 68 + fctx->flags.f = cpu_to_be64(flags.fu); 69 69 70 70 aead->authsize = authsize; 71 71 ··· 319 319 flags->w0.iv_source = IV_FROM_DPTR; 320 320 /* ask microcode to calculate ipad/opad */ 321 321 flags->w0.auth_input_type = 1; 322 - flags->f = be64_to_cpu(flags->f); 322 + flags->f = cpu_to_be64(flags->fu); 323 323 324 324 return 0; 325 325 }
+1
drivers/crypto/cavium/nitrox/nitrox_debugfs.c
··· 3 3 #include <linux/debugfs.h> 4 4 5 5 #include "nitrox_csr.h" 6 + #include "nitrox_debugfs.h" 6 7 #include "nitrox_dev.h" 7 8 8 9 static int firmware_show(struct seq_file *s, void *v)
+1
drivers/crypto/cavium/nitrox/nitrox_hal.c
··· 3 3 4 4 #include "nitrox_dev.h" 5 5 #include "nitrox_csr.h" 6 + #include "nitrox_hal.h" 6 7 7 8 #define PLL_REF_CLK 50 8 9 #define MAX_CSR_RETRIES 10
+1
drivers/crypto/cavium/nitrox/nitrox_isr.c
··· 7 7 #include "nitrox_csr.h" 8 8 #include "nitrox_common.h" 9 9 #include "nitrox_hal.h" 10 + #include "nitrox_isr.h" 10 11 #include "nitrox_mbx.h" 11 12 12 13 /**
+9
drivers/crypto/cavium/nitrox/nitrox_isr.h
··· 9 9 int nitrox_sriov_register_interupts(struct nitrox_device *ndev); 10 10 void nitrox_sriov_unregister_interrupts(struct nitrox_device *ndev); 11 11 12 + #ifdef CONFIG_PCI_IOV 13 + int nitrox_sriov_configure(struct pci_dev *pdev, int num_vfs); 14 + #else 15 + static inline int nitrox_sriov_configure(struct pci_dev *pdev, int num_vfs) 16 + { 17 + return 0; 18 + } 19 + #endif 20 + 12 21 #endif /* __NITROX_ISR_H */
-13
drivers/crypto/cavium/nitrox/nitrox_main.c
··· 49 49 module_param(qlen, uint, 0644); 50 50 MODULE_PARM_DESC(qlen, "Command queue length - default 2048"); 51 51 52 - #ifdef CONFIG_PCI_IOV 53 - int nitrox_sriov_configure(struct pci_dev *pdev, int num_vfs); 54 - #else 55 - int nitrox_sriov_configure(struct pci_dev *pdev, int num_vfs) 56 - { 57 - return 0; 58 - } 59 - #endif 60 - 61 52 /** 62 53 * struct ucode - Firmware Header 63 54 * @id: microcode ID ··· 546 555 547 556 nitrox_remove_from_devlist(ndev); 548 557 549 - #ifdef CONFIG_PCI_IOV 550 558 /* disable SR-IOV */ 551 559 nitrox_sriov_configure(pdev, 0); 552 - #endif 553 560 nitrox_crypto_unregister(); 554 561 nitrox_debugfs_exit(ndev); 555 562 nitrox_pf_sw_cleanup(ndev); ··· 573 584 .probe = nitrox_probe, 574 585 .remove = nitrox_remove, 575 586 .shutdown = nitrox_shutdown, 576 - #ifdef CONFIG_PCI_IOV 577 587 .sriov_configure = nitrox_sriov_configure, 578 - #endif 579 588 }; 580 589 581 590 module_pci_driver(nitrox_driver);
+1
drivers/crypto/cavium/nitrox/nitrox_mbx.c
··· 4 4 #include "nitrox_csr.h" 5 5 #include "nitrox_hal.h" 6 6 #include "nitrox_dev.h" 7 + #include "nitrox_mbx.h" 7 8 8 9 #define RING_TO_VFNO(_x, _y) ((_x) / (_y)) 9 10
+4
drivers/crypto/cavium/nitrox/nitrox_req.h
··· 149 149 150 150 union fc_ctx_flags { 151 151 __be64 f; 152 + u64 fu; 152 153 struct { 153 154 #if defined(__BIG_ENDIAN_BITFIELD) 154 155 u64 cipher_type : 4; ··· 281 280 * - packet payload bytes 282 281 */ 283 282 union pkt_instr_hdr { 283 + __be64 bev; 284 284 u64 value; 285 285 struct { 286 286 #if defined(__BIG_ENDIAN_BITFIELD) ··· 326 324 * @ctxp: Context pointer. CTXP<63,2:0> must be zero in all cases. 327 325 */ 328 326 union pkt_hdr { 327 + __be64 bev[2]; 329 328 u64 value[2]; 330 329 struct { 331 330 #if defined(__BIG_ENDIAN_BITFIELD) ··· 373 370 * sglist components at [RPTR] on the remote host. 374 371 */ 375 372 union slc_store_info { 373 + __be64 bev[2]; 376 374 u64 value[2]; 377 375 struct { 378 376 #if defined(__BIG_ENDIAN_BITFIELD)
+4 -3
drivers/crypto/cavium/nitrox/nitrox_reqmgr.c
··· 3 3 #include <linux/workqueue.h> 4 4 #include <crypto/internal/skcipher.h> 5 5 6 + #include "nitrox_common.h" 6 7 #include "nitrox_dev.h" 7 8 #include "nitrox_req.h" 8 9 #include "nitrox_csr.h" ··· 449 448 sr->instr.ih.s.ssz = sr->out.sgmap_cnt; 450 449 sr->instr.ih.s.fsz = FDATA_SIZE + sizeof(struct gphdr); 451 450 sr->instr.ih.s.tlen = sr->instr.ih.s.fsz + sr->in.total_bytes; 452 - sr->instr.ih.value = cpu_to_be64(sr->instr.ih.value); 451 + sr->instr.ih.bev = cpu_to_be64(sr->instr.ih.value); 453 452 454 453 /* word 2 */ 455 454 sr->instr.irh.value[0] = 0; ··· 461 460 sr->instr.irh.s.ctxc = req->ctrl.s.ctxc; 462 461 sr->instr.irh.s.arg = req->ctrl.s.arg; 463 462 sr->instr.irh.s.opcode = req->opcode; 464 - sr->instr.irh.value[0] = cpu_to_be64(sr->instr.irh.value[0]); 463 + sr->instr.irh.bev[0] = cpu_to_be64(sr->instr.irh.value[0]); 465 464 466 465 /* word 3 */ 467 466 sr->instr.irh.s.ctxp = cpu_to_be64(ctx_handle); ··· 469 468 /* word 4 */ 470 469 sr->instr.slc.value[0] = 0; 471 470 sr->instr.slc.s.ssz = sr->out.sgmap_cnt; 472 - sr->instr.slc.value[0] = cpu_to_be64(sr->instr.slc.value[0]); 471 + sr->instr.slc.bev[0] = cpu_to_be64(sr->instr.slc.value[0]); 473 472 474 473 /* word 5 */ 475 474 sr->instr.slc.s.rptr = cpu_to_be64(sr->out.sgcomp_dma);