diff options
author | Tejun Heo <tj@kernel.org> | 2010-12-24 10:14:20 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2010-12-24 10:14:20 -0500 |
commit | 37c95bfe944babae817bfcf02c996729c9a3335d (patch) | |
tree | 5c7baaf638a3058162513c8524be6954d43e649e /drivers/usb/atm/speedtch.c | |
parent | 8c71778cbf2c8beaefaa2dee5478aa0622d96682 (diff) |
speedtch: don't abuse struct delayed_work
speedtch directly uses the internal timer and work members of a struct
delayed_work. Use a separate work item and timer instead.
* Nicolas Kaiser discovered that timer init was missing. Fixed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Tested-by: Nicolas Kaiser <nikai@nikai.net>
Cc: Duncan Sands <duncan.sands@free.fr>
Cc: linux-usb@vger.kernel.org
Diffstat (limited to 'drivers/usb/atm/speedtch.c')
-rw-r--r-- | drivers/usb/atm/speedtch.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 4716e707de59..9046eba112af 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -139,7 +139,8 @@ struct speedtch_instance_data { | |||
139 | 139 | ||
140 | struct speedtch_params params; /* set in probe, constant afterwards */ | 140 | struct speedtch_params params; /* set in probe, constant afterwards */ |
141 | 141 | ||
142 | struct delayed_work status_checker; | 142 | struct timer_list status_check_timer; |
143 | struct work_struct status_check_work; | ||
143 | 144 | ||
144 | unsigned char last_status; | 145 | unsigned char last_status; |
145 | 146 | ||
@@ -498,7 +499,7 @@ static void speedtch_check_status(struct work_struct *work) | |||
498 | { | 499 | { |
499 | struct speedtch_instance_data *instance = | 500 | struct speedtch_instance_data *instance = |
500 | container_of(work, struct speedtch_instance_data, | 501 | container_of(work, struct speedtch_instance_data, |
501 | status_checker.work); | 502 | status_check_work); |
502 | struct usbatm_data *usbatm = instance->usbatm; | 503 | struct usbatm_data *usbatm = instance->usbatm; |
503 | struct atm_dev *atm_dev = usbatm->atm_dev; | 504 | struct atm_dev *atm_dev = usbatm->atm_dev; |
504 | unsigned char *buf = instance->scratch_buffer; | 505 | unsigned char *buf = instance->scratch_buffer; |
@@ -575,11 +576,11 @@ static void speedtch_status_poll(unsigned long data) | |||
575 | { | 576 | { |
576 | struct speedtch_instance_data *instance = (void *)data; | 577 | struct speedtch_instance_data *instance = (void *)data; |
577 | 578 | ||
578 | schedule_delayed_work(&instance->status_checker, 0); | 579 | schedule_work(&instance->status_check_work); |
579 | 580 | ||
580 | /* The following check is racy, but the race is harmless */ | 581 | /* The following check is racy, but the race is harmless */ |
581 | if (instance->poll_delay < MAX_POLL_DELAY) | 582 | if (instance->poll_delay < MAX_POLL_DELAY) |
582 | mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay)); | 583 | mod_timer(&instance->status_check_timer, jiffies + msecs_to_jiffies(instance->poll_delay)); |
583 | else | 584 | else |
584 | atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n"); | 585 | atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n"); |
585 | } | 586 | } |
@@ -595,7 +596,7 @@ static void speedtch_resubmit_int(unsigned long data) | |||
595 | if (int_urb) { | 596 | if (int_urb) { |
596 | ret = usb_submit_urb(int_urb, GFP_ATOMIC); | 597 | ret = usb_submit_urb(int_urb, GFP_ATOMIC); |
597 | if (!ret) | 598 | if (!ret) |
598 | schedule_delayed_work(&instance->status_checker, 0); | 599 | schedule_work(&instance->status_check_work); |
599 | else { | 600 | else { |
600 | atm_dbg(instance->usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret); | 601 | atm_dbg(instance->usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret); |
601 | mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY)); | 602 | mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY)); |
@@ -624,7 +625,7 @@ static void speedtch_handle_int(struct urb *int_urb) | |||
624 | } | 625 | } |
625 | 626 | ||
626 | if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) { | 627 | if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) { |
627 | del_timer(&instance->status_checker.timer); | 628 | del_timer(&instance->status_check_timer); |
628 | atm_info(usbatm, "DSL line goes up\n"); | 629 | atm_info(usbatm, "DSL line goes up\n"); |
629 | } else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) { | 630 | } else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) { |
630 | atm_info(usbatm, "DSL line goes down\n"); | 631 | atm_info(usbatm, "DSL line goes down\n"); |
@@ -640,7 +641,7 @@ static void speedtch_handle_int(struct urb *int_urb) | |||
640 | 641 | ||
641 | if ((int_urb = instance->int_urb)) { | 642 | if ((int_urb = instance->int_urb)) { |
642 | ret = usb_submit_urb(int_urb, GFP_ATOMIC); | 643 | ret = usb_submit_urb(int_urb, GFP_ATOMIC); |
643 | schedule_delayed_work(&instance->status_checker, 0); | 644 | schedule_work(&instance->status_check_work); |
644 | if (ret < 0) { | 645 | if (ret < 0) { |
645 | atm_dbg(usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret); | 646 | atm_dbg(usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret); |
646 | goto fail; | 647 | goto fail; |
@@ -686,7 +687,7 @@ static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_de | |||
686 | } | 687 | } |
687 | 688 | ||
688 | /* Start status polling */ | 689 | /* Start status polling */ |
689 | mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(1000)); | 690 | mod_timer(&instance->status_check_timer, jiffies + msecs_to_jiffies(1000)); |
690 | 691 | ||
691 | return 0; | 692 | return 0; |
692 | } | 693 | } |
@@ -698,7 +699,7 @@ static void speedtch_atm_stop(struct usbatm_data *usbatm, struct atm_dev *atm_de | |||
698 | 699 | ||
699 | atm_dbg(usbatm, "%s entered\n", __func__); | 700 | atm_dbg(usbatm, "%s entered\n", __func__); |
700 | 701 | ||
701 | del_timer_sync(&instance->status_checker.timer); | 702 | del_timer_sync(&instance->status_check_timer); |
702 | 703 | ||
703 | /* | 704 | /* |
704 | * Since resubmit_timer and int_urb can schedule themselves and | 705 | * Since resubmit_timer and int_urb can schedule themselves and |
@@ -869,10 +870,11 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
869 | 870 | ||
870 | usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); | 871 | usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); |
871 | 872 | ||
872 | INIT_DELAYED_WORK(&instance->status_checker, speedtch_check_status); | 873 | INIT_WORK(&instance->status_check_work, speedtch_check_status); |
874 | init_timer(&instance->status_check_timer); | ||
873 | 875 | ||
874 | instance->status_checker.timer.function = speedtch_status_poll; | 876 | instance->status_check_timer.function = speedtch_status_poll; |
875 | instance->status_checker.timer.data = (unsigned long)instance; | 877 | instance->status_check_timer.data = (unsigned long)instance; |
876 | instance->last_status = 0xff; | 878 | instance->last_status = 0xff; |
877 | instance->poll_delay = MIN_POLL_DELAY; | 879 | instance->poll_delay = MIN_POLL_DELAY; |
878 | 880 | ||