aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-10-10 04:37:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-10 12:35:20 -0400
commite77e2c2f2989eefff7e1c0fff9cb72afaedf6796 (patch)
tree86510942a995515e678099df883488ae946de4e7 /drivers/media
parent6d28e98906aa9405895f92348543d08da1837ea5 (diff)
V4L/DVB (6315): pvrusb2: Change list_for_each+list_entry to list_for_each_entry
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Reviewed-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c51
2 files changed, 17 insertions, 38 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index eec83d6ae788..27b12b4b5c88 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -3458,7 +3458,6 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
3458 int setFl,u64 *val_ptr) 3458 int setFl,u64 *val_ptr)
3459{ 3459{
3460#ifdef CONFIG_VIDEO_ADV_DEBUG 3460#ifdef CONFIG_VIDEO_ADV_DEBUG
3461 struct list_head *item;
3462 struct pvr2_i2c_client *cp; 3461 struct pvr2_i2c_client *cp;
3463 struct v4l2_register req; 3462 struct v4l2_register req;
3464 int stat = 0; 3463 int stat = 0;
@@ -3471,8 +3470,7 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
3471 req.reg = reg_id; 3470 req.reg = reg_id;
3472 if (setFl) req.val = *val_ptr; 3471 if (setFl) req.val = *val_ptr;
3473 mutex_lock(&hdw->i2c_list_lock); do { 3472 mutex_lock(&hdw->i2c_list_lock); do {
3474 list_for_each(item,&hdw->i2c_clients) { 3473 list_for_each_entry(cp, &hdw->i2c_clients, list) {
3475 cp = list_entry(item,struct pvr2_i2c_client,list);
3476 if (!v4l2_chip_match_i2c_client( 3474 if (!v4l2_chip_match_i2c_client(
3477 cp->client, 3475 cp->client,
3478 req.match_type, req.match_chip)) { 3476 req.match_type, req.match_chip)) {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 7697f391e8bb..898c9d2e4cdf 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -570,15 +570,13 @@ int pvr2_i2c_client_cmd(struct pvr2_i2c_client *cp,unsigned int cmd,void *arg)
570 570
571int pvr2_i2c_core_cmd(struct pvr2_hdw *hdw,unsigned int cmd,void *arg) 571int pvr2_i2c_core_cmd(struct pvr2_hdw *hdw,unsigned int cmd,void *arg)
572{ 572{
573 struct list_head *item,*nc; 573 struct pvr2_i2c_client *cp, *ncp;
574 struct pvr2_i2c_client *cp;
575 int stat = -EINVAL; 574 int stat = -EINVAL;
576 575
577 if (!hdw) return stat; 576 if (!hdw) return stat;
578 577
579 mutex_lock(&hdw->i2c_list_lock); 578 mutex_lock(&hdw->i2c_list_lock);
580 list_for_each_safe(item,nc,&hdw->i2c_clients) { 579 list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients, list) {
581 cp = list_entry(item,struct pvr2_i2c_client,list);
582 if (!cp->recv_enable) continue; 580 if (!cp->recv_enable) continue;
583 mutex_unlock(&hdw->i2c_list_lock); 581 mutex_unlock(&hdw->i2c_list_lock);
584 stat = pvr2_i2c_client_cmd(cp,cmd,arg); 582 stat = pvr2_i2c_client_cmd(cp,cmd,arg);
@@ -602,13 +600,11 @@ static int handler_check(struct pvr2_i2c_client *cp)
602 600
603void pvr2_i2c_core_status_poll(struct pvr2_hdw *hdw) 601void pvr2_i2c_core_status_poll(struct pvr2_hdw *hdw)
604{ 602{
605 struct list_head *item;
606 struct pvr2_i2c_client *cp; 603 struct pvr2_i2c_client *cp;
607 mutex_lock(&hdw->i2c_list_lock); do { 604 mutex_lock(&hdw->i2c_list_lock); do {
608 struct v4l2_tuner *vtp = &hdw->tuner_signal_info; 605 struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
609 memset(vtp,0,sizeof(*vtp)); 606 memset(vtp,0,sizeof(*vtp));
610 list_for_each(item,&hdw->i2c_clients) { 607 list_for_each_entry(cp, &hdw->i2c_clients, list) {
611 cp = list_entry(item,struct pvr2_i2c_client,list);
612 if (!cp->detected_flag) continue; 608 if (!cp->detected_flag) continue;
613 if (!cp->status_poll) continue; 609 if (!cp->status_poll) continue;
614 cp->status_poll(cp); 610 cp->status_poll(cp);
@@ -630,8 +626,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
630{ 626{
631 unsigned long msk; 627 unsigned long msk;
632 unsigned int idx; 628 unsigned int idx;
633 struct list_head *item,*nc; 629 struct pvr2_i2c_client *cp, *ncp;
634 struct pvr2_i2c_client *cp;
635 630
636 if (!hdw->i2c_linked) return; 631 if (!hdw->i2c_linked) return;
637 if (!(hdw->i2c_pend_types & PVR2_I2C_PEND_ALL)) { 632 if (!(hdw->i2c_pend_types & PVR2_I2C_PEND_ALL)) {
@@ -649,9 +644,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
649 buf = kmalloc(BUFSIZE,GFP_KERNEL); 644 buf = kmalloc(BUFSIZE,GFP_KERNEL);
650 pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_DETECT"); 645 pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_DETECT");
651 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_DETECT; 646 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_DETECT;
652 list_for_each(item,&hdw->i2c_clients) { 647 list_for_each_entry(cp, &hdw->i2c_clients, list) {
653 cp = list_entry(item,struct pvr2_i2c_client,
654 list);
655 if (!cp->detected_flag) { 648 if (!cp->detected_flag) {
656 cp->ctl_mask = 0; 649 cp->ctl_mask = 0;
657 pvr2_i2c_probe(hdw,cp); 650 pvr2_i2c_probe(hdw,cp);
@@ -687,9 +680,7 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
687 "i2c: PEND_STALE (0x%lx)", 680 "i2c: PEND_STALE (0x%lx)",
688 hdw->i2c_stale_mask); 681 hdw->i2c_stale_mask);
689 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_STALE; 682 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_STALE;
690 list_for_each(item,&hdw->i2c_clients) { 683 list_for_each_entry(cp, &hdw->i2c_clients, list) {
691 cp = list_entry(item,struct pvr2_i2c_client,
692 list);
693 m2 = hdw->i2c_stale_mask; 684 m2 = hdw->i2c_stale_mask;
694 m2 &= cp->ctl_mask; 685 m2 &= cp->ctl_mask;
695 m2 &= ~cp->pend_mask; 686 m2 &= ~cp->pend_mask;
@@ -710,9 +701,8 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
710 and update each one. */ 701 and update each one. */
711 pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_CLIENT"); 702 pvr2_trace(PVR2_TRACE_I2C_CORE,"i2c: PEND_CLIENT");
712 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_CLIENT; 703 hdw->i2c_pend_types &= ~PVR2_I2C_PEND_CLIENT;
713 list_for_each_safe(item,nc,&hdw->i2c_clients) { 704 list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients,
714 cp = list_entry(item,struct pvr2_i2c_client, 705 list) {
715 list);
716 if (!cp->handler) continue; 706 if (!cp->handler) continue;
717 if (!cp->handler->func_table->update) continue; 707 if (!cp->handler->func_table->update) continue;
718 pvr2_trace(PVR2_TRACE_I2C_CORE, 708 pvr2_trace(PVR2_TRACE_I2C_CORE,
@@ -744,10 +734,8 @@ void pvr2_i2c_core_sync(struct pvr2_hdw *hdw)
744 for (idx = 0, msk = 1; pm; idx++, msk <<= 1) { 734 for (idx = 0, msk = 1; pm; idx++, msk <<= 1) {
745 if (!(pm & msk)) continue; 735 if (!(pm & msk)) continue;
746 pm &= ~msk; 736 pm &= ~msk;
747 list_for_each(item,&hdw->i2c_clients) { 737 list_for_each_entry(cp, &hdw->i2c_clients,
748 cp = list_entry(item, 738 list) {
749 struct pvr2_i2c_client,
750 list);
751 if (cp->pend_mask & msk) { 739 if (cp->pend_mask & msk) {
752 cp->pend_mask &= ~msk; 740 cp->pend_mask &= ~msk;
753 cp->recv_enable = !0; 741 cp->recv_enable = !0;
@@ -771,7 +759,6 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
771 unsigned long msk,sm,pm; 759 unsigned long msk,sm,pm;
772 unsigned int idx; 760 unsigned int idx;
773 const struct pvr2_i2c_op *opf; 761 const struct pvr2_i2c_op *opf;
774 struct list_head *item;
775 struct pvr2_i2c_client *cp; 762 struct pvr2_i2c_client *cp;
776 unsigned int pt = 0; 763 unsigned int pt = 0;
777 764
@@ -790,11 +777,9 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw)
790 } 777 }
791 if (sm) pt |= PVR2_I2C_PEND_STALE; 778 if (sm) pt |= PVR2_I2C_PEND_STALE;
792 779
793 list_for_each(item,&hdw->i2c_clients) { 780 list_for_each_entry(cp, &hdw->i2c_clients, list)
794 cp = list_entry(item,struct pvr2_i2c_client,list); 781 if (handler_check(cp))
795 if (!handler_check(cp)) continue; 782 pt |= PVR2_I2C_PEND_CLIENT;
796 pt |= PVR2_I2C_PEND_CLIENT;
797 }
798 783
799 if (pt) { 784 if (pt) {
800 mutex_lock(&hdw->i2c_list_lock); do { 785 mutex_lock(&hdw->i2c_list_lock); do {
@@ -882,12 +867,10 @@ unsigned int pvr2_i2c_report(struct pvr2_hdw *hdw,
882 char *buf,unsigned int maxlen) 867 char *buf,unsigned int maxlen)
883{ 868{
884 unsigned int ccnt,bcnt; 869 unsigned int ccnt,bcnt;
885 struct list_head *item;
886 struct pvr2_i2c_client *cp; 870 struct pvr2_i2c_client *cp;
887 ccnt = 0; 871 ccnt = 0;
888 mutex_lock(&hdw->i2c_list_lock); do { 872 mutex_lock(&hdw->i2c_list_lock); do {
889 list_for_each(item,&hdw->i2c_clients) { 873 list_for_each_entry(cp, &hdw->i2c_clients, list) {
890 cp = list_entry(item,struct pvr2_i2c_client,list);
891 bcnt = pvr2_i2c_client_describe( 874 bcnt = pvr2_i2c_client_describe(
892 cp, 875 cp,
893 (PVR2_I2C_DETAIL_HANDLER| 876 (PVR2_I2C_DETAIL_HANDLER|
@@ -925,13 +908,11 @@ static int pvr2_i2c_attach_inform(struct i2c_client *client)
925static int pvr2_i2c_detach_inform(struct i2c_client *client) 908static int pvr2_i2c_detach_inform(struct i2c_client *client)
926{ 909{
927 struct pvr2_hdw *hdw = (struct pvr2_hdw *)(client->adapter->algo_data); 910 struct pvr2_hdw *hdw = (struct pvr2_hdw *)(client->adapter->algo_data);
928 struct pvr2_i2c_client *cp; 911 struct pvr2_i2c_client *cp, *ncp;
929 struct list_head *item,*nc;
930 unsigned long amask = 0; 912 unsigned long amask = 0;
931 int foundfl = 0; 913 int foundfl = 0;
932 mutex_lock(&hdw->i2c_list_lock); do { 914 mutex_lock(&hdw->i2c_list_lock); do {
933 list_for_each_safe(item,nc,&hdw->i2c_clients) { 915 list_for_each_entry_safe(cp, ncp, &hdw->i2c_clients, list) {
934 cp = list_entry(item,struct pvr2_i2c_client,list);
935 if (cp->client == client) { 916 if (cp->client == client) {
936 trace_i2c("pvr2_i2c_detach" 917 trace_i2c("pvr2_i2c_detach"
937 " [client=%s @ 0x%x ctxt=%p]", 918 " [client=%s @ 0x%x ctxt=%p]",