imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,8 +1,8 @@
 static inline void setup_percpu_segment(int cpu) {
 #ifdef CONFIG_X86_32
   struct desc_struct gdt;
   pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF, 0x2 | DESCTYPE_S, 0x8);
   gdt.s = 1;
-  write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
+  write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
 #endif
 }<sep>@@
expression e;
@@

- get_cpu_gdt_table
+ get_cpu_gdt_rw
    (e)
--- initial
+++ final
@@ -1,50 +1,50 @@
 int x86_acpi_suspend_lowlevel(void) {
   struct wakeup_header *header = (struct wakeup_header *)__va(real_mode_header->wakeup_header);
   if (header->signature != WAKEUP_HEADER_SIGNATURE) {
     printk(KERN_ERR "wakeup header does not match\n");
     return -EINVAL;
   }
   header->video_mode = saved_video_mode;
   header->pmode_behavior = 0;
 #ifndef CONFIG_64BIT
   native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
   /*
    * We have to check that we can write back the value, and not
    * just read it.  At least on 90 nm Pentium M (Family 6, Model
    * 13), reading an invalid MSR is not guaranteed to trap, see
    * Erratum X4 in "Intel Pentium M Processor on 90 nm Process
    * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90
    * nm process with 512-KB L2 Cache Specification Update".
    */
   if (!rdmsr_safe(MSR_EFER, &header->pmode_efer_low, &header->pmode_efer_high) && !wrmsr_safe(MSR_EFER, header->pmode_efer_low, header->pmode_efer_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
 #endif /* !CONFIG_64BIT */
   header->pmode_cr0 = read_cr0();
   if (__this_cpu_read(cpu_info.cpuid_level) >= 0) {
     header->pmode_cr4 = __read_cr4();
     header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4);
   }
   if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, &header->pmode_misc_en_low, &header->pmode_misc_en_high) && !wrmsr_safe(MSR_IA32_MISC_ENABLE, header->pmode_misc_en_low, header->pmode_misc_en_high)) header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
   header->realmode_flags = acpi_realmode_flags;
   header->real_magic = 0x12345678;
 #ifndef CONFIG_64BIT
   header->pmode_entry = (u32)&wakeup_pmode_return;
   header->pmode_cr3 = (u32)__pa_symbol(initial_page_table);
   saved_magic = 0x12345678;
 #else /* CONFIG_64BIT */
 #ifdef CONFIG_SMP
   initial_stack = (unsigned long)temp_stack + sizeof(temp_stack);
-  early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(smp_processor_id());
+  early_gdt_descr.address = (unsigned long)get_cpu_gdt_rw(smp_processor_id());
   initial_gs = per_cpu_offset(smp_processor_id());
 #endif
   initial_code = (unsigned long)wakeup_long64;
   saved_magic = 0x123456789abcdef0L;
 #endif /* CONFIG_64BIT */
   /*
    * Pause/unpause graph tracing around do_suspend_lowlevel as it has
    * inconsistent call/return info after it jumps to the wakeup vector.
    */
   pause_graph_tracing();
   do_suspend_lowlevel();
   unpause_graph_tracing();
   return 0;
 }<sep>@@
expression e;
@@

- get_cpu_gdt_table
+ get_cpu_gdt_rw
    (e)
