V4L/DVB (11203): pvrusb2: Implement better reporting on attached sub-devices
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
fd28aeafd6
commit
2eb563b7e7
|
@ -4876,41 +4876,85 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which,
|
||||||
stats.buffers_processed,
|
stats.buffers_processed,
|
||||||
stats.buffers_failed);
|
stats.buffers_failed);
|
||||||
}
|
}
|
||||||
case 6: {
|
|
||||||
struct v4l2_subdev *sd;
|
|
||||||
unsigned int tcnt = 0;
|
|
||||||
unsigned int ccnt;
|
|
||||||
const char *p;
|
|
||||||
unsigned int id;
|
|
||||||
ccnt = scnprintf(buf,
|
|
||||||
acnt,
|
|
||||||
"Associated v4l2_subdev drivers:");
|
|
||||||
tcnt += ccnt;
|
|
||||||
v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
|
|
||||||
id = sd->grp_id;
|
|
||||||
p = NULL;
|
|
||||||
if (id < ARRAY_SIZE(module_names)) {
|
|
||||||
p = module_names[id];
|
|
||||||
}
|
|
||||||
if (p) {
|
|
||||||
ccnt = scnprintf(buf + tcnt,
|
|
||||||
acnt - tcnt,
|
|
||||||
" %s", p);
|
|
||||||
} else {
|
|
||||||
ccnt = scnprintf(buf + tcnt,
|
|
||||||
acnt - tcnt,
|
|
||||||
" (unknown id=%u)", id);
|
|
||||||
}
|
|
||||||
tcnt += ccnt;
|
|
||||||
}
|
|
||||||
return tcnt;
|
|
||||||
}
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Generate report containing info about attached sub-devices and attached
|
||||||
|
i2c clients, including an indication of which attached i2c clients are
|
||||||
|
actually sub-devices. */
|
||||||
|
static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw,
|
||||||
|
char *buf, unsigned int acnt)
|
||||||
|
{
|
||||||
|
struct v4l2_subdev *sd;
|
||||||
|
unsigned int tcnt = 0;
|
||||||
|
unsigned int ccnt;
|
||||||
|
struct i2c_client *client;
|
||||||
|
struct list_head *item;
|
||||||
|
void *cd;
|
||||||
|
const char *p;
|
||||||
|
unsigned int id;
|
||||||
|
|
||||||
|
ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers:");
|
||||||
|
tcnt += ccnt;
|
||||||
|
v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
|
||||||
|
id = sd->grp_id;
|
||||||
|
p = NULL;
|
||||||
|
if (id < ARRAY_SIZE(module_names)) p = module_names[id];
|
||||||
|
if (p) {
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s", p);
|
||||||
|
tcnt += ccnt;
|
||||||
|
} else {
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt,
|
||||||
|
" (unknown id=%u)", id);
|
||||||
|
tcnt += ccnt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n");
|
||||||
|
tcnt += ccnt;
|
||||||
|
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt, "I2C clients:\n");
|
||||||
|
tcnt += ccnt;
|
||||||
|
|
||||||
|
mutex_lock(&hdw->i2c_adap.clist_lock);
|
||||||
|
list_for_each(item, &hdw->i2c_adap.clients) {
|
||||||
|
client = list_entry(item, struct i2c_client, list);
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt,
|
||||||
|
" %s: i2c=%02x", client->name, client->addr);
|
||||||
|
tcnt += ccnt;
|
||||||
|
cd = i2c_get_clientdata(client);
|
||||||
|
v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
|
||||||
|
if (cd == sd) {
|
||||||
|
id = sd->grp_id;
|
||||||
|
p = NULL;
|
||||||
|
if (id < ARRAY_SIZE(module_names)) {
|
||||||
|
p = module_names[id];
|
||||||
|
}
|
||||||
|
if (p) {
|
||||||
|
ccnt = scnprintf(buf + tcnt,
|
||||||
|
acnt - tcnt,
|
||||||
|
" subdev=%s", p);
|
||||||
|
tcnt += ccnt;
|
||||||
|
} else {
|
||||||
|
ccnt = scnprintf(buf + tcnt,
|
||||||
|
acnt - tcnt,
|
||||||
|
" subdev= id %u)",
|
||||||
|
id);
|
||||||
|
tcnt += ccnt;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n");
|
||||||
|
tcnt += ccnt;
|
||||||
|
}
|
||||||
|
mutex_unlock(&hdw->i2c_adap.clist_lock);
|
||||||
|
return tcnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
|
unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
|
||||||
char *buf,unsigned int acnt)
|
char *buf,unsigned int acnt)
|
||||||
{
|
{
|
||||||
|
@ -4925,6 +4969,8 @@ unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
|
||||||
buf[0] = '\n'; ccnt = 1;
|
buf[0] = '\n'; ccnt = 1;
|
||||||
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
||||||
}
|
}
|
||||||
|
ccnt = pvr2_hdw_report_clients(hdw, buf, acnt);
|
||||||
|
bcnt += ccnt; acnt -= ccnt; buf += ccnt;
|
||||||
LOCK_GIVE(hdw->big_lock);
|
LOCK_GIVE(hdw->big_lock);
|
||||||
return bcnt;
|
return bcnt;
|
||||||
}
|
}
|
||||||
|
@ -4932,14 +4978,25 @@ unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
|
||||||
|
|
||||||
static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw)
|
static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw)
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[256];
|
||||||
unsigned int idx,ccnt;
|
unsigned int idx, ccnt;
|
||||||
|
unsigned int lcnt, ucnt;
|
||||||
|
|
||||||
for (idx = 0; ; idx++) {
|
for (idx = 0; ; idx++) {
|
||||||
ccnt = pvr2_hdw_report_unlocked(hdw,idx,buf,sizeof(buf));
|
ccnt = pvr2_hdw_report_unlocked(hdw,idx,buf,sizeof(buf));
|
||||||
if (!ccnt) break;
|
if (!ccnt) break;
|
||||||
printk(KERN_INFO "%s %.*s\n",hdw->name,ccnt,buf);
|
printk(KERN_INFO "%s %.*s\n",hdw->name,ccnt,buf);
|
||||||
}
|
}
|
||||||
|
ccnt = pvr2_hdw_report_clients(hdw, buf, sizeof(buf));
|
||||||
|
ucnt = 0;
|
||||||
|
while (ucnt < ccnt) {
|
||||||
|
lcnt = 0;
|
||||||
|
while ((lcnt + ucnt < ccnt) && (buf[lcnt + ucnt] != '\n')) {
|
||||||
|
lcnt++;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO "%s %.*s\n", hdw->name, lcnt, buf + ucnt);
|
||||||
|
ucnt += lcnt + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue