imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,30 +1,30 @@
 static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv, struct vmw_dma_buffer *buffer, size_t shader_size, size_t offset, SVGA3dShaderType shader_type) {
   struct vmw_shader *shader;
   struct vmw_resource *res;
   int ret;
   /*
    * Approximate idr memory usage with 128 bytes. It will be limited
    * by maximum number_of shaders anyway.
    */
   if (unlikely(vmw_shader_size == 0)) vmw_shader_size = ttm_round_pot(sizeof(struct vmw_shader)) + 128;
   ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), vmw_shader_size, false, true);
   if (unlikely(ret != 0)) {
     if (ret != -ERESTARTSYS)
       DRM_ERROR("Out of graphics memory for shader "
                 "creation.\n");
     goto out_err;
   }
   shader = kzalloc(sizeof(*shader), GFP_KERNEL);
-  if (unlikely(shader == NULL)) {
+  if (unlikely(!shader)) {
     ttm_mem_global_free(vmw_mem_glob(dev_priv), vmw_shader_size);
     ret = -ENOMEM;
     goto out_err;
   }
   res = &shader->res;
   /*
    * From here on, the destructor takes over resource freeing.
    */
   ret = vmw_gb_shader_init(dev_priv, res, shader_size, offset, shader_type, 0, 0, buffer, vmw_shader_free);
 out_err:
   return ret ? ERR_PTR(ret) : res;
 }<sep>@@
expression e1;
statement S1,S2;
@@

        e1 = \(kmalloc\|kmemdup\|kzalloc\)(...);
	if (unlikely(
-       e1 == NULL
+       !e1
	))
	S1 else S2
--- initial
+++ final
@@ -1,42 +1,42 @@
 static int vmw_user_shader_alloc(struct vmw_private *dev_priv, struct vmw_dma_buffer *buffer, size_t shader_size, size_t offset, SVGA3dShaderType shader_type, uint8_t num_input_sig, uint8_t num_output_sig, struct ttm_object_file *tfile, u32 *handle) {
   struct vmw_user_shader *ushader;
   struct vmw_resource *res, *tmp;
   int ret;
   /*
    * Approximate idr memory usage with 128 bytes. It will be limited
    * by maximum number_of shaders anyway.
    */
   if (unlikely(vmw_user_shader_size == 0)) vmw_user_shader_size = ttm_round_pot(sizeof(struct vmw_user_shader)) + 128;
   ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), vmw_user_shader_size, false, true);
   if (unlikely(ret != 0)) {
     if (ret != -ERESTARTSYS)
       DRM_ERROR("Out of graphics memory for shader "
                 "creation.\n");
     goto out;
   }
   ushader = kzalloc(sizeof(*ushader), GFP_KERNEL);
-  if (unlikely(ushader == NULL)) {
+  if (unlikely(!ushader)) {
     ttm_mem_global_free(vmw_mem_glob(dev_priv), vmw_user_shader_size);
     ret = -ENOMEM;
     goto out;
   }
   res = &ushader->shader.res;
   ushader->base.shareable = false;
   ushader->base.tfile = NULL;
   /*
    * From here on, the destructor takes over resource freeing.
    */
   ret = vmw_gb_shader_init(dev_priv, res, shader_size, offset, shader_type, num_input_sig, num_output_sig, buffer, vmw_user_shader_free);
   if (unlikely(ret != 0)) goto out;
   tmp = vmw_resource_reference(res);
   ret = ttm_base_object_init(tfile, &ushader->base, false, VMW_RES_SHADER, &vmw_user_shader_base_release, NULL);
   if (unlikely(ret != 0)) {
     vmw_resource_unreference(&tmp);
     goto out_err;
   }
   if (handle) *handle = ushader->base.hash.key;
 out_err:
   vmw_resource_unreference(&res);
 out:
   return ret;
 }<sep>@@
expression e1;
statement S1,S2;
@@

        e1 = \(kmalloc\|kmemdup\|kzalloc\)(...);
	if (unlikely(
-       e1 == NULL
+       !e1
	))
	S1 else S2
