Commit fa7ce764 authored by Jean Delvare's avatar Jean Delvare Committed by Mauro Carvalho Chehab

V4L/DVB (11748): pvrusb2: Don't use the internal i2c client list

The i2c core used to maintain a list of client for each adapter. This
is a duplication of what the driver core already does, so this list
will be removed as part of a future cleanup. Anyone using this list
must stop doing so.

For pvrusb2, I propose the following change, which should lead to an
equally informative output. The only difference is that i2c clients
which are not a v4l2 subdev won't show up, but I guess this case is
not supposed to happen anyway.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 48c5b0df
...@@ -4841,65 +4841,35 @@ static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw, ...@@ -4841,65 +4841,35 @@ static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw,
unsigned int tcnt = 0; unsigned int tcnt = 0;
unsigned int ccnt; unsigned int ccnt;
struct i2c_client *client; struct i2c_client *client;
struct list_head *item;
void *cd;
const char *p; const char *p;
unsigned int id; unsigned int id;
ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers:"); ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers and I2C clients:\n");
tcnt += ccnt; tcnt += ccnt;
v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
id = sd->grp_id; id = sd->grp_id;
p = NULL; p = NULL;
if (id < ARRAY_SIZE(module_names)) p = module_names[id]; if (id < ARRAY_SIZE(module_names)) p = module_names[id];
if (p) { if (p) {
ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s", p); ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s:", p);
tcnt += ccnt; tcnt += ccnt;
} else { } else {
ccnt = scnprintf(buf + tcnt, acnt - tcnt, ccnt = scnprintf(buf + tcnt, acnt - tcnt,
" (unknown id=%u)", id); " (unknown id=%u):", id);
tcnt += ccnt; tcnt += ccnt;
} }
} client = v4l2_get_subdevdata(sd);
ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n"); if (client) {
tcnt += ccnt; ccnt = scnprintf(buf + tcnt, acnt - tcnt,
" %s @ %02x\n", client->name,
ccnt = scnprintf(buf + tcnt, acnt - tcnt, "I2C clients:\n"); client->addr);
tcnt += ccnt; tcnt += ccnt;
} else {
mutex_lock(&hdw->i2c_adap.clist_lock); ccnt = scnprintf(buf + tcnt, acnt - tcnt,
list_for_each(item, &hdw->i2c_adap.clients) { " no i2c client\n");
client = list_entry(item, struct i2c_client, list); tcnt += ccnt;
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; return tcnt;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment