aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/jsm/jsm_driver.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-11 18:34:40 -0500
commit0f4974c439dd7826c85bae4e6a8088ce2db0f498 (patch)
treefdabc7d9bb7d7bc49aad547c0aac3a633ce01f09 /drivers/serial/jsm/jsm_driver.c
parent3126c136bc30225d7a43af741778aa50e95e467a (diff)
parent36ba782e9674cdc29ec7003757df0b375e99fa96 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (58 commits) tty: split the lock up a bit further tty: Move the leader test in disassociate tty: Push the bkl down a bit in the hangup code tty: Push the lock down further into the ldisc code tty: push the BKL down into the handlers a bit tty: moxa: split open lock tty: moxa: Kill the use of lock_kernel tty: moxa: Fix modem op locking tty: moxa: Kill off the throttle method tty: moxa: Locking clean up tty: moxa: rework the locking a bit tty: moxa: Use more tty_port ops tty: isicom: fix deadlock on shutdown tty: mxser: Use the new locking rules to fix setserial properly tty: mxser: use the tty_port_open method tty: isicom: sort out the board init logic tty: isicom: switch to the new tty_port_open helper tty: tty_port: Add a kref object to the tty port tty: istallion: tty port open/close methods tty: stallion: Convert to the tty_port_open/close methods ...
Diffstat (limited to 'drivers/serial/jsm/jsm_driver.c')
-rw-r--r--drivers/serial/jsm/jsm_driver.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index b3604aa322a4..108c3e0471fd 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -48,6 +48,17 @@ struct uart_driver jsm_uart_driver = {
48 .nr = NR_PORTS, 48 .nr = NR_PORTS,
49}; 49};
50 50
51static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev,
52 pci_channel_state_t state);
53static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev);
54static void jsm_io_resume(struct pci_dev *pdev);
55
56static struct pci_error_handlers jsm_err_handler = {
57 .error_detected = jsm_io_error_detected,
58 .slot_reset = jsm_io_slot_reset,
59 .resume = jsm_io_resume,
60};
61
51int jsm_debug; 62int jsm_debug;
52module_param(jsm_debug, int, 0); 63module_param(jsm_debug, int, 0);
53MODULE_PARM_DESC(jsm_debug, "Driver debugging level"); 64MODULE_PARM_DESC(jsm_debug, "Driver debugging level");
@@ -123,7 +134,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
123 } 134 }
124 135
125 rc = request_irq(brd->irq, brd->bd_ops->intr, 136 rc = request_irq(brd->irq, brd->bd_ops->intr,
126 IRQF_DISABLED|IRQF_SHARED, "JSM", brd); 137 IRQF_SHARED, "JSM", brd);
127 if (rc) { 138 if (rc) {
128 printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq); 139 printk(KERN_WARNING "Failed to hook IRQ %d\n",brd->irq);
129 goto out_iounmap; 140 goto out_iounmap;
@@ -164,6 +175,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
164 } 175 }
165 176
166 pci_set_drvdata(pdev, brd); 177 pci_set_drvdata(pdev, brd);
178 pci_save_state(pdev);
167 179
168 return 0; 180 return 0;
169 out_free_irq: 181 out_free_irq:
@@ -222,8 +234,42 @@ static struct pci_driver jsm_driver = {
222 .id_table = jsm_pci_tbl, 234 .id_table = jsm_pci_tbl,
223 .probe = jsm_probe_one, 235 .probe = jsm_probe_one,
224 .remove = __devexit_p(jsm_remove_one), 236 .remove = __devexit_p(jsm_remove_one),
237 .err_handler = &jsm_err_handler,
225}; 238};
226 239
240static pci_ers_result_t jsm_io_error_detected(struct pci_dev *pdev,
241 pci_channel_state_t state)
242{
243 struct jsm_board *brd = pci_get_drvdata(pdev);
244
245 jsm_remove_uart_port(brd);
246
247 return PCI_ERS_RESULT_NEED_RESET;
248}
249
250static pci_ers_result_t jsm_io_slot_reset(struct pci_dev *pdev)
251{
252 int rc;
253
254 rc = pci_enable_device(pdev);
255
256 if (rc)
257 return PCI_ERS_RESULT_DISCONNECT;
258
259 pci_set_master(pdev);
260
261 return PCI_ERS_RESULT_RECOVERED;
262}
263
264static void jsm_io_resume(struct pci_dev *pdev)
265{
266 struct jsm_board *brd = pci_get_drvdata(pdev);
267
268 pci_restore_state(pdev);
269
270 jsm_uart_port_init(brd);
271}
272
227static int __init jsm_init_module(void) 273static int __init jsm_init_module(void)
228{ 274{
229 int rc; 275 int rc;