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->legacy.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->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>@@
struct nand_chip *chip;
@@
- chip->chip_delay
+ chip->legacy.chip_delay
--- initial
+++ final
@@ -1,63 +1,63 @@
 static int tmio_probe(struct platform_device *dev) {
   struct tmio_nand_data *data = dev_get_platdata(&dev->dev);
   struct resource *fcr = platform_get_resource(dev, IORESOURCE_MEM, 0);
   struct resource *ccr = platform_get_resource(dev, IORESOURCE_MEM, 1);
   int irq = platform_get_irq(dev, 0);
   struct tmio_nand *tmio;
   struct mtd_info *mtd;
   struct nand_chip *nand_chip;
   int retval;
   if (data == NULL) dev_warn(&dev->dev, "NULL platform data!\n");
   tmio = devm_kzalloc(&dev->dev, sizeof(*tmio), GFP_KERNEL);
   if (!tmio) return -ENOMEM;
   tmio->dev = dev;
   platform_set_drvdata(dev, tmio);
   nand_chip = &tmio->chip;
   mtd = nand_to_mtd(nand_chip);
   mtd->name = "tmio-nand";
   mtd->dev.parent = &dev->dev;
   tmio->ccr = devm_ioremap(&dev->dev, ccr->start, resource_size(ccr));
   if (!tmio->ccr) return -EIO;
   tmio->fcr_base = fcr->start & 0xfffff;
   tmio->fcr = devm_ioremap(&dev->dev, fcr->start, resource_size(fcr));
   if (!tmio->fcr) return -EIO;
   retval = tmio_hw_init(dev, tmio);
   if (retval) return retval;
   /* Set address of NAND IO lines */
   nand_chip->legacy.IO_ADDR_R = tmio->fcr;
   nand_chip->legacy.IO_ADDR_W = tmio->fcr;
   /* Set address of hardware control function */
   nand_chip->legacy.cmd_ctrl = tmio_nand_hwcontrol;
   nand_chip->legacy.dev_ready = tmio_nand_dev_ready;
   nand_chip->legacy.read_byte = tmio_nand_read_byte;
   nand_chip->legacy.write_buf = tmio_nand_write_buf;
   nand_chip->legacy.read_buf = tmio_nand_read_buf;
   /* set eccmode using hardware ECC */
   nand_chip->ecc.mode = NAND_ECC_HW;
   nand_chip->ecc.size = 512;
   nand_chip->ecc.bytes = 6;
   nand_chip->ecc.strength = 2;
   nand_chip->ecc.hwctl = tmio_nand_enable_hwecc;
   nand_chip->ecc.calculate = tmio_nand_calculate_ecc;
   nand_chip->ecc.correct = tmio_nand_correct_data;
   if (data) nand_chip->badblock_pattern = data->badblock_pattern;
   /* 15 us command delay time */
-  nand_chip->chip_delay = 15;
+  nand_chip->legacy.chip_delay = 15;
   retval = devm_request_irq(&dev->dev, irq, &tmio_irq, 0, dev_name(&dev->dev), tmio);
   if (retval) {
     dev_err(&dev->dev, "request_irq error %d\n", retval);
     goto err_irq;
   }
   tmio->irq = irq;
   nand_chip->legacy.waitfunc = tmio_nand_wait;
   /* Scan to find existence of the device */
   retval = nand_scan(nand_chip, 1);
   if (retval) goto err_irq;
   /* Register the partitions */
   retval = mtd_device_parse_register(mtd, data ? data->part_parsers : NULL, NULL, data ? data->partition : NULL, data ? data->num_partitions : 0);
   if (!retval) return retval;
   nand_release(nand_chip);
 err_irq:
   tmio_hw_stop(dev, tmio);
   return retval;
 }<sep>@@
struct nand_chip *chip;
@@
- chip->chip_delay
+ chip->legacy.chip_delay
--- initial
+++ final
@@ -1,75 +1,75 @@
 static int __init txx9ndfmc_probe(struct platform_device *dev) {
   struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
   int hold, spw;
   int i;
   struct txx9ndfmc_drvdata *drvdata;
   unsigned long gbusclk = plat->gbus_clock;
   struct resource *res;
   drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
   if (!drvdata) return -ENOMEM;
   res = platform_get_resource(dev, IORESOURCE_MEM, 0);
   drvdata->base = devm_ioremap_resource(&dev->dev, res);
   if (IS_ERR(drvdata->base)) return PTR_ERR(drvdata->base);
   hold = plat->hold ?: 20; /* tDH */
   spw = plat->spw ?: 90;   /* max(tREADID, tWP, tRP) */
   hold = TXX9NDFMC_NS_TO_CYC(gbusclk, hold);
   spw = TXX9NDFMC_NS_TO_CYC(gbusclk, spw);
   if (plat->flags & NDFMC_PLAT_FLAG_HOLDADD) hold -= 2; /* actual hold time : (HOLD + 2) BUSCLK */
   spw -= 1;                                             /* actual wait time : (SPW + 1) BUSCLK */
   hold = clamp(hold, 1, 15);
   drvdata->hold = hold;
   spw = clamp(spw, 1, 15);
   drvdata->spw = spw;
   dev_info(&dev->dev, "CLK:%ldMHz HOLD:%d SPW:%d\n", (gbusclk + 500000) / 1000000, hold, spw);
   nand_controller_init(&drvdata->controller);
   drvdata->controller.ops = &txx9ndfmc_controller_ops;
   platform_set_drvdata(dev, drvdata);
   txx9ndfmc_initialize(dev);
   for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) {
     struct txx9ndfmc_priv *txx9_priv;
     struct nand_chip *chip;
     struct mtd_info *mtd;
     if (!(plat->ch_mask & (1 << i))) continue;
     txx9_priv = kzalloc(sizeof(struct txx9ndfmc_priv), GFP_KERNEL);
     if (!txx9_priv) continue;
     chip = &txx9_priv->chip;
     mtd = nand_to_mtd(chip);
     mtd->dev.parent = &dev->dev;
     chip->legacy.read_byte = txx9ndfmc_read_byte;
     chip->legacy.read_buf = txx9ndfmc_read_buf;
     chip->legacy.write_buf = txx9ndfmc_write_buf;
     chip->legacy.cmd_ctrl = txx9ndfmc_cmd_ctrl;
     chip->legacy.dev_ready = txx9ndfmc_dev_ready;
     chip->ecc.calculate = txx9ndfmc_calculate_ecc;
     chip->ecc.correct = txx9ndfmc_correct_data;
     chip->ecc.hwctl = txx9ndfmc_enable_hwecc;
     chip->ecc.mode = NAND_ECC_HW;
     chip->ecc.strength = 1;
-    chip->chip_delay = 100;
+    chip->legacy.chip_delay = 100;
     chip->controller = &drvdata->controller;
     nand_set_controller_data(chip, txx9_priv);
     txx9_priv->dev = dev;
     if (plat->ch_mask != 1) {
       txx9_priv->cs = i;
       txx9_priv->mtdname = kasprintf(GFP_KERNEL, "%s.%u", dev_name(&dev->dev), i);
     } else {
       txx9_priv->cs = -1;
       txx9_priv->mtdname = kstrdup(dev_name(&dev->dev), GFP_KERNEL);
     }
     if (!txx9_priv->mtdname) {
       kfree(txx9_priv);
       dev_err(&dev->dev, "Unable to allocate MTD name.\n");
       continue;
     }
     if (plat->wide_mask & (1 << i)) chip->options |= NAND_BUSWIDTH_16;
     if (nand_scan(chip, 1)) {
       kfree(txx9_priv->mtdname);
       kfree(txx9_priv);
       continue;
     }
     mtd->name = txx9_priv->mtdname;
     mtd_device_register(mtd, NULL, 0);
     drvdata->mtds[i] = mtd;
   }
   return 0;
 }<sep>@@
