aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c115
1 files changed, 86 insertions, 29 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 0cfe0eec34ea..b0383153e3ce 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -4876,38 +4876,82 @@ static unsigned int pvr2_hdw_report_unlocked(struct pvr2_hdw *hdw,int which,
4876 stats.buffers_processed, 4876 stats.buffers_processed,
4877 stats.buffers_failed); 4877 stats.buffers_failed);
4878 } 4878 }
4879 case 6: { 4879 default: break;
4880 struct v4l2_subdev *sd; 4880 }
4881 unsigned int tcnt = 0; 4881 return 0;
4882 unsigned int ccnt; 4882}
4883 const char *p; 4883
4884 unsigned int id; 4884
4885 ccnt = scnprintf(buf, 4885/* Generate report containing info about attached sub-devices and attached
4886 acnt, 4886 i2c clients, including an indication of which attached i2c clients are
4887 "Associated v4l2_subdev drivers:"); 4887 actually sub-devices. */
4888static unsigned int pvr2_hdw_report_clients(struct pvr2_hdw *hdw,
4889 char *buf, unsigned int acnt)
4890{
4891 struct v4l2_subdev *sd;
4892 unsigned int tcnt = 0;
4893 unsigned int ccnt;
4894 struct i2c_client *client;
4895 struct list_head *item;
4896 void *cd;
4897 const char *p;
4898 unsigned int id;
4899
4900 ccnt = scnprintf(buf, acnt, "Associated v4l2-subdev drivers:");
4901 tcnt += ccnt;
4902 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
4903 id = sd->grp_id;
4904 p = NULL;
4905 if (id < ARRAY_SIZE(module_names)) p = module_names[id];
4906 if (p) {
4907 ccnt = scnprintf(buf + tcnt, acnt - tcnt, " %s", p);
4908 tcnt += ccnt;
4909 } else {
4910 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4911 " (unknown id=%u)", id);
4912 tcnt += ccnt;
4913 }
4914 }
4915 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n");
4916 tcnt += ccnt;
4917
4918 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "I2C clients:\n");
4919 tcnt += ccnt;
4920
4921 mutex_lock(&hdw->i2c_adap.clist_lock);
4922 list_for_each(item, &hdw->i2c_adap.clients) {
4923 client = list_entry(item, struct i2c_client, list);
4924 ccnt = scnprintf(buf + tcnt, acnt - tcnt,
4925 " %s: i2c=%02x", client->name, client->addr);
4888 tcnt += ccnt; 4926 tcnt += ccnt;
4927 cd = i2c_get_clientdata(client);
4889 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) { 4928 v4l2_device_for_each_subdev(sd, &hdw->v4l2_dev) {
4890 id = sd->grp_id; 4929 if (cd == sd) {
4891 p = NULL; 4930 id = sd->grp_id;
4892 if (id < ARRAY_SIZE(module_names)) { 4931 p = NULL;
4893 p = module_names[id]; 4932 if (id < ARRAY_SIZE(module_names)) {
4894 } 4933 p = module_names[id];
4895 if (p) { 4934 }
4896 ccnt = scnprintf(buf + tcnt, 4935 if (p) {
4897 acnt - tcnt, 4936 ccnt = scnprintf(buf + tcnt,
4898 " %s", p); 4937 acnt - tcnt,
4899 } else { 4938 " subdev=%s", p);
4900 ccnt = scnprintf(buf + tcnt, 4939 tcnt += ccnt;
4901 acnt - tcnt, 4940 } else {
4902 " (unknown id=%u)", id); 4941 ccnt = scnprintf(buf + tcnt,
4942 acnt - tcnt,
4943 " subdev= id %u)",
4944 id);
4945 tcnt += ccnt;
4946 }
4947 break;
4903 } 4948 }
4904 tcnt += ccnt;
4905 } 4949 }
4906 return tcnt; 4950 ccnt = scnprintf(buf + tcnt, acnt - tcnt, "\n");
4907 } 4951 tcnt += ccnt;
4908 default: break;
4909 } 4952 }
4910 return 0; 4953 mutex_unlock(&hdw->i2c_adap.clist_lock);
4954 return tcnt;
4911} 4955}
4912 4956
4913 4957
@@ -4925,6 +4969,8 @@ unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
4925 buf[0] = '\n'; ccnt = 1; 4969 buf[0] = '\n'; ccnt = 1;
4926 bcnt += ccnt; acnt -= ccnt; buf += ccnt; 4970 bcnt += ccnt; acnt -= ccnt; buf += ccnt;
4927 } 4971 }
4972 ccnt = pvr2_hdw_report_clients(hdw, buf, acnt);
4973 bcnt += ccnt; acnt -= ccnt; buf += ccnt;
4928 LOCK_GIVE(hdw->big_lock); 4974 LOCK_GIVE(hdw->big_lock);
4929 return bcnt; 4975 return bcnt;
4930} 4976}
@@ -4932,14 +4978,25 @@ unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw,
4932 4978
4933static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw) 4979static void pvr2_hdw_state_log_state(struct pvr2_hdw *hdw)
4934{ 4980{
4935 char buf[128]; 4981 char buf[256];
4936 unsigned int idx,ccnt; 4982 unsigned int idx, ccnt;
4983 unsigned int lcnt, ucnt;
4937 4984
4938 for (idx = 0; ; idx++) { 4985 for (idx = 0; ; idx++) {
4939 ccnt = pvr2_hdw_report_unlocked(hdw,idx,buf,sizeof(buf)); 4986 ccnt = pvr2_hdw_report_unlocked(hdw,idx,buf,sizeof(buf));
4940 if (!ccnt) break; 4987 if (!ccnt) break;
4941 printk(KERN_INFO "%s %.*s\n",hdw->name,ccnt,buf); 4988 printk(KERN_INFO "%s %.*s\n",hdw->name,ccnt,buf);
4942 } 4989 }
4990 ccnt = pvr2_hdw_report_clients(hdw, buf, sizeof(buf));
4991 ucnt = 0;
4992 while (ucnt < ccnt) {
4993 lcnt = 0;
4994 while ((lcnt + ucnt < ccnt) && (buf[lcnt + ucnt] != '\n')) {
4995 lcnt++;
4996 }
4997 printk(KERN_INFO "%s %.*s\n", hdw->name, lcnt, buf + ucnt);
4998 ucnt += lcnt + 1;
4999 }
4943} 5000}
4944 5001
4945 5002