imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,18 +1,17 @@
 static int __maybe_unused zynqmp_runtime_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct spi_master *master = platform_get_drvdata(pdev);
+  struct spi_master *master = dev_get_drvdata(dev);
   struct zynqmp_qspi *xqspi = spi_master_get_devdata(master);
   int ret;
   ret = clk_enable(xqspi->pclk);
   if (ret) {
     dev_err(dev, "Cannot enable APB clock.\n");
     return ret;
   }
   ret = clk_enable(xqspi->refclk);
   if (ret) {
     dev_err(dev, "Cannot enable device clock.\n");
     clk_disable(xqspi->pclk);
     return ret;
   }
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,22 +1,21 @@
 static int wdat_wdt_resume_noirq(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct wdat_wdt *wdat = platform_get_drvdata(pdev);
+  struct wdat_wdt *wdat = dev_get_drvdata(dev);
   int ret;
   if (!watchdog_active(&wdat->wdd)) return 0;
   if (!wdat->stopped) {
     /*
      * Looks like the boot firmware reinitializes the watchdog
      * before it hands off to the OS on resume from sleep so we
      * stop and reprogram the watchdog here.
      */
     ret = wdat_wdt_stop(&wdat->wdd);
     if (ret) return ret;
     ret = wdat_wdt_set_timeout(&wdat->wdd, wdat->wdd.timeout);
     if (ret) return ret;
     ret = wdat_wdt_enable_reboot(wdat);
     if (ret) return ret;
     ret = wdat_wdt_ping(&wdat->wdd);
     if (ret) return ret;
   }
   return wdat_wdt_start(&wdat->wdd);
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,26 +1,25 @@
 static int s5pcsis_pm_resume(struct device *dev, bool runtime) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct v4l2_subdev *sd = platform_get_drvdata(pdev);
+  struct v4l2_subdev *sd = dev_get_drvdata(dev);
   struct csis_state *state = sd_to_csis_state(sd);
   int ret = 0;
   v4l2_dbg(1, debug, sd, "%s: flags: 0x%x\n", __func__, state->flags);
   mutex_lock(&state->lock);
   if (!runtime && !(state->flags & ST_SUSPENDED)) goto unlock;
   if (!(state->flags & ST_POWERED)) {
     ret = regulator_bulk_enable(CSIS_NUM_SUPPLIES, state->supplies);
     if (ret) goto unlock;
     ret = phy_power_on(state->phy);
     if (!ret) {
       state->flags |= ST_POWERED;
     } else {
       regulator_bulk_disable(CSIS_NUM_SUPPLIES, state->supplies);
       goto unlock;
     }
     clk_enable(state->clock[CSIS_CLK_GATE]);
   }
   if (state->flags & ST_STREAMING) s5pcsis_start_stream(state);
   state->flags &= ~ST_SUSPENDED;
 unlock:
   mutex_unlock(&state->lock);
   return ret ? -EAGAIN : 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,19 +1,18 @@
 static ssize_t dsicm_hw_revision_show(struct device *dev, struct device_attribute *attr, char *buf) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct panel_drv_data *ddata = platform_get_drvdata(pdev);
+  struct panel_drv_data *ddata = dev_get_drvdata(dev);
   struct omap_dss_device *in = ddata->in;
   u8 id1, id2, id3;
   int r;
   mutex_lock(&ddata->lock);
   if (ddata->enabled) {
     in->ops.dsi->bus_lock(in);
     r = dsicm_wake_up(ddata);
     if (!r) r = dsicm_get_id(ddata, &id1, &id2, &id3);
     in->ops.dsi->bus_unlock(in);
   } else {
     r = -ENODEV;
   }
   mutex_unlock(&ddata->lock);
   if (r) return r;
   return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,14 +1,13 @@
 static int atmel_tcb_pwm_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
+  struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev);
   void __iomem *base = tcbpwm->tc->regs;
   int i;
   for (i = 0; i < (NPWM / 2); i++) {
     struct atmel_tcb_channel *chan = &tcbpwm->bkup[i];
     chan->cmr = readl(base + ATMEL_TC_REG(i, CMR));
     chan->ra = readl(base + ATMEL_TC_REG(i, RA));
     chan->rb = readl(base + ATMEL_TC_REG(i, RB));
     chan->rc = readl(base + ATMEL_TC_REG(i, RC));
   }
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,9 +1,8 @@
 static int imx_uart_resume_noirq(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct imx_port *sport = platform_get_drvdata(pdev);
+  struct imx_port *sport = dev_get_drvdata(dev);
   int ret;
   ret = clk_enable(sport->clk_ipg);
   if (ret) return ret;
   imx_uart_restore_context(sport);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,13 +1,12 @@
 static void __maybe_unused cros_ec_sensors_complete(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+  struct iio_dev *indio_dev = dev_get_drvdata(dev);
   struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
   if (st->curr_sampl_freq == 0) return;
   if (st->curr_sampl_freq < CROS_EC_MIN_SUSPEND_SAMPLING_FREQUENCY) {
     mutex_lock(&st->cmd_lock);
     st->param.cmd = MOTIONSENSE_CMD_EC_RATE;
     st->param.ec_rate.data = st->curr_sampl_freq;
     cros_ec_motion_send_host_cmd(st, 0);
     mutex_unlock(&st->cmd_lock);
   }
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,43 +1,42 @@
 static ssize_t state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
+  struct arche_platform_drvdata *arche_pdata = dev_get_drvdata(dev);
   int ret = 0;
   mutex_lock(&arche_pdata->platform_state_mutex);
   if (sysfs_streq(buf, "off")) {
     if (arche_pdata->state == ARCHE_PLATFORM_STATE_OFF) goto exit;
     /*  If SVC goes down, bring down APB's as well */
     device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
     arche_platform_poweroff_seq(arche_pdata);
   } else if (sysfs_streq(buf, "active")) {
     if (arche_pdata->state == ARCHE_PLATFORM_STATE_ACTIVE) goto exit;
     /* First we want to make sure we power off everything
      * and then activate back again
      */
     device_for_each_child(arche_pdata->dev, NULL, apb_poweroff);
     arche_platform_poweroff_seq(arche_pdata);
     arche_platform_wd_irq_en(arche_pdata);
     ret = arche_platform_coldboot_seq(arche_pdata);
     if (ret) goto exit;
   } else if (sysfs_streq(buf, "standby")) {
     if (arche_pdata->state == ARCHE_PLATFORM_STATE_STANDBY) goto exit;
     dev_warn(arche_pdata->dev, "standby state not supported\n");
   } else if (sysfs_streq(buf, "fw_flashing")) {
     if (arche_pdata->state == ARCHE_PLATFORM_STATE_FW_FLASHING) goto exit;
     /*
      * Here we only control SVC.
      *
      * In case of FW_FLASHING mode we do not want to control
      * APBs, as in case of V2, SPI bus is shared between both
      * the APBs. So let user chose which APB he wants to flash.
      */
     arche_platform_poweroff_seq(arche_pdata);
     ret = arche_platform_fw_flashing_seq(arche_pdata);
     if (ret) goto exit;
   } else {
     dev_err(arche_pdata->dev, "unknown state\n");
     ret = -EINVAL;
   }
 exit:
   mutex_unlock(&arche_pdata->platform_state_mutex);
   return ret ? ret : count;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,7 +1,6 @@
 static int ad7606_par8_read_block(struct device *dev, int count, void *buf) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+  struct iio_dev *indio_dev = dev_get_drvdata(dev);
   struct ad7606_state *st = iio_priv(indio_dev);
   insb((unsigned long)st->base_address, buf, count * 2);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,8 +1,7 @@
 static int mxc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+  struct rtc_plat_data *pdata = dev_get_drvdata(dev);
   void __iomem *ioaddr = pdata->ioaddr;
   rtc_time64_to_tm(get_alarm_or_time(dev, MXC_RTC_ALARM), &alrm->time);
   alrm->pending = ((readw(ioaddr + RTC_RTCISR) & RTC_ALM_BIT)) ? 1 : 0;
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,8 +1,7 @@
 static int dw_resume_early(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct dw_dma_chip *chip = platform_get_drvdata(pdev);
+  struct dw_dma_chip *chip = dev_get_drvdata(dev);
   int ret;
   ret = clk_prepare_enable(chip->clk);
   if (ret) return ret;
   return dw_dma_enable(chip);
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,8 +1,7 @@
 static int nvec_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct nvec_chip *nvec = platform_get_drvdata(pdev);
+  struct nvec_chip *nvec = dev_get_drvdata(dev);
   dev_dbg(nvec->dev, "resuming\n");
   tegra_init_i2c_slave(nvec);
   nvec_toggle_global_events(nvec, true);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,6 +1,5 @@
 static int __maybe_unused hid_sensor_runtime_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct iio_dev *indio_dev = platform_get_drvdata(pdev);
+  struct iio_dev *indio_dev = dev_get_drvdata(dev);
   struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
   return _hid_sensor_power_state(attrb, true);
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,8 +1,7 @@
 static int lpc32xx_rtc_freeze(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
+  struct lpc32xx_rtc *rtc = dev_get_drvdata(dev);
   spin_lock_irq(&rtc->lock);
   rtc_writel(rtc, LPC32XX_RTC_CTRL, rtc_readl(rtc, LPC32XX_RTC_CTRL) & ~LPC32XX_RTC_CTRL_MATCH0);
   spin_unlock_irq(&rtc->lock);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,7 +1,6 @@
 static ssize_t ds1685_rtc_sysfs_battery_show(struct device *dev, struct device_attribute *attr, char *buf) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+  struct ds1685_priv *rtc = dev_get_drvdata(dev);
   u8 ctrld;
   ctrld = rtc->read(rtc, RTC_CTRL_D);
   return sprintf(buf, "%s\n", (ctrld & RTC_CTRL_D_VRT) ? "ok" : "not ok or N/A");
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,25 +1,24 @@
 static int __maybe_unused auok190x_runtime_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct fb_info *info = platform_get_drvdata(pdev);
+  struct fb_info *info = dev_get_drvdata(dev);
   struct auok190xfb_par *par = info->par;
   struct auok190x_board *board = par->board;
   if (!par->standby) {
     dev_warn(dev, "not in standby, runtime-pm pairing mismatch\n");
     return 0;
   }
   if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) {
     dev_dbg(dev, "runtime resume without standby\n");
   } else {
     /* when in standby, controller is always busy
      * and only accepts the wakeup command
      */
     dev_dbg(dev, "runtime resume from standby\n");
     auok190x_send_command_nowait(par, AUOK190X_CMD_WAKEUP);
     msleep(160);
     /* wait for the controller to be ready and release the lock */
     board->wait_for_rdy(par);
   }
   par->standby = 0;
   mutex_unlock(&(par->io_lock));
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,31 +1,30 @@
 static int __maybe_unused auok190x_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct fb_info *info = platform_get_drvdata(pdev);
+  struct fb_info *info = dev_get_drvdata(dev);
   struct auok190xfb_par *par = info->par;
   struct auok190x_board *board = par->board;
   int ret;
   dev_dbg(dev, "suspend\n");
   if (board->quirks & AUOK190X_QUIRK_STANDBYBROKEN) {
     /* suspend via powering off the ic */
     dev_dbg(dev, "suspend with broken standby\n");
     auok190x_power(par, 0);
   } else {
     dev_dbg(dev, "suspend using sleep\n");
     /* the sleep state can only be entered from the standby state.
      * pm_runtime_get_noresume gets called before the suspend call.
      * So the devices usage count is >0 but it is not necessarily
      * active.
      */
     if (!pm_runtime_status_suspended(dev)) {
       ret = auok190x_runtime_suspend(dev);
       if (ret < 0) {
         dev_err(dev, "auok190x_runtime_suspend failed with %d\n", ret);
         return ret;
       }
       par->manual_standby = 1;
     }
     gpio_direction_output(board->gpio_nsleep, 0);
   }
   msleep(100);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,17 +1,16 @@
 static int fsldma_resume_early(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct fsldma_device *fdev = platform_get_drvdata(pdev);
+  struct fsldma_device *fdev = dev_get_drvdata(dev);
   struct fsldma_chan *chan;
   u32 mode;
   int i;
   for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) {
     chan = fdev->chan[i];
     if (!chan) continue;
     spin_lock_bh(&chan->desc_lock);
     mode = chan->regs_save.mr & ~FSL_DMA_MR_CS & ~FSL_DMA_MR_CC & ~FSL_DMA_MR_CA;
     set_mr(chan, mode);
     chan->pm_state = RUNNING;
     spin_unlock_bh(&chan->desc_lock);
   }
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,10 +1,9 @@
 static int imx_uart_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct imx_port *sport = platform_get_drvdata(pdev);
+  struct imx_port *sport = dev_get_drvdata(dev);
   /* disable wakeup from i.MX UART */
   imx_uart_enable_wakeup(sport, false);
   uart_resume_port(&imx_uart_uart_driver, &sport->port);
   enable_irq(sport->port.irq);
   clk_disable_unprepare(sport->clk_ipg);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,19 +1,18 @@
 static int ds1742_rtc_set_time(struct device *dev, struct rtc_time *tm) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+  struct rtc_plat_data *pdata = dev_get_drvdata(dev);
   void __iomem *ioaddr = pdata->ioaddr_rtc;
   u8 century;
   century = bin2bcd((tm->tm_year + 1900) / 100);
   writeb(RTC_WRITE, ioaddr + RTC_CONTROL);
   writeb(bin2bcd(tm->tm_year % 100), ioaddr + RTC_YEAR);
   writeb(bin2bcd(tm->tm_mon + 1), ioaddr + RTC_MONTH);
   writeb(bin2bcd(tm->tm_wday) & RTC_DAY_MASK, ioaddr + RTC_DAY);
   writeb(bin2bcd(tm->tm_mday), ioaddr + RTC_DATE);
   writeb(bin2bcd(tm->tm_hour), ioaddr + RTC_HOURS);
   writeb(bin2bcd(tm->tm_min), ioaddr + RTC_MINUTES);
   writeb(bin2bcd(tm->tm_sec) & RTC_SECONDS_MASK, ioaddr + RTC_SECONDS);
   /* RTC_CENTURY and RTC_CONTROL share same register */
   writeb(RTC_WRITE | (century & RTC_CENTURY_MASK), ioaddr + RTC_CENTURY);
   writeb(century & RTC_CENTURY_MASK, ioaddr + RTC_CONTROL);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,13 +1,12 @@
 static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+  struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
   struct rtc_time *tm = &alrm->time;
   unsigned long secs;
   u32 tod, days;
   rtc_tm_to_time(tm, &secs);
   tod = secs % SEC_PER_DAY;
   ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_TODA, tod);
   days = secs / SEC_PER_DAY;
   ezx_pcap_write(pcap_rtc->pcap, PCAP_REG_RTC_DAYA, days);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,33 +1,32 @@
 static int ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct ds1685_priv *rtc = platform_get_drvdata(pdev);
+  struct ds1685_priv *rtc = dev_get_drvdata(dev);
   u8 seconds, minutes, hours, mday, ctrlb, ctrlc;
   int ret;
   /* Fetch the alarm info from the RTC alarm registers. */
   ds1685_rtc_begin_data_access(rtc);
   seconds = rtc->read(rtc, RTC_SECS_ALARM);
   minutes = rtc->read(rtc, RTC_MINS_ALARM);
   hours = rtc->read(rtc, RTC_HRS_ALARM);
   mday = rtc->read(rtc, RTC_MDAY_ALARM);
   ctrlb = rtc->read(rtc, RTC_CTRL_B);
   ctrlc = rtc->read(rtc, RTC_CTRL_C);
   ds1685_rtc_end_data_access(rtc);
   /* Check the month date for validity. */
   ret = ds1685_rtc_check_mday(rtc, mday);
   if (ret) return ret;
   /*
    * Check the three alarm bytes.
    *
    * The Linux RTC system doesn't support the "don't care" capability
    * of this RTC chip.  We check for it anyways in case support is
    * added in the future and only assign when we care.
    */
   if (likely(seconds < 0xc0)) alrm->time.tm_sec = ds1685_rtc_bcd2bin(rtc, seconds, RTC_SECS_BCD_MASK, RTC_SECS_BIN_MASK);
   if (likely(minutes < 0xc0)) alrm->time.tm_min = ds1685_rtc_bcd2bin(rtc, minutes, RTC_MINS_BCD_MASK, RTC_MINS_BIN_MASK);
   if (likely(hours < 0xc0)) alrm->time.tm_hour = ds1685_rtc_bcd2bin(rtc, hours, RTC_HRS_24_BCD_MASK, RTC_HRS_24_BIN_MASK);
   /* Write the data to rtc_wkalrm. */
   alrm->time.tm_mday = ds1685_rtc_bcd2bin(rtc, mday, RTC_MDAY_BCD_MASK, RTC_MDAY_BIN_MASK);
   alrm->enabled = !!(ctrlb & RTC_CTRL_B_AIE);
   alrm->pending = !!(ctrlc & RTC_CTRL_C_AF);
   return 0;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,21 +1,20 @@
 static time64_t get_alarm_or_time(struct device *dev, int time_alarm) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
+  struct rtc_plat_data *pdata = dev_get_drvdata(dev);
   void __iomem *ioaddr = pdata->ioaddr;
   u32 day = 0, hr = 0, min = 0, sec = 0, hr_min = 0;
   switch (time_alarm) {
   case MXC_RTC_TIME:
     day = readw(ioaddr + RTC_DAYR);
     hr_min = readw(ioaddr + RTC_HOURMIN);
     sec = readw(ioaddr + RTC_SECOND);
     break;
   case MXC_RTC_ALARM:
     day = readw(ioaddr + RTC_DAYALARM);
     hr_min = readw(ioaddr + RTC_ALRM_HM) & 0xffff;
     sec = readw(ioaddr + RTC_ALRM_SEC);
     break;
   }
   hr = hr_min >> 8;
   min = hr_min & 0xff;
   return ((((time64_t)day * 24 + hr) * 60) + min) * 60 + sec;
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)
--- initial
+++ final
@@ -1,9 +1,8 @@
 static void asoc_ssc_exit(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct ssc_device *ssc = platform_get_drvdata(pdev);
+  struct ssc_device *ssc = dev_get_drvdata(dev);
   if (ssc->pdata->use_dma)
     atmel_pcm_dma_platform_unregister(dev);
   else
     atmel_pcm_pdc_platform_unregister(dev);
   snd_soc_unregister_component(dev);
 }<sep>@@
identifier e1;
expression e2;
type T;
@@

(
- T e1 = to_platform_device(e2);
  ...
- platform_get_drvdata(e1)
+ dev_get_drvdata(e2)
  ... when any
&
  T e1 = to_platform_device(e2);
  <... when != e1
(
  platform_get_drvdata(e1)
|
- &e1->dev
+ e2
)
  ...>
)