imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,71 +1,71 @@
 static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc, struct device_node *np) {
   struct sunxi_nand_chip *chip;
   struct mtd_info *mtd;
   struct nand_chip *nand;
   int nsels;
   int ret;
   int i;
   u32 tmp;
   if (!of_get_property(np, "reg", &nsels)) return -EINVAL;
   nsels /= sizeof(u32);
   if (!nsels) {
     dev_err(dev, "invalid reg property size\n");
     return -EINVAL;
   }
   chip = devm_kzalloc(dev, sizeof(*chip) + (nsels * sizeof(struct sunxi_nand_chip_sel)), GFP_KERNEL);
   if (!chip) {
     dev_err(dev, "could not allocate chip\n");
     return -ENOMEM;
   }
   chip->nsels = nsels;
   chip->selected = -1;
   for (i = 0; i < nsels; i++) {
     ret = of_property_read_u32_index(np, "reg", i, &tmp);
     if (ret) {
       dev_err(dev, "could not retrieve reg property: %d\n", ret);
       return ret;
     }
     if (tmp > NFC_MAX_CS) {
       dev_err(dev, "invalid reg value: %u (max CS = 7)\n", tmp);
       return -EINVAL;
     }
     if (test_and_set_bit(tmp, &nfc->assigned_cs)) {
       dev_err(dev, "CS %d already assigned\n", tmp);
       return -EINVAL;
     }
     chip->sels[i].cs = tmp;
     if (!of_property_read_u32_index(np, "allwinner,rb", i, &tmp) && tmp < 2)
       chip->sels[i].rb = tmp;
     else
       chip->sels[i].rb = -1;
   }
   nand = &chip->nand;
   /* Default tR value specified in the ONFI spec (chapter 4.15.1) */
   nand->chip_delay = 200;
   nand->controller = &nfc->controller;
   nand->controller->ops = &sunxi_nand_controller_ops;
   /*
    * Set the ECC mode to the default value in case nothing is specified
    * in the DT.
    */
   nand->ecc.mode = NAND_ECC_HW;
   nand_set_flash_node(nand, np);
   nand->select_chip = sunxi_nfc_select_chip;
-  nand->cmd_ctrl = sunxi_nfc_cmd_ctrl;
+  nand->legacy.cmd_ctrl = sunxi_nfc_cmd_ctrl;
   nand->legacy.read_buf = sunxi_nfc_read_buf;
   nand->legacy.write_buf = sunxi_nfc_write_buf;
   nand->legacy.read_byte = sunxi_nfc_read_byte;
   nand->setup_data_interface = sunxi_nfc_setup_data_interface;
   mtd = nand_to_mtd(nand);
   mtd->dev.parent = dev;
   ret = nand_scan(nand, nsels);
   if (ret) return ret;
   ret = mtd_device_register(mtd, NULL, 0);
   if (ret) {
     dev_err(dev, "failed to register mtd device: %d\n", ret);
     nand_release(nand);
     return ret;
   }
   list_add_tail(&chip->node, &nfc->chips);
   return 0;
 }<sep>@@
expression chip; 
@@
- chip->cmd_ctrl
+ chip->legacy.cmd_ctrl
--- initial
+++ final
@@ -1,9 +1,9 @@
 static ssize_t nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a, const char *buf, size_t count) {
   struct drm_device *dev = dev_get_drvdata(d);
   struct nouveau_drm *drm = nouveau_drm(dev);
-  struct nvkm_therm *therm = nvxx_therm(&drm->device);
+  struct nvkm_therm *therm = nvxx_therm(&drm->client.device);
   long value;
   if (kstrtol(buf, 10, &value) == -EINVAL) return count;
   therm->attr_set(therm, NVKM_THERM_ATTR_THRS_DOWN_CLK, value / 1000);
   return count;
 }<sep>@@
