Annotation of /trunk/kernel26-alx/patches-2.6.27-r3/0139-2.6.27.40-all-fixes.patch
Parent Directory | Revision Log
Revision 1176 -
(hide annotations)
(download)
Thu Oct 14 15:11:06 2010 UTC (13 years, 11 months ago) by niro
File size: 71460 byte(s)
Thu Oct 14 15:11:06 2010 UTC (13 years, 11 months ago) by niro
File size: 71460 byte(s)
-2.6.27-alx-r3: new magellan 0.5.2 kernel
1 | niro | 1176 | diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c |
2 | index 7c074ee..94c25fa 100644 | ||
3 | --- a/arch/x86/kernel/acpi/processor.c | ||
4 | +++ b/arch/x86/kernel/acpi/processor.c | ||
5 | @@ -78,7 +78,8 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | ||
6 | struct cpuinfo_x86 *c = &cpu_data(pr->id); | ||
7 | |||
8 | pr->pdc = NULL; | ||
9 | - if (c->x86_vendor == X86_VENDOR_INTEL) | ||
10 | + if (c->x86_vendor == X86_VENDOR_INTEL || | ||
11 | + c->x86_vendor == X86_VENDOR_CENTAUR) | ||
12 | init_intel_pdc(pr, c); | ||
13 | |||
14 | return; | ||
15 | diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c | ||
16 | index d883e1b..a24bdd9 100644 | ||
17 | --- a/drivers/dca/dca-core.c | ||
18 | +++ b/drivers/dca/dca-core.c | ||
19 | @@ -28,7 +28,7 @@ | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/dca.h> | ||
22 | |||
23 | -#define DCA_VERSION "1.4" | ||
24 | +#define DCA_VERSION "1.8" | ||
25 | |||
26 | MODULE_VERSION(DCA_VERSION); | ||
27 | MODULE_LICENSE("GPL"); | ||
28 | @@ -60,16 +60,17 @@ int dca_add_requester(struct device *dev) | ||
29 | { | ||
30 | struct dca_provider *dca; | ||
31 | int err, slot = -ENODEV; | ||
32 | + unsigned long flags; | ||
33 | |||
34 | if (!dev) | ||
35 | return -EFAULT; | ||
36 | |||
37 | - spin_lock(&dca_lock); | ||
38 | + spin_lock_irqsave(&dca_lock, flags); | ||
39 | |||
40 | /* check if the requester has not been added already */ | ||
41 | dca = dca_find_provider_by_dev(dev); | ||
42 | if (dca) { | ||
43 | - spin_unlock(&dca_lock); | ||
44 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
45 | return -EEXIST; | ||
46 | } | ||
47 | |||
48 | @@ -78,19 +79,21 @@ int dca_add_requester(struct device *dev) | ||
49 | if (slot >= 0) | ||
50 | break; | ||
51 | } | ||
52 | - if (slot < 0) { | ||
53 | - spin_unlock(&dca_lock); | ||
54 | + | ||
55 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
56 | + | ||
57 | + if (slot < 0) | ||
58 | return slot; | ||
59 | - } | ||
60 | |||
61 | err = dca_sysfs_add_req(dca, dev, slot); | ||
62 | if (err) { | ||
63 | - dca->ops->remove_requester(dca, dev); | ||
64 | - spin_unlock(&dca_lock); | ||
65 | + spin_lock_irqsave(&dca_lock, flags); | ||
66 | + if (dca == dca_find_provider_by_dev(dev)) | ||
67 | + dca->ops->remove_requester(dca, dev); | ||
68 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
69 | return err; | ||
70 | } | ||
71 | |||
72 | - spin_unlock(&dca_lock); | ||
73 | return 0; | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(dca_add_requester); | ||
76 | @@ -103,25 +106,25 @@ int dca_remove_requester(struct device *dev) | ||
77 | { | ||
78 | struct dca_provider *dca; | ||
79 | int slot; | ||
80 | + unsigned long flags; | ||
81 | |||
82 | if (!dev) | ||
83 | return -EFAULT; | ||
84 | |||
85 | - spin_lock(&dca_lock); | ||
86 | + spin_lock_irqsave(&dca_lock, flags); | ||
87 | dca = dca_find_provider_by_dev(dev); | ||
88 | if (!dca) { | ||
89 | - spin_unlock(&dca_lock); | ||
90 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
91 | return -ENODEV; | ||
92 | } | ||
93 | slot = dca->ops->remove_requester(dca, dev); | ||
94 | - if (slot < 0) { | ||
95 | - spin_unlock(&dca_lock); | ||
96 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
97 | + | ||
98 | + if (slot < 0) | ||
99 | return slot; | ||
100 | - } | ||
101 | |||
102 | dca_sysfs_remove_req(dca, slot); | ||
103 | |||
104 | - spin_unlock(&dca_lock); | ||
105 | return 0; | ||
106 | } | ||
107 | EXPORT_SYMBOL_GPL(dca_remove_requester); | ||
108 | @@ -135,17 +138,18 @@ u8 dca_common_get_tag(struct device *dev, int cpu) | ||
109 | { | ||
110 | struct dca_provider *dca; | ||
111 | u8 tag; | ||
112 | + unsigned long flags; | ||
113 | |||
114 | - spin_lock(&dca_lock); | ||
115 | + spin_lock_irqsave(&dca_lock, flags); | ||
116 | |||
117 | dca = dca_find_provider_by_dev(dev); | ||
118 | if (!dca) { | ||
119 | - spin_unlock(&dca_lock); | ||
120 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
121 | return -ENODEV; | ||
122 | } | ||
123 | tag = dca->ops->get_tag(dca, dev, cpu); | ||
124 | |||
125 | - spin_unlock(&dca_lock); | ||
126 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
127 | return tag; | ||
128 | } | ||
129 | |||
130 | @@ -217,11 +221,16 @@ static BLOCKING_NOTIFIER_HEAD(dca_provider_chain); | ||
131 | int register_dca_provider(struct dca_provider *dca, struct device *dev) | ||
132 | { | ||
133 | int err; | ||
134 | + unsigned long flags; | ||
135 | |||
136 | err = dca_sysfs_add_provider(dca, dev); | ||
137 | if (err) | ||
138 | return err; | ||
139 | + | ||
140 | + spin_lock_irqsave(&dca_lock, flags); | ||
141 | list_add(&dca->node, &dca_providers); | ||
142 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
143 | + | ||
144 | blocking_notifier_call_chain(&dca_provider_chain, | ||
145 | DCA_PROVIDER_ADD, NULL); | ||
146 | return 0; | ||
147 | @@ -234,9 +243,15 @@ EXPORT_SYMBOL_GPL(register_dca_provider); | ||
148 | */ | ||
149 | void unregister_dca_provider(struct dca_provider *dca) | ||
150 | { | ||
151 | + unsigned long flags; | ||
152 | + | ||
153 | blocking_notifier_call_chain(&dca_provider_chain, | ||
154 | DCA_PROVIDER_REMOVE, NULL); | ||
155 | + | ||
156 | + spin_lock_irqsave(&dca_lock, flags); | ||
157 | list_del(&dca->node); | ||
158 | + spin_unlock_irqrestore(&dca_lock, flags); | ||
159 | + | ||
160 | dca_sysfs_remove_provider(dca); | ||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(unregister_dca_provider); | ||
163 | diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c | ||
164 | index c620b20..f29ed05 100644 | ||
165 | --- a/drivers/hwmon/it87.c | ||
166 | +++ b/drivers/hwmon/it87.c | ||
167 | @@ -1017,7 +1017,7 @@ static int __init it87_find(unsigned short *address, | ||
168 | int reg; | ||
169 | |||
170 | superio_select(GPIO); | ||
171 | - if (chip_type == it8718) | ||
172 | + if (sio_data->type == it8718) | ||
173 | sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); | ||
174 | |||
175 | reg = superio_inb(IT87_SIO_PINX2_REG); | ||
176 | diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c | ||
177 | index 8df889b..5b6b828 100644 | ||
178 | --- a/drivers/isdn/hisax/hfc_usb.c | ||
179 | +++ b/drivers/isdn/hisax/hfc_usb.c | ||
180 | @@ -818,8 +818,8 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) | ||
181 | } | ||
182 | /* we have a complete hdlc packet */ | ||
183 | if (finish) { | ||
184 | - if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) | ||
185 | - && (fifo->skbuff->len > 3)) { | ||
186 | + if (fifo->skbuff->len > 3 && | ||
187 | + !fifo->skbuff->data[fifo->skbuff->len - 1]) { | ||
188 | |||
189 | if (fifon == HFCUSB_D_RX) { | ||
190 | DBG(HFCUSB_DBG_DCHANNEL, | ||
191 | diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c | ||
192 | index 93063c6..35df2e2 100644 | ||
193 | --- a/drivers/media/common/tuners/tda18271-fe.c | ||
194 | +++ b/drivers/media/common/tuners/tda18271-fe.c | ||
195 | @@ -595,13 +595,13 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | ||
196 | case RF2: | ||
197 | map[i].rf_a1 = (prog_cal[RF2] - prog_tab[RF2] - | ||
198 | prog_cal[RF1] + prog_tab[RF1]) / | ||
199 | - ((rf_freq[RF2] - rf_freq[RF1]) / 1000); | ||
200 | + (s32)((rf_freq[RF2] - rf_freq[RF1]) / 1000); | ||
201 | map[i].rf2 = rf_freq[RF2] / 1000; | ||
202 | break; | ||
203 | case RF3: | ||
204 | map[i].rf_a2 = (prog_cal[RF3] - prog_tab[RF3] - | ||
205 | prog_cal[RF2] + prog_tab[RF2]) / | ||
206 | - ((rf_freq[RF3] - rf_freq[RF2]) / 1000); | ||
207 | + (s32)((rf_freq[RF3] - rf_freq[RF2]) / 1000); | ||
208 | map[i].rf_b2 = prog_cal[RF2] - prog_tab[RF2]; | ||
209 | map[i].rf3 = rf_freq[RF3] / 1000; | ||
210 | break; | ||
211 | @@ -927,12 +927,12 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | ||
212 | struct tda18271_std_map_item *map; | ||
213 | char *mode; | ||
214 | int ret; | ||
215 | - u32 freq = params->frequency * 62500; | ||
216 | + u32 freq = params->frequency * 125 * | ||
217 | + ((params->mode == V4L2_TUNER_RADIO) ? 1 : 1000) / 2; | ||
218 | |||
219 | priv->mode = TDA18271_ANALOG; | ||
220 | |||
221 | if (params->mode == V4L2_TUNER_RADIO) { | ||
222 | - freq = freq / 1000; | ||
223 | map = &std_map->fm_radio; | ||
224 | mode = "fm"; | ||
225 | } else if (params->std & V4L2_STD_MN) { | ||
226 | diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c | ||
227 | index 1a0142e..78f710d 100644 | ||
228 | --- a/drivers/media/dvb/frontends/dib7000p.c | ||
229 | +++ b/drivers/media/dvb/frontends/dib7000p.c | ||
230 | @@ -1343,6 +1343,11 @@ struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, | ||
231 | if (dib7000p_identify(st) != 0) | ||
232 | goto error; | ||
233 | |||
234 | + /* FIXME: make sure the dev.parent field is initialized, or else | ||
235 | + request_firmware() will hit an OOPS (this should be moved somewhere | ||
236 | + more common) */ | ||
237 | + st->i2c_master.gated_tuner_i2c_adap.dev.parent = i2c_adap->dev.parent; | ||
238 | + | ||
239 | dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr); | ||
240 | |||
241 | dib7000p_demod_reset(st); | ||
242 | diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c | ||
243 | index ac3292d..95f77b6 100644 | ||
244 | --- a/drivers/media/video/em28xx/em28xx-audio.c | ||
245 | +++ b/drivers/media/video/em28xx/em28xx-audio.c | ||
246 | @@ -365,6 +365,11 @@ static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream) | ||
247 | |||
248 | static int snd_em28xx_prepare(struct snd_pcm_substream *substream) | ||
249 | { | ||
250 | + struct em28xx *dev = snd_pcm_substream_chip(substream); | ||
251 | + | ||
252 | + dev->adev.hwptr_done_capture = 0; | ||
253 | + dev->adev.capture_transfer_done = 0; | ||
254 | + | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c | ||
259 | index 92b83fe..83f0bca 100644 | ||
260 | --- a/drivers/media/video/s2255drv.c | ||
261 | +++ b/drivers/media/video/s2255drv.c | ||
262 | @@ -578,11 +578,6 @@ static int s2255_got_frame(struct s2255_dev *dev, int chn) | ||
263 | buf = list_entry(dma_q->active.next, | ||
264 | struct s2255_buffer, vb.queue); | ||
265 | |||
266 | - if (!waitqueue_active(&buf->vb.done)) { | ||
267 | - /* no one active */ | ||
268 | - rc = -1; | ||
269 | - goto unlock; | ||
270 | - } | ||
271 | list_del(&buf->vb.queue); | ||
272 | do_gettimeofday(&buf->vb.ts); | ||
273 | dprintk(100, "[%p/%d] wakeup\n", buf, buf->vb.i); | ||
274 | diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c | ||
275 | index 1a551a8..d3ade96 100644 | ||
276 | --- a/drivers/misc/thinkpad_acpi.c | ||
277 | +++ b/drivers/misc/thinkpad_acpi.c | ||
278 | @@ -5042,7 +5042,7 @@ static int brightness_write(char *buf) | ||
279 | * Doing it this way makes the syscall restartable in case of EINTR | ||
280 | */ | ||
281 | rc = brightness_set(level); | ||
282 | - return (rc == -EINTR)? ERESTARTSYS : rc; | ||
283 | + return (rc == -EINTR)? -ERESTARTSYS : rc; | ||
284 | } | ||
285 | |||
286 | static struct ibm_struct brightness_driver_data = { | ||
287 | diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c | ||
288 | index 822d521..4015499 100644 | ||
289 | --- a/drivers/scsi/gdth.c | ||
290 | +++ b/drivers/scsi/gdth.c | ||
291 | @@ -2912,7 +2912,7 @@ static int gdth_read_event(gdth_ha_str *ha, int handle, gdth_evt_str *estr) | ||
292 | eindex = handle; | ||
293 | estr->event_source = 0; | ||
294 | |||
295 | - if (eindex >= MAX_EVENTS) { | ||
296 | + if (eindex < 0 || eindex >= MAX_EVENTS) { | ||
297 | spin_unlock_irqrestore(&ha->smp_lock, flags); | ||
298 | return eindex; | ||
299 | } | ||
300 | diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c | ||
301 | index 8bec02c..c0c6895 100644 | ||
302 | --- a/drivers/usb/host/ohci-hcd.c | ||
303 | +++ b/drivers/usb/host/ohci-hcd.c | ||
304 | @@ -89,6 +89,7 @@ static int ohci_restart (struct ohci_hcd *ohci); | ||
305 | #ifdef CONFIG_PCI | ||
306 | static void quirk_amd_pll(int state); | ||
307 | static void amd_iso_dev_put(void); | ||
308 | +static void sb800_prefetch(struct ohci_hcd *ohci, int on); | ||
309 | #else | ||
310 | static inline void quirk_amd_pll(int state) | ||
311 | { | ||
312 | @@ -98,6 +99,10 @@ static inline void amd_iso_dev_put(void) | ||
313 | { | ||
314 | return; | ||
315 | } | ||
316 | +static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
317 | +{ | ||
318 | + return; | ||
319 | +} | ||
320 | #endif | ||
321 | |||
322 | |||
323 | diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c | ||
324 | index a9c2ae3..2969fc1 100644 | ||
325 | --- a/drivers/usb/host/ohci-pci.c | ||
326 | +++ b/drivers/usb/host/ohci-pci.c | ||
327 | @@ -177,6 +177,13 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) | ||
328 | return 0; | ||
329 | |||
330 | pci_read_config_byte(amd_smbus_dev, PCI_REVISION_ID, &rev); | ||
331 | + | ||
332 | + /* SB800 needs pre-fetch fix */ | ||
333 | + if ((rev >= 0x40) && (rev <= 0x4f)) { | ||
334 | + ohci->flags |= OHCI_QUIRK_AMD_PREFETCH; | ||
335 | + ohci_dbg(ohci, "enabled AMD prefetch quirk\n"); | ||
336 | + } | ||
337 | + | ||
338 | if ((rev > 0x3b) || (rev < 0x30)) { | ||
339 | pci_dev_put(amd_smbus_dev); | ||
340 | amd_smbus_dev = NULL; | ||
341 | @@ -262,6 +269,19 @@ static void amd_iso_dev_put(void) | ||
342 | |||
343 | } | ||
344 | |||
345 | +static void sb800_prefetch(struct ohci_hcd *ohci, int on) | ||
346 | +{ | ||
347 | + struct pci_dev *pdev; | ||
348 | + u16 misc; | ||
349 | + | ||
350 | + pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); | ||
351 | + pci_read_config_word(pdev, 0x50, &misc); | ||
352 | + if (on == 0) | ||
353 | + pci_write_config_word(pdev, 0x50, misc & 0xfcff); | ||
354 | + else | ||
355 | + pci_write_config_word(pdev, 0x50, misc | 0x0300); | ||
356 | +} | ||
357 | + | ||
358 | /* List of quirks for OHCI */ | ||
359 | static const struct pci_device_id ohci_pci_quirks[] = { | ||
360 | { | ||
361 | diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c | ||
362 | index c2d80f8..2c7409b 100644 | ||
363 | --- a/drivers/usb/host/ohci-q.c | ||
364 | +++ b/drivers/usb/host/ohci-q.c | ||
365 | @@ -49,9 +49,12 @@ __acquires(ohci->lock) | ||
366 | switch (usb_pipetype (urb->pipe)) { | ||
367 | case PIPE_ISOCHRONOUS: | ||
368 | ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs--; | ||
369 | - if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | ||
370 | - && quirk_amdiso(ohci)) | ||
371 | - quirk_amd_pll(1); | ||
372 | + if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { | ||
373 | + if (quirk_amdiso(ohci)) | ||
374 | + quirk_amd_pll(1); | ||
375 | + if (quirk_amdprefetch(ohci)) | ||
376 | + sb800_prefetch(ohci, 0); | ||
377 | + } | ||
378 | break; | ||
379 | case PIPE_INTERRUPT: | ||
380 | ohci_to_hcd(ohci)->self.bandwidth_int_reqs--; | ||
381 | @@ -680,9 +683,12 @@ static void td_submit_urb ( | ||
382 | data + urb->iso_frame_desc [cnt].offset, | ||
383 | urb->iso_frame_desc [cnt].length, urb, cnt); | ||
384 | } | ||
385 | - if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0 | ||
386 | - && quirk_amdiso(ohci)) | ||
387 | - quirk_amd_pll(0); | ||
388 | + if (ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs == 0) { | ||
389 | + if (quirk_amdiso(ohci)) | ||
390 | + quirk_amd_pll(0); | ||
391 | + if (quirk_amdprefetch(ohci)) | ||
392 | + sb800_prefetch(ohci, 1); | ||
393 | + } | ||
394 | periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 | ||
395 | && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; | ||
396 | break; | ||
397 | diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h | ||
398 | index faf622e..3babb17 100644 | ||
399 | --- a/drivers/usb/host/ohci.h | ||
400 | +++ b/drivers/usb/host/ohci.h | ||
401 | @@ -402,6 +402,7 @@ struct ohci_hcd { | ||
402 | #define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ | ||
403 | #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */ | ||
404 | #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/ | ||
405 | +#define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */ | ||
406 | // there are also chip quirks/bugs in init logic | ||
407 | |||
408 | struct work_struct nec_work; /* Worker for NEC quirk */ | ||
409 | @@ -433,6 +434,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | ||
410 | { | ||
411 | return ohci->flags & OHCI_QUIRK_AMD_ISO; | ||
412 | } | ||
413 | +static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
414 | +{ | ||
415 | + return ohci->flags & OHCI_QUIRK_AMD_PREFETCH; | ||
416 | +} | ||
417 | #else | ||
418 | static inline int quirk_nec(struct ohci_hcd *ohci) | ||
419 | { | ||
420 | @@ -446,6 +451,10 @@ static inline int quirk_amdiso(struct ohci_hcd *ohci) | ||
421 | { | ||
422 | return 0; | ||
423 | } | ||
424 | +static inline int quirk_amdprefetch(struct ohci_hcd *ohci) | ||
425 | +{ | ||
426 | + return 0; | ||
427 | +} | ||
428 | #endif | ||
429 | |||
430 | /* convert between an hcd pointer and the corresponding ohci_hcd */ | ||
431 | diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c | ||
432 | index 79ea98c..7ee5903 100644 | ||
433 | --- a/drivers/usb/serial/aircable.c | ||
434 | +++ b/drivers/usb/serial/aircable.c | ||
435 | @@ -362,7 +362,7 @@ static int aircable_attach(struct usb_serial *serial) | ||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | -static void aircable_shutdown(struct usb_serial *serial) | ||
440 | +static void aircable_release(struct usb_serial *serial) | ||
441 | { | ||
442 | |||
443 | struct usb_serial_port *port = serial->port[0]; | ||
444 | @@ -373,7 +373,6 @@ static void aircable_shutdown(struct usb_serial *serial) | ||
445 | if (priv) { | ||
446 | serial_buf_free(priv->tx_buf); | ||
447 | serial_buf_free(priv->rx_buf); | ||
448 | - usb_set_serial_port_data(port, NULL); | ||
449 | kfree(priv); | ||
450 | } | ||
451 | } | ||
452 | @@ -598,7 +597,7 @@ static struct usb_serial_driver aircable_device = { | ||
453 | .num_ports = 1, | ||
454 | .attach = aircable_attach, | ||
455 | .probe = aircable_probe, | ||
456 | - .shutdown = aircable_shutdown, | ||
457 | + .release = aircable_release, | ||
458 | .write = aircable_write, | ||
459 | .write_room = aircable_write_room, | ||
460 | .write_bulk_callback = aircable_write_bulk_callback, | ||
461 | diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c | ||
462 | index 2ebe06c..5f77c61 100644 | ||
463 | --- a/drivers/usb/serial/belkin_sa.c | ||
464 | +++ b/drivers/usb/serial/belkin_sa.c | ||
465 | @@ -90,7 +90,7 @@ static int debug; | ||
466 | |||
467 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ | ||
468 | static int belkin_sa_startup(struct usb_serial *serial); | ||
469 | -static void belkin_sa_shutdown(struct usb_serial *serial); | ||
470 | +static void belkin_sa_release(struct usb_serial *serial); | ||
471 | static int belkin_sa_open(struct tty_struct *tty, | ||
472 | struct usb_serial_port *port, struct file *filp); | ||
473 | static void belkin_sa_close(struct tty_struct *tty, | ||
474 | @@ -143,7 +143,7 @@ static struct usb_serial_driver belkin_device = { | ||
475 | .tiocmget = belkin_sa_tiocmget, | ||
476 | .tiocmset = belkin_sa_tiocmset, | ||
477 | .attach = belkin_sa_startup, | ||
478 | - .shutdown = belkin_sa_shutdown, | ||
479 | + .release = belkin_sa_release, | ||
480 | }; | ||
481 | |||
482 | |||
483 | @@ -198,14 +198,13 @@ static int belkin_sa_startup(struct usb_serial *serial) | ||
484 | } | ||
485 | |||
486 | |||
487 | -static void belkin_sa_shutdown(struct usb_serial *serial) | ||
488 | +static void belkin_sa_release(struct usb_serial *serial) | ||
489 | { | ||
490 | struct belkin_sa_private *priv; | ||
491 | int i; | ||
492 | |||
493 | dbg("%s", __func__); | ||
494 | |||
495 | - /* stop reads and writes on all ports */ | ||
496 | for (i = 0; i < serial->num_ports; ++i) { | ||
497 | /* My special items, the standard routines free my urbs */ | ||
498 | priv = usb_get_serial_port_data(serial->port[i]); | ||
499 | diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c | ||
500 | index 69e6687..64d3874 100644 | ||
501 | --- a/drivers/usb/serial/cp2101.c | ||
502 | +++ b/drivers/usb/serial/cp2101.c | ||
503 | @@ -50,7 +50,7 @@ static int cp2101_tiocmset(struct tty_struct *, struct file *, | ||
504 | unsigned int, unsigned int); | ||
505 | static void cp2101_break_ctl(struct tty_struct *, int); | ||
506 | static int cp2101_startup(struct usb_serial *); | ||
507 | -static void cp2101_shutdown(struct usb_serial *); | ||
508 | +static void cp2101_disconnect(struct usb_serial *); | ||
509 | |||
510 | |||
511 | static int debug; | ||
512 | @@ -125,7 +125,7 @@ static struct usb_serial_driver cp2101_device = { | ||
513 | .tiocmget = cp2101_tiocmget, | ||
514 | .tiocmset = cp2101_tiocmset, | ||
515 | .attach = cp2101_startup, | ||
516 | - .shutdown = cp2101_shutdown, | ||
517 | + .disconnect = cp2101_disconnect, | ||
518 | }; | ||
519 | |||
520 | /* Config request types */ | ||
521 | @@ -727,7 +727,7 @@ static int cp2101_startup(struct usb_serial *serial) | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | -static void cp2101_shutdown(struct usb_serial *serial) | ||
526 | +static void cp2101_disconnect(struct usb_serial *serial) | ||
527 | { | ||
528 | int i; | ||
529 | |||
530 | diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c | ||
531 | index 7b3df8e..4443821 100644 | ||
532 | --- a/drivers/usb/serial/cyberjack.c | ||
533 | +++ b/drivers/usb/serial/cyberjack.c | ||
534 | @@ -58,7 +58,8 @@ static int debug; | ||
535 | |||
536 | /* Function prototypes */ | ||
537 | static int cyberjack_startup(struct usb_serial *serial); | ||
538 | -static void cyberjack_shutdown(struct usb_serial *serial); | ||
539 | +static void cyberjack_disconnect(struct usb_serial *serial); | ||
540 | +static void cyberjack_release(struct usb_serial *serial); | ||
541 | static int cyberjack_open(struct tty_struct *tty, | ||
542 | struct usb_serial_port *port, struct file *filp); | ||
543 | static void cyberjack_close(struct tty_struct *tty, | ||
544 | @@ -95,7 +96,8 @@ static struct usb_serial_driver cyberjack_device = { | ||
545 | .id_table = id_table, | ||
546 | .num_ports = 1, | ||
547 | .attach = cyberjack_startup, | ||
548 | - .shutdown = cyberjack_shutdown, | ||
549 | + .disconnect = cyberjack_disconnect, | ||
550 | + .release = cyberjack_release, | ||
551 | .open = cyberjack_open, | ||
552 | .close = cyberjack_close, | ||
553 | .write = cyberjack_write, | ||
554 | @@ -148,17 +150,25 @@ static int cyberjack_startup(struct usb_serial *serial) | ||
555 | return 0; | ||
556 | } | ||
557 | |||
558 | -static void cyberjack_shutdown(struct usb_serial *serial) | ||
559 | +static void cyberjack_disconnect(struct usb_serial *serial) | ||
560 | { | ||
561 | int i; | ||
562 | |||
563 | dbg("%s", __func__); | ||
564 | |||
565 | - for (i = 0; i < serial->num_ports; ++i) { | ||
566 | + for (i = 0; i < serial->num_ports; ++i) | ||
567 | usb_kill_urb(serial->port[i]->interrupt_in_urb); | ||
568 | +} | ||
569 | + | ||
570 | +static void cyberjack_release(struct usb_serial *serial) | ||
571 | +{ | ||
572 | + int i; | ||
573 | + | ||
574 | + dbg("%s", __func__); | ||
575 | + | ||
576 | + for (i = 0; i < serial->num_ports; ++i) { | ||
577 | /* My special items, the standard routines free my urbs */ | ||
578 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
579 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
580 | } | ||
581 | } | ||
582 | |||
583 | diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c | ||
584 | index 7eb473b..d8c76b2 100644 | ||
585 | --- a/drivers/usb/serial/cypress_m8.c | ||
586 | +++ b/drivers/usb/serial/cypress_m8.c | ||
587 | @@ -171,7 +171,7 @@ struct cypress_buf { | ||
588 | static int cypress_earthmate_startup(struct usb_serial *serial); | ||
589 | static int cypress_hidcom_startup(struct usb_serial *serial); | ||
590 | static int cypress_ca42v2_startup(struct usb_serial *serial); | ||
591 | -static void cypress_shutdown(struct usb_serial *serial); | ||
592 | +static void cypress_release(struct usb_serial *serial); | ||
593 | static int cypress_open(struct tty_struct *tty, | ||
594 | struct usb_serial_port *port, struct file *filp); | ||
595 | static void cypress_close(struct tty_struct *tty, | ||
596 | @@ -215,7 +215,7 @@ static struct usb_serial_driver cypress_earthmate_device = { | ||
597 | .id_table = id_table_earthmate, | ||
598 | .num_ports = 1, | ||
599 | .attach = cypress_earthmate_startup, | ||
600 | - .shutdown = cypress_shutdown, | ||
601 | + .release = cypress_release, | ||
602 | .open = cypress_open, | ||
603 | .close = cypress_close, | ||
604 | .write = cypress_write, | ||
605 | @@ -241,7 +241,7 @@ static struct usb_serial_driver cypress_hidcom_device = { | ||
606 | .id_table = id_table_cyphidcomrs232, | ||
607 | .num_ports = 1, | ||
608 | .attach = cypress_hidcom_startup, | ||
609 | - .shutdown = cypress_shutdown, | ||
610 | + .release = cypress_release, | ||
611 | .open = cypress_open, | ||
612 | .close = cypress_close, | ||
613 | .write = cypress_write, | ||
614 | @@ -267,7 +267,7 @@ static struct usb_serial_driver cypress_ca42v2_device = { | ||
615 | .id_table = id_table_nokiaca42v2, | ||
616 | .num_ports = 1, | ||
617 | .attach = cypress_ca42v2_startup, | ||
618 | - .shutdown = cypress_shutdown, | ||
619 | + .release = cypress_release, | ||
620 | .open = cypress_open, | ||
621 | .close = cypress_close, | ||
622 | .write = cypress_write, | ||
623 | @@ -612,7 +612,7 @@ static int cypress_ca42v2_startup(struct usb_serial *serial) | ||
624 | } /* cypress_ca42v2_startup */ | ||
625 | |||
626 | |||
627 | -static void cypress_shutdown(struct usb_serial *serial) | ||
628 | +static void cypress_release(struct usb_serial *serial) | ||
629 | { | ||
630 | struct cypress_private *priv; | ||
631 | |||
632 | @@ -625,7 +625,6 @@ static void cypress_shutdown(struct usb_serial *serial) | ||
633 | if (priv) { | ||
634 | cypress_buf_free(priv->buf); | ||
635 | kfree(priv); | ||
636 | - usb_set_serial_port_data(serial->port[0], NULL); | ||
637 | } | ||
638 | } | ||
639 | |||
640 | diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c | ||
641 | index 657fc25..0d7e539 100644 | ||
642 | --- a/drivers/usb/serial/digi_acceleport.c | ||
643 | +++ b/drivers/usb/serial/digi_acceleport.c | ||
644 | @@ -460,7 +460,8 @@ static void digi_close(struct tty_struct *tty, struct usb_serial_port *port, | ||
645 | struct file *filp); | ||
646 | static int digi_startup_device(struct usb_serial *serial); | ||
647 | static int digi_startup(struct usb_serial *serial); | ||
648 | -static void digi_shutdown(struct usb_serial *serial); | ||
649 | +static void digi_disconnect(struct usb_serial *serial); | ||
650 | +static void digi_release(struct usb_serial *serial); | ||
651 | static void digi_read_bulk_callback(struct urb *urb); | ||
652 | static int digi_read_inb_callback(struct urb *urb); | ||
653 | static int digi_read_oob_callback(struct urb *urb); | ||
654 | @@ -522,7 +523,8 @@ static struct usb_serial_driver digi_acceleport_2_device = { | ||
655 | .tiocmget = digi_tiocmget, | ||
656 | .tiocmset = digi_tiocmset, | ||
657 | .attach = digi_startup, | ||
658 | - .shutdown = digi_shutdown, | ||
659 | + .disconnect = digi_disconnect, | ||
660 | + .release = digi_release, | ||
661 | }; | ||
662 | |||
663 | static struct usb_serial_driver digi_acceleport_4_device = { | ||
664 | @@ -548,7 +550,8 @@ static struct usb_serial_driver digi_acceleport_4_device = { | ||
665 | .tiocmget = digi_tiocmget, | ||
666 | .tiocmset = digi_tiocmset, | ||
667 | .attach = digi_startup, | ||
668 | - .shutdown = digi_shutdown, | ||
669 | + .disconnect = digi_disconnect, | ||
670 | + .release = digi_release, | ||
671 | }; | ||
672 | |||
673 | |||
674 | @@ -1586,16 +1589,23 @@ static int digi_startup(struct usb_serial *serial) | ||
675 | } | ||
676 | |||
677 | |||
678 | -static void digi_shutdown(struct usb_serial *serial) | ||
679 | +static void digi_disconnect(struct usb_serial *serial) | ||
680 | { | ||
681 | int i; | ||
682 | - dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt()); | ||
683 | + dbg("digi_disconnect: TOP, in_interrupt()=%ld", in_interrupt()); | ||
684 | |||
685 | /* stop reads and writes on all ports */ | ||
686 | for (i = 0; i < serial->type->num_ports + 1; i++) { | ||
687 | usb_kill_urb(serial->port[i]->read_urb); | ||
688 | usb_kill_urb(serial->port[i]->write_urb); | ||
689 | } | ||
690 | +} | ||
691 | + | ||
692 | + | ||
693 | +static void digi_release(struct usb_serial *serial) | ||
694 | +{ | ||
695 | + int i; | ||
696 | + dbg("digi_release: TOP, in_interrupt()=%ld", in_interrupt()); | ||
697 | |||
698 | /* free the private data structures for all ports */ | ||
699 | /* number of regular ports + 1 for the out-of-band port */ | ||
700 | diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c | ||
701 | index 28ee28c..341f3e4 100644 | ||
702 | --- a/drivers/usb/serial/empeg.c | ||
703 | +++ b/drivers/usb/serial/empeg.c | ||
704 | @@ -92,7 +92,6 @@ static int empeg_chars_in_buffer(struct tty_struct *tty); | ||
705 | static void empeg_throttle(struct tty_struct *tty); | ||
706 | static void empeg_unthrottle(struct tty_struct *tty); | ||
707 | static int empeg_startup(struct usb_serial *serial); | ||
708 | -static void empeg_shutdown(struct usb_serial *serial); | ||
709 | static void empeg_set_termios(struct tty_struct *tty, | ||
710 | struct usb_serial_port *port, struct ktermios *old_termios); | ||
711 | static void empeg_write_bulk_callback(struct urb *urb); | ||
712 | @@ -126,7 +125,6 @@ static struct usb_serial_driver empeg_device = { | ||
713 | .throttle = empeg_throttle, | ||
714 | .unthrottle = empeg_unthrottle, | ||
715 | .attach = empeg_startup, | ||
716 | - .shutdown = empeg_shutdown, | ||
717 | .set_termios = empeg_set_termios, | ||
718 | .write = empeg_write, | ||
719 | .write_room = empeg_write_room, | ||
720 | @@ -429,12 +427,6 @@ static int empeg_startup(struct usb_serial *serial) | ||
721 | } | ||
722 | |||
723 | |||
724 | -static void empeg_shutdown(struct usb_serial *serial) | ||
725 | -{ | ||
726 | - dbg("%s", __func__); | ||
727 | -} | ||
728 | - | ||
729 | - | ||
730 | static void empeg_set_termios(struct tty_struct *tty, | ||
731 | struct usb_serial_port *port, struct ktermios *old_termios) | ||
732 | { | ||
733 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c | ||
734 | index c3089c9..39d16c0 100644 | ||
735 | --- a/drivers/usb/serial/ftdi_sio.c | ||
736 | +++ b/drivers/usb/serial/ftdi_sio.c | ||
737 | @@ -708,7 +708,6 @@ static const char *ftdi_chip_name[] = { | ||
738 | /* function prototypes for a FTDI serial converter */ | ||
739 | static int ftdi_sio_probe(struct usb_serial *serial, | ||
740 | const struct usb_device_id *id); | ||
741 | -static void ftdi_shutdown(struct usb_serial *serial); | ||
742 | static int ftdi_sio_port_probe(struct usb_serial_port *port); | ||
743 | static int ftdi_sio_port_remove(struct usb_serial_port *port); | ||
744 | static int ftdi_open(struct tty_struct *tty, | ||
745 | @@ -764,7 +763,6 @@ static struct usb_serial_driver ftdi_sio_device = { | ||
746 | .ioctl = ftdi_ioctl, | ||
747 | .set_termios = ftdi_set_termios, | ||
748 | .break_ctl = ftdi_break_ctl, | ||
749 | - .shutdown = ftdi_shutdown, | ||
750 | }; | ||
751 | |||
752 | |||
753 | @@ -1442,18 +1440,6 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) | ||
754 | return 0; | ||
755 | } | ||
756 | |||
757 | -/* ftdi_shutdown is called from usbserial:usb_serial_disconnect | ||
758 | - * it is called when the usb device is disconnected | ||
759 | - * | ||
760 | - * usbserial:usb_serial_disconnect | ||
761 | - * calls __serial_close for each open of the port | ||
762 | - * shutdown is called then (ie ftdi_shutdown) | ||
763 | - */ | ||
764 | -static void ftdi_shutdown(struct usb_serial *serial) | ||
765 | -{ | ||
766 | - dbg("%s", __func__); | ||
767 | -} | ||
768 | - | ||
769 | static int ftdi_sio_port_remove(struct usb_serial_port *port) | ||
770 | { | ||
771 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
772 | diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c | ||
773 | index d860071..7ebef38 100644 | ||
774 | --- a/drivers/usb/serial/garmin_gps.c | ||
775 | +++ b/drivers/usb/serial/garmin_gps.c | ||
776 | @@ -1527,7 +1527,7 @@ static int garmin_attach(struct usb_serial *serial) | ||
777 | } | ||
778 | |||
779 | |||
780 | -static void garmin_shutdown(struct usb_serial *serial) | ||
781 | +static void garmin_disconnect(struct usb_serial *serial) | ||
782 | { | ||
783 | struct usb_serial_port *port = serial->port[0]; | ||
784 | struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | ||
785 | @@ -1536,8 +1536,17 @@ static void garmin_shutdown(struct usb_serial *serial) | ||
786 | |||
787 | usb_kill_urb(port->interrupt_in_urb); | ||
788 | del_timer_sync(&garmin_data_p->timer); | ||
789 | +} | ||
790 | + | ||
791 | + | ||
792 | +static void garmin_release(struct usb_serial *serial) | ||
793 | +{ | ||
794 | + struct usb_serial_port *port = serial->port[0]; | ||
795 | + struct garmin_data *garmin_data_p = usb_get_serial_port_data(port); | ||
796 | + | ||
797 | + dbg("%s", __func__); | ||
798 | + | ||
799 | kfree(garmin_data_p); | ||
800 | - usb_set_serial_port_data(port, NULL); | ||
801 | } | ||
802 | |||
803 | |||
804 | @@ -1556,7 +1565,8 @@ static struct usb_serial_driver garmin_device = { | ||
805 | .throttle = garmin_throttle, | ||
806 | .unthrottle = garmin_unthrottle, | ||
807 | .attach = garmin_attach, | ||
808 | - .shutdown = garmin_shutdown, | ||
809 | + .disconnect = garmin_disconnect, | ||
810 | + .release = garmin_release, | ||
811 | .write = garmin_write, | ||
812 | .write_room = garmin_write_room, | ||
813 | .write_bulk_callback = garmin_write_bulk_callback, | ||
814 | diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c | ||
815 | index aa7f08b..12ed41a 100644 | ||
816 | --- a/drivers/usb/serial/generic.c | ||
817 | +++ b/drivers/usb/serial/generic.c | ||
818 | @@ -63,7 +63,8 @@ struct usb_serial_driver usb_serial_generic_device = { | ||
819 | .id_table = generic_device_ids, | ||
820 | .usb_driver = &generic_driver, | ||
821 | .num_ports = 1, | ||
822 | - .shutdown = usb_serial_generic_shutdown, | ||
823 | + .disconnect = usb_serial_generic_disconnect, | ||
824 | + .release = usb_serial_generic_release, | ||
825 | .throttle = usb_serial_generic_throttle, | ||
826 | .unthrottle = usb_serial_generic_unthrottle, | ||
827 | .resume = usb_serial_generic_resume, | ||
828 | @@ -419,7 +420,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) | ||
829 | } | ||
830 | } | ||
831 | |||
832 | -void usb_serial_generic_shutdown(struct usb_serial *serial) | ||
833 | +void usb_serial_generic_disconnect(struct usb_serial *serial) | ||
834 | { | ||
835 | int i; | ||
836 | |||
837 | @@ -430,3 +431,7 @@ void usb_serial_generic_shutdown(struct usb_serial *serial) | ||
838 | generic_cleanup(serial->port[i]); | ||
839 | } | ||
840 | |||
841 | +void usb_serial_generic_release(struct usb_serial *serial) | ||
842 | +{ | ||
843 | + dbg("%s", __func__); | ||
844 | +} | ||
845 | diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c | ||
846 | index 183045a..167c2f1 100644 | ||
847 | --- a/drivers/usb/serial/io_edgeport.c | ||
848 | +++ b/drivers/usb/serial/io_edgeport.c | ||
849 | @@ -225,7 +225,8 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file); | ||
850 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, | ||
851 | unsigned int set, unsigned int clear); | ||
852 | static int edge_startup(struct usb_serial *serial); | ||
853 | -static void edge_shutdown(struct usb_serial *serial); | ||
854 | +static void edge_disconnect(struct usb_serial *serial); | ||
855 | +static void edge_release(struct usb_serial *serial); | ||
856 | |||
857 | #include "io_tables.h" /* all of the devices that this driver supports */ | ||
858 | |||
859 | @@ -3178,21 +3179,16 @@ static int edge_startup(struct usb_serial *serial) | ||
860 | |||
861 | |||
862 | /**************************************************************************** | ||
863 | - * edge_shutdown | ||
864 | + * edge_disconnect | ||
865 | * This function is called whenever the device is removed from the usb bus. | ||
866 | ****************************************************************************/ | ||
867 | -static void edge_shutdown(struct usb_serial *serial) | ||
868 | +static void edge_disconnect(struct usb_serial *serial) | ||
869 | { | ||
870 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
871 | - int i; | ||
872 | |||
873 | dbg("%s", __func__); | ||
874 | |||
875 | /* stop reads and writes on all ports */ | ||
876 | - for (i = 0; i < serial->num_ports; ++i) { | ||
877 | - kfree(usb_get_serial_port_data(serial->port[i])); | ||
878 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
879 | - } | ||
880 | /* free up our endpoint stuff */ | ||
881 | if (edge_serial->is_epic) { | ||
882 | usb_kill_urb(edge_serial->interrupt_read_urb); | ||
883 | @@ -3203,9 +3199,24 @@ static void edge_shutdown(struct usb_serial *serial) | ||
884 | usb_free_urb(edge_serial->read_urb); | ||
885 | kfree(edge_serial->bulk_in_buffer); | ||
886 | } | ||
887 | +} | ||
888 | + | ||
889 | + | ||
890 | +/**************************************************************************** | ||
891 | + * edge_release | ||
892 | + * This function is called when the device structure is deallocated. | ||
893 | + ****************************************************************************/ | ||
894 | +static void edge_release(struct usb_serial *serial) | ||
895 | +{ | ||
896 | + struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
897 | + int i; | ||
898 | + | ||
899 | + dbg("%s", __func__); | ||
900 | + | ||
901 | + for (i = 0; i < serial->num_ports; ++i) | ||
902 | + kfree(usb_get_serial_port_data(serial->port[i])); | ||
903 | |||
904 | kfree(edge_serial); | ||
905 | - usb_set_serial_data(serial, NULL); | ||
906 | } | ||
907 | |||
908 | |||
909 | diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h | ||
910 | index 7eb9d67..9241d31 100644 | ||
911 | --- a/drivers/usb/serial/io_tables.h | ||
912 | +++ b/drivers/usb/serial/io_tables.h | ||
913 | @@ -117,7 +117,8 @@ static struct usb_serial_driver edgeport_2port_device = { | ||
914 | .throttle = edge_throttle, | ||
915 | .unthrottle = edge_unthrottle, | ||
916 | .attach = edge_startup, | ||
917 | - .shutdown = edge_shutdown, | ||
918 | + .disconnect = edge_disconnect, | ||
919 | + .release = edge_release, | ||
920 | .ioctl = edge_ioctl, | ||
921 | .set_termios = edge_set_termios, | ||
922 | .tiocmget = edge_tiocmget, | ||
923 | @@ -145,7 +146,8 @@ static struct usb_serial_driver edgeport_4port_device = { | ||
924 | .throttle = edge_throttle, | ||
925 | .unthrottle = edge_unthrottle, | ||
926 | .attach = edge_startup, | ||
927 | - .shutdown = edge_shutdown, | ||
928 | + .disconnect = edge_disconnect, | ||
929 | + .release = edge_release, | ||
930 | .ioctl = edge_ioctl, | ||
931 | .set_termios = edge_set_termios, | ||
932 | .tiocmget = edge_tiocmget, | ||
933 | @@ -173,7 +175,8 @@ static struct usb_serial_driver edgeport_8port_device = { | ||
934 | .throttle = edge_throttle, | ||
935 | .unthrottle = edge_unthrottle, | ||
936 | .attach = edge_startup, | ||
937 | - .shutdown = edge_shutdown, | ||
938 | + .disconnect = edge_disconnect, | ||
939 | + .release = edge_release, | ||
940 | .ioctl = edge_ioctl, | ||
941 | .set_termios = edge_set_termios, | ||
942 | .tiocmget = edge_tiocmget, | ||
943 | @@ -200,7 +203,8 @@ static struct usb_serial_driver epic_device = { | ||
944 | .throttle = edge_throttle, | ||
945 | .unthrottle = edge_unthrottle, | ||
946 | .attach = edge_startup, | ||
947 | - .shutdown = edge_shutdown, | ||
948 | + .disconnect = edge_disconnect, | ||
949 | + .release = edge_release, | ||
950 | .ioctl = edge_ioctl, | ||
951 | .set_termios = edge_set_termios, | ||
952 | .tiocmget = edge_tiocmget, | ||
953 | diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c | ||
954 | index 0d744f0..3ff4895 100644 | ||
955 | --- a/drivers/usb/serial/io_ti.c | ||
956 | +++ b/drivers/usb/serial/io_ti.c | ||
957 | @@ -2652,7 +2652,7 @@ cleanup: | ||
958 | return -ENOMEM; | ||
959 | } | ||
960 | |||
961 | -static void edge_shutdown(struct usb_serial *serial) | ||
962 | +static void edge_disconnect(struct usb_serial *serial) | ||
963 | { | ||
964 | int i; | ||
965 | struct edgeport_port *edge_port; | ||
966 | @@ -2662,12 +2662,22 @@ static void edge_shutdown(struct usb_serial *serial) | ||
967 | for (i = 0; i < serial->num_ports; ++i) { | ||
968 | edge_port = usb_get_serial_port_data(serial->port[i]); | ||
969 | edge_remove_sysfs_attrs(edge_port->port); | ||
970 | + } | ||
971 | +} | ||
972 | + | ||
973 | +static void edge_release(struct usb_serial *serial) | ||
974 | +{ | ||
975 | + int i; | ||
976 | + struct edgeport_port *edge_port; | ||
977 | + | ||
978 | + dbg("%s", __func__); | ||
979 | + | ||
980 | + for (i = 0; i < serial->num_ports; ++i) { | ||
981 | + edge_port = usb_get_serial_port_data(serial->port[i]); | ||
982 | edge_buf_free(edge_port->ep_out_buf); | ||
983 | kfree(edge_port); | ||
984 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
985 | } | ||
986 | kfree(usb_get_serial_data(serial)); | ||
987 | - usb_set_serial_data(serial, NULL); | ||
988 | } | ||
989 | |||
990 | |||
991 | @@ -2904,7 +2914,8 @@ static struct usb_serial_driver edgeport_1port_device = { | ||
992 | .throttle = edge_throttle, | ||
993 | .unthrottle = edge_unthrottle, | ||
994 | .attach = edge_startup, | ||
995 | - .shutdown = edge_shutdown, | ||
996 | + .disconnect = edge_disconnect, | ||
997 | + .release = edge_release, | ||
998 | .port_probe = edge_create_sysfs_attrs, | ||
999 | .ioctl = edge_ioctl, | ||
1000 | .set_termios = edge_set_termios, | ||
1001 | @@ -2933,7 +2944,8 @@ static struct usb_serial_driver edgeport_2port_device = { | ||
1002 | .throttle = edge_throttle, | ||
1003 | .unthrottle = edge_unthrottle, | ||
1004 | .attach = edge_startup, | ||
1005 | - .shutdown = edge_shutdown, | ||
1006 | + .disconnect = edge_disconnect, | ||
1007 | + .release = edge_release, | ||
1008 | .port_probe = edge_create_sysfs_attrs, | ||
1009 | .ioctl = edge_ioctl, | ||
1010 | .set_termios = edge_set_termios, | ||
1011 | diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c | ||
1012 | index ae0b0ff..c4aa904 100644 | ||
1013 | --- a/drivers/usb/serial/ipaq.c | ||
1014 | +++ b/drivers/usb/serial/ipaq.c | ||
1015 | @@ -79,7 +79,6 @@ static int ipaq_open(struct tty_struct *tty, | ||
1016 | static void ipaq_close(struct tty_struct *tty, | ||
1017 | struct usb_serial_port *port, struct file *filp); | ||
1018 | static int ipaq_startup(struct usb_serial *serial); | ||
1019 | -static void ipaq_shutdown(struct usb_serial *serial); | ||
1020 | static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port, | ||
1021 | const unsigned char *buf, int count); | ||
1022 | static int ipaq_write_bulk(struct usb_serial_port *port, | ||
1023 | @@ -581,7 +580,6 @@ static struct usb_serial_driver ipaq_device = { | ||
1024 | .open = ipaq_open, | ||
1025 | .close = ipaq_close, | ||
1026 | .attach = ipaq_startup, | ||
1027 | - .shutdown = ipaq_shutdown, | ||
1028 | .write = ipaq_write, | ||
1029 | .write_room = ipaq_write_room, | ||
1030 | .chars_in_buffer = ipaq_chars_in_buffer, | ||
1031 | @@ -957,11 +955,6 @@ static int ipaq_startup(struct usb_serial *serial) | ||
1032 | return usb_reset_configuration(serial->dev); | ||
1033 | } | ||
1034 | |||
1035 | -static void ipaq_shutdown(struct usb_serial *serial) | ||
1036 | -{ | ||
1037 | - dbg("%s", __func__); | ||
1038 | -} | ||
1039 | - | ||
1040 | static int __init ipaq_init(void) | ||
1041 | { | ||
1042 | int retval; | ||
1043 | diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c | ||
1044 | index d6da4c9..1b7729b 100644 | ||
1045 | --- a/drivers/usb/serial/iuu_phoenix.c | ||
1046 | +++ b/drivers/usb/serial/iuu_phoenix.c | ||
1047 | @@ -122,8 +122,8 @@ static int iuu_startup(struct usb_serial *serial) | ||
1048 | return 0; | ||
1049 | } | ||
1050 | |||
1051 | -/* Shutdown function */ | ||
1052 | -static void iuu_shutdown(struct usb_serial *serial) | ||
1053 | +/* Release function */ | ||
1054 | +static void iuu_release(struct usb_serial *serial) | ||
1055 | { | ||
1056 | struct usb_serial_port *port = serial->port[0]; | ||
1057 | struct iuu_private *priv = usb_get_serial_port_data(port); | ||
1058 | @@ -1171,7 +1171,7 @@ static struct usb_serial_driver iuu_device = { | ||
1059 | .tiocmget = iuu_tiocmget, | ||
1060 | .tiocmset = iuu_tiocmset, | ||
1061 | .attach = iuu_startup, | ||
1062 | - .shutdown = iuu_shutdown, | ||
1063 | + .release = iuu_release, | ||
1064 | }; | ||
1065 | |||
1066 | static int __init iuu_init(void) | ||
1067 | diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c | ||
1068 | index 704716f..d4e0227 100644 | ||
1069 | --- a/drivers/usb/serial/keyspan.c | ||
1070 | +++ b/drivers/usb/serial/keyspan.c | ||
1071 | @@ -2678,7 +2678,7 @@ static int keyspan_startup(struct usb_serial *serial) | ||
1072 | return 0; | ||
1073 | } | ||
1074 | |||
1075 | -static void keyspan_shutdown(struct usb_serial *serial) | ||
1076 | +static void keyspan_disconnect(struct usb_serial *serial) | ||
1077 | { | ||
1078 | int i, j; | ||
1079 | struct usb_serial_port *port; | ||
1080 | @@ -2718,6 +2718,17 @@ static void keyspan_shutdown(struct usb_serial *serial) | ||
1081 | usb_free_urb(p_priv->out_urbs[j]); | ||
1082 | } | ||
1083 | } | ||
1084 | +} | ||
1085 | + | ||
1086 | +static void keyspan_release(struct usb_serial *serial) | ||
1087 | +{ | ||
1088 | + int i; | ||
1089 | + struct usb_serial_port *port; | ||
1090 | + struct keyspan_serial_private *s_priv; | ||
1091 | + | ||
1092 | + dbg("%s", __func__); | ||
1093 | + | ||
1094 | + s_priv = usb_get_serial_data(serial); | ||
1095 | |||
1096 | /* dbg("Freeing serial->private."); */ | ||
1097 | kfree(s_priv); | ||
1098 | diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h | ||
1099 | index 38b4582..4961c26 100644 | ||
1100 | --- a/drivers/usb/serial/keyspan.h | ||
1101 | +++ b/drivers/usb/serial/keyspan.h | ||
1102 | @@ -42,7 +42,8 @@ static void keyspan_close (struct tty_struct *tty, | ||
1103 | struct usb_serial_port *port, | ||
1104 | struct file *filp); | ||
1105 | static int keyspan_startup (struct usb_serial *serial); | ||
1106 | -static void keyspan_shutdown (struct usb_serial *serial); | ||
1107 | +static void keyspan_disconnect (struct usb_serial *serial); | ||
1108 | +static void keyspan_release (struct usb_serial *serial); | ||
1109 | static int keyspan_write_room (struct tty_struct *tty); | ||
1110 | |||
1111 | static int keyspan_write (struct tty_struct *tty, | ||
1112 | @@ -569,7 +570,8 @@ static struct usb_serial_driver keyspan_1port_device = { | ||
1113 | .tiocmget = keyspan_tiocmget, | ||
1114 | .tiocmset = keyspan_tiocmset, | ||
1115 | .attach = keyspan_startup, | ||
1116 | - .shutdown = keyspan_shutdown, | ||
1117 | + .disconnect = keyspan_disconnect, | ||
1118 | + .release = keyspan_release, | ||
1119 | }; | ||
1120 | |||
1121 | static struct usb_serial_driver keyspan_2port_device = { | ||
1122 | @@ -589,7 +591,8 @@ static struct usb_serial_driver keyspan_2port_device = { | ||
1123 | .tiocmget = keyspan_tiocmget, | ||
1124 | .tiocmset = keyspan_tiocmset, | ||
1125 | .attach = keyspan_startup, | ||
1126 | - .shutdown = keyspan_shutdown, | ||
1127 | + .disconnect = keyspan_disconnect, | ||
1128 | + .release = keyspan_release, | ||
1129 | }; | ||
1130 | |||
1131 | static struct usb_serial_driver keyspan_4port_device = { | ||
1132 | @@ -609,7 +612,8 @@ static struct usb_serial_driver keyspan_4port_device = { | ||
1133 | .tiocmget = keyspan_tiocmget, | ||
1134 | .tiocmset = keyspan_tiocmset, | ||
1135 | .attach = keyspan_startup, | ||
1136 | - .shutdown = keyspan_shutdown, | ||
1137 | + .disconnect = keyspan_disconnect, | ||
1138 | + .release = keyspan_release, | ||
1139 | }; | ||
1140 | |||
1141 | #endif | ||
1142 | diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c | ||
1143 | index 040040a..f9a1824 100644 | ||
1144 | --- a/drivers/usb/serial/keyspan_pda.c | ||
1145 | +++ b/drivers/usb/serial/keyspan_pda.c | ||
1146 | @@ -789,7 +789,7 @@ static int keyspan_pda_startup(struct usb_serial *serial) | ||
1147 | return 0; | ||
1148 | } | ||
1149 | |||
1150 | -static void keyspan_pda_shutdown(struct usb_serial *serial) | ||
1151 | +static void keyspan_pda_release(struct usb_serial *serial) | ||
1152 | { | ||
1153 | dbg("%s", __func__); | ||
1154 | |||
1155 | @@ -847,7 +847,7 @@ static struct usb_serial_driver keyspan_pda_device = { | ||
1156 | .tiocmget = keyspan_pda_tiocmget, | ||
1157 | .tiocmset = keyspan_pda_tiocmset, | ||
1158 | .attach = keyspan_pda_startup, | ||
1159 | - .shutdown = keyspan_pda_shutdown, | ||
1160 | + .release = keyspan_pda_release, | ||
1161 | }; | ||
1162 | |||
1163 | |||
1164 | diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c | ||
1165 | index b84dddc..e0219bd 100644 | ||
1166 | --- a/drivers/usb/serial/kl5kusb105.c | ||
1167 | +++ b/drivers/usb/serial/kl5kusb105.c | ||
1168 | @@ -73,7 +73,8 @@ static int debug; | ||
1169 | * Function prototypes | ||
1170 | */ | ||
1171 | static int klsi_105_startup(struct usb_serial *serial); | ||
1172 | -static void klsi_105_shutdown(struct usb_serial *serial); | ||
1173 | +static void klsi_105_disconnect(struct usb_serial *serial); | ||
1174 | +static void klsi_105_release(struct usb_serial *serial); | ||
1175 | static int klsi_105_open(struct tty_struct *tty, | ||
1176 | struct usb_serial_port *port, struct file *filp); | ||
1177 | static void klsi_105_close(struct tty_struct *tty, | ||
1178 | @@ -132,7 +133,8 @@ static struct usb_serial_driver kl5kusb105d_device = { | ||
1179 | .tiocmget = klsi_105_tiocmget, | ||
1180 | .tiocmset = klsi_105_tiocmset, | ||
1181 | .attach = klsi_105_startup, | ||
1182 | - .shutdown = klsi_105_shutdown, | ||
1183 | + .disconnect = klsi_105_disconnect, | ||
1184 | + .release = klsi_105_release, | ||
1185 | .throttle = klsi_105_throttle, | ||
1186 | .unthrottle = klsi_105_unthrottle, | ||
1187 | }; | ||
1188 | @@ -314,7 +316,7 @@ err_cleanup: | ||
1189 | } /* klsi_105_startup */ | ||
1190 | |||
1191 | |||
1192 | -static void klsi_105_shutdown(struct usb_serial *serial) | ||
1193 | +static void klsi_105_disconnect(struct usb_serial *serial) | ||
1194 | { | ||
1195 | int i; | ||
1196 | |||
1197 | @@ -324,33 +326,36 @@ static void klsi_105_shutdown(struct usb_serial *serial) | ||
1198 | for (i = 0; i < serial->num_ports; ++i) { | ||
1199 | struct klsi_105_private *priv = | ||
1200 | usb_get_serial_port_data(serial->port[i]); | ||
1201 | - unsigned long flags; | ||
1202 | |||
1203 | if (priv) { | ||
1204 | /* kill our write urb pool */ | ||
1205 | int j; | ||
1206 | struct urb **write_urbs = priv->write_urb_pool; | ||
1207 | - spin_lock_irqsave(&priv->lock, flags); | ||
1208 | |||
1209 | for (j = 0; j < NUM_URBS; j++) { | ||
1210 | if (write_urbs[j]) { | ||
1211 | - /* FIXME - uncomment the following | ||
1212 | - * usb_kill_urb call when the host | ||
1213 | - * controllers get fixed to set | ||
1214 | - * urb->dev = NULL after the urb is | ||
1215 | - * finished. Otherwise this call | ||
1216 | - * oopses. */ | ||
1217 | - /* usb_kill_urb(write_urbs[j]); */ | ||
1218 | - kfree(write_urbs[j]->transfer_buffer); | ||
1219 | + usb_kill_urb(write_urbs[j]); | ||
1220 | usb_free_urb(write_urbs[j]); | ||
1221 | } | ||
1222 | } | ||
1223 | - spin_unlock_irqrestore(&priv->lock, flags); | ||
1224 | - kfree(priv); | ||
1225 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1226 | } | ||
1227 | } | ||
1228 | -} /* klsi_105_shutdown */ | ||
1229 | +} /* klsi_105_disconnect */ | ||
1230 | + | ||
1231 | + | ||
1232 | +static void klsi_105_release(struct usb_serial *serial) | ||
1233 | +{ | ||
1234 | + int i; | ||
1235 | + | ||
1236 | + dbg("%s", __func__); | ||
1237 | + | ||
1238 | + for (i = 0; i < serial->num_ports; ++i) { | ||
1239 | + struct klsi_105_private *priv = | ||
1240 | + usb_get_serial_port_data(serial->port[i]); | ||
1241 | + | ||
1242 | + kfree(priv); | ||
1243 | + } | ||
1244 | +} /* klsi_105_release */ | ||
1245 | |||
1246 | static int klsi_105_open(struct tty_struct *tty, | ||
1247 | struct usb_serial_port *port, struct file *filp) | ||
1248 | diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c | ||
1249 | index 5326c59..d586af0 100644 | ||
1250 | --- a/drivers/usb/serial/kobil_sct.c | ||
1251 | +++ b/drivers/usb/serial/kobil_sct.c | ||
1252 | @@ -69,7 +69,7 @@ static int debug; | ||
1253 | |||
1254 | /* Function prototypes */ | ||
1255 | static int kobil_startup(struct usb_serial *serial); | ||
1256 | -static void kobil_shutdown(struct usb_serial *serial); | ||
1257 | +static void kobil_release(struct usb_serial *serial); | ||
1258 | static int kobil_open(struct tty_struct *tty, | ||
1259 | struct usb_serial_port *port, struct file *filp); | ||
1260 | static void kobil_close(struct tty_struct *tty, struct usb_serial_port *port, | ||
1261 | @@ -118,7 +118,7 @@ static struct usb_serial_driver kobil_device = { | ||
1262 | .id_table = id_table, | ||
1263 | .num_ports = 1, | ||
1264 | .attach = kobil_startup, | ||
1265 | - .shutdown = kobil_shutdown, | ||
1266 | + .release = kobil_release, | ||
1267 | .ioctl = kobil_ioctl, | ||
1268 | .set_termios = kobil_set_termios, | ||
1269 | .tiocmget = kobil_tiocmget, | ||
1270 | @@ -202,17 +202,13 @@ static int kobil_startup(struct usb_serial *serial) | ||
1271 | } | ||
1272 | |||
1273 | |||
1274 | -static void kobil_shutdown(struct usb_serial *serial) | ||
1275 | +static void kobil_release(struct usb_serial *serial) | ||
1276 | { | ||
1277 | int i; | ||
1278 | dbg("%s - port %d", __func__, serial->port[0]->number); | ||
1279 | |||
1280 | - for (i = 0; i < serial->num_ports; ++i) { | ||
1281 | - while (serial->port[i]->port.count > 0) | ||
1282 | - kobil_close(NULL, serial->port[i], NULL); | ||
1283 | + for (i = 0; i < serial->num_ports; ++i) | ||
1284 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1285 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1286 | - } | ||
1287 | } | ||
1288 | |||
1289 | |||
1290 | diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c | ||
1291 | index 0ded8bd..b8f4f58 100644 | ||
1292 | --- a/drivers/usb/serial/mct_u232.c | ||
1293 | +++ b/drivers/usb/serial/mct_u232.c | ||
1294 | @@ -92,7 +92,7 @@ static int debug; | ||
1295 | * Function prototypes | ||
1296 | */ | ||
1297 | static int mct_u232_startup(struct usb_serial *serial); | ||
1298 | -static void mct_u232_shutdown(struct usb_serial *serial); | ||
1299 | +static void mct_u232_release(struct usb_serial *serial); | ||
1300 | static int mct_u232_open(struct tty_struct *tty, | ||
1301 | struct usb_serial_port *port, struct file *filp); | ||
1302 | static void mct_u232_close(struct tty_struct *tty, | ||
1303 | @@ -148,7 +148,7 @@ static struct usb_serial_driver mct_u232_device = { | ||
1304 | .tiocmget = mct_u232_tiocmget, | ||
1305 | .tiocmset = mct_u232_tiocmset, | ||
1306 | .attach = mct_u232_startup, | ||
1307 | - .shutdown = mct_u232_shutdown, | ||
1308 | + .release = mct_u232_release, | ||
1309 | }; | ||
1310 | |||
1311 | |||
1312 | @@ -401,7 +401,7 @@ static int mct_u232_startup(struct usb_serial *serial) | ||
1313 | } /* mct_u232_startup */ | ||
1314 | |||
1315 | |||
1316 | -static void mct_u232_shutdown(struct usb_serial *serial) | ||
1317 | +static void mct_u232_release(struct usb_serial *serial) | ||
1318 | { | ||
1319 | struct mct_u232_private *priv; | ||
1320 | int i; | ||
1321 | @@ -411,12 +411,9 @@ static void mct_u232_shutdown(struct usb_serial *serial) | ||
1322 | for (i = 0; i < serial->num_ports; ++i) { | ||
1323 | /* My special items, the standard routines free my urbs */ | ||
1324 | priv = usb_get_serial_port_data(serial->port[i]); | ||
1325 | - if (priv) { | ||
1326 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1327 | - kfree(priv); | ||
1328 | - } | ||
1329 | + kfree(priv); | ||
1330 | } | ||
1331 | -} /* mct_u232_shutdown */ | ||
1332 | +} /* mct_u232_release */ | ||
1333 | |||
1334 | static int mct_u232_open(struct tty_struct *tty, | ||
1335 | struct usb_serial_port *port, struct file *filp) | ||
1336 | diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c | ||
1337 | index 1c2402d..b987808 100644 | ||
1338 | --- a/drivers/usb/serial/mos7720.c | ||
1339 | +++ b/drivers/usb/serial/mos7720.c | ||
1340 | @@ -1547,19 +1547,16 @@ static int mos7720_startup(struct usb_serial *serial) | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1344 | -static void mos7720_shutdown(struct usb_serial *serial) | ||
1345 | +static void mos7720_release(struct usb_serial *serial) | ||
1346 | { | ||
1347 | int i; | ||
1348 | |||
1349 | /* free private structure allocated for serial port */ | ||
1350 | - for (i = 0; i < serial->num_ports; ++i) { | ||
1351 | + for (i = 0; i < serial->num_ports; ++i) | ||
1352 | kfree(usb_get_serial_port_data(serial->port[i])); | ||
1353 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1354 | - } | ||
1355 | |||
1356 | /* free private structure allocated for serial device */ | ||
1357 | kfree(usb_get_serial_data(serial)); | ||
1358 | - usb_set_serial_data(serial, NULL); | ||
1359 | } | ||
1360 | |||
1361 | static struct usb_driver usb_driver = { | ||
1362 | @@ -1584,7 +1581,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | ||
1363 | .throttle = mos7720_throttle, | ||
1364 | .unthrottle = mos7720_unthrottle, | ||
1365 | .attach = mos7720_startup, | ||
1366 | - .shutdown = mos7720_shutdown, | ||
1367 | + .release = mos7720_release, | ||
1368 | .ioctl = mos7720_ioctl, | ||
1369 | .set_termios = mos7720_set_termios, | ||
1370 | .write = mos7720_write, | ||
1371 | diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c | ||
1372 | index 8befcbb..e8a3938 100644 | ||
1373 | --- a/drivers/usb/serial/mos7840.c | ||
1374 | +++ b/drivers/usb/serial/mos7840.c | ||
1375 | @@ -2643,16 +2643,16 @@ error: | ||
1376 | } | ||
1377 | |||
1378 | /**************************************************************************** | ||
1379 | - * mos7840_shutdown | ||
1380 | + * mos7840_disconnect | ||
1381 | * This function is called whenever the device is removed from the usb bus. | ||
1382 | ****************************************************************************/ | ||
1383 | |||
1384 | -static void mos7840_shutdown(struct usb_serial *serial) | ||
1385 | +static void mos7840_disconnect(struct usb_serial *serial) | ||
1386 | { | ||
1387 | int i; | ||
1388 | unsigned long flags; | ||
1389 | struct moschip_port *mos7840_port; | ||
1390 | - dbg("%s \n", " shutdown :entering.........."); | ||
1391 | + dbg("%s\n", " disconnect :entering.........."); | ||
1392 | |||
1393 | if (!serial) { | ||
1394 | dbg("%s", "Invalid Handler \n"); | ||
1395 | @@ -2670,10 +2670,41 @@ static void mos7840_shutdown(struct usb_serial *serial) | ||
1396 | mos7840_port->zombie = 1; | ||
1397 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | ||
1398 | usb_kill_urb(mos7840_port->control_urb); | ||
1399 | - kfree(mos7840_port->ctrl_buf); | ||
1400 | - kfree(mos7840_port->dr); | ||
1401 | - kfree(mos7840_port); | ||
1402 | - mos7840_set_port_private(serial->port[i], NULL); | ||
1403 | + } | ||
1404 | + | ||
1405 | + dbg("%s\n", "Thank u ::"); | ||
1406 | + | ||
1407 | +} | ||
1408 | + | ||
1409 | +/**************************************************************************** | ||
1410 | + * mos7840_release | ||
1411 | + * This function is called when the usb_serial structure is freed. | ||
1412 | + ****************************************************************************/ | ||
1413 | + | ||
1414 | +static void mos7840_release(struct usb_serial *serial) | ||
1415 | +{ | ||
1416 | + int i; | ||
1417 | + struct moschip_port *mos7840_port; | ||
1418 | + dbg("%s\n", " release :entering.........."); | ||
1419 | + | ||
1420 | + if (!serial) { | ||
1421 | + dbg("%s", "Invalid Handler"); | ||
1422 | + return; | ||
1423 | + } | ||
1424 | + | ||
1425 | + /* check for the ports to be closed,close the ports and disconnect */ | ||
1426 | + | ||
1427 | + /* free private structure allocated for serial port * | ||
1428 | + * stop reads and writes on all ports */ | ||
1429 | + | ||
1430 | + for (i = 0; i < serial->num_ports; ++i) { | ||
1431 | + mos7840_port = mos7840_get_port_private(serial->port[i]); | ||
1432 | + dbg("mos7840_port %d = %p", i, mos7840_port); | ||
1433 | + if (mos7840_port) { | ||
1434 | + kfree(mos7840_port->ctrl_buf); | ||
1435 | + kfree(mos7840_port->dr); | ||
1436 | + kfree(mos7840_port); | ||
1437 | + } | ||
1438 | } | ||
1439 | |||
1440 | dbg("%s\n", "Thank u :: "); | ||
1441 | @@ -2714,7 +2745,8 @@ static struct usb_serial_driver moschip7840_4port_device = { | ||
1442 | .tiocmget = mos7840_tiocmget, | ||
1443 | .tiocmset = mos7840_tiocmset, | ||
1444 | .attach = mos7840_startup, | ||
1445 | - .shutdown = mos7840_shutdown, | ||
1446 | + .disconnect = mos7840_disconnect, | ||
1447 | + .release = mos7840_release, | ||
1448 | .read_bulk_callback = mos7840_bulk_in_callback, | ||
1449 | .read_int_callback = mos7840_interrupt_callback, | ||
1450 | }; | ||
1451 | diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c | ||
1452 | index ae8e227..355250c 100644 | ||
1453 | --- a/drivers/usb/serial/omninet.c | ||
1454 | +++ b/drivers/usb/serial/omninet.c | ||
1455 | @@ -73,7 +73,8 @@ static void omninet_write_bulk_callback(struct urb *urb); | ||
1456 | static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | ||
1457 | const unsigned char *buf, int count); | ||
1458 | static int omninet_write_room(struct tty_struct *tty); | ||
1459 | -static void omninet_shutdown(struct usb_serial *serial); | ||
1460 | +static void omninet_disconnect(struct usb_serial *serial); | ||
1461 | +static void omninet_release(struct usb_serial *serial); | ||
1462 | static int omninet_attach(struct usb_serial *serial); | ||
1463 | |||
1464 | static struct usb_device_id id_table[] = { | ||
1465 | @@ -109,7 +110,8 @@ static struct usb_serial_driver zyxel_omninet_device = { | ||
1466 | .write_room = omninet_write_room, | ||
1467 | .read_bulk_callback = omninet_read_bulk_callback, | ||
1468 | .write_bulk_callback = omninet_write_bulk_callback, | ||
1469 | - .shutdown = omninet_shutdown, | ||
1470 | + .disconnect = omninet_disconnect, | ||
1471 | + .release = omninet_release, | ||
1472 | }; | ||
1473 | |||
1474 | |||
1475 | @@ -342,13 +344,22 @@ static void omninet_write_bulk_callback(struct urb *urb) | ||
1476 | } | ||
1477 | |||
1478 | |||
1479 | -static void omninet_shutdown(struct usb_serial *serial) | ||
1480 | +static void omninet_disconnect(struct usb_serial *serial) | ||
1481 | { | ||
1482 | struct usb_serial_port *wport = serial->port[1]; | ||
1483 | - struct usb_serial_port *port = serial->port[0]; | ||
1484 | + | ||
1485 | dbg("%s", __func__); | ||
1486 | |||
1487 | usb_kill_urb(wport->write_urb); | ||
1488 | +} | ||
1489 | + | ||
1490 | + | ||
1491 | +static void omninet_release(struct usb_serial *serial) | ||
1492 | +{ | ||
1493 | + struct usb_serial_port *port = serial->port[0]; | ||
1494 | + | ||
1495 | + dbg("%s", __func__); | ||
1496 | + | ||
1497 | kfree(usb_get_serial_port_data(port)); | ||
1498 | } | ||
1499 | |||
1500 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
1501 | index faa30ad..850c628 100644 | ||
1502 | --- a/drivers/usb/serial/option.c | ||
1503 | +++ b/drivers/usb/serial/option.c | ||
1504 | @@ -48,7 +48,8 @@ static int option_open(struct tty_struct *tty, struct usb_serial_port *port, | ||
1505 | static void option_close(struct tty_struct *tty, struct usb_serial_port *port, | ||
1506 | struct file *filp); | ||
1507 | static int option_startup(struct usb_serial *serial); | ||
1508 | -static void option_shutdown(struct usb_serial *serial); | ||
1509 | +static void option_disconnect(struct usb_serial *serial); | ||
1510 | +static void option_release(struct usb_serial *serial); | ||
1511 | static int option_write_room(struct tty_struct *tty); | ||
1512 | |||
1513 | static void option_instat_callback(struct urb *urb); | ||
1514 | @@ -62,6 +63,8 @@ static int option_tiocmget(struct tty_struct *tty, struct file *file); | ||
1515 | static int option_tiocmset(struct tty_struct *tty, struct file *file, | ||
1516 | unsigned int set, unsigned int clear); | ||
1517 | static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *port); | ||
1518 | +static int option_suspend(struct usb_serial *serial, pm_message_t message); | ||
1519 | +static int option_resume(struct usb_serial *serial); | ||
1520 | |||
1521 | /* Vendor and product IDs */ | ||
1522 | #define OPTION_VENDOR_ID 0x0AF0 | ||
1523 | @@ -511,6 +514,8 @@ static struct usb_driver option_driver = { | ||
1524 | .name = "option", | ||
1525 | .probe = usb_serial_probe, | ||
1526 | .disconnect = usb_serial_disconnect, | ||
1527 | + .suspend = usb_serial_suspend, | ||
1528 | + .resume = usb_serial_resume, | ||
1529 | .id_table = option_ids, | ||
1530 | .no_dynamic_id = 1, | ||
1531 | }; | ||
1532 | @@ -537,8 +542,11 @@ static struct usb_serial_driver option_1port_device = { | ||
1533 | .tiocmget = option_tiocmget, | ||
1534 | .tiocmset = option_tiocmset, | ||
1535 | .attach = option_startup, | ||
1536 | - .shutdown = option_shutdown, | ||
1537 | + .disconnect = option_disconnect, | ||
1538 | + .release = option_release, | ||
1539 | .read_int_callback = option_instat_callback, | ||
1540 | + .suspend = option_suspend, | ||
1541 | + .resume = option_resume, | ||
1542 | }; | ||
1543 | |||
1544 | static int debug; | ||
1545 | @@ -809,10 +817,10 @@ static void option_instat_callback(struct urb *urb) | ||
1546 | req_pkt->bRequestType, req_pkt->bRequest); | ||
1547 | } | ||
1548 | } else | ||
1549 | - dbg("%s: error %d", __func__, status); | ||
1550 | + err("%s: error %d", __func__, status); | ||
1551 | |||
1552 | /* Resubmit urb so we continue receiving IRQ data */ | ||
1553 | - if (status != -ESHUTDOWN) { | ||
1554 | + if (status != -ESHUTDOWN && status != -ENOENT) { | ||
1555 | urb->dev = serial->dev; | ||
1556 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
1557 | if (err) | ||
1558 | @@ -831,7 +839,6 @@ static int option_write_room(struct tty_struct *tty) | ||
1559 | |||
1560 | portdata = usb_get_serial_port_data(port); | ||
1561 | |||
1562 | - | ||
1563 | for (i = 0; i < N_OUT_URB; i++) { | ||
1564 | this_urb = portdata->out_urbs[i]; | ||
1565 | if (this_urb && !test_bit(i, &portdata->out_busy)) | ||
1566 | @@ -1090,14 +1097,12 @@ bail_out_error: | ||
1567 | return 1; | ||
1568 | } | ||
1569 | |||
1570 | -static void option_shutdown(struct usb_serial *serial) | ||
1571 | +static void stop_read_write_urbs(struct usb_serial *serial) | ||
1572 | { | ||
1573 | int i, j; | ||
1574 | struct usb_serial_port *port; | ||
1575 | struct option_port_private *portdata; | ||
1576 | |||
1577 | - dbg("%s", __func__); | ||
1578 | - | ||
1579 | /* Stop reading/writing urbs */ | ||
1580 | for (i = 0; i < serial->num_ports; ++i) { | ||
1581 | port = serial->port[i]; | ||
1582 | @@ -1107,6 +1112,22 @@ static void option_shutdown(struct usb_serial *serial) | ||
1583 | for (j = 0; j < N_OUT_URB; j++) | ||
1584 | usb_kill_urb(portdata->out_urbs[j]); | ||
1585 | } | ||
1586 | +} | ||
1587 | + | ||
1588 | +static void option_disconnect(struct usb_serial *serial) | ||
1589 | +{ | ||
1590 | + dbg("%s", __func__); | ||
1591 | + | ||
1592 | + stop_read_write_urbs(serial); | ||
1593 | +} | ||
1594 | + | ||
1595 | +static void option_release(struct usb_serial *serial) | ||
1596 | +{ | ||
1597 | + int i, j; | ||
1598 | + struct usb_serial_port *port; | ||
1599 | + struct option_port_private *portdata; | ||
1600 | + | ||
1601 | + dbg("%s", __func__); | ||
1602 | |||
1603 | /* Now free them */ | ||
1604 | for (i = 0; i < serial->num_ports; ++i) { | ||
1605 | @@ -1137,6 +1158,66 @@ static void option_shutdown(struct usb_serial *serial) | ||
1606 | } | ||
1607 | } | ||
1608 | |||
1609 | +static int option_suspend(struct usb_serial *serial, pm_message_t message) | ||
1610 | +{ | ||
1611 | + dbg("%s entered", __func__); | ||
1612 | + stop_read_write_urbs(serial); | ||
1613 | + | ||
1614 | + return 0; | ||
1615 | +} | ||
1616 | + | ||
1617 | +static int option_resume(struct usb_serial *serial) | ||
1618 | +{ | ||
1619 | + int err, i, j; | ||
1620 | + struct usb_serial_port *port; | ||
1621 | + struct urb *urb; | ||
1622 | + struct option_port_private *portdata; | ||
1623 | + | ||
1624 | + dbg("%s entered", __func__); | ||
1625 | + /* get the interrupt URBs resubmitted unconditionally */ | ||
1626 | + for (i = 0; i < serial->num_ports; i++) { | ||
1627 | + port = serial->port[i]; | ||
1628 | + if (!port->interrupt_in_urb) { | ||
1629 | + dbg("%s: No interrupt URB for port %d\n", __func__, i); | ||
1630 | + continue; | ||
1631 | + } | ||
1632 | + port->interrupt_in_urb->dev = serial->dev; | ||
1633 | + err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | ||
1634 | + dbg("Submitted interrupt URB for port %d (result %d)", i, err); | ||
1635 | + if (err < 0) { | ||
1636 | + err("%s: Error %d for interrupt URB of port%d", | ||
1637 | + __func__, err, i); | ||
1638 | + return err; | ||
1639 | + } | ||
1640 | + } | ||
1641 | + | ||
1642 | + for (i = 0; i < serial->num_ports; i++) { | ||
1643 | + /* walk all ports */ | ||
1644 | + port = serial->port[i]; | ||
1645 | + portdata = usb_get_serial_port_data(port); | ||
1646 | + mutex_lock(&port->mutex); | ||
1647 | + | ||
1648 | + /* skip closed ports */ | ||
1649 | + if (!port->port.count) { | ||
1650 | + mutex_unlock(&port->mutex); | ||
1651 | + continue; | ||
1652 | + } | ||
1653 | + | ||
1654 | + for (j = 0; j < N_IN_URB; j++) { | ||
1655 | + urb = portdata->in_urbs[j]; | ||
1656 | + err = usb_submit_urb(urb, GFP_NOIO); | ||
1657 | + if (err < 0) { | ||
1658 | + mutex_unlock(&port->mutex); | ||
1659 | + err("%s: Error %d for bulk URB %d", | ||
1660 | + __func__, err, i); | ||
1661 | + return err; | ||
1662 | + } | ||
1663 | + } | ||
1664 | + mutex_unlock(&port->mutex); | ||
1665 | + } | ||
1666 | + return 0; | ||
1667 | +} | ||
1668 | + | ||
1669 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
1670 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
1671 | MODULE_VERSION(DRIVER_VERSION); | ||
1672 | diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c | ||
1673 | index 81db571..6697a0c 100644 | ||
1674 | --- a/drivers/usb/serial/oti6858.c | ||
1675 | +++ b/drivers/usb/serial/oti6858.c | ||
1676 | @@ -160,7 +160,7 @@ static int oti6858_tiocmget(struct tty_struct *tty, struct file *file); | ||
1677 | static int oti6858_tiocmset(struct tty_struct *tty, struct file *file, | ||
1678 | unsigned int set, unsigned int clear); | ||
1679 | static int oti6858_startup(struct usb_serial *serial); | ||
1680 | -static void oti6858_shutdown(struct usb_serial *serial); | ||
1681 | +static void oti6858_release(struct usb_serial *serial); | ||
1682 | |||
1683 | /* functions operating on buffers */ | ||
1684 | static struct oti6858_buf *oti6858_buf_alloc(unsigned int size); | ||
1685 | @@ -195,7 +195,7 @@ static struct usb_serial_driver oti6858_device = { | ||
1686 | .write_room = oti6858_write_room, | ||
1687 | .chars_in_buffer = oti6858_chars_in_buffer, | ||
1688 | .attach = oti6858_startup, | ||
1689 | - .shutdown = oti6858_shutdown, | ||
1690 | + .release = oti6858_release, | ||
1691 | }; | ||
1692 | |||
1693 | struct oti6858_private { | ||
1694 | @@ -833,7 +833,7 @@ static int oti6858_ioctl(struct tty_struct *tty, struct file *file, | ||
1695 | } | ||
1696 | |||
1697 | |||
1698 | -static void oti6858_shutdown(struct usb_serial *serial) | ||
1699 | +static void oti6858_release(struct usb_serial *serial) | ||
1700 | { | ||
1701 | struct oti6858_private *priv; | ||
1702 | int i; | ||
1703 | @@ -845,7 +845,6 @@ static void oti6858_shutdown(struct usb_serial *serial) | ||
1704 | if (priv) { | ||
1705 | oti6858_buf_free(priv->buf); | ||
1706 | kfree(priv); | ||
1707 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1708 | } | ||
1709 | } | ||
1710 | } | ||
1711 | diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c | ||
1712 | index 1ede144..70536c1 100644 | ||
1713 | --- a/drivers/usb/serial/pl2303.c | ||
1714 | +++ b/drivers/usb/serial/pl2303.c | ||
1715 | @@ -905,7 +905,7 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | ||
1716 | dbg("%s - error sending break = %d", __func__, result); | ||
1717 | } | ||
1718 | |||
1719 | -static void pl2303_shutdown(struct usb_serial *serial) | ||
1720 | +static void pl2303_release(struct usb_serial *serial) | ||
1721 | { | ||
1722 | int i; | ||
1723 | struct pl2303_private *priv; | ||
1724 | @@ -917,7 +917,6 @@ static void pl2303_shutdown(struct usb_serial *serial) | ||
1725 | if (priv) { | ||
1726 | pl2303_buf_free(priv->buf); | ||
1727 | kfree(priv); | ||
1728 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1729 | } | ||
1730 | } | ||
1731 | } | ||
1732 | @@ -1145,7 +1144,7 @@ static struct usb_serial_driver pl2303_device = { | ||
1733 | .write_room = pl2303_write_room, | ||
1734 | .chars_in_buffer = pl2303_chars_in_buffer, | ||
1735 | .attach = pl2303_startup, | ||
1736 | - .shutdown = pl2303_shutdown, | ||
1737 | + .release = pl2303_release, | ||
1738 | }; | ||
1739 | |||
1740 | static int __init pl2303_init(void) | ||
1741 | diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c | ||
1742 | index 639328b..28d66d3 100644 | ||
1743 | --- a/drivers/usb/serial/sierra.c | ||
1744 | +++ b/drivers/usb/serial/sierra.c | ||
1745 | @@ -677,7 +677,7 @@ static int sierra_startup(struct usb_serial *serial) | ||
1746 | return 0; | ||
1747 | } | ||
1748 | |||
1749 | -static void sierra_shutdown(struct usb_serial *serial) | ||
1750 | +static void sierra_disconnect(struct usb_serial *serial) | ||
1751 | { | ||
1752 | int i, j; | ||
1753 | struct usb_serial_port *port; | ||
1754 | @@ -696,10 +696,29 @@ static void sierra_shutdown(struct usb_serial *serial) | ||
1755 | for (j = 0; j < N_IN_URB; j++) { | ||
1756 | usb_kill_urb(portdata->in_urbs[j]); | ||
1757 | usb_free_urb(portdata->in_urbs[j]); | ||
1758 | - kfree(portdata->in_buffer[j]); | ||
1759 | } | ||
1760 | + } | ||
1761 | +} | ||
1762 | + | ||
1763 | +static void sierra_release(struct usb_serial *serial) | ||
1764 | +{ | ||
1765 | + int i, j; | ||
1766 | + struct usb_serial_port *port; | ||
1767 | + struct sierra_port_private *portdata; | ||
1768 | + | ||
1769 | + dev_dbg(&serial->dev->dev, "%s\n", __func__); | ||
1770 | + | ||
1771 | + for (i = 0; i < serial->num_ports; ++i) { | ||
1772 | + port = serial->port[i]; | ||
1773 | + if (!port) | ||
1774 | + continue; | ||
1775 | + portdata = usb_get_serial_port_data(port); | ||
1776 | + if (!portdata) | ||
1777 | + continue; | ||
1778 | + | ||
1779 | + for (j = 0; j < N_IN_URB; j++) | ||
1780 | + kfree(portdata->in_buffer[j]); | ||
1781 | kfree(portdata); | ||
1782 | - usb_set_serial_port_data(port, NULL); | ||
1783 | } | ||
1784 | } | ||
1785 | |||
1786 | @@ -721,7 +740,8 @@ static struct usb_serial_driver sierra_device = { | ||
1787 | .tiocmget = sierra_tiocmget, | ||
1788 | .tiocmset = sierra_tiocmset, | ||
1789 | .attach = sierra_startup, | ||
1790 | - .shutdown = sierra_shutdown, | ||
1791 | + .disconnect = sierra_disconnect, | ||
1792 | + .release = sierra_release, | ||
1793 | .read_int_callback = sierra_instat_callback, | ||
1794 | }; | ||
1795 | |||
1796 | diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c | ||
1797 | index 283cf6b..af54f0b 100644 | ||
1798 | --- a/drivers/usb/serial/spcp8x5.c | ||
1799 | +++ b/drivers/usb/serial/spcp8x5.c | ||
1800 | @@ -356,7 +356,7 @@ cleanup: | ||
1801 | } | ||
1802 | |||
1803 | /* call when the device plug out. free all the memory alloced by probe */ | ||
1804 | -static void spcp8x5_shutdown(struct usb_serial *serial) | ||
1805 | +static void spcp8x5_release(struct usb_serial *serial) | ||
1806 | { | ||
1807 | int i; | ||
1808 | struct spcp8x5_private *priv; | ||
1809 | @@ -366,7 +366,6 @@ static void spcp8x5_shutdown(struct usb_serial *serial) | ||
1810 | if (priv) { | ||
1811 | free_ringbuf(priv->buf); | ||
1812 | kfree(priv); | ||
1813 | - usb_set_serial_port_data(serial->port[i] , NULL); | ||
1814 | } | ||
1815 | } | ||
1816 | } | ||
1817 | @@ -1041,7 +1040,7 @@ static struct usb_serial_driver spcp8x5_device = { | ||
1818 | .write_bulk_callback = spcp8x5_write_bulk_callback, | ||
1819 | .chars_in_buffer = spcp8x5_chars_in_buffer, | ||
1820 | .attach = spcp8x5_startup, | ||
1821 | - .shutdown = spcp8x5_shutdown, | ||
1822 | + .release = spcp8x5_release, | ||
1823 | }; | ||
1824 | |||
1825 | static int __init spcp8x5_init(void) | ||
1826 | diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c | ||
1827 | index 55b9d67..efe3bf2 100644 | ||
1828 | --- a/drivers/usb/serial/ti_usb_3410_5052.c | ||
1829 | +++ b/drivers/usb/serial/ti_usb_3410_5052.c | ||
1830 | @@ -148,7 +148,7 @@ struct ti_device { | ||
1831 | /* Function Declarations */ | ||
1832 | |||
1833 | static int ti_startup(struct usb_serial *serial); | ||
1834 | -static void ti_shutdown(struct usb_serial *serial); | ||
1835 | +static void ti_release(struct usb_serial *serial); | ||
1836 | static int ti_open(struct tty_struct *tty, struct usb_serial_port *port, | ||
1837 | struct file *file); | ||
1838 | static void ti_close(struct tty_struct *tty, struct usb_serial_port *port, | ||
1839 | @@ -271,7 +271,7 @@ static struct usb_serial_driver ti_1port_device = { | ||
1840 | .id_table = ti_id_table_3410, | ||
1841 | .num_ports = 1, | ||
1842 | .attach = ti_startup, | ||
1843 | - .shutdown = ti_shutdown, | ||
1844 | + .release = ti_release, | ||
1845 | .open = ti_open, | ||
1846 | .close = ti_close, | ||
1847 | .write = ti_write, | ||
1848 | @@ -299,7 +299,7 @@ static struct usb_serial_driver ti_2port_device = { | ||
1849 | .id_table = ti_id_table_5052, | ||
1850 | .num_ports = 2, | ||
1851 | .attach = ti_startup, | ||
1852 | - .shutdown = ti_shutdown, | ||
1853 | + .release = ti_release, | ||
1854 | .open = ti_open, | ||
1855 | .close = ti_close, | ||
1856 | .write = ti_write, | ||
1857 | @@ -506,7 +506,7 @@ free_tdev: | ||
1858 | } | ||
1859 | |||
1860 | |||
1861 | -static void ti_shutdown(struct usb_serial *serial) | ||
1862 | +static void ti_release(struct usb_serial *serial) | ||
1863 | { | ||
1864 | int i; | ||
1865 | struct ti_device *tdev = usb_get_serial_data(serial); | ||
1866 | @@ -519,12 +519,10 @@ static void ti_shutdown(struct usb_serial *serial) | ||
1867 | if (tport) { | ||
1868 | ti_buf_free(tport->tp_write_buf); | ||
1869 | kfree(tport); | ||
1870 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1871 | } | ||
1872 | } | ||
1873 | |||
1874 | kfree(tdev); | ||
1875 | - usb_set_serial_data(serial, NULL); | ||
1876 | } | ||
1877 | |||
1878 | |||
1879 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c | ||
1880 | index 579796a..4f5ee74 100644 | ||
1881 | --- a/drivers/usb/serial/usb-serial.c | ||
1882 | +++ b/drivers/usb/serial/usb-serial.c | ||
1883 | @@ -140,6 +140,14 @@ static void destroy_serial(struct kref *kref) | ||
1884 | if (serial->minor != SERIAL_TTY_NO_MINOR) | ||
1885 | return_serial(serial); | ||
1886 | |||
1887 | + serial->type->release(serial); | ||
1888 | + | ||
1889 | + for (i = 0; i < serial->num_ports; ++i) { | ||
1890 | + port = serial->port[i]; | ||
1891 | + if (port) | ||
1892 | + put_device(&port->dev); | ||
1893 | + } | ||
1894 | + | ||
1895 | /* If this is a "fake" port, we have to clean it up here, as it will | ||
1896 | * not get cleaned up in port_release() as it was never registered with | ||
1897 | * the driver core */ | ||
1898 | @@ -147,9 +155,8 @@ static void destroy_serial(struct kref *kref) | ||
1899 | for (i = serial->num_ports; | ||
1900 | i < serial->num_port_pointers; ++i) { | ||
1901 | port = serial->port[i]; | ||
1902 | - if (!port) | ||
1903 | - continue; | ||
1904 | - port_free(port); | ||
1905 | + if (port) | ||
1906 | + port_free(port); | ||
1907 | } | ||
1908 | } | ||
1909 | |||
1910 | @@ -1061,10 +1068,6 @@ void usb_serial_disconnect(struct usb_interface *interface) | ||
1911 | serial->disconnected = 1; | ||
1912 | mutex_unlock(&serial->disc_mutex); | ||
1913 | |||
1914 | - /* Unfortunately, many of the sub-drivers expect the port structures | ||
1915 | - * to exist when their shutdown method is called, so we have to go | ||
1916 | - * through this awkward two-step unregistration procedure. | ||
1917 | - */ | ||
1918 | for (i = 0; i < serial->num_ports; ++i) { | ||
1919 | port = serial->port[i]; | ||
1920 | if (port) { | ||
1921 | @@ -1075,14 +1078,7 @@ void usb_serial_disconnect(struct usb_interface *interface) | ||
1922 | device_del(&port->dev); | ||
1923 | } | ||
1924 | } | ||
1925 | - serial->type->shutdown(serial); | ||
1926 | - for (i = 0; i < serial->num_ports; ++i) { | ||
1927 | - port = serial->port[i]; | ||
1928 | - if (port) { | ||
1929 | - put_device(&port->dev); | ||
1930 | - serial->port[i] = NULL; | ||
1931 | - } | ||
1932 | - } | ||
1933 | + serial->type->disconnect(serial); | ||
1934 | |||
1935 | /* let the last holder of this object | ||
1936 | * cause it to be cleaned up */ | ||
1937 | @@ -1246,7 +1242,8 @@ static void fixup_generic(struct usb_serial_driver *device) | ||
1938 | set_to_generic_if_null(device, chars_in_buffer); | ||
1939 | set_to_generic_if_null(device, read_bulk_callback); | ||
1940 | set_to_generic_if_null(device, write_bulk_callback); | ||
1941 | - set_to_generic_if_null(device, shutdown); | ||
1942 | + set_to_generic_if_null(device, disconnect); | ||
1943 | + set_to_generic_if_null(device, release); | ||
1944 | set_to_generic_if_null(device, resume); | ||
1945 | } | ||
1946 | |||
1947 | diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c | ||
1948 | index ec33fa5..b538017 100644 | ||
1949 | --- a/drivers/usb/serial/visor.c | ||
1950 | +++ b/drivers/usb/serial/visor.c | ||
1951 | @@ -48,7 +48,7 @@ static void visor_unthrottle(struct tty_struct *tty); | ||
1952 | static int visor_probe(struct usb_serial *serial, | ||
1953 | const struct usb_device_id *id); | ||
1954 | static int visor_calc_num_ports(struct usb_serial *serial); | ||
1955 | -static void visor_shutdown(struct usb_serial *serial); | ||
1956 | +static void visor_release(struct usb_serial *serial); | ||
1957 | static void visor_write_bulk_callback(struct urb *urb); | ||
1958 | static void visor_read_bulk_callback(struct urb *urb); | ||
1959 | static void visor_read_int_callback(struct urb *urb); | ||
1960 | @@ -203,7 +203,7 @@ static struct usb_serial_driver handspring_device = { | ||
1961 | .attach = treo_attach, | ||
1962 | .probe = visor_probe, | ||
1963 | .calc_num_ports = visor_calc_num_ports, | ||
1964 | - .shutdown = visor_shutdown, | ||
1965 | + .release = visor_release, | ||
1966 | .write = visor_write, | ||
1967 | .write_room = visor_write_room, | ||
1968 | .write_bulk_callback = visor_write_bulk_callback, | ||
1969 | @@ -228,7 +228,7 @@ static struct usb_serial_driver clie_5_device = { | ||
1970 | .attach = clie_5_attach, | ||
1971 | .probe = visor_probe, | ||
1972 | .calc_num_ports = visor_calc_num_ports, | ||
1973 | - .shutdown = visor_shutdown, | ||
1974 | + .release = visor_release, | ||
1975 | .write = visor_write, | ||
1976 | .write_room = visor_write_room, | ||
1977 | .write_bulk_callback = visor_write_bulk_callback, | ||
1978 | @@ -916,7 +916,7 @@ static int clie_5_attach(struct usb_serial *serial) | ||
1979 | return generic_startup(serial); | ||
1980 | } | ||
1981 | |||
1982 | -static void visor_shutdown(struct usb_serial *serial) | ||
1983 | +static void visor_release(struct usb_serial *serial) | ||
1984 | { | ||
1985 | struct visor_private *priv; | ||
1986 | int i; | ||
1987 | @@ -925,10 +925,7 @@ static void visor_shutdown(struct usb_serial *serial) | ||
1988 | |||
1989 | for (i = 0; i < serial->num_ports; i++) { | ||
1990 | priv = usb_get_serial_port_data(serial->port[i]); | ||
1991 | - if (priv) { | ||
1992 | - usb_set_serial_port_data(serial->port[i], NULL); | ||
1993 | - kfree(priv); | ||
1994 | - } | ||
1995 | + kfree(priv); | ||
1996 | } | ||
1997 | } | ||
1998 | |||
1999 | diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c | ||
2000 | index 3a9d143..12ea829 100644 | ||
2001 | --- a/drivers/usb/serial/whiteheat.c | ||
2002 | +++ b/drivers/usb/serial/whiteheat.c | ||
2003 | @@ -144,7 +144,7 @@ static int whiteheat_firmware_attach(struct usb_serial *serial); | ||
2004 | |||
2005 | /* function prototypes for the Connect Tech WhiteHEAT serial converter */ | ||
2006 | static int whiteheat_attach(struct usb_serial *serial); | ||
2007 | -static void whiteheat_shutdown(struct usb_serial *serial); | ||
2008 | +static void whiteheat_release(struct usb_serial *serial); | ||
2009 | static int whiteheat_open(struct tty_struct *tty, | ||
2010 | struct usb_serial_port *port, struct file *filp); | ||
2011 | static void whiteheat_close(struct tty_struct *tty, | ||
2012 | @@ -190,7 +190,7 @@ static struct usb_serial_driver whiteheat_device = { | ||
2013 | .id_table = id_table_std, | ||
2014 | .num_ports = 4, | ||
2015 | .attach = whiteheat_attach, | ||
2016 | - .shutdown = whiteheat_shutdown, | ||
2017 | + .release = whiteheat_release, | ||
2018 | .open = whiteheat_open, | ||
2019 | .close = whiteheat_close, | ||
2020 | .write = whiteheat_write, | ||
2021 | @@ -600,7 +600,7 @@ no_command_buffer: | ||
2022 | } | ||
2023 | |||
2024 | |||
2025 | -static void whiteheat_shutdown(struct usb_serial *serial) | ||
2026 | +static void whiteheat_release(struct usb_serial *serial) | ||
2027 | { | ||
2028 | struct usb_serial_port *command_port; | ||
2029 | struct usb_serial_port *port; | ||
2030 | diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c | ||
2031 | index fd03330..1695c2e 100644 | ||
2032 | --- a/fs/fuse/dir.c | ||
2033 | +++ b/fs/fuse/dir.c | ||
2034 | @@ -398,6 +398,9 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | ||
2035 | if (fc->no_create) | ||
2036 | return -ENOSYS; | ||
2037 | |||
2038 | + if (flags & O_DIRECT) | ||
2039 | + return -EINVAL; | ||
2040 | + | ||
2041 | forget_req = fuse_get_req(fc); | ||
2042 | if (IS_ERR(forget_req)) | ||
2043 | return PTR_ERR(forget_req); | ||
2044 | diff --git a/fs/fuse/file.c b/fs/fuse/file.c | ||
2045 | index 0c92f15..afdde60 100644 | ||
2046 | --- a/fs/fuse/file.c | ||
2047 | +++ b/fs/fuse/file.c | ||
2048 | @@ -1005,7 +1005,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf, | ||
2049 | break; | ||
2050 | } | ||
2051 | } | ||
2052 | - fuse_put_request(fc, req); | ||
2053 | + if (!IS_ERR(req)) | ||
2054 | + fuse_put_request(fc, req); | ||
2055 | if (res > 0) { | ||
2056 | if (write) | ||
2057 | fuse_write_update_size(inode, pos); | ||
2058 | diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c | ||
2059 | index cfe05c1..3f39be1 100644 | ||
2060 | --- a/fs/jffs2/read.c | ||
2061 | +++ b/fs/jffs2/read.c | ||
2062 | @@ -164,12 +164,15 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | ||
2063 | |||
2064 | /* XXX FIXME: Where a single physical node actually shows up in two | ||
2065 | frags, we read it twice. Don't do that. */ | ||
2066 | - /* Now we're pointing at the first frag which overlaps our page */ | ||
2067 | + /* Now we're pointing at the first frag which overlaps our page | ||
2068 | + * (or perhaps is before it, if we've been asked to read off the | ||
2069 | + * end of the file). */ | ||
2070 | while(offset < end) { | ||
2071 | D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end)); | ||
2072 | - if (unlikely(!frag || frag->ofs > offset)) { | ||
2073 | + if (unlikely(!frag || frag->ofs > offset || | ||
2074 | + frag->ofs + frag->size <= offset)) { | ||
2075 | uint32_t holesize = end - offset; | ||
2076 | - if (frag) { | ||
2077 | + if (frag && frag->ofs > offset) { | ||
2078 | D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset)); | ||
2079 | holesize = min(holesize, frag->ofs - offset); | ||
2080 | } | ||
2081 | diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h | ||
2082 | index 655341d..9d8ca87 100644 | ||
2083 | --- a/include/linux/usb/serial.h | ||
2084 | +++ b/include/linux/usb/serial.h | ||
2085 | @@ -177,8 +177,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | ||
2086 | * This will be called when the struct usb_serial structure is fully set | ||
2087 | * set up. Do any local initialization of the device, or any private | ||
2088 | * memory structure allocation at this point in time. | ||
2089 | - * @shutdown: pointer to the driver's shutdown function. This will be | ||
2090 | - * called when the device is removed from the system. | ||
2091 | + * @disconnect: pointer to the driver's disconnect function. This will be | ||
2092 | + * called when the device is unplugged or unbound from the driver. | ||
2093 | + * @release: pointer to the driver's release function. This will be called | ||
2094 | + * when the usb_serial data structure is about to be destroyed. | ||
2095 | * @usb_driver: pointer to the struct usb_driver that controls this | ||
2096 | * device. This is necessary to allow dynamic ids to be added to | ||
2097 | * the driver from sysfs. | ||
2098 | @@ -208,7 +210,8 @@ struct usb_serial_driver { | ||
2099 | int (*attach)(struct usb_serial *serial); | ||
2100 | int (*calc_num_ports) (struct usb_serial *serial); | ||
2101 | |||
2102 | - void (*shutdown)(struct usb_serial *serial); | ||
2103 | + void (*disconnect)(struct usb_serial *serial); | ||
2104 | + void (*release)(struct usb_serial *serial); | ||
2105 | |||
2106 | int (*port_probe)(struct usb_serial_port *port); | ||
2107 | int (*port_remove)(struct usb_serial_port *port); | ||
2108 | @@ -288,7 +291,8 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | ||
2109 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | ||
2110 | extern void usb_serial_generic_throttle(struct tty_struct *tty); | ||
2111 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); | ||
2112 | -extern void usb_serial_generic_shutdown(struct usb_serial *serial); | ||
2113 | +extern void usb_serial_generic_disconnect(struct usb_serial *serial); | ||
2114 | +extern void usb_serial_generic_release(struct usb_serial *serial); | ||
2115 | extern int usb_serial_generic_register(int debug); | ||
2116 | extern void usb_serial_generic_deregister(void); | ||
2117 | |||
2118 | diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c | ||
2119 | index b0a4744..07b0f65 100644 | ||
2120 | --- a/sound/arm/aaci.c | ||
2121 | +++ b/sound/arm/aaci.c | ||
2122 | @@ -504,6 +504,10 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | ||
2123 | int err; | ||
2124 | |||
2125 | aaci_pcm_hw_free(substream); | ||
2126 | + if (aacirun->pcm_open) { | ||
2127 | + snd_ac97_pcm_close(aacirun->pcm); | ||
2128 | + aacirun->pcm_open = 0; | ||
2129 | + } | ||
2130 | |||
2131 | err = devdma_hw_alloc(NULL, substream, | ||
2132 | params_buffer_bytes(params)); | ||
2133 | @@ -517,7 +521,7 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | ||
2134 | else | ||
2135 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | ||
2136 | params_channels(params), | ||
2137 | - aacirun->pcm->r[1].slots); | ||
2138 | + aacirun->pcm->r[0].slots); | ||
2139 | |||
2140 | if (err) | ||
2141 | goto out; | ||
2142 | diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h | ||
2143 | index 7191d82..c456004 100644 | ||
2144 | --- a/sound/usb/usbaudio.h | ||
2145 | +++ b/sound/usb/usbaudio.h | ||
2146 | @@ -209,7 +209,7 @@ struct snd_usb_midi_endpoint_info { | ||
2147 | /* | ||
2148 | */ | ||
2149 | |||
2150 | -#define combine_word(s) ((*s) | ((unsigned int)(s)[1] << 8)) | ||
2151 | +#define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8)) | ||
2152 | #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16)) | ||
2153 | #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24)) | ||
2154 |