--- initial
+++ final
@@ -1,47 +1,47 @@
 static int cpu_initialize_context(unsigned int cpu, struct task_struct *idle) {
   struct vcpu_guest_context *ctxt;
   struct desc_struct *gdt;
   unsigned long gdt_mfn;
   /* used to tell cpu_init() that it can proceed with initialization */
   cpumask_set_cpu(cpu, cpu_callout_mask);
   if (cpumask_test_and_set_cpu(cpu, xen_cpu_initialized_map)) return 0;
   ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
   if (ctxt == NULL) return -ENOMEM;
-  gdt = get_cpu_gdt_table(cpu);
+  gdt = get_cpu_gdt_rw(cpu);
 #ifdef CONFIG_X86_32
   ctxt->user_regs.fs = __KERNEL_PERCPU;
   ctxt->user_regs.gs = __KERNEL_STACK_CANARY;
 #endif
   memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
   ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle;
   ctxt->flags = VGCF_IN_KERNEL;
   ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
   ctxt->user_regs.ds = __USER_DS;
   ctxt->user_regs.es = __USER_DS;
   ctxt->user_regs.ss = __KERNEL_DS;
   xen_copy_trap_info(ctxt->trap_ctxt);
   ctxt->ldt_ents = 0;
   BUG_ON((unsigned long)gdt & ~PAGE_MASK);
   gdt_mfn = arbitrary_virt_to_mfn(gdt);
   make_lowmem_page_readonly(gdt);
   make_lowmem_page_readonly(mfn_to_virt(gdt_mfn));
   ctxt->gdt_frames[0] = gdt_mfn;
   ctxt->gdt_ents = GDT_ENTRIES;
   ctxt->kernel_ss = __KERNEL_DS;
   ctxt->kernel_sp = idle->thread.sp0;
 #ifdef CONFIG_X86_32
   ctxt->event_callback_cs = __KERNEL_CS;
   ctxt->failsafe_callback_cs = __KERNEL_CS;
 #else
   ctxt->gs_base_kernel = per_cpu_offset(cpu);
 #endif
   ctxt->event_callback_eip = (unsigned long)xen_hypervisor_callback;
   ctxt->failsafe_callback_eip = (unsigned long)xen_failsafe_callback;
   ctxt->user_regs.cs = __KERNEL_CS;
   per_cpu(xen_cr3, cpu) = __pa(swapper_pg_dir);
   ctxt->user_regs.esp = idle->thread.sp0 - sizeof(struct pt_regs);
   ctxt->ctrlreg[3] = xen_pfn_to_cr3(virt_to_gfn(swapper_pg_dir));
   if (HYPERVISOR_vcpu_op(VCPUOP_initialise, xen_vcpu_nr(cpu), ctxt)) BUG();
   kfree(ctxt);
   return 0;
 }<sep>@@
expression e;
@@

- get_cpu_gdt_table
+ get_cpu_gdt_rw
    (e)
