imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,9 +1,9 @@
 static void reg_r(struct gspca_dev *gspca_dev, __u16 index, __u16 len) {
   struct usb_device *dev = gspca_dev->dev;
   if (len > USB_BUF_SZ) {
-    PERR("reg_r: buffer overflow\n");
+    gspca_err(gspca_dev, "reg_r: buffer overflow\n");
     return;
   }
   usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, 0, index, gspca_dev->usb_buf, len, 500);
   PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", index, gspca_dev->usb_buf[0]);
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,42 +1,42 @@
 static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *v4l2_buf) {
   struct gspca_dev *gspca_dev = video_drvdata(file);
   struct gspca_frame *frame;
   int i, j, ret;
   PDEBUG(D_FRAM, "dqbuf");
   if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS;
   for (;;) {
     ret = frame_ready_nolock(gspca_dev, file, v4l2_buf->memory);
     if (ret < 0) goto out;
     if (ret > 0) break;
     mutex_unlock(&gspca_dev->queue_lock);
     if (file->f_flags & O_NONBLOCK) return -EAGAIN;
     /* wait till a frame is ready */
     ret = wait_event_interruptible_timeout(gspca_dev->wq, frame_ready(gspca_dev, file, v4l2_buf->memory), msecs_to_jiffies(3000));
     if (ret < 0) return ret;
     if (ret == 0) return -EIO;
     if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS;
   }
   i = gspca_dev->fr_o;
   j = gspca_dev->fr_queue[i];
   frame = &gspca_dev->frame[j];
   gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES;
   frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE;
   memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf);
   PDEBUG(D_FRAM, "dqbuf %d", j);
   ret = 0;
   if (gspca_dev->memory == V4L2_MEMORY_USERPTR) {
     if (copy_to_user((__u8 __user *)frame->v4l2_buf.m.userptr, frame->data, frame->v4l2_buf.bytesused)) {
-      PERR("dqbuf cp to user failed");
+      gspca_err(gspca_dev, "dqbuf cp to user failed\n");
       ret = -EFAULT;
     }
   }
 out:
   mutex_unlock(&gspca_dev->queue_lock);
   if (ret == 0 && gspca_dev->sd_desc->dq_callback) {
     mutex_lock(&gspca_dev->usb_lock);
     gspca_dev->usb_err = 0;
     if (gspca_dev->present) gspca_dev->sd_desc->dq_callback(gspca_dev);
     mutex_unlock(&gspca_dev->usb_lock);
   }
   return ret;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,48 +1,48 @@
 static int jlj_start(struct gspca_dev *gspca_dev) {
   int i;
   int start_commands_size;
   u8 response = 0xff;
   struct sd *sd = (struct sd *)gspca_dev;
   struct jlj_command start_commands[] = {{{0x71, 0x81}, 0, 0},
                                          {{0x70, 0x05}, 0, JEILINJ_CMD_DELAY},
                                          {{0x95, 0x70}, 1, 0},
                                          {{0x71, 0x81 - gspca_dev->curr_mode}, 0, 0},
                                          {{0x70, 0x04}, 0, JEILINJ_CMD_DELAY},
                                          {{0x95, 0x70}, 1, 0},
                                          {{0x71, 0x00}, 0, 0}, /* start streaming ??*/
                                          {{0x70, 0x08}, 0, JEILINJ_CMD_DELAY},
                                          {{0x95, 0x70}, 1, 0},
 #define SPORTSCAM_DV15_CMD_SIZE 9
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xde, 0x24}, 0, 0},
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xdd, 0xf0}, 0, 0},
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xe3, 0x2c}, 0, 0},
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xe4, 0x00}, 0, 0},
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xe5, 0x00}, 0, 0},
                                          {{0x94, 0x02}, 0, 0},
                                          {{0xe6, 0x2c}, 0, 0},
                                          {{0x94, 0x03}, 0, 0},
                                          {{0xaa, 0x00}, 0, 0}};
   sd->blocks_left = 0;
   /* Under Windows, USB spy shows that only the 9 first start
    * commands are used for SPORTSCAM_DV15 webcam
    */
   if (sd->type == SPORTSCAM_DV15)
     start_commands_size = SPORTSCAM_DV15_CMD_SIZE;
   else
     start_commands_size = ARRAY_SIZE(start_commands);
   for (i = 0; i < start_commands_size; i++) {
     jlj_write2(gspca_dev, start_commands[i].instruction);
     if (start_commands[i].delay) msleep(start_commands[i].delay);
     if (start_commands[i].ack_wanted) jlj_read1(gspca_dev, &response);
   }
   setcamquality(gspca_dev, v4l2_ctrl_g_ctrl(sd->jpegqual));
   msleep(2);
   setfreq(gspca_dev, v4l2_ctrl_g_ctrl(sd->freq));
-  if (gspca_dev->usb_err < 0) PERR("Start streaming command failed");
+  if (gspca_dev->usb_err < 0) gspca_err(gspca_dev, "Start streaming command failed\n");
   return gspca_dev->usb_err;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,16 +1,16 @@
 static int m5602_configure(struct gspca_dev *gspca_dev, const struct usb_device_id *id) {
   struct sd *sd = (struct sd *)gspca_dev;
   struct cam *cam;
   int err;
   cam = &gspca_dev->cam;
   if (dump_bridge) m5602_dump_bridge(sd);
   /* Probe sensor */
   err = m5602_probe_sensor(sd);
   if (err) goto fail;
   return 0;
 fail:
-  PERR("ALi m5602 webcam failed");
+  gspca_err(gspca_dev, "ALi m5602 webcam failed\n");
   cam->cam_mode = NULL;
   cam->nmodes = 0;
   return err;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,5 +1,5 @@
 static void lcd_stop(struct gspca_dev *gspca_dev) {
   gspca_dev->usb_buf[0] = 0x19;
   gspca_dev->usb_buf[1] = 0x54;
-  if (mr_write(gspca_dev, 2) < 0) PERR("LCD Stop failed");
+  if (mr_write(gspca_dev, 2) < 0) gspca_err(gspca_dev, "LCD Stop failed\n");
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,5 +1,5 @@
 static void stream_stop(struct gspca_dev *gspca_dev) {
   gspca_dev->usb_buf[0] = 0x01;
   gspca_dev->usb_buf[1] = 0x00;
-  if (mr_write(gspca_dev, 2) < 0) PERR("Stream Stop failed");
+  if (mr_write(gspca_dev, 2) < 0) gspca_err(gspca_dev, "Stream Stop failed\n");
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,36 +1,36 @@
 static int sd_init_controls(struct gspca_dev *gspca_dev) {
   struct sd *sd = (struct sd *)gspca_dev;
   struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
   gspca_dev->vdev.ctrl_handler = hdl;
   v4l2_ctrl_handler_init(hdl, 10);
   if (valid_controls[sd->sensor].has_brightness) sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_BRIGHTNESS, 0, sd->sensor == SEN_OV7660 ? 6 : 255, 1, sd->sensor == SEN_OV7660 ? 3 : 127);
   if (valid_controls[sd->sensor].has_contrast) {
     if (sd->sensor == SEN_OV7660)
       v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_CONTRAST, 0, 6, 1, 3);
     else
       v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_CONTRAST, 0, 255, 1, (sd->sensor == SEN_OV6630 || sd->sensor == SEN_OV66308AF) ? 200 : 127);
   }
   if (valid_controls[sd->sensor].has_sat) v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_SATURATION, 0, sd->sensor == SEN_OV7660 ? 4 : 255, 1, sd->sensor == SEN_OV7660 ? 2 : 127);
   if (valid_controls[sd->sensor].has_exposure) gspca_dev->exposure = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_EXPOSURE, 0, 255, 1, 127);
   if (valid_controls[sd->sensor].has_hvflip) {
     sd->hflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0);
     sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);
   }
   if (valid_controls[sd->sensor].has_autobright) sd->autobright = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_AUTOBRIGHTNESS, 0, 1, 1, 1);
   if (valid_controls[sd->sensor].has_autogain) gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
   if (valid_controls[sd->sensor].has_freq) {
     if (sd->sensor == SEN_OV7670)
       sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, V4L2_CID_POWER_LINE_FREQUENCY, V4L2_CID_POWER_LINE_FREQUENCY_AUTO, 0, V4L2_CID_POWER_LINE_FREQUENCY_AUTO);
     else
       sd->freq = v4l2_ctrl_new_std_menu(hdl, &sd_ctrl_ops, V4L2_CID_POWER_LINE_FREQUENCY, V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0, 0);
   }
   if (sd->bridge == BRIDGE_W9968CF) sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, V4L2_CID_JPEG_COMPRESSION_QUALITY, QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
   if (hdl->error) {
-    PERR("Could not initialize controls\n");
+    gspca_err(gspca_dev, "Could not initialize controls\n");
     return hdl->error;
   }
   if (gspca_dev->autogain) v4l2_ctrl_auto_cluster(3, &gspca_dev->autogain, 0, true);
   if (sd->autobright) v4l2_ctrl_auto_cluster(2, &sd->autobright, 0, false);
   if (sd->hflip) v4l2_ctrl_cluster(2, &sd->hflip);
   return 0;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,28 +1,28 @@
 static void reg_w_var(struct gspca_dev *gspca_dev, const u8 *seq, const u8 *page3, unsigned int page3_len) {
   int index, len;
   for (;;) {
     index = *seq++;
     len = *seq++;
     switch (len) {
     case END_OF_SEQUENCE: return;
     case LOAD_PAGE3: reg_w_page(gspca_dev, page3, page3_len); break;
     default:
       if (len > USB_BUF_SZ) {
-        PERR("Incorrect variable sequence");
+        gspca_err(gspca_dev, "Incorrect variable sequence\n");
         return;
       }
       while (len > 0) {
         if (len < 8) {
           reg_w_buf(gspca_dev, index, seq, len);
           seq += len;
           break;
         }
         reg_w_buf(gspca_dev, index, seq, 8);
         seq += 8;
         index += 8;
         len -= 8;
       }
     }
   }
   /* not reached */
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,28 +1,28 @@
 static void reg_w_var(struct gspca_dev *gspca_dev, const __u8 *seq, const __u8 *page4, unsigned int page4_len) {
   int index, len;
   for (;;) {
     index = *seq++;
     len = *seq++;
     switch (len) {
     case END_OF_SEQUENCE: return;
     case LOAD_PAGE4: reg_w_page(gspca_dev, page4, page4_len); break;
     default:
       if (len > USB_BUF_SZ) {
-        PERR("Incorrect variable sequence");
+        gspca_err(gspca_dev, "Incorrect variable sequence\n");
         return;
       }
       while (len > 0) {
         if (len < 8) {
           reg_w_buf(gspca_dev, index, seq, len);
           seq += len;
           break;
         }
         reg_w_buf(gspca_dev, index, seq, 8);
         seq += 8;
         index += 8;
         len -= 8;
       }
     }
   }
   /* not reached */
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,10 +1,10 @@
 static void sd_stopN(struct gspca_dev *gspca_dev) {
   int result;
   __u8 data[6];
   result = sn9c2028_read1(gspca_dev);
-  if (result < 0) PERR("Camera Stop read failed");
+  if (result < 0) gspca_err(gspca_dev, "Camera Stop read failed\n");
   memset(data, 0, 6);
   data[0] = 0x14;
   result = sn9c2028_command(gspca_dev, data);
-  if (result < 0) PERR("Camera Stop command failed");
+  if (result < 0) gspca_err(gspca_dev, "Camera Stop command failed\n");
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,14 +1,14 @@
 static void reg_r(struct gspca_dev *gspca_dev, u16 value, int len) {
   int ret;
   if (gspca_dev->usb_err < 0) return;
   if (len > USB_BUF_SZ) {
-    PERR("reg_r: buffer overflow\n");
+    gspca_err(gspca_dev, "reg_r: buffer overflow\n");
     return;
   }
   ret = usb_control_msg(gspca_dev->dev, usb_rcvctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, gspca_dev->usb_buf, len, 500);
   PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]);
   if (ret < 0) {
     pr_err("reg_r err %d\n", ret);
     gspca_dev->usb_err = ret;
   }
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,15 +1,15 @@
 static void reg_w(struct gspca_dev *gspca_dev, u16 value, const u8 *buffer, int len) {
   int ret;
   if (gspca_dev->usb_err < 0) return;
   PDEBUG(D_USBO, "reg_w [%04x] = %02x %02x ..", value, buffer[0], buffer[1]);
   if (len > USB_BUF_SZ) {
-    PERR("reg_w: buffer overflow\n");
+    gspca_err(gspca_dev, "reg_w: buffer overflow\n");
     return;
   }
   memcpy(gspca_dev->usb_buf, buffer, len);
   ret = usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, gspca_dev->usb_buf, len, 500);
   if (ret < 0) {
     pr_err("reg_w err %d\n", ret);
     gspca_dev->usb_err = ret;
   }
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,13 +1,13 @@
 static void wait_status_0(struct gspca_dev *gspca_dev) {
   int i, w;
   i = 16;
   w = 0;
   do {
     reg_r(gspca_dev, 0x21, 0x0000, 1);
     if (gspca_dev->usb_buf[0] == 0) return;
     w += 15;
     msleep(w);
   } while (--i > 0);
-  PERR("wait_status_0 timeout");
+  gspca_err(gspca_dev, "wait_status_0 timeout\n");
   gspca_dev->usb_err = -ETIME;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,15 +1,15 @@
 static void wait_status_1(struct gspca_dev *gspca_dev) {
   int i;
   i = 10;
   do {
     reg_r(gspca_dev, 0x21, 0x0001, 1);
     msleep(10);
     if (gspca_dev->usb_buf[0] == 1) {
       reg_wb(gspca_dev, 0x21, 0x0000, 0x0001, 0x00);
       reg_r(gspca_dev, 0x21, 0x0001, 1);
       return;
     }
   } while (--i > 0);
-  PERR("wait_status_1 timeout");
+  gspca_err(gspca_dev, "wait_status_1 timeout\n");
   gspca_dev->usb_err = -ETIME;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,18 +1,18 @@
 static int spca500_full_reset(struct gspca_dev *gspca_dev) {
   int err;
   /* send the reset command */
   err = reg_w(gspca_dev, 0xe0, 0x0001, 0x0000);
   if (err < 0) return err;
   /* wait for the reset to complete */
   err = reg_r_wait(gspca_dev, 0x06, 0x0000, 0x0000);
   if (err < 0) return err;
   err = reg_w(gspca_dev, 0xe0, 0x0000, 0x0000);
   if (err < 0) return err;
   err = reg_r_wait(gspca_dev, 0x06, 0, 0);
   if (err < 0) {
-    PERR("reg_r_wait() failed");
+    gspca_err(gspca_dev, "reg_r_wait() failed\n");
     return err;
   }
   /* all ok */
   return 0;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,30 +1,30 @@
 static void spca500_reinit(struct gspca_dev *gspca_dev) {
   int err;
   __u8 Data;
   /* some unknown command from Aiptek pocket dv and family300 */
   reg_w(gspca_dev, 0x00, 0x0d01, 0x01);
   reg_w(gspca_dev, 0x00, 0x0d03, 0x00);
   reg_w(gspca_dev, 0x00, 0x0d02, 0x01);
   /* enable drop packet */
   reg_w(gspca_dev, 0x00, 0x850a, 0x0001);
   err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_pocketdv);
-  if (err < 0) PERR("spca50x_setup_qtable failed on init");
+  if (err < 0) gspca_err(gspca_dev, "spca50x_setup_qtable failed on init\n");
   /* set qtable index */
   reg_w(gspca_dev, 0x00, 0x8880, 2);
   /* family cam Quicksmart stuff */
   reg_w(gspca_dev, 0x00, 0x800a, 0x00);
   /* Set agc transfer: synced between frames */
   reg_w(gspca_dev, 0x00, 0x820f, 0x01);
   /* Init SDRAM - needed for SDRAM access */
   reg_w(gspca_dev, 0x00, 0x870a, 0x04);
   /*Start init sequence or stream */
   reg_w(gspca_dev, 0, 0x8003, 0x00);
   /* switch to video camera mode */
   reg_w(gspca_dev, 0x00, 0x8000, 0x0004);
   msleep(2000);
   if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) {
     reg_r(gspca_dev, 0x816b, 1);
     Data = gspca_dev->usb_buf[0];
     reg_w(gspca_dev, 0x00, 0x816b, Data);
   }
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,18 +1,18 @@
 static int spca500_synch310(struct gspca_dev *gspca_dev) {
   if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) {
-    PERR("Set packet size: set interface error");
+    gspca_err(gspca_dev, "Set packet size: set interface error\n");
     goto error;
   }
   spca500_ping310(gspca_dev);
   reg_r(gspca_dev, 0x0d00, 1);
   /* need alt setting here */
   PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt);
   /* Windoze use pipe with altsetting 6 why 7 here */
   if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, gspca_dev->alt) < 0) {
-    PERR("Set packet size: set interface error");
+    gspca_err(gspca_dev, "Set packet size: set interface error\n");
     goto error;
   }
   return 0;
 error:
   return -EBUSY;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,41 +1,41 @@
 static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, /* isoc packet */
                         int len)                               /* iso packet length */
 {
   struct sd *sd = (struct sd *)gspca_dev;
   len--;
   switch (*data++) { /* sequence number */
   case 0:            /* start of frame */
     gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
     /* This should never happen */
     if (len < 2) {
-      PERR("Short SOF packet, ignoring");
+      gspca_err(gspca_dev, "Short SOF packet, ignoring\n");
       gspca_dev->last_packet_type = DISCARD_PACKET;
       return;
     }
 #if IS_ENABLED(CONFIG_INPUT)
     if (data[0] & 0x20) {
       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1);
       input_sync(gspca_dev->input_dev);
       input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0);
       input_sync(gspca_dev->input_dev);
     }
 #endif
     if (data[1] & 0x10) {
       /* compressed bayer */
       gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
     } else {
       /* raw bayer (with a header, which we skip) */
       if (sd->chip_revision == Rev012A) {
         data += 20;
         len -= 20;
       } else {
         data += 16;
         len -= 16;
       }
       gspca_frame_add(gspca_dev, FIRST_PACKET, data, len);
     }
     return;
   case 0xff: /* drop (empty mpackets) */ return;
   }
   gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)