struct nouveau_drm *drm;
@@
- drm->device
+ drm->client.device
--- initial
+++ final
@@ -1,8 +1,8 @@
 void dc_sink_release(struct dc_sink *sink) {
   ASSERT(atomic_read(&sink->ref_count) > 0);
   atomic_dec(&sink->ref_count);
   if (atomic_read(&sink->ref_count) == 0) {
     destruct(sink);
-    dm_free(sink);
+    kfree(sink);
   }
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,16 +1,16 @@
 struct i2c_engine *dal_i2c_hw_engine_dce80_create(const struct i2c_hw_engine_dce80_create_arg *arg) {
   struct i2c_hw_engine_dce80 *engine;
   if (!arg) {
     BREAK_TO_DEBUGGER();
     return NULL;
   }
-  engine = dm_alloc(sizeof(struct i2c_hw_engine_dce80));
+  engine = kzalloc(sizeof(struct i2c_hw_engine_dce80), GFP_KERNEL);
   if (!engine) {
     BREAK_TO_DEBUGGER();
     return NULL;
   }
   if (construct(engine, arg)) return &engine->base.base;
   BREAK_TO_DEBUGGER();
-  dm_free(engine);
+  kfree(engine);
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 void dcn10_clock_source_destroy(struct clock_source **clk_src) {
-  dm_free(TO_DCE110_CLK_SRC(*clk_src));
+  kfree(TO_DCE110_CLK_SRC(*clk_src));
   *clk_src = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 void dce112_clock_source_destroy(struct clock_source **clk_src) {
-  dm_free(TO_DCE110_CLK_SRC(*clk_src));
+  kfree(TO_DCE110_CLK_SRC(*clk_src));
   *clk_src = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,6 +1,6 @@
 static void dce110_destroy_resource_pool(struct resource_pool **pool) {
   struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
   destruct(dce110_pool);
-  dm_free(dce110_pool);
+  kfree(dce110_pool);
   *pool = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,11 +1,11 @@
 bool dal_vector_reserve(struct vector *vector, uint32_t capacity) {
   void *new_container;
   if (capacity <= vector->capacity) return true;
-  new_container = dm_realloc(vector->container, capacity * vector->struct_size);
+  new_container = krealloc(vector->container, capacity * vector->struct_size, GFP_KERNEL);
   if (new_container) {
     vector->container = new_container;
     vector->capacity = capacity;
     return true;
   }
   return false;
 }<sep>@@
expression ptr, size;
@@

- dm_realloc(ptr, size)
+ krealloc(ptr, size, GFP_KERNEL)
--- initial
+++ final
@@ -1,10 +1,10 @@
 static struct dce_hwseq *dce100_hwseq_create(struct dc_context *ctx) {
-  struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+  struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
   if (hws) {
     hws->ctx = ctx;
     hws->regs = &hwseq_reg;
     hws->shifts = &hwseq_shift;
     hws->masks = &hwseq_mask;
   }
   return hws;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,6 +1,6 @@
 static void destroy(struct i2caux **i2c_engine) {
   struct i2caux_dce110 *i2caux_dce110 = FROM_I2C_AUX(*i2c_engine);
   destruct(i2caux_dce110);
-  dm_free(i2caux_dce110);
+  kfree(i2caux_dce110);
   *i2c_engine = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,10 +1,10 @@
 static void bios_parser_destroy(struct dc_bios **dcb) {
   struct bios_parser *bp = BP_FROM_DCB(*dcb);
   if (!bp) {
     BREAK_TO_DEBUGGER();
     return;
   }
   destruct(bp);
-  dm_free(bp);
+  kfree(bp);
   *dcb = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 static void dce120_transform_destroy(struct transform **xfm) {
-  dm_free(TO_DCE_TRANSFORM(*xfm));
+  kfree(TO_DCE_TRANSFORM(*xfm));
   *xfm = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 static void dcn10_ipp_destroy(struct input_pixel_processor **ipp) {
-  dm_free(TO_DCN10_IPP(*ipp));
+  kfree(TO_DCN10_IPP(*ipp));
   *ipp = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,6 +1,6 @@
 void dal_vector_destroy(struct vector **vector) {
   if (vector == NULL || *vector == NULL) return;
   dal_vector_destruct(*vector);
-  dm_free(*vector);
+  kfree(*vector);
   *vector = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,8 +1,8 @@
 struct output_pixel_processor *dce112_opp_create(struct dc_context *ctx, uint32_t inst) {
-  struct dce110_opp *opp = dm_alloc(sizeof(struct dce110_opp));
+  struct dce110_opp *opp = kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
   if (!opp) return NULL;
   if (dce110_opp_construct(opp, ctx, inst, &opp_regs[inst], &opp_shift, &opp_mask)) return &opp->base;
   BREAK_TO_DEBUGGER();
-  dm_free(opp);
+  kfree(opp);
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,22 +1,22 @@
 struct dc *dc_create(const struct dc_init_data *init_params) {
-  struct dc *dc = dm_alloc(sizeof(*dc));
+  struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
   unsigned int full_pipe_count;
   if (NULL == dc) goto alloc_fail;
   if (false == construct(dc, init_params)) goto construct_fail;
   /*TODO: separate HW and SW initialization*/
   dc->hwss.init_hw(dc);
   full_pipe_count = dc->res_pool->pipe_count;
   if (dc->res_pool->underlay_pipe_index != NO_UNDERLAY_PIPE) full_pipe_count--;
   dc->caps.max_streams = min(full_pipe_count, dc->res_pool->stream_enc_count);
   dc->caps.max_links = dc->link_count;
   dc->caps.max_audios = dc->res_pool->audio_count;
   dc->config = init_params->flags;
   dm_logger_write(dc->ctx->logger, LOG_DC, "Display Core initialized\n");
   /* TODO: missing feature to be enabled */
   dc->debug.disable_dfs_bypass = true;
   return dc;
 construct_fail:
-  dm_free(dc);
+  kfree(dc);
 alloc_fail:
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,22 +1,22 @@
 void dm_logger_close(struct log_entry *entry) {
   struct dal_logger *logger = entry->logger;
   if (logger && logger->open_count > 0) {
     logger->open_count--;
   } else {
     BREAK_TO_DEBUGGER();
     goto cleanup;
   }
   /* --Flush log_entry buffer-- */
   /* print to kernel console */
   log_to_debug_console(entry);
   /* log internally for dsat */
   log_to_internal_buffer(entry);
   /* TODO: Write end heading */
 cleanup:
   if (entry->buf) {
-    dm_free(entry->buf);
+    kfree(entry->buf);
     entry->buf = NULL;
     entry->buf_offset = 0;
     entry->max_buf_bytes = 0;
   }
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,6 +1,6 @@
 static void destroy(struct hw_gpio_pin **ptr) {
   struct hw_ddc *pin = HW_DDC_FROM_BASE(*ptr);
   destruct(pin);
-  dm_free(pin);
+  kfree(pin);
   *ptr = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,8 +1,8 @@
 void dc_release_state(struct dc_state *context) {
   ASSERT(atomic_read(&context->ref_count) > 0);
   atomic_dec(&context->ref_count);
   if (atomic_read(&context->ref_count) == 0) {
     dc_resource_state_destruct(context);
-    dm_free(context);
+    kfree(context);
   }
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 static void virtual_link_encoder_destroy(struct link_encoder **enc) {
-  dm_free(*enc);
+  kfree(*enc);
   *enc = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,4 +1,4 @@
 static void dce112_transform_destroy(struct transform **xfm) {
-  dm_free(TO_DCE_TRANSFORM(*xfm));
+  kfree(TO_DCE_TRANSFORM(*xfm));
   *xfm = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,9 +1,9 @@
 static struct input_pixel_processor *dce112_ipp_create(struct dc_context *ctx, uint32_t inst) {
-  struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+  struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
   if (!ipp) {
     BREAK_TO_DEBUGGER();
     return NULL;
   }
   dce_ipp_construct(ipp, ctx, inst, &ipp_regs[inst], &ipp_shift, &ipp_mask);
   return &ipp->base;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,8 +1,8 @@
 struct compressor *dce110_compressor_create(struct dc_context *ctx) {
-  struct dce110_compressor *cp110 = dm_alloc(sizeof(struct dce110_compressor));
+  struct dce110_compressor *cp110 = kzalloc(sizeof(struct dce110_compressor), GFP_KERNEL);
   if (!cp110) return NULL;
   if (dce110_compressor_construct(cp110, ctx)) return &cp110->base;
   BREAK_TO_DEBUGGER();
-  dm_free(cp110);
+  kfree(cp110);
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,8 +1,8 @@
 struct link_encoder *dcn10_link_encoder_create(const struct encoder_init_data *enc_init_data) {
-  struct dce110_link_encoder *enc110 = dm_alloc(sizeof(struct dce110_link_encoder));
+  struct dce110_link_encoder *enc110 = kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
   if (!enc110) return NULL;
   if (dce110_link_encoder_construct(enc110, enc_init_data, &link_enc_feature, &link_enc_regs[enc_init_data->transmitter], &link_enc_aux_regs[enc_init_data->channel - 1], &link_enc_hpd_regs[enc_init_data->hpd_source])) { return &enc110->base; }
   BREAK_TO_DEBUGGER();
-  dm_free(enc110);
+  kfree(enc110);
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,22 +1,22 @@
 bool dal_vector_presized_costruct(struct vector *vector, struct dc_context *ctx, uint32_t count, void *initial_value, uint32_t struct_size) {
   uint32_t i;
   vector->container = NULL;
   if (!struct_size || !count) {
     /* Container must be non-zero size*/
     BREAK_TO_DEBUGGER();
     return false;
   }
-  vector->container = dm_alloc(struct_size * count);
+  vector->container = kzalloc(struct_size * count, GFP_KERNEL);
   if (vector->container == NULL) return false;
   /* If caller didn't supply initial value then the default
    * of all zeros is expected, which is exactly what dal_alloc()
    * initialises the memory to. */
   if (NULL != initial_value) {
     for (i = 0; i < count; ++i)
       memmove(vector->container + i * struct_size, initial_value, struct_size);
   }
   vector->capacity = count;
   vector->struct_size = struct_size;
   vector->count = count;
   return true;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,6 +1,6 @@
 static struct mpc *dcn10_mpc_create(struct dc_context *ctx) {
-  struct dcn10_mpc *mpc10 = dm_alloc(sizeof(struct dcn10_mpc));
+  struct dcn10_mpc *mpc10 = kzalloc(sizeof(struct dcn10_mpc), GFP_KERNEL);
   if (!mpc10) return NULL;
   dcn10_mpc_construct(mpc10, ctx, &mpc_regs, &mpc_shift, &mpc_mask, 4);
   return &mpc10->base;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,8 +1,8 @@
 static struct transform *dcn10_dpp_create(struct dc_context *ctx, uint32_t inst) {
-  struct dcn10_dpp *dpp = dm_alloc(sizeof(struct dcn10_dpp));
+  struct dcn10_dpp *dpp = kzalloc(sizeof(struct dcn10_dpp), GFP_KERNEL);
   if (!dpp) return NULL;
   if (dcn10_dpp_construct(dpp, ctx, inst, &tf_regs[inst], &tf_shift, &tf_mask)) return &dpp->base;
   BREAK_TO_DEBUGGER();
-  dm_free(dpp);
+  kfree(dpp);
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,9 +1,9 @@
 void dal_ddc_service_destroy(struct ddc_service **ddc) {
   if (!ddc || !*ddc) {
     BREAK_TO_DEBUGGER();
     return;
   }
   destruct(*ddc);
-  dm_free(*ddc);
+  kfree(*ddc);
   *ddc = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,10 +1,10 @@
 struct clock_source *dce80_clock_source_create(struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) {
-  struct dce110_clk_src *clk_src = dm_alloc(sizeof(struct dce110_clk_src));
+  struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
   if (!clk_src) return NULL;
   if (dce110_clk_src_construct(clk_src, ctx, bios, id, regs, &cs_shift, &cs_mask)) {
     clk_src->base.dp_clk_src = dp_clk_src;
     return &clk_src->base;
   }
   BREAK_TO_DEBUGGER();
   return NULL;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,6 +1,6 @@
 struct dc_state *dc_create_state(void) {
-  struct dc_state *context = dm_alloc(sizeof(struct dc_state));
+  struct dc_state *context = kzalloc(sizeof(struct dc_state), GFP_KERNEL);
   if (!context) return NULL;
   atomic_inc(&context->ref_count);
   return context;
 }<sep>@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)
--- initial
+++ final
@@ -1,6 +1,6 @@
 static void destroy(struct i2c_engine **engine) {
   struct i2c_sw_engine_dce110 *sw_engine = FROM_I2C_ENGINE(*engine);
   destruct(sw_engine);
-  dm_free(sw_engine);
+  kfree(sw_engine);
   *engine = NULL;
 }<sep>@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)
--- initial
+++ final
@@ -1,31 +1,31 @@
 static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) {
   struct pci_dev *parent = pdev->bus->self;
   struct pcie_link_state *link;
   if (!pci_is_pcie(pdev)) return;
   if (pdev->has_secondary_link) parent = pdev;
   if (!parent || !parent->link_state) return;
   /*
    * A driver requested that ASPM be disabled on this device, but
    * if we don't have permission to manage ASPM (e.g., on ACPI
    * systems we have to observe the FADT ACPI_FADT_NO_ASPM bit and
    * the _OSC method), we can't honor that request.  Windows has
    * a similar mechanism using "PciASPMOptOut", which is also
    * ignored in this situation.
    */
   if (aspm_disabled) {
-    dev_warn(&pdev->dev, "can't disable ASPM; OS doesn't have ASPM control\n");
+    pci_warn(pdev, "can't disable ASPM; OS doesn't have ASPM control\n");
     return;
   }
   if (sem) down_read(&pci_bus_sem);
   mutex_lock(&aspm_lock);
   link = parent->link_state;
   if (state & PCIE_LINK_STATE_L0S) link->aspm_disable |= ASPM_STATE_L0S;
   if (state & PCIE_LINK_STATE_L1) link->aspm_disable |= ASPM_STATE_L1;
   pcie_config_aspm_link(link, policy_to_aspm_state(link));
   if (state & PCIE_LINK_STATE_CLKPM) {
     link->clkpm_capable = 0;
     pcie_set_clkpm(link, 0);
   }
   mutex_unlock(&aspm_lock);
   if (sem) up_read(&pci_bus_sem);
 }<sep>@@
struct pci_dev *dv;
@@

-dev_warn(&dv->dev,
+pci_warn(dv,
	...)
--- initial
+++ final
@@ -1,41 +1,41 @@
 static void pci_read_bridge_mmio_pref(struct pci_bus *child) {
   struct pci_dev *dev = child->self;
   u16 mem_base_lo, mem_limit_lo;
   u64 base64, limit64;
   pci_bus_addr_t base, limit;
   struct pci_bus_region region;
   struct resource *res;
   res = child->resource[2];
   pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
   pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo);
   base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16;
   limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16;
   if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
     u32 mem_base_hi, mem_limit_hi;
     pci_read_config_dword(dev, PCI_PREF_BASE_UPPER32, &mem_base_hi);
     pci_read_config_dword(dev, PCI_PREF_LIMIT_UPPER32, &mem_limit_hi);
     /*
      * Some bridges set the base > limit by default, and some
      * (broken) BIOSes do not initialize them.  If we find
      * this, just assume they are not being used.
      */
     if (mem_base_hi <= mem_limit_hi) {
       base64 |= (u64)mem_base_hi << 32;
       limit64 |= (u64)mem_limit_hi << 32;
     }
   }
   base = (pci_bus_addr_t)base64;
   limit = (pci_bus_addr_t)limit64;
   if (base != base64) {
-    dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", (unsigned long long)base64);
+    pci_err(dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", (unsigned long long)base64);
     return;
   }
   if (base <= limit) {
     res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
     if (res->flags & PCI_PREF_RANGE_TYPE_64) res->flags |= IORESOURCE_MEM_64;
     region.start = base;
     region.end = limit + 0xfffff;
     pcibios_bus_to_resource(dev->bus, res, &region);
-    dev_printk(KERN_DEBUG, &dev->dev, "  bridge window %pR\n", res);
+    pci_printk(KERN_DEBUG, dev, "  bridge window %pR\n", res);
   }
 }<sep>@@
struct pci_dev *dv;
@@

-dev_err(&dv->dev,
+pci_err(dv,
	...)

@@
struct pci_dev *dv;
expression i;
@@

-dev_printk(i,&dv->dev,
+pci_printk(i,dv,
	...)
--- initial
+++ final
@@ -1,19 +1,19 @@
 static void ricoh_mmc_fixup_rl5c476(struct pci_dev *dev) {
   /* disable via cardbus interface */
   u8 write_enable;
   u8 write_target;
   u8 disable;
   /* disable must be done via function #0 */
   if (PCI_FUNC(dev->devfn)) return;
   pci_read_config_byte(dev, 0xB7, &disable);
   if (disable & 0x02) return;
   pci_read_config_byte(dev, 0x8E, &write_enable);
   pci_write_config_byte(dev, 0x8E, 0xAA);
   pci_read_config_byte(dev, 0x8D, &write_target);
   pci_write_config_byte(dev, 0x8D, 0xB7);
   pci_write_config_byte(dev, 0xB7, disable | 0x02);
   pci_write_config_byte(dev, 0x8E, write_enable);
   pci_write_config_byte(dev, 0x8D, write_target);
-  dev_notice(&dev->dev, "proprietary Ricoh MMC controller disabled (via cardbus function)\n");
-  dev_notice(&dev->dev, "MMC cards are now supported by standard SDHCI controller\n");
+  pci_notice(dev, "proprietary Ricoh MMC controller disabled (via cardbus function)\n");
+  pci_notice(dev, "MMC cards are now supported by standard SDHCI controller\n");
 }<sep>@@
struct pci_dev *dv;
@@

-dev_notice(&dv->dev,
+pci_notice(dv,
	...)
--- initial
+++ final
@@ -1,27 +1,27 @@
 static pci_ers_result_t reset_link(struct pci_dev *dev) {
   struct pci_dev *udev;
   pci_ers_result_t status;
   struct pcie_port_service_driver *driver;
   if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
     /* Reset this port for all subordinates */
     udev = dev;
   } else {
     /* Reset the upstream component (likely downstream port) */
     udev = dev->bus->self;
   }
   /* Use the aer driver of the component firstly */
   driver = find_aer_service(udev);
   if (driver && driver->reset_link) {
     status = driver->reset_link(udev);
   } else if (udev->has_secondary_link) {
     status = default_reset_link(udev);
   } else {
-    dev_printk(KERN_DEBUG, &dev->dev, "no link-reset support at upstream device %s\n", pci_name(udev));
+    pci_printk(KERN_DEBUG, dev, "no link-reset support at upstream device %s\n", pci_name(udev));
     return PCI_ERS_RESULT_DISCONNECT;
   }
   if (status != PCI_ERS_RESULT_RECOVERED) {
-    dev_printk(KERN_DEBUG, &dev->dev, "link reset at upstream device %s failed\n", pci_name(udev));
+    pci_printk(KERN_DEBUG, dev, "link reset at upstream device %s failed\n", pci_name(udev));
     return PCI_ERS_RESULT_DISCONNECT;
   }
   return status;
 }<sep>@@
struct pci_dev *dv;
expression i;
@@

-dev_printk(i,&dv->dev,
+pci_printk(i,dv,
	...)
--- initial
+++ final
@@ -1,11 +1,11 @@
 static void extend_bridge_window(struct pci_dev *bridge, struct resource *res, struct list_head *add_list, resource_size_t available) {
   struct pci_dev_resource *dev_res;
   if (res->parent) return;
   if (resource_size(res) >= available) return;
   dev_res = res_to_dev_res(add_list, res);
   if (!dev_res) return;
   /* Is there room to extend the window? */
   if (available - resource_size(res) <= dev_res->add_size) return;
   dev_res->add_size = available - resource_size(res);
-  dev_dbg(&bridge->dev, "bridge window %pR extended by %pa\n", res, &dev_res->add_size);
+  pci_dbg(bridge, "bridge window %pR extended by %pa\n", res, &dev_res->add_size);
 }<sep>@@
struct pci_dev *dv;
@@

-dev_dbg(&dv->dev,
+pci_dbg(dv,
	...)