--- initial
+++ final
@@ -1,22 +1,22 @@
 static void vgetcpu_cpu_init(void *arg) {
   int cpu = smp_processor_id();
   struct desc_struct d = {};
   unsigned long node = 0;
 #ifdef CONFIG_NUMA
   node = cpu_to_node(cpu);
 #endif
   if (static_cpu_has(X86_FEATURE_RDTSCP)) write_rdtscp_aux((node << 12) | cpu);
   /*
    * Store cpu number in limit so that it can be loaded
    * quickly in user space in vgetcpu. (12 bits for the CPU
    * and 8 bits for the node)
    */
   d.limit0 = cpu | ((node & 0xf) << 12);
   d.limit = node >> 4;
   d.type = 5; /* RO data, expand down, accessed */
   d.dpl = 3;  /* Visible to user code */
   d.s = 1;    /* Not a system segment */
   d.p = 1;    /* Present */
   d.d = 1;    /* 32-bit */
-  write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
+  write_gdt_entry(get_cpu_gdt_rw(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
 }<sep>@@
expression e;
@@

- get_cpu_gdt_table
+ get_cpu_gdt_rw
    (e)
--- initial
+++ final
@@ -1,49 +1,49 @@
 static int cm_alloc_msg(struct cm_id_private *cm_id_priv, struct ib_mad_send_buf **msg) {
   struct ib_mad_agent *mad_agent;
   struct ib_mad_send_buf *m;
   struct ib_ah *ah;
   struct cm_av *av;
   unsigned long flags, flags2;
   int ret = 0;
   /* don't let the port to be released till the agent is down */
   spin_lock_irqsave(&cm.state_lock, flags2);
   spin_lock_irqsave(&cm.lock, flags);
   if (!cm_id_priv->prim_send_port_not_ready)
     av = &cm_id_priv->av;
   else if (!cm_id_priv->altr_send_port_not_ready && (cm_id_priv->alt_av.port))
     av = &cm_id_priv->alt_av;
   else {
     pr_info("%s: not valid CM id\n", __func__);
     ret = -ENODEV;
     spin_unlock_irqrestore(&cm.lock, flags);
     goto out;
   }
   spin_unlock_irqrestore(&cm.lock, flags);
   /* Make sure the port haven't released the mad yet */
   mad_agent = cm_id_priv->av.port->mad_agent;
   if (!mad_agent) {
     pr_info("%s: not a valid MAD agent\n", __func__);
     ret = -ENODEV;
     goto out;
   }
-  ah = ib_create_ah(mad_agent->qp->pd, &av->ah_attr);
+  ah = rdma_create_ah(mad_agent->qp->pd, &av->ah_attr);
   if (IS_ERR(ah)) {
     ret = PTR_ERR(ah);
     goto out;
   }
   m = ib_create_send_mad(mad_agent, cm_id_priv->id.remote_cm_qpn, av->pkey_index, 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, GFP_ATOMIC, IB_MGMT_BASE_VERSION);
   if (IS_ERR(m)) {
     ib_destroy_ah(ah);
     ret = PTR_ERR(m);
     goto out;
   }
   /* Timeout set by caller if response is expected. */
   m->ah = ah;
   m->retries = cm_id_priv->max_cm_retries;
   atomic_inc(&cm_id_priv->refcount);
   m->context[0] = cm_id_priv;
   *msg = m;
 out:
   spin_unlock_irqrestore(&cm.state_lock, flags2);
   return ret;
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,7 +1,7 @@
 struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, const struct ib_wc *wc, const struct ib_grh *grh, u8 port_num) {
   struct rdma_ah_attr ah_attr;
   int ret;
   ret = ib_init_ah_from_wc(pd->device, port_num, wc, grh, &ah_attr);
   if (ret) return ERR_PTR(ret);
-  return ib_create_ah(pd, &ah_attr);
+  return rdma_create_ah(pd, &ah_attr);
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,18 +1,18 @@
 struct ipoib_ah *ipoib_create_ah(struct net_device *dev, struct ib_pd *pd, struct rdma_ah_attr *attr) {
   struct ipoib_ah *ah;
   struct ib_ah *vah;
   ah = kmalloc(sizeof *ah, GFP_KERNEL);
   if (!ah) return ERR_PTR(-ENOMEM);
   ah->dev = dev;
   ah->last_send = 0;
   kref_init(&ah->ref);
-  vah = ib_create_ah(pd, attr);
+  vah = rdma_create_ah(pd, attr);
   if (IS_ERR(vah)) {
     kfree(ah);
     ah = (struct ipoib_ah *)vah;
   } else {
     ah->ah = vah;
     ipoib_dbg(ipoib_priv(dev), "Created ah %p\n", ah->ah);
   }
   return ah;
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,76 +1,76 @@
 int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, enum ib_qp_type dest_qpt, u16 pkey_index, u32 remote_qpn, u32 qkey, struct rdma_ah_attr *attr, u8 *s_mac, u16 vlan_id, struct ib_mad *mad) {
   struct ib_sge list;
   struct ib_ud_wr wr;
   struct ib_send_wr *bad_wr;
   struct mlx4_ib_demux_pv_ctx *sqp_ctx;
   struct mlx4_ib_demux_pv_qp *sqp;
   struct mlx4_mad_snd_buf *sqp_mad;
   struct ib_ah *ah;
   struct ib_qp *send_qp = NULL;
   unsigned wire_tx_ix = 0;
   int ret = 0;
   u16 wire_pkey_ix;
   int src_qpnum;
   u8 sgid_index;
   sqp_ctx = dev->sriov.sqps[port - 1];
   /* check if proxy qp created */
   if (!sqp_ctx || sqp_ctx->state != DEMUX_PV_STATE_ACTIVE) return -EAGAIN;
   if (dest_qpt == IB_QPT_SMI) {
     src_qpnum = 0;
     sqp = &sqp_ctx->qp[0];
     wire_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][0];
   } else {
     src_qpnum = 1;
     sqp = &sqp_ctx->qp[1];
     wire_pkey_ix = dev->pkeys.virt2phys_pkey[slave][port - 1][pkey_index];
   }
   send_qp = sqp->qp;
   /* create ah */
   sgid_index = attr->grh.sgid_index;
   attr->grh.sgid_index = 0;
-  ah = ib_create_ah(sqp_ctx->pd, attr);
+  ah = rdma_create_ah(sqp_ctx->pd, attr);
   if (IS_ERR(ah)) return -ENOMEM;
   attr->grh.sgid_index = sgid_index;
   to_mah(ah)->av.ib.gid_index = sgid_index;
   /* get rid of force-loopback bit */
   to_mah(ah)->av.ib.port_pd &= cpu_to_be32(0x7FFFFFFF);
   spin_lock(&sqp->tx_lock);
   if (sqp->tx_ix_head - sqp->tx_ix_tail >= (MLX4_NUM_TUNNEL_BUFS - 1))
     ret = -EAGAIN;
   else
     wire_tx_ix = (++sqp->tx_ix_head) & (MLX4_NUM_TUNNEL_BUFS - 1);
   spin_unlock(&sqp->tx_lock);
   if (ret) goto out;
   sqp_mad = (struct mlx4_mad_snd_buf *)(sqp->tx_ring[wire_tx_ix].buf.addr);
   if (sqp->tx_ring[wire_tx_ix].ah) ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah);
   sqp->tx_ring[wire_tx_ix].ah = ah;
   ib_dma_sync_single_for_cpu(&dev->ib_dev, sqp->tx_ring[wire_tx_ix].buf.map, sizeof(struct mlx4_mad_snd_buf), DMA_TO_DEVICE);
   memcpy(&sqp_mad->payload, mad, sizeof *mad);
   ib_dma_sync_single_for_device(&dev->ib_dev, sqp->tx_ring[wire_tx_ix].buf.map, sizeof(struct mlx4_mad_snd_buf), DMA_TO_DEVICE);
   list.addr = sqp->tx_ring[wire_tx_ix].buf.map;
   list.length = sizeof(struct mlx4_mad_snd_buf);
   list.lkey = sqp_ctx->pd->local_dma_lkey;
   wr.ah = ah;
   wr.port_num = port;
   wr.pkey_index = wire_pkey_ix;
   wr.remote_qkey = qkey;
   wr.remote_qpn = remote_qpn;
   wr.wr.next = NULL;
   wr.wr.wr_id = ((u64)wire_tx_ix) | MLX4_TUN_SET_WRID_QPN(src_qpnum);
   wr.wr.sg_list = &list;
   wr.wr.num_sge = 1;
   wr.wr.opcode = IB_WR_SEND;
   wr.wr.send_flags = IB_SEND_SIGNALED;
   if (s_mac) memcpy(to_mah(ah)->av.eth.s_mac, s_mac, 6);
   if (vlan_id < 0x1000) vlan_id |= (attr->sl & 7) << 13;
   to_mah(ah)->av.eth.vlan = cpu_to_be16(vlan_id);
   ret = ib_post_send(send_qp, &wr.wr, &bad_wr);
   if (!ret) return 0;
   spin_lock(&sqp->tx_lock);
   sqp->tx_ix_tail++;
   spin_unlock(&sqp->tx_lock);
   sqp->tx_ring[wire_tx_ix].ah = NULL;
 out:
   ib_destroy_ah(ah);
   return ret;
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,16 +1,16 @@
 static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl) {
   struct ib_ah *new_ah;
   struct rdma_ah_attr ah_attr;
   unsigned long flags;
   if (!dev->send_agent[port_num - 1][0]) return;
   memset(&ah_attr, 0, sizeof ah_attr);
   ah_attr.dlid = lid;
   ah_attr.sl = sl;
   ah_attr.port_num = port_num;
-  new_ah = ib_create_ah(dev->send_agent[port_num - 1][0]->qp->pd, &ah_attr);
+  new_ah = rdma_create_ah(dev->send_agent[port_num - 1][0]->qp->pd, &ah_attr);
   if (IS_ERR(new_ah)) return;
   spin_lock_irqsave(&dev->sm_lock, flags);
   if (dev->sm_ah[port_num - 1]) ib_destroy_ah(dev->sm_ah[port_num - 1]);
   dev->sm_ah[port_num - 1] = new_ah;
   spin_unlock_irqrestore(&dev->sm_lock, flags);
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,16 +1,16 @@
 static void update_sm_ah(struct mthca_dev *dev, u8 port_num, u16 lid, u8 sl) {
   struct ib_ah *new_ah;
   struct rdma_ah_attr ah_attr;
   unsigned long flags;
   if (!dev->send_agent[port_num - 1][0]) return;
   memset(&ah_attr, 0, sizeof ah_attr);
   ah_attr.dlid = lid;
   ah_attr.sl = sl;
   ah_attr.port_num = port_num;
-  new_ah = ib_create_ah(dev->send_agent[port_num - 1][0]->qp->pd, &ah_attr);
+  new_ah = rdma_create_ah(dev->send_agent[port_num - 1][0]->qp->pd, &ah_attr);
   if (IS_ERR(new_ah)) return;
   spin_lock_irqsave(&dev->sm_lock, flags);
   if (dev->sm_ah[port_num - 1]) ib_destroy_ah(dev->sm_ah[port_num - 1]);
   dev->sm_ah[port_num - 1] = new_ah;
   spin_unlock_irqrestore(&dev->sm_lock, flags);
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,13 +1,13 @@
 struct ib_ah *qib_create_qp0_ah(struct qib_ibport *ibp, u16 dlid) {
   struct rdma_ah_attr attr;
   struct ib_ah *ah = ERR_PTR(-EINVAL);
   struct rvt_qp *qp0;
   memset(&attr, 0, sizeof(attr));
   attr.dlid = dlid;
   attr.port_num = ppd_from_ibp(ibp)->port;
   rcu_read_lock();
   qp0 = rcu_dereference(ibp->rvp.qp[0]);
-  if (qp0) ah = ib_create_ah(qp0->ibqp.pd, &attr);
+  if (qp0) ah = rdma_create_ah(qp0->ibqp.pd, &attr);
   rcu_read_unlock();
   return ah;
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,35 +1,35 @@
 static void update_sm_ah(struct work_struct *work) {
   struct ib_sa_port *port = container_of(work, struct ib_sa_port, update_task);
   struct ib_sa_sm_ah *new_ah;
   struct ib_port_attr port_attr;
   struct rdma_ah_attr ah_attr;
   if (ib_query_port(port->agent->device, port->port_num, &port_attr)) {
     pr_warn("Couldn't query port\n");
     return;
   }
   new_ah = kmalloc(sizeof(*new_ah), GFP_KERNEL);
   if (!new_ah) return;
   kref_init(&new_ah->ref);
   new_ah->src_path_mask = (1 << port_attr.lmc) - 1;
   new_ah->pkey_index = 0;
   if (ib_find_pkey(port->agent->device, port->port_num, IB_DEFAULT_PKEY_FULL, &new_ah->pkey_index)) pr_err("Couldn't find index for default PKey\n");
   memset(&ah_attr, 0, sizeof(ah_attr));
   ah_attr.dlid = port_attr.sm_lid;
   ah_attr.sl = port_attr.sm_sl;
   ah_attr.port_num = port->port_num;
   if (port_attr.grh_required) {
     ah_attr.ah_flags = IB_AH_GRH;
     ah_attr.grh.dgid.global.subnet_prefix = cpu_to_be64(port_attr.subnet_prefix);
     ah_attr.grh.dgid.global.interface_id = cpu_to_be64(IB_SA_WELL_KNOWN_GUID);
   }
-  new_ah->ah = ib_create_ah(port->agent->qp->pd, &ah_attr);
+  new_ah->ah = rdma_create_ah(port->agent->qp->pd, &ah_attr);
   if (IS_ERR(new_ah->ah)) {
     pr_warn("Couldn't create new SM AH\n");
     kfree(new_ah);
     return;
   }
   spin_lock_irq(&port->ah_lock);
   if (port->sm_ah) kref_put(&port->sm_ah->ref, free_sm_ah);
   port->sm_ah = new_ah;
   spin_unlock_irq(&port->ah_lock);
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,13 +1,13 @@
 struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid) {
   struct rdma_ah_attr attr;
   struct ib_ah *ah = ERR_PTR(-EINVAL);
   struct rvt_qp *qp0;
   memset(&attr, 0, sizeof(attr));
   attr.dlid = dlid;
   attr.port_num = ppd_from_ibp(ibp)->port;
   rcu_read_lock();
   qp0 = rcu_dereference(ibp->rvp.qp[0]);
-  if (qp0) ah = ib_create_ah(qp0->ibqp.pd, &attr);
+  if (qp0) ah = rdma_create_ah(qp0->ibqp.pd, &attr);
   rcu_read_unlock();
   return ah;
 }<sep>@@
expression e1,e2;
@@

-       ib_create_ah(e1,e2)
+       rdma_create_ah(e1,e2)
--- initial
+++ final
@@ -1,42 +1,42 @@
 void agent_send_response(const struct ib_mad_hdr *mad_hdr, const struct ib_grh *grh, const struct ib_wc *wc, const struct ib_device *device, int port_num, int qpn, size_t resp_mad_len, bool opa) {
   struct ib_agent_port_private *port_priv;
   struct ib_mad_agent *agent;
   struct ib_mad_send_buf *send_buf;
   struct ib_ah *ah;
   struct ib_mad_send_wr_private *mad_send_wr;
   if (rdma_cap_ib_switch(device))
     port_priv = ib_get_agent_port(device, 0);
   else
     port_priv = ib_get_agent_port(device, port_num);
   if (!port_priv) {
     dev_err(&device->dev, "Unable to find port agent\n");
     return;
   }
   agent = port_priv->agent[qpn];
   ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num);
   if (IS_ERR(ah)) {
     dev_err(&device->dev, "ib_create_ah_from_wc error %ld\n", PTR_ERR(ah));
     return;
   }
   if (opa && mad_hdr->base_version != OPA_MGMT_BASE_VERSION) resp_mad_len = IB_MGMT_MAD_SIZE;
   send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0, IB_MGMT_MAD_HDR, resp_mad_len - IB_MGMT_MAD_HDR, GFP_KERNEL, mad_hdr->base_version);
   if (IS_ERR(send_buf)) {
     dev_err(&device->dev, "ib_create_send_mad error\n");
     goto err1;
   }
   memcpy(send_buf->mad, mad_hdr, resp_mad_len);
   send_buf->ah = ah;
   if (rdma_cap_ib_switch(device)) {
     mad_send_wr = container_of(send_buf, struct ib_mad_send_wr_private, send_buf);
     mad_send_wr->send_wr.port_num = port_num;
   }
   if (ib_post_send_mad(send_buf, NULL)) {
     dev_err(&device->dev, "ib_post_send_mad error\n");
     goto err2;
   }
   return;
 err2:
   ib_free_send_mad(send_buf);
 err1:
-  ib_destroy_ah(ah);
+  rdma_destroy_ah(ah);
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)
--- initial
+++ final
@@ -1,49 +1,49 @@
 static int cm_alloc_msg(struct cm_id_private *cm_id_priv, struct ib_mad_send_buf **msg) {
   struct ib_mad_agent *mad_agent;
   struct ib_mad_send_buf *m;
   struct ib_ah *ah;
   struct cm_av *av;
   unsigned long flags, flags2;
   int ret = 0;
   /* don't let the port to be released till the agent is down */
   spin_lock_irqsave(&cm.state_lock, flags2);
   spin_lock_irqsave(&cm.lock, flags);
   if (!cm_id_priv->prim_send_port_not_ready)
     av = &cm_id_priv->av;
   else if (!cm_id_priv->altr_send_port_not_ready && (cm_id_priv->alt_av.port))
     av = &cm_id_priv->alt_av;
   else {
     pr_info("%s: not valid CM id\n", __func__);
     ret = -ENODEV;
     spin_unlock_irqrestore(&cm.lock, flags);
     goto out;
   }
   spin_unlock_irqrestore(&cm.lock, flags);
   /* Make sure the port haven't released the mad yet */
   mad_agent = cm_id_priv->av.port->mad_agent;
   if (!mad_agent) {
     pr_info("%s: not a valid MAD agent\n", __func__);
     ret = -ENODEV;
     goto out;
   }
   ah = rdma_create_ah(mad_agent->qp->pd, &av->ah_attr);
   if (IS_ERR(ah)) {
     ret = PTR_ERR(ah);
     goto out;
   }
   m = ib_create_send_mad(mad_agent, cm_id_priv->id.remote_cm_qpn, av->pkey_index, 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, GFP_ATOMIC, IB_MGMT_BASE_VERSION);
   if (IS_ERR(m)) {
-    ib_destroy_ah(ah);
+    rdma_destroy_ah(ah);
     ret = PTR_ERR(m);
     goto out;
   }
   /* Timeout set by caller if response is expected. */
   m->ah = ah;
   m->retries = cm_id_priv->max_cm_retries;
   atomic_inc(&cm_id_priv->refcount);
   m->context[0] = cm_id_priv;
   *msg = m;
 out:
   spin_unlock_irqrestore(&cm.state_lock, flags2);
   return ret;
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)
--- initial
+++ final
@@ -1,14 +1,14 @@
 static int cm_alloc_response_msg(struct cm_port *port, struct ib_mad_recv_wc *mad_recv_wc, struct ib_mad_send_buf **msg) {
   struct ib_mad_send_buf *m;
   struct ib_ah *ah;
   ah = ib_create_ah_from_wc(port->mad_agent->qp->pd, mad_recv_wc->wc, mad_recv_wc->recv_buf.grh, port->port_num);
   if (IS_ERR(ah)) return PTR_ERR(ah);
   m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, GFP_ATOMIC, IB_MGMT_BASE_VERSION);
   if (IS_ERR(m)) {
-    ib_destroy_ah(ah);
+    rdma_destroy_ah(ah);
     return PTR_ERR(m);
   }
   m->ah = ah;
   *msg = m;
   return 0;
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)
--- initial
+++ final
@@ -1,32 +1,32 @@
 static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, struct ib_mad_send_buf *send_buf, struct ib_mad_recv_wc *mad_wc) {
   struct srpt_port *sport = (struct srpt_port *)mad_agent->context;
   struct ib_ah *ah;
   struct ib_mad_send_buf *rsp;
   struct ib_dm_mad *dm_mad;
   if (!mad_wc || !mad_wc->recv_buf.mad) return;
   ah = ib_create_ah_from_wc(mad_agent->qp->pd, mad_wc->wc, mad_wc->recv_buf.grh, mad_agent->port_num);
   if (IS_ERR(ah)) goto err;
   BUILD_BUG_ON(offsetof(struct ib_dm_mad, data) != IB_MGMT_DEVICE_HDR);
   rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp, mad_wc->wc->pkey_index, 0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, GFP_KERNEL, IB_MGMT_BASE_VERSION);
   if (IS_ERR(rsp)) goto err_rsp;
   rsp->ah = ah;
   dm_mad = rsp->mad;
   memcpy(dm_mad, mad_wc->recv_buf.mad, sizeof(*dm_mad));
   dm_mad->mad_hdr.method = IB_MGMT_METHOD_GET_RESP;
   dm_mad->mad_hdr.status = 0;
   switch (mad_wc->recv_buf.mad->mad_hdr.method) {
   case IB_MGMT_METHOD_GET: srpt_mgmt_method_get(sport, mad_wc->recv_buf.mad, dm_mad); break;
   case IB_MGMT_METHOD_SET: dm_mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); break;
   default: dm_mad->mad_hdr.status = cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD); break;
   }
   if (!ib_post_send_mad(rsp, NULL)) {
     ib_free_recv_mad(mad_wc);
     /* will destroy_ah & free_send_mad in send completion */
     return;
   }
   ib_free_send_mad(rsp);
 err_rsp:
-  ib_destroy_ah(ah);
+  rdma_destroy_ah(ah);
 err:
   ib_free_recv_mad(mad_wc);
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)
--- initial
+++ final
@@ -1,16 +1,16 @@
 static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent, struct ib_mad_recv_wc *recv_wc) {
   struct ib_mad_send_buf *msg;
   struct ib_ah *ah;
   int hdr_len;
   ah = ib_create_ah_from_wc(agent->qp->pd, recv_wc->wc, recv_wc->recv_buf.grh, agent->port_num);
   if (IS_ERR(ah)) return (void *)ah;
   hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class);
   msg = ib_create_send_mad(agent, recv_wc->wc->src_qp, recv_wc->wc->pkey_index, 1, hdr_len, 0, GFP_KERNEL, IB_MGMT_BASE_VERSION);
   if (IS_ERR(msg))
-    ib_destroy_ah(ah);
+    rdma_destroy_ah(ah);
   else {
     msg->ah = ah;
     msg->context[0] = ah;
   }
   return msg;
 }<sep>@@
expression ad;
@@

-       ib_destroy_ah
+       rdma_destroy_ah
	(ah)