--- initial
+++ final
@@ -1,25 +1,25 @@
 static int sd_start(struct gspca_dev *gspca_dev) {
   struct sd *dev = (struct sd *)gspca_dev;
   int ret;
   /* "Open the shutter" and set size, to start capture */
   switch (gspca_dev->curr_mode) {
   default:
     /*	case 2: */
     PDEBUG(D_STREAM, "Start streaming at high resolution");
     ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_HIGH);
     break;
   case 1:
     PDEBUG(D_STREAM, "Start streaming at medium resolution");
     ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_MED);
     break;
   case 0: PDEBUG(D_STREAM, "Start streaming at low resolution"); ret = sq905_command(&dev->gspca_dev, SQ905_CAPTURE_LOW);
   }
   if (ret < 0) {
-    PERR("Start streaming command failed");
+    gspca_err(gspca_dev, "Start streaming command failed\n");
     return ret;
   }
   /* Start the workqueue function to do the streaming */
   dev->work_thread = create_singlethread_workqueue(MODULE_NAME);
   queue_work(dev->work_thread, &dev->work_struct);
   return 0;
 }<sep>@@
if String.length c < 3 || not(String.sub c (String.length c - 3) 2 = "\\n")
then c1 := make_expr ((String.sub c 0 (String.length c - 1)) ^ "\\n\"")
else c1 := make_expr c

@@
symbol gspca_dev;
constant char[] r.c;
expression s.c1;
@@
-               PERR(c
+               gspca_err(gspca_dev,c1
		,...)