struct nand_chip *chip;
@@
- chip->chip_delay
+ chip->legacy.chip_delay
--- initial
+++ final
@@ -1,16 +1,16 @@
 static int tvc_connect(struct omap_dss_device *dssdev) {
   struct panel_drv_data *ddata = to_panel_data(dssdev);
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(ddata->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int dvic_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,16 +1,16 @@
 static int hdmic_connect(struct omap_dss_device *dssdev) {
   struct panel_drv_data *ddata = to_panel_data(dssdev);
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(ddata->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int opa362_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int tfp410_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,20 +1,20 @@
 static int tpd_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst) {
   struct panel_drv_data *ddata = to_panel_data(dssdev);
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
   gpiod_set_value_cansleep(ddata->ls_oe_gpio, 1);
   /* DC-DC converter needs at max 300us to get to 90% of 5V */
   udelay(300);
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int panel_dpi_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,34 +1,34 @@
 static int dsicm_connect(struct omap_dss_device *dssdev) {
   struct panel_drv_data *ddata = to_panel_data(dssdev);
   struct device *dev = &ddata->pdev->dev;
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     dev_err(dev, "Failed to connect to video source\n");
     goto err_connect;
   }
   r = src->ops->dsi.request_vc(src, &ddata->channel);
   if (r) {
     dev_err(dev, "failed to get virtual channel\n");
     goto err_req_vc;
   }
   r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
   if (r) {
     dev_err(dev, "failed to set VC_ID\n");
     goto err_vc_id;
   }
   return 0;
 err_vc_id:
   src->ops->dsi.release_vc(src, ddata->channel);
 err_req_vc:
   omapdss_device_disconnect(src, dssdev);
 err_connect:
   omapdss_device_put(src);
   return r;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,17 +1,17 @@
 static int lb035q02_connect(struct omap_dss_device *dssdev) {
   struct panel_drv_data *ddata = to_panel_data(dssdev);
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   init_lb035q02_panel(ddata->spi);
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int nec_8048_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int sharp_ls_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int acx565akm_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int td028ttec1_panel_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,15 +1,15 @@
 static int tpo_td043_connect(struct omap_dss_device *dssdev) {
   struct omap_dss_device *src;
   int r;
-  src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
-  if (IS_ERR(src)) {
+  src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
+  if (IS_ERR_OR_NULL(src)) {
     dev_err(dssdev->dev, "failed to find video source\n");
-    return PTR_ERR(src);
+    return src ? PTR_ERR(src) : -EINVAL;
   }
   r = omapdss_device_connect(dssdev->dss, src, dssdev);
   if (r) {
     omapdss_device_put(src);
     return r;
   }
   return 0;
 }<sep>@@
expression src,e;
@@

-       src = omapdss_of_find_source_for_first_ep(e);
-       if (IS_ERR(src))
+       src = omapdss_of_find_connected_device(e, 0);
+       if (IS_ERR_OR_NULL(src))
	{
                ...
-               return PTR_ERR(src);
+               return src ? PTR_ERR(src) : -EINVAL;
        }
--- initial
+++ final
@@ -1,16 +1,16 @@
 static void omapdrm_cleanup(struct omap_drm_private *priv) {
   struct drm_device *ddev = priv->ddev;
   DBG("");
   drm_dev_unregister(ddev);
   omap_modeset_disable_external_hpd(ddev);
   drm_kms_helper_poll_fini(ddev);
   omap_fbdev_fini(ddev);
   drm_atomic_helper_shutdown(ddev);
   drm_mode_config_cleanup(ddev);
   omap_drm_irq_uninstall(ddev);
   omap_gem_deinit(ddev);
   destroy_workqueue(priv->wq);
   omap_disconnect_pipelines(ddev);
   omap_crtc_pre_uninit(priv);
-  drm_dev_unref(ddev);
+  drm_dev_put(ddev);
 }<sep>@@
expression ddev;
@@
-       drm_dev_unref(ddev);
+       drm_dev_put(ddev);