aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-05-01 23:22:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:00 -0400
commitfa7ce76428e7ee61dfccf336505da7e1b79966b0 (patch)
tree76780f5a0d02ab5038d8028d8e9414384a7079be /drivers/media
parent48c5b0dfd74f6380aa5fc500fe8d8256f0662592 (diff)
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: Jean Delvare <khali@linux-fr.org> Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c56
1 files changed, 13 insertions, 43 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 686df1afbbaf..0c745b142fb7 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -4841,65 +4841,35 @@ static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw,
4841 unsigned int tcnt = 0; 4841 unsigned int tcnt = 0;
4842 unsigned int ccnt; 4842 unsigned int ccnt;
4843 struct i2c_client *client; 4843 struct i2c_client *client;
4844 struct list_head *item;
4845 void *cd;
4846 const char *p; 4844 const char *p;
4847 unsigned int id; 4845 unsigned int id;
4848 4846
4849 ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers:"); 4847 ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers and I2C clients:\n");
4850 tcnt += ccnt; 4848 tcnt += ccnt;
4851 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { 4849 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
4852 id = sd->grp_id; 4850 id = sd->grp_id;
4853 p = NULL; 4851 p = NULL;
4854 if (id < ARRAY_SIZE(module_names)) p = module_names[id]; 4852 if (id < ARRAY_SIZE(module_names)) p = module_names[id];
4855 if (p) { 4853 if (p) {
4856 ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s", p); 4854 ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s:", p);
4857 tcnt += ccnt; 4855 tcnt += ccnt;
4858 } else { 4856 } else {
4859 ccnt = scnprintf(buf + tcnt, acnt - tcnt, 4857 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4860 " (unknown id=%u)", id); 4858 " (unknown id=%u):", id);
4861 tcnt += ccnt; 4859 tcnt += ccnt;
4862 } 4860 }
4863 } 4861 client = v4l2_get_subdevdata(sd);
4864 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n"); 4862 if (client) {
4865 tcnt += ccnt; 4863 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4866 4864 " %s @ %02x\n", client->name,
4867 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "I2C clients:\n"); 4865 client->addr);
4868 tcnt += ccnt; 4866 tcnt += ccnt;
4869 4867 } else {
4870 mutex_lock(&hdw->i2c_adap.clist_lock); 4868 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4871 list_for_each(item, &hdw->i2c_adap.clients) { 4869 " no i2c client\n");
4872 client = list_entry(item, struct i2c_client, list); 4870 tcnt += ccnt;
4873 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4874 " %s: i2c=%02x", client->name, client->addr);
4875 tcnt += ccnt;
4876 cd = i2c_get_clientdata(client);
4877 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
4878 if (cd == sd) {
4879 id = sd->grp_id;
4880 p = NULL;
4881 if (id < ARRAY_SIZE(module_names)) {
4882 p = module_names[id];
4883 }
4884 if (p) {
4885 ccnt = scnprintf(buf + tcnt,
4886 acnt - tcnt,
4887 " subdev=%s", p);
4888 tcnt += ccnt;
4889 } else {
4890 ccnt = scnprintf(buf + tcnt,
4891 acnt - tcnt,
4892 " subdev= id %u)",
4893 id);
4894 tcnt += ccnt;
4895 }
4896 break;
4897 }
4898 } 4871 }
4899 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n");
4900 tcnt += ccnt;
4901 } 4872 }
4902 mutex_unlock(&hdw->i2c_adap.clist_lock);
4903 return tcnt; 4873 return tcnt;
4904} 4874}
4905 4875