/* ---------------------------------------------------------------------- */
#define UNSET (-1U)
-#define PREFIX "saa6588: "
-#define dprintk if (debug) printk
struct saa6588 {
struct v4l2_subdev sd;
if (s->rd_index == s->wr_index) {
if (debug > 2)
- dprintk(PREFIX "Read: buffer empty.\n");
+ v4l2_info(&s->sd, "Read: buffer empty.\n");
return false;
}
if (debug > 2) {
- dprintk(PREFIX "Read: ");
+ v4l2_info(&s->sd, "Read: ");
for (i = s->rd_index; i < s->rd_index + 3; i++)
- dprintk("0x%02x ", s->buffer[i]);
+ v4l2_info(&s->sd, "0x%02x ", s->buffer[i]);
}
memcpy(buf, &s->buffer[s->rd_index], 3);
s->block_count--;
if (debug > 2)
- dprintk("%d blocks total.\n", s->block_count);
+ v4l2_info(&s->sd, "%d blocks total.\n", s->block_count);
return true;
}
unsigned int i;
if (debug > 3)
- dprintk(PREFIX "New block: ");
+ v4l2_info(&s->sd, "New block: ");
for (i = 0; i < 3; ++i) {
if (debug > 3)
- dprintk("0x%02x ", blockbuf[i]);
+ v4l2_info(&s->sd, "0x%02x ", blockbuf[i]);
s->buffer[s->wr_index] = blockbuf[i];
s->wr_index++;
}
s->block_count++;
if (debug > 3)
- dprintk("%d blocks total.\n", s->block_count);
+ v4l2_info(&s->sd, "%d blocks total.\n", s->block_count);
}
static void saa6588_i2c_poll(struct saa6588 *s)
SAA6588 returns garbage otherwise. */
if (6 != i2c_master_recv(client, &tmpbuf[0], 6)) {
if (debug > 1)
- dprintk(PREFIX "read error!\n");
+ v4l2_info(&s->sd, "read error!\n");
return;
}
blocknum = tmpbuf[0] >> 5;
if (blocknum == s->last_blocknum) {
if (debug > 3)
- dprintk("Saw block %d again.\n", blocknum);
+ v4l2_info(&s->sd, "Saw block %d again.\n", blocknum);
return;
}
break;
}
- dprintk(PREFIX "writing: 0w=0x%02x 1w=0x%02x 2w=0x%02x\n",
- buf[0], buf[1], buf[2]);
+ if (debug)
+ v4l2_info(&s->sd, "writing: 0w=0x%02x 1w=0x%02x 2w=0x%02x\n",
+ buf[0], buf[1], buf[2]);
rc = i2c_master_send(client, buf, 3);
if (rc != 3)
- printk(PREFIX "i2c i/o error: rc == %d (should be 3)\n", rc);
+ v4l2_info(&s->sd, "i2c i/o error: rc == %d (should be 3)\n", rc);
}
/* ---------------------------------------------------------------------- */