--- initial
+++ final
@@ -1,28 +1,27 @@
 static int ctr_encrypt(struct skcipher_request *req) {
   struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
   struct crypto_aes_ctx *ctx = crypto_skcipher_ctx(tfm);
   struct skcipher_walk walk;
   int err, blocks;
   err = skcipher_walk_virt(&walk, req, true);
   kernel_neon_begin();
   while ((blocks = (walk.nbytes / AES_BLOCK_SIZE))) {
     ce_aes_ctr_encrypt(walk.dst.virt.addr, walk.src.virt.addr, (u8 *)ctx->key_enc, num_rounds(ctx), blocks, walk.iv);
     err = skcipher_walk_done(&walk, walk.nbytes % AES_BLOCK_SIZE);
   }
   if (walk.nbytes) {
     u8 __aligned(8) tail[AES_BLOCK_SIZE];
     unsigned int nbytes = walk.nbytes;
     u8 *tdst = walk.dst.virt.addr;
     u8 *tsrc = walk.src.virt.addr;
     /*
      * Tell aes_ctr_encrypt() to process a tail block.
      */
     blocks = -1;
     ce_aes_ctr_encrypt(tail, NULL, (u8 *)ctx->key_enc, num_rounds(ctx), blocks, walk.iv);
-    if (tdst != tsrc) memcpy(tdst, tsrc, nbytes);
-    crypto_xor(tdst, tail, nbytes);
+    crypto_xor_cpy(tdst, tsrc, tail, nbytes);
     err = skcipher_walk_done(&walk, 0);
   }
   kernel_neon_end();
   return err;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               if (tdst != tsrc)
-                       memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,31 +1,30 @@
 static int ctr_encrypt(struct skcipher_request *req) {
   struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
   struct crypto_aes_ctx *ctx = crypto_skcipher_ctx(tfm);
   int err, first, rounds = 6 + ctx->key_length / 4;
   struct skcipher_walk walk;
   int blocks;
   err = skcipher_walk_virt(&walk, req, true);
   first = 1;
   kernel_neon_begin();
   while ((blocks = (walk.nbytes / AES_BLOCK_SIZE))) {
     aes_ctr_encrypt(walk.dst.virt.addr, walk.src.virt.addr, (u8 *)ctx->key_enc, rounds, blocks, walk.iv, first);
     err = skcipher_walk_done(&walk, walk.nbytes % AES_BLOCK_SIZE);
     first = 0;
   }
   if (walk.nbytes) {
     u8 __aligned(8) tail[AES_BLOCK_SIZE];
     unsigned int nbytes = walk.nbytes;
     u8 *tdst = walk.dst.virt.addr;
     u8 *tsrc = walk.src.virt.addr;
     /*
      * Tell aes_ctr_encrypt() to process a tail block.
      */
     blocks = -1;
     aes_ctr_encrypt(tail, NULL, (u8 *)ctx->key_enc, rounds, blocks, walk.iv, first);
-    if (tdst != tsrc) memcpy(tdst, tsrc, nbytes);
-    crypto_xor(tdst, tail, nbytes);
+    crypto_xor_cpy(tdst, tsrc, tail, nbytes);
     err = skcipher_walk_done(&walk, 0);
   }
   kernel_neon_end();
   return err;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               if (tdst != tsrc)
-                       memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,29 +1,28 @@
 static int ctr_encrypt(struct skcipher_request *req) {
   struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
   struct aesbs_ctx *ctx = crypto_skcipher_ctx(tfm);
   struct skcipher_walk walk;
   u8 buf[AES_BLOCK_SIZE];
   int err;
   err = skcipher_walk_virt(&walk, req, true);
   kernel_neon_begin();
   while (walk.nbytes > 0) {
     unsigned int blocks = walk.nbytes / AES_BLOCK_SIZE;
     u8 *final = (walk.total % AES_BLOCK_SIZE) ? buf : NULL;
     if (walk.nbytes < walk.total) {
       blocks = round_down(blocks, walk.stride / AES_BLOCK_SIZE);
       final = NULL;
     }
     aesbs_ctr_encrypt(walk.dst.virt.addr, walk.src.virt.addr, ctx->rk, ctx->rounds, blocks, walk.iv, final);
     if (final) {
       u8 *dst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE;
       u8 *src = walk.src.virt.addr + blocks * AES_BLOCK_SIZE;
-      if (dst != src) memcpy(dst, src, walk.total % AES_BLOCK_SIZE);
-      crypto_xor(dst, final, walk.total % AES_BLOCK_SIZE);
+      crypto_xor_cpy(dst, src, final, walk.total % AES_BLOCK_SIZE);
       err = skcipher_walk_done(&walk, 0);
       break;
     }
     err = skcipher_walk_done(&walk, walk.nbytes - blocks * AES_BLOCK_SIZE);
   }
   kernel_neon_end();
   return err;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               if (tdst != tsrc)
-                       memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,17 +1,16 @@
 static void p8_aes_ctr_final(struct p8_aes_ctr_ctx *ctx, struct blkcipher_walk *walk) {
   u8 *ctrblk = walk->iv;
   u8 keystream[AES_BLOCK_SIZE];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   preempt_disable();
   pagefault_disable();
   enable_kernel_vsx();
   aes_p8_encrypt(ctrblk, keystream, &ctx->enc_key);
   disable_kernel_vsx();
   pagefault_enable();
   preempt_enable();
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, AES_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,11 +1,10 @@
 static void ctr_crypt_final(struct crypto_sparc64_aes_ctx *ctx, struct blkcipher_walk *walk) {
   u8 *ctrblk = walk->iv;
   u64 keystream[AES_BLOCK_SIZE / sizeof(u64)];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   ctx->ops->ecb_encrypt(&ctx->key[0], (const u64 *)ctrblk, keystream, AES_BLOCK_SIZE);
-  crypto_xor((u8 *)keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, (u8 *)keystream, src, nbytes);
   crypto_inc(ctrblk, AES_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
type T;
@@

-               crypto_xor((T)tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, (T)tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,11 +1,10 @@
 static void ctr_crypt_final(struct crypto_aes_ctx *ctx, struct skcipher_walk *walk) {
   u8 *ctrblk = walk->iv;
   u8 keystream[AES_BLOCK_SIZE];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   aesni_enc(ctx, keystream, ctrblk);
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, AES_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,11 +1,10 @@
 static void ctr_crypt_final(struct bf_ctx *ctx, struct blkcipher_walk *walk) {
   u8 *ctrblk = walk->iv;
   u8 keystream[BF_BLOCK_SIZE];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   blowfish_enc_blk(ctx, keystream, ctrblk);
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, BF_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,12 +1,11 @@
 static void ctr_crypt_final(struct blkcipher_desc *desc, struct blkcipher_walk *walk) {
   struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
   u8 *ctrblk = walk->iv;
   u8 keystream[CAST5_BLOCK_SIZE];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   __cast5_encrypt(ctx, keystream, ctrblk);
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, CAST5_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,14 +1,13 @@
 static void crypto_ctr_crypt_final(struct blkcipher_walk *walk, struct crypto_cipher *tfm) {
   unsigned int bsize = crypto_cipher_blocksize(tfm);
   unsigned long alignmask = crypto_cipher_alignmask(tfm);
   u8 *ctrblk = walk->iv;
   u8 tmp[bsize + alignmask];
   u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1);
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   crypto_cipher_encrypt_one(tfm, keystream, ctrblk);
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, bsize);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,11 +1,10 @@
 static void ctr_crypt_final(struct des3_ede_x86_ctx *ctx, struct blkcipher_walk *walk) {
   u8 *ctrblk = walk->iv;
   u8 keystream[DES3_EDE_BLOCK_SIZE];
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   unsigned int nbytes = walk->nbytes;
   des3_ede_enc_blk(ctx, keystream, ctrblk);
-  crypto_xor(keystream, src, nbytes);
-  memcpy(dst, keystream, nbytes);
+  crypto_xor_cpy(dst, keystream, src, nbytes);
   crypto_inc(ctrblk, DES3_EDE_BLOCK_SIZE);
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               crypto_xor(tsrc, tail, nbytes);
-               memcpy(tdst, tsrc, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,17 +1,16 @@
 static int crypto_pcbc_decrypt_inplace(struct skcipher_request *req, struct skcipher_walk *walk, struct crypto_cipher *tfm) {
   int bsize = crypto_cipher_blocksize(tfm);
   unsigned int nbytes = walk->nbytes;
   u8 *src = walk->src.virt.addr;
   u8 *iv = walk->iv;
   u8 tmpbuf[bsize] __aligned(__alignof__(u32));
   do {
     memcpy(tmpbuf, src, bsize);
     crypto_cipher_decrypt_one(tfm, src, src);
     crypto_xor(src, iv, bsize);
-    memcpy(iv, tmpbuf, bsize);
-    crypto_xor(iv, src, bsize);
+    crypto_xor_cpy(iv, tmpbuf, src, bsize);
     src += bsize;
   } while ((nbytes -= bsize) >= bsize);
   memcpy(walk->iv, iv, bsize);
   return nbytes;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,17 +1,16 @@
 static int crypto_pcbc_decrypt_segment(struct skcipher_request *req, struct skcipher_walk *walk, struct crypto_cipher *tfm) {
   int bsize = crypto_cipher_blocksize(tfm);
   unsigned int nbytes = walk->nbytes;
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   u8 *iv = walk->iv;
   do {
     crypto_cipher_decrypt_one(tfm, dst, src);
     crypto_xor(dst, iv, bsize);
-    memcpy(iv, src, bsize);
-    crypto_xor(iv, dst, bsize);
+    crypto_xor_cpy(iv, src, dst, bsize);
     src += bsize;
     dst += bsize;
   } while ((nbytes -= bsize) >= bsize);
   memcpy(walk->iv, iv, bsize);
   return nbytes;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,17 +1,16 @@
 static int crypto_pcbc_encrypt_inplace(struct skcipher_request *req, struct skcipher_walk *walk, struct crypto_cipher *tfm) {
   int bsize = crypto_cipher_blocksize(tfm);
   unsigned int nbytes = walk->nbytes;
   u8 *src = walk->src.virt.addr;
   u8 *iv = walk->iv;
   u8 tmpbuf[bsize];
   do {
     memcpy(tmpbuf, src, bsize);
     crypto_xor(iv, src, bsize);
     crypto_cipher_encrypt_one(tfm, src, iv);
-    memcpy(iv, tmpbuf, bsize);
-    crypto_xor(iv, src, bsize);
+    crypto_xor_cpy(iv, tmpbuf, src, bsize);
     src += bsize;
   } while ((nbytes -= bsize) >= bsize);
   memcpy(walk->iv, iv, bsize);
   return nbytes;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,16 +1,15 @@
 static int crypto_pcbc_encrypt_segment(struct skcipher_request *req, struct skcipher_walk *walk, struct crypto_cipher *tfm) {
   int bsize = crypto_cipher_blocksize(tfm);
   unsigned int nbytes = walk->nbytes;
   u8 *src = walk->src.virt.addr;
   u8 *dst = walk->dst.virt.addr;
   u8 *iv = walk->iv;
   do {
     crypto_xor(iv, src, bsize);
     crypto_cipher_encrypt_one(tfm, dst, iv);
-    memcpy(iv, dst, bsize);
-    crypto_xor(iv, src, bsize);
+    crypto_xor_cpy(iv, dst, src, bsize);
     src += bsize;
     dst += bsize;
   } while ((nbytes -= bsize) >= bsize);
   return nbytes;
 }<sep>@@
expression tdst, tsrc, nbytes, tail;
@@

-               memcpy(tdst, tsrc, nbytes);
-               crypto_xor(tdst, tail, nbytes);
+               crypto_xor_cpy(tdst, tsrc, tail, nbytes);
--- initial
+++ final
@@ -1,19 +1,18 @@
 static int bcm_iproc_i2c_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev);
+  struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
   int ret;
   u32 val;
   /*
    * Power domain could have been shut off completely in system deep
    * sleep, so re-initialize the block here
    */
   ret = bcm_iproc_i2c_init(iproc_i2c);
   if (ret) return ret;
   /* configure to the desired bus speed */
   val = readl(iproc_i2c->base + TIM_CFG_OFFSET);
   val &= ~(1 << TIM_CFG_MODE_400_SHIFT);
   val |= (iproc_i2c->bus_speed == 400000) << TIM_CFG_MODE_400_SHIFT;
   writel(val, iproc_i2c->base + TIM_CFG_OFFSET);
   bcm_iproc_i2c_enable_disable(iproc_i2c, 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,11 +1,10 @@
 static int bcm_iproc_i2c_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct bcm_iproc_i2c_dev *iproc_i2c = platform_get_drvdata(pdev);
+  struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
   /* make sure there's no pending interrupt when we go into suspend */
   writel(0, iproc_i2c->base + IE_OFFSET);
   readl(iproc_i2c->base + IE_OFFSET);
   synchronize_irq(iproc_i2c->irq);
   /* now disable the controller */
   bcm_iproc_i2c_enable_disable(iproc_i2c, false);
   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,11 +1,10 @@
 static int __maybe_unused cdns_i2c_runtime_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
+  struct cdns_i2c *xi2c = dev_get_drvdata(dev);
   int ret;
   ret = clk_enable(xi2c->clk);
   if (ret) {
     dev_err(dev, "Cannot enable clock.\n");
     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,6 +1,5 @@
 static int __maybe_unused cdns_i2c_runtime_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct cdns_i2c *xi2c = platform_get_drvdata(pdev);
+  struct cdns_i2c *xi2c = dev_get_drvdata(dev);
   clk_disable(xi2c->clk);
   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 davinci_i2c_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+  struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev);
   clk_prepare_enable(i2c_dev->clk);
   /* take I2C out of reset */
   davinci_i2c_reset_ctrl(i2c_dev, 1);
   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 davinci_i2c_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct davinci_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
+  struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev);
   /* put I2C into reset */
   davinci_i2c_reset_ctrl(i2c_dev, 0);
   clk_disable_unprepare(i2c_dev->clk);
   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 int dw_i2c_plat_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
+  struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
   i2c_dw_plat_prepare_clk(i_dev, true);
   i_dev->init(i_dev);
   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 int dw_i2c_plat_suspend(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);
+  struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
   i_dev->disable(i_dev);
   i2c_dw_plat_prepare_clk(i_dev, false);
   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,16 +1,15 @@
 static int exynos5_i2c_resume_noirq(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
+  struct exynos5_i2c *i2c = dev_get_drvdata(dev);
   int ret = 0;
   ret = clk_prepare_enable(i2c->clk);
   if (ret) return ret;
   ret = exynos5_hsi2c_clock_setup(i2c);
   if (ret) {
     clk_disable_unprepare(i2c->clk);
     return ret;
   }
   exynos5_i2c_init(i2c);
   clk_disable(i2c->clk);
   i2c->suspended = 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,7 +1,6 @@
 static int exynos5_i2c_suspend_noirq(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct exynos5_i2c *i2c = platform_get_drvdata(pdev);
+  struct exynos5_i2c *i2c = dev_get_drvdata(dev);
   i2c->suspended = 1;
   clk_unprepare(i2c->clk);
   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 int hix5hd2_i2c_runtime_resume(struct device *dev) {
-  struct platform_device *pdev = to_platform_device(dev);
-  struct hix5hd2_i2c_priv *priv = platform_get_drvdata(pdev);
+  struct hix5hd2_i2c_priv *priv = dev_get_drvdata(dev);
   clk_prepare_enable(priv->clk);
   hix5hd2_i2c_init(priv);
   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
)
  ...>
)