diff options
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 20 | ||||
-rw-r--r-- | drivers/isdn/gigaset/common.c | 6 | ||||
-rw-r--r-- | drivers/isdn/gigaset/gigaset.h | 4 | ||||
-rw-r--r-- | drivers/isdn/gigaset/proc.c | 16 | ||||
-rw-r--r-- | drivers/isdn/gigaset/usb-gigaset.c | 23 |
5 files changed, 35 insertions, 34 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 580831d9dba1..1cf48cfad1de 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -2217,7 +2217,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2217 | usb_get_dev(udev); | 2217 | usb_get_dev(udev); |
2218 | ucs->udev = udev; | 2218 | ucs->udev = udev; |
2219 | ucs->interface = interface; | 2219 | ucs->interface = interface; |
2220 | cs->dev = &udev->dev; | 2220 | cs->dev = &interface->dev; |
2221 | 2221 | ||
2222 | /* allocate URBs: | 2222 | /* allocate URBs: |
2223 | * - one for the interrupt pipe | 2223 | * - one for the interrupt pipe |
@@ -2289,14 +2289,13 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2289 | /* tell common part that the device is ready */ | 2289 | /* tell common part that the device is ready */ |
2290 | if (startmode == SM_LOCKED) | 2290 | if (startmode == SM_LOCKED) |
2291 | atomic_set(&cs->mstate, MS_LOCKED); | 2291 | atomic_set(&cs->mstate, MS_LOCKED); |
2292 | if (!gigaset_start(cs)) | ||
2293 | goto error; | ||
2294 | 2292 | ||
2295 | /* save address of controller structure */ | 2293 | /* save address of controller structure */ |
2296 | usb_set_intfdata(interface, cs); | 2294 | usb_set_intfdata(interface, cs); |
2297 | 2295 | ||
2298 | /* set up device sysfs */ | 2296 | if (!gigaset_start(cs)) |
2299 | gigaset_init_dev_sysfs(interface); | 2297 | goto error; |
2298 | |||
2300 | return 0; | 2299 | return 0; |
2301 | 2300 | ||
2302 | error: | 2301 | error: |
@@ -2313,23 +2312,24 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2313 | struct cardstate *cs; | 2312 | struct cardstate *cs; |
2314 | struct bas_cardstate *ucs; | 2313 | struct bas_cardstate *ucs; |
2315 | 2314 | ||
2316 | /* clear device sysfs */ | ||
2317 | gigaset_free_dev_sysfs(interface); | ||
2318 | |||
2319 | cs = usb_get_intfdata(interface); | 2315 | cs = usb_get_intfdata(interface); |
2320 | usb_set_intfdata(interface, NULL); | ||
2321 | 2316 | ||
2322 | IFNULLRET(cs); | 2317 | IFNULLRET(cs); |
2323 | ucs = cs->hw.bas; | 2318 | ucs = cs->hw.bas; |
2324 | IFNULLRET(ucs); | 2319 | IFNULLRET(ucs); |
2325 | 2320 | ||
2326 | dev_info(cs->dev, "disconnecting GigaSet base"); | 2321 | dev_info(cs->dev, "disconnecting Gigaset base\n"); |
2327 | gigaset_stop(cs); | 2322 | gigaset_stop(cs); |
2328 | freeurbs(cs); | 2323 | freeurbs(cs); |
2324 | usb_set_intfdata(interface, NULL); | ||
2329 | kfree(ucs->rcvbuf); | 2325 | kfree(ucs->rcvbuf); |
2330 | ucs->rcvbuf = NULL; | 2326 | ucs->rcvbuf = NULL; |
2331 | ucs->rcvbuf_size = 0; | 2327 | ucs->rcvbuf_size = 0; |
2332 | atomic_set(&ucs->basstate, 0); | 2328 | atomic_set(&ucs->basstate, 0); |
2329 | usb_put_dev(ucs->udev); | ||
2330 | ucs->interface = NULL; | ||
2331 | ucs->udev = NULL; | ||
2332 | cs->dev = NULL; | ||
2333 | gigaset_unassign(cs); | 2333 | gigaset_unassign(cs); |
2334 | } | 2334 | } |
2335 | 2335 | ||
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index fb5cf703133f..2ea4976aa02a 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
@@ -833,6 +833,9 @@ int gigaset_start(struct cardstate *cs) | |||
833 | 833 | ||
834 | wait_event(cs->waitqueue, !cs->waiting); | 834 | wait_event(cs->waitqueue, !cs->waiting); |
835 | 835 | ||
836 | /* set up device sysfs */ | ||
837 | gigaset_init_dev_sysfs(cs); | ||
838 | |||
836 | up(&cs->sem); | 839 | up(&cs->sem); |
837 | return 1; | 840 | return 1; |
838 | 841 | ||
@@ -882,6 +885,9 @@ void gigaset_stop(struct cardstate *cs) | |||
882 | { | 885 | { |
883 | down(&cs->sem); | 886 | down(&cs->sem); |
884 | 887 | ||
888 | /* clear device sysfs */ | ||
889 | gigaset_free_dev_sysfs(cs); | ||
890 | |||
885 | atomic_set(&cs->connected, 0); | 891 | atomic_set(&cs->connected, 0); |
886 | 892 | ||
887 | cs->waiting = 1; | 893 | cs->waiting = 1; |
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h index d77588de7eb7..04457571923d 100644 --- a/drivers/isdn/gigaset/gigaset.h +++ b/drivers/isdn/gigaset/gigaset.h | |||
@@ -778,8 +778,8 @@ void gigaset_handle_modem_response(struct cardstate *cs); | |||
778 | */ | 778 | */ |
779 | 779 | ||
780 | /* initialize sysfs for device */ | 780 | /* initialize sysfs for device */ |
781 | void gigaset_init_dev_sysfs(struct usb_interface *interface); | 781 | void gigaset_init_dev_sysfs(struct cardstate *cs); |
782 | void gigaset_free_dev_sysfs(struct usb_interface *interface); | 782 | void gigaset_free_dev_sysfs(struct cardstate *cs); |
783 | 783 | ||
784 | /* =========================================================================== | 784 | /* =========================================================================== |
785 | * Functions implemented in common.c/gigaset.h | 785 | * Functions implemented in common.c/gigaset.h |
diff --git a/drivers/isdn/gigaset/proc.c b/drivers/isdn/gigaset/proc.c index 695495ad0668..912fed670742 100644 --- a/drivers/isdn/gigaset/proc.c +++ b/drivers/isdn/gigaset/proc.c | |||
@@ -19,16 +19,14 @@ | |||
19 | static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr, | 19 | static ssize_t show_cidmode(struct device *dev, struct device_attribute *attr, |
20 | char *buf) | 20 | char *buf) |
21 | { | 21 | { |
22 | struct usb_interface *intf = to_usb_interface(dev); | 22 | struct cardstate *cs = dev_get_drvdata(dev); |
23 | struct cardstate *cs = usb_get_intfdata(intf); | ||
24 | return sprintf(buf, "%d\n", atomic_read(&cs->cidmode)); | 23 | return sprintf(buf, "%d\n", atomic_read(&cs->cidmode)); |
25 | } | 24 | } |
26 | 25 | ||
27 | static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, | 26 | static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, |
28 | const char *buf, size_t count) | 27 | const char *buf, size_t count) |
29 | { | 28 | { |
30 | struct usb_interface *intf = to_usb_interface(dev); | 29 | struct cardstate *cs = dev_get_drvdata(dev); |
31 | struct cardstate *cs = usb_get_intfdata(intf); | ||
32 | long int value; | 30 | long int value; |
33 | char *end; | 31 | char *end; |
34 | 32 | ||
@@ -63,17 +61,15 @@ static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr, | |||
63 | static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode); | 61 | static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode); |
64 | 62 | ||
65 | /* free sysfs for device */ | 63 | /* free sysfs for device */ |
66 | void gigaset_free_dev_sysfs(struct usb_interface *interface) | 64 | void gigaset_free_dev_sysfs(struct cardstate *cs) |
67 | { | 65 | { |
68 | gig_dbg(DEBUG_INIT, "removing sysfs entries"); | 66 | gig_dbg(DEBUG_INIT, "removing sysfs entries"); |
69 | device_remove_file(&interface->dev, &dev_attr_cidmode); | 67 | device_remove_file(cs->dev, &dev_attr_cidmode); |
70 | } | 68 | } |
71 | EXPORT_SYMBOL_GPL(gigaset_free_dev_sysfs); | ||
72 | 69 | ||
73 | /* initialize sysfs for device */ | 70 | /* initialize sysfs for device */ |
74 | void gigaset_init_dev_sysfs(struct usb_interface *interface) | 71 | void gigaset_init_dev_sysfs(struct cardstate *cs) |
75 | { | 72 | { |
76 | gig_dbg(DEBUG_INIT, "setting up sysfs"); | 73 | gig_dbg(DEBUG_INIT, "setting up sysfs"); |
77 | device_create_file(&interface->dev, &dev_attr_cidmode); | 74 | device_create_file(cs->dev, &dev_attr_cidmode); |
78 | } | 75 | } |
79 | EXPORT_SYMBOL_GPL(gigaset_init_dev_sysfs); | ||
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index f09d821b6e89..a977dd570751 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -748,7 +748,10 @@ static int gigaset_probe(struct usb_interface *interface, | |||
748 | usb_get_dev(udev); | 748 | usb_get_dev(udev); |
749 | ucs->udev = udev; | 749 | ucs->udev = udev; |
750 | ucs->interface = interface; | 750 | ucs->interface = interface; |
751 | cs->dev = &udev->dev; | 751 | cs->dev = &interface->dev; |
752 | |||
753 | /* save address of controller structure */ | ||
754 | usb_set_intfdata(interface, cs); // dev_set_drvdata(&interface->dev, cs); | ||
752 | 755 | ||
753 | endpoint = &hostif->endpoint[0].desc; | 756 | endpoint = &hostif->endpoint[0].desc; |
754 | 757 | ||
@@ -805,17 +808,12 @@ static int gigaset_probe(struct usb_interface *interface, | |||
805 | /* tell common part that the device is ready */ | 808 | /* tell common part that the device is ready */ |
806 | if (startmode == SM_LOCKED) | 809 | if (startmode == SM_LOCKED) |
807 | atomic_set(&cs->mstate, MS_LOCKED); | 810 | atomic_set(&cs->mstate, MS_LOCKED); |
811 | |||
808 | if (!gigaset_start(cs)) { | 812 | if (!gigaset_start(cs)) { |
809 | tasklet_kill(&cs->write_tasklet); | 813 | tasklet_kill(&cs->write_tasklet); |
810 | retval = -ENODEV; //FIXME | 814 | retval = -ENODEV; //FIXME |
811 | goto error; | 815 | goto error; |
812 | } | 816 | } |
813 | |||
814 | /* save address of controller structure */ | ||
815 | usb_set_intfdata(interface, cs); | ||
816 | |||
817 | /* set up device sysfs */ | ||
818 | gigaset_init_dev_sysfs(interface); | ||
819 | return 0; | 817 | return 0; |
820 | 818 | ||
821 | error: | 819 | error: |
@@ -827,6 +825,7 @@ error: | |||
827 | kfree(cs->inbuf[0].rcvbuf); | 825 | kfree(cs->inbuf[0].rcvbuf); |
828 | if (ucs->read_urb != NULL) | 826 | if (ucs->read_urb != NULL) |
829 | usb_free_urb(ucs->read_urb); | 827 | usb_free_urb(ucs->read_urb); |
828 | usb_set_intfdata(interface, NULL); | ||
830 | ucs->read_urb = ucs->bulk_out_urb = NULL; | 829 | ucs->read_urb = ucs->bulk_out_urb = NULL; |
831 | cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; | 830 | cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; |
832 | usb_put_dev(ucs->udev); | 831 | usb_put_dev(ucs->udev); |
@@ -845,16 +844,12 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
845 | struct usb_cardstate *ucs; | 844 | struct usb_cardstate *ucs; |
846 | 845 | ||
847 | cs = usb_get_intfdata(interface); | 846 | cs = usb_get_intfdata(interface); |
848 | |||
849 | /* clear device sysfs */ | ||
850 | gigaset_free_dev_sysfs(interface); | ||
851 | |||
852 | usb_set_intfdata(interface, NULL); | ||
853 | ucs = cs->hw.usb; | 847 | ucs = cs->hw.usb; |
854 | usb_kill_urb(ucs->read_urb); | 848 | usb_kill_urb(ucs->read_urb); |
855 | 849 | ||
856 | gigaset_stop(cs); | 850 | gigaset_stop(cs); |
857 | 851 | ||
852 | usb_set_intfdata(interface, NULL); | ||
858 | tasklet_kill(&cs->write_tasklet); | 853 | tasklet_kill(&cs->write_tasklet); |
859 | 854 | ||
860 | usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */ | 855 | usb_kill_urb(ucs->bulk_out_urb); /* FIXME: only if active? */ |
@@ -868,6 +863,10 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
868 | ucs->read_urb = ucs->bulk_out_urb = NULL; | 863 | ucs->read_urb = ucs->bulk_out_urb = NULL; |
869 | cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; | 864 | cs->inbuf[0].rcvbuf = ucs->bulk_out_buffer = NULL; |
870 | 865 | ||
866 | usb_put_dev(ucs->udev); | ||
867 | ucs->interface = NULL; | ||
868 | ucs->udev = NULL; | ||
869 | cs->dev = NULL; | ||
871 | gigaset_unassign(cs); | 870 | gigaset_unassign(cs); |
872 | } | 871 | } |
873 | 872 | ||