--- initial
+++ final
@@ -1,82 +1,82 @@
 static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, /* isoc packet */
                              int len)                               /* iso packet length */
 {
   struct sd *sd = (struct sd *)gspca_dev;
   PDEBUG(D_PACK, "Packet of length %d arrived", len);
   /* A packet may contain several frames
      loop until the whole packet is reached */
   while (len) {
     int id, chunk_len;
     if (len < 4) {
       PDEBUG(D_PACK, "Packet is smaller than 4 bytes");
       return;
     }
     /* Capture the id */
     id = (data[0] << 8) | data[1];
     /* Capture the chunk length */
     chunk_len = (data[2] << 8) | data[3];
     PDEBUG(D_PACK, "Chunk id: %x, length: %d", id, chunk_len);
     data += 4;
     len -= 4;
     if (len < chunk_len) {
-      PERR("URB packet length is smaller than the specified chunk length");
+      gspca_err(gspca_dev, "URB packet length is smaller than the specified chunk length\n");
       gspca_dev->last_packet_type = DISCARD_PACKET;
       return;
     }
     /* First byte seem to be 02=data 2nd byte is unknown??? */
     if (sd->bridge == BRIDGE_ST6422 && (id & 0xff00) == 0x0200) goto frame_data;
     switch (id) {
     case 0x0200:
     case 0x4200:
     frame_data:
       PDEBUG(D_PACK, "Frame data packet detected");
       if (sd->to_skip) {
         int skip = (sd->to_skip < chunk_len) ? sd->to_skip : chunk_len;
         data += skip;
         len -= skip;
         chunk_len -= skip;
         sd->to_skip -= skip;
       }
       gspca_frame_add(gspca_dev, INTER_PACKET, data, chunk_len);
       break;
     case 0x8001:
     case 0x8005:
     case 0xc001:
     case 0xc005:
       PDEBUG(D_PACK, "Starting new frame");
       /* Create a new frame, chunk length should be zero */
       gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
       if (sd->bridge == BRIDGE_ST6422) sd->to_skip = gspca_dev->pixfmt.width * 4;
-      if (chunk_len) PERR("Chunk length is non-zero on a SOF");
+      if (chunk_len) gspca_err(gspca_dev, "Chunk length is non-zero on a SOF\n");
       break;
     case 0x8002:
     case 0x8006:
     case 0xc002:
       PDEBUG(D_PACK, "End of frame detected");
       /* Complete the last frame (if any) */
       gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
-      if (chunk_len) PERR("Chunk length is non-zero on a EOF");
+      if (chunk_len) gspca_err(gspca_dev, "Chunk length is non-zero on a EOF\n");
       break;
     case 0x0005:
       PDEBUG(D_PACK, "Chunk 0x005 detected");
       /* Unknown chunk with 11 bytes of data,
          occurs just before end of each frame
          in compressed mode */
       break;
     case 0x0100:
       PDEBUG(D_PACK, "Chunk 0x0100 detected");
       /* Unknown chunk with 2 bytes of data,
          occurs 2-3 times per USB interrupt */
       break;
     case 0x42ff:
       PDEBUG(D_PACK, "Chunk 0x42ff detected");
       /* Special chunk seen sometimes on the ST6422 */
       break;
     default:
       PDEBUG(D_PACK, "Unknown chunk 0x%04x detected", id);
       /* Unknown chunk */
     }
     data += chunk_len;
     len -= chunk_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
		,...)