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

IB/core cleanup: Add const on args - device->process_mad

The process_mad device function declares some parameters as "in". Make those
parameters const and adjust the call tree under process_mad in the various
drivers accordingly.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Hal Rosenstock <hal@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Ira Weiny and committed by
Doug Ledford
a97e2d86 5ede9289

+80 -78
+3 -3
drivers/infiniband/hw/amso1100/c2_provider.c
··· 582 582 static int c2_process_mad(struct ib_device *ibdev, 583 583 int mad_flags, 584 584 u8 port_num, 585 - struct ib_wc *in_wc, 586 - struct ib_grh *in_grh, 587 - struct ib_mad *in_mad, struct ib_mad *out_mad) 585 + const struct ib_wc *in_wc, 586 + const struct ib_grh *in_grh, 587 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 588 588 { 589 589 pr_debug("%s:%u\n", __func__, __LINE__); 590 590 return -ENOSYS;
+3 -3
drivers/infiniband/hw/cxgb3/iwch_provider.c
··· 85 85 static int iwch_process_mad(struct ib_device *ibdev, 86 86 int mad_flags, 87 87 u8 port_num, 88 - struct ib_wc *in_wc, 89 - struct ib_grh *in_grh, 90 - struct ib_mad *in_mad, struct ib_mad *out_mad) 88 + const struct ib_wc *in_wc, 89 + const struct ib_grh *in_grh, 90 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 91 91 { 92 92 return -ENOSYS; 93 93 }
+3 -2
drivers/infiniband/hw/cxgb4/provider.c
··· 80 80 } 81 81 82 82 static int c4iw_process_mad(struct ib_device *ibdev, int mad_flags, 83 - u8 port_num, struct ib_wc *in_wc, 84 - struct ib_grh *in_grh, struct ib_mad *in_mad, 83 + u8 port_num, const struct ib_wc *in_wc, 84 + const struct ib_grh *in_grh, 85 + const struct ib_mad *in_mad, 85 86 struct ib_mad *out_mad) 86 87 { 87 88 return -ENOSYS;
+2 -2
drivers/infiniband/hw/ehca/ehca_iverbs.h
··· 191 191 int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); 192 192 193 193 int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 194 - struct ib_wc *in_wc, struct ib_grh *in_grh, 195 - struct ib_mad *in_mad, 194 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 195 + const struct ib_mad *in_mad, 196 196 struct ib_mad *out_mad); 197 197 198 198 void ehca_poll_eqs(unsigned long data);
+7 -7
drivers/infiniband/hw/ehca/ehca_sqp.c
··· 140 140 } __attribute__ ((packed)); 141 141 142 142 static int ehca_process_perf(struct ib_device *ibdev, u8 port_num, 143 - struct ib_wc *in_wc, struct ib_grh *in_grh, 144 - struct ib_mad *in_mad, struct ib_mad *out_mad) 143 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 144 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 145 145 { 146 - struct ib_perf *in_perf = (struct ib_perf *)in_mad; 146 + const struct ib_perf *in_perf = (const struct ib_perf *)in_mad; 147 147 struct ib_perf *out_perf = (struct ib_perf *)out_mad; 148 148 struct ib_class_port_info *poi = 149 149 (struct ib_class_port_info *)out_perf->data; ··· 187 187 188 188 /* if request was globally routed, copy route info */ 189 189 if (in_grh) { 190 - struct vertcfl *vertcfl = 191 - (struct vertcfl *)&in_grh->version_tclass_flow; 190 + const struct vertcfl *vertcfl = 191 + (const struct vertcfl *)&in_grh->version_tclass_flow; 192 192 memcpy(poi->redirect_gid, in_grh->dgid.raw, 193 193 sizeof(poi->redirect_gid)); 194 194 tcslfl->tc = vertcfl->tc; ··· 217 217 } 218 218 219 219 int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 220 - struct ib_wc *in_wc, struct ib_grh *in_grh, 221 - struct ib_mad *in_mad, struct ib_mad *out_mad) 220 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 221 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 222 222 { 223 223 int ret; 224 224
+4 -4
drivers/infiniband/hw/ipath/ipath_mad.c
··· 1257 1257 } 1258 1258 1259 1259 static int process_subn(struct ib_device *ibdev, int mad_flags, 1260 - u8 port_num, struct ib_mad *in_mad, 1260 + u8 port_num, const struct ib_mad *in_mad, 1261 1261 struct ib_mad *out_mad) 1262 1262 { 1263 1263 struct ib_smp *smp = (struct ib_smp *)out_mad; ··· 1389 1389 } 1390 1390 1391 1391 static int process_perf(struct ib_device *ibdev, u8 port_num, 1392 - struct ib_mad *in_mad, 1392 + const struct ib_mad *in_mad, 1393 1393 struct ib_mad *out_mad) 1394 1394 { 1395 1395 struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad; ··· 1490 1490 * This is called by the ib_mad module. 1491 1491 */ 1492 1492 int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 1493 - struct ib_wc *in_wc, struct ib_grh *in_grh, 1494 - struct ib_mad *in_mad, struct ib_mad *out_mad) 1493 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 1494 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 1495 1495 { 1496 1496 int ret; 1497 1497
+3 -3
drivers/infiniband/hw/ipath/ipath_verbs.h
··· 701 701 int ipath_process_mad(struct ib_device *ibdev, 702 702 int mad_flags, 703 703 u8 port_num, 704 - struct ib_wc *in_wc, 705 - struct ib_grh *in_grh, 706 - struct ib_mad *in_mad, struct ib_mad *out_mad); 704 + const struct ib_wc *in_wc, 705 + const struct ib_grh *in_grh, 706 + const struct ib_mad *in_mad, struct ib_mad *out_mad); 707 707 708 708 /* 709 709 * Compare the lower 24 bits of the two values.
+11 -10
drivers/infiniband/hw/mlx4/mad.c
··· 111 111 } 112 112 113 113 int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, 114 - int port, struct ib_wc *in_wc, struct ib_grh *in_grh, 115 - void *in_mad, void *response_mad) 114 + int port, const struct ib_wc *in_wc, 115 + const struct ib_grh *in_grh, 116 + const void *in_mad, void *response_mad) 116 117 { 117 118 struct mlx4_cmd_mailbox *inmailbox, *outmailbox; 118 119 void *inbox; ··· 221 220 * Snoop SM MADs for port info, GUID info, and P_Key table sets, so we can 222 221 * synthesize LID change, Client-Rereg, GID change, and P_Key change events. 223 222 */ 224 - static void smp_snoop(struct ib_device *ibdev, u8 port_num, struct ib_mad *mad, 223 + static void smp_snoop(struct ib_device *ibdev, u8 port_num, const struct ib_mad *mad, 225 224 u16 prev_lid) 226 225 { 227 226 struct ib_port_info *pinfo; ··· 357 356 } 358 357 } 359 358 360 - static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, struct ib_mad *mad) 359 + static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_mad *mad) 361 360 { 362 361 int qpn = mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_LID_ROUTED; 363 362 struct ib_mad_send_buf *send_buf; ··· 723 722 } 724 723 725 724 static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 726 - struct ib_wc *in_wc, struct ib_grh *in_grh, 727 - struct ib_mad *in_mad, struct ib_mad *out_mad) 725 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 726 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 728 727 { 729 728 u16 slid, prev_lid = 0; 730 729 int err; ··· 826 825 } 827 826 828 827 static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 829 - struct ib_wc *in_wc, struct ib_grh *in_grh, 830 - struct ib_mad *in_mad, struct ib_mad *out_mad) 828 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 829 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 831 830 { 832 831 struct mlx4_cmd_mailbox *mailbox; 833 832 struct mlx4_ib_dev *dev = to_mdev(ibdev); ··· 867 866 } 868 867 869 868 int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 870 - struct ib_wc *in_wc, struct ib_grh *in_grh, 871 - struct ib_mad *in_mad, struct ib_mad *out_mad) 869 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 870 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 872 871 { 873 872 switch (rdma_port_get_link_layer(ibdev, port_num)) { 874 873 case IB_LINK_LAYER_INFINIBAND:
+4 -4
drivers/infiniband/hw/mlx4/mlx4_ib.h
··· 706 706 struct ib_recv_wr **bad_wr); 707 707 708 708 int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, 709 - int port, struct ib_wc *in_wc, struct ib_grh *in_grh, 710 - void *in_mad, void *response_mad); 709 + int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 710 + const void *in_mad, void *response_mad); 711 711 int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 712 - struct ib_wc *in_wc, struct ib_grh *in_grh, 713 - struct ib_mad *in_mad, struct ib_mad *out_mad); 712 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 713 + const struct ib_mad *in_mad, struct ib_mad *out_mad); 714 714 int mlx4_ib_mad_init(struct mlx4_ib_dev *dev); 715 715 void mlx4_ib_mad_cleanup(struct mlx4_ib_dev *dev); 716 716
+4 -4
drivers/infiniband/hw/mlx5/mad.c
··· 41 41 }; 42 42 43 43 int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey, 44 - u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh, 45 - void *in_mad, void *response_mad) 44 + u8 port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 45 + const void *in_mad, void *response_mad) 46 46 { 47 47 u8 op_modifier = 0; 48 48 ··· 58 58 } 59 59 60 60 int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 61 - struct ib_wc *in_wc, struct ib_grh *in_grh, 62 - struct ib_mad *in_mad, struct ib_mad *out_mad) 61 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 62 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 63 63 { 64 64 u16 slid; 65 65 int err;
+4 -4
drivers/infiniband/hw/mlx5/mlx5_ib.h
··· 525 525 void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, struct mlx5_ib_srq *srq); 526 526 void mlx5_ib_free_srq_wqe(struct mlx5_ib_srq *srq, int wqe_index); 527 527 int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey, 528 - u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh, 529 - void *in_mad, void *response_mad); 528 + u8 port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 529 + const void *in_mad, void *response_mad); 530 530 struct ib_ah *create_ib_ah(struct ib_ah_attr *ah_attr, 531 531 struct mlx5_ib_ah *ah); 532 532 struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); ··· 586 586 int mlx5_ib_unmap_fmr(struct list_head *fmr_list); 587 587 int mlx5_ib_fmr_dealloc(struct ib_fmr *ibfmr); 588 588 int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 589 - struct ib_wc *in_wc, struct ib_grh *in_grh, 590 - struct ib_mad *in_mad, struct ib_mad *out_mad); 589 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 590 + const struct ib_mad *in_mad, struct ib_mad *out_mad); 591 591 struct ib_xrcd *mlx5_ib_alloc_xrcd(struct ib_device *ibdev, 592 592 struct ib_ucontext *context, 593 593 struct ib_udata *udata);
+2 -2
drivers/infiniband/hw/mthca/mthca_cmd.c
··· 1858 1858 } 1859 1859 1860 1860 int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey, 1861 - int port, struct ib_wc *in_wc, struct ib_grh *in_grh, 1862 - void *in_mad, void *response_mad) 1861 + int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 1862 + const void *in_mad, void *response_mad) 1863 1863 { 1864 1864 struct mthca_mailbox *inmailbox, *outmailbox; 1865 1865 void *inbox;
+2 -2
drivers/infiniband/hw/mthca/mthca_cmd.h
··· 312 312 struct mthca_mailbox *mailbox); 313 313 int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn); 314 314 int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey, 315 - int port, struct ib_wc *in_wc, struct ib_grh *in_grh, 316 - void *in_mad, void *response_mad); 315 + int port, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 316 + const void *in_mad, void *response_mad); 317 317 int mthca_READ_MGM(struct mthca_dev *dev, int index, 318 318 struct mthca_mailbox *mailbox); 319 319 int mthca_WRITE_MGM(struct mthca_dev *dev, int index,
+3 -3
drivers/infiniband/hw/mthca/mthca_dev.h
··· 576 576 int mthca_process_mad(struct ib_device *ibdev, 577 577 int mad_flags, 578 578 u8 port_num, 579 - struct ib_wc *in_wc, 580 - struct ib_grh *in_grh, 581 - struct ib_mad *in_mad, 579 + const struct ib_wc *in_wc, 580 + const struct ib_grh *in_grh, 581 + const struct ib_mad *in_mad, 582 582 struct ib_mad *out_mad); 583 583 int mthca_create_agents(struct mthca_dev *dev); 584 584 void mthca_free_agents(struct mthca_dev *dev);
+5 -5
drivers/infiniband/hw/mthca/mthca_mad.c
··· 104 104 */ 105 105 static void smp_snoop(struct ib_device *ibdev, 106 106 u8 port_num, 107 - struct ib_mad *mad, 107 + const struct ib_mad *mad, 108 108 u16 prev_lid) 109 109 { 110 110 struct ib_event event; ··· 160 160 161 161 static void forward_trap(struct mthca_dev *dev, 162 162 u8 port_num, 163 - struct ib_mad *mad) 163 + const struct ib_mad *mad) 164 164 { 165 165 int qpn = mad->mad_hdr.mgmt_class != IB_MGMT_CLASS_SUBN_LID_ROUTED; 166 166 struct ib_mad_send_buf *send_buf; ··· 195 195 int mthca_process_mad(struct ib_device *ibdev, 196 196 int mad_flags, 197 197 u8 port_num, 198 - struct ib_wc *in_wc, 199 - struct ib_grh *in_grh, 200 - struct ib_mad *in_mad, 198 + const struct ib_wc *in_wc, 199 + const struct ib_grh *in_grh, 200 + const struct ib_mad *in_mad, 201 201 struct ib_mad *out_mad) 202 202 { 203 203 int err;
+2 -2
drivers/infiniband/hw/nes/nes_verbs.c
··· 3221 3221 * nes_process_mad 3222 3222 */ 3223 3223 static int nes_process_mad(struct ib_device *ibdev, int mad_flags, 3224 - u8 port_num, struct ib_wc *in_wc, struct ib_grh *in_grh, 3225 - struct ib_mad *in_mad, struct ib_mad *out_mad) 3224 + u8 port_num, const struct ib_wc *in_wc, const struct ib_grh *in_grh, 3225 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 3226 3226 { 3227 3227 nes_debug(NES_DBG_INIT, "\n"); 3228 3228 return -ENOSYS;
+3 -3
drivers/infiniband/hw/ocrdma/ocrdma_ah.c
··· 196 196 int ocrdma_process_mad(struct ib_device *ibdev, 197 197 int process_mad_flags, 198 198 u8 port_num, 199 - struct ib_wc *in_wc, 200 - struct ib_grh *in_grh, 201 - struct ib_mad *in_mad, struct ib_mad *out_mad) 199 + const struct ib_wc *in_wc, 200 + const struct ib_grh *in_grh, 201 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 202 202 { 203 203 int status; 204 204 struct ocrdma_dev *dev;
+3 -3
drivers/infiniband/hw/ocrdma/ocrdma_ah.h
··· 42 42 int ocrdma_process_mad(struct ib_device *, 43 43 int process_mad_flags, 44 44 u8 port_num, 45 - struct ib_wc *in_wc, 46 - struct ib_grh *in_grh, 47 - struct ib_mad *in_mad, struct ib_mad *out_mad); 45 + const struct ib_wc *in_wc, 46 + const struct ib_grh *in_grh, 47 + const struct ib_mad *in_mad, struct ib_mad *out_mad); 48 48 #endif /* __OCRDMA_AH_H__ */
+5 -5
drivers/infiniband/hw/qib/qib_mad.c
··· 1854 1854 } 1855 1855 1856 1856 static int process_subn(struct ib_device *ibdev, int mad_flags, 1857 - u8 port, struct ib_mad *in_mad, 1857 + u8 port, const struct ib_mad *in_mad, 1858 1858 struct ib_mad *out_mad) 1859 1859 { 1860 1860 struct ib_smp *smp = (struct ib_smp *)out_mad; ··· 2006 2006 } 2007 2007 2008 2008 static int process_perf(struct ib_device *ibdev, u8 port, 2009 - struct ib_mad *in_mad, 2009 + const struct ib_mad *in_mad, 2010 2010 struct ib_mad *out_mad) 2011 2011 { 2012 2012 struct ib_pma_mad *pmp = (struct ib_pma_mad *)out_mad; ··· 2299 2299 } 2300 2300 2301 2301 static int process_cc(struct ib_device *ibdev, int mad_flags, 2302 - u8 port, struct ib_mad *in_mad, 2302 + u8 port, const struct ib_mad *in_mad, 2303 2303 struct ib_mad *out_mad) 2304 2304 { 2305 2305 struct ib_cc_mad *ccp = (struct ib_cc_mad *)out_mad; ··· 2400 2400 * This is called by the ib_mad module. 2401 2401 */ 2402 2402 int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port, 2403 - struct ib_wc *in_wc, struct ib_grh *in_grh, 2404 - struct ib_mad *in_mad, struct ib_mad *out_mad) 2403 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 2404 + const struct ib_mad *in_mad, struct ib_mad *out_mad) 2405 2405 { 2406 2406 int ret; 2407 2407 struct qib_ibport *ibp = to_iport(ibdev, port);
+2 -2
drivers/infiniband/hw/qib/qib_verbs.h
··· 872 872 void qib_sys_guid_chg(struct qib_ibport *ibp); 873 873 void qib_node_desc_chg(struct qib_ibport *ibp); 874 874 int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, 875 - struct ib_wc *in_wc, struct ib_grh *in_grh, 876 - struct ib_mad *in_mad, struct ib_mad *out_mad); 875 + const struct ib_wc *in_wc, const struct ib_grh *in_grh, 876 + const struct ib_mad *in_mad, struct ib_mad *out_mad); 877 877 int qib_create_agents(struct qib_ibdev *dev); 878 878 void qib_free_agents(struct qib_ibdev *dev); 879 879
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/mad.c
··· 36 36 #include <linux/mlx5/cmd.h> 37 37 #include "mlx5_core.h" 38 38 39 - int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, 39 + int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb, 40 40 u16 opmod, u8 port) 41 41 { 42 42 struct mlx5_mad_ifc_mbox_in *in = NULL;
+1 -1
include/linux/mlx5/driver.h
··· 696 696 u32 *mkey); 697 697 int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn); 698 698 int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn); 699 - int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb, 699 + int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, const void *inb, void *outb, 700 700 u16 opmod, u8 port); 701 701 void mlx5_pagealloc_init(struct mlx5_core_dev *dev); 702 702 void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
+3 -3
include/rdma/ib_verbs.h
··· 1690 1690 int (*process_mad)(struct ib_device *device, 1691 1691 int process_mad_flags, 1692 1692 u8 port_num, 1693 - struct ib_wc *in_wc, 1694 - struct ib_grh *in_grh, 1695 - struct ib_mad *in_mad, 1693 + const struct ib_wc *in_wc, 1694 + const struct ib_grh *in_grh, 1695 + const struct ib_mad *in_mad, 1696 1696 struct ib_mad *out_mad); 1697 1697 struct ib_xrcd * (*alloc_xrcd)(struct ib_device *device, 1698 1698 struct ib_ucontext *ucontext,