Changes in uspace/drv/char/ns8250/ns8250.c [b19e892:d51838f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ns8250/ns8250.c
rb19e892 rd51838f 55 55 #include <ops/char_dev.h> 56 56 57 #include <irc.h>58 57 #include <device/hw_res.h> 59 58 #include <ipc/serial_ctl.h> … … 154 153 /** DDF function node */ 155 154 ddf_fun_t *fun; 155 /** Parent session */ 156 async_sess_t *parent_sess; 156 157 /** I/O registers **/ 157 158 ns8250_regs_t *regs; … … 160 161 /** The irq assigned to this device. */ 161 162 int irq; 163 /** IRQ capability handle */ 164 int irq_cap; 162 165 /** The base i/o address of the devices registers. */ 163 166 uintptr_t io_addr; … … 380 383 static int ns8250_dev_initialize(ns8250_t *ns) 381 384 { 382 async_sess_t *parent_sess;383 385 int ret = EOK; 384 386 … … 388 390 memset(&hw_resources, 0, sizeof(hw_resource_list_t)); 389 391 390 /* Connect to the parent's driver. */391 parent_sess = ddf_dev_parent_sess_create(ns->dev);392 if (parent_sess == NULL) {393 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "394 "device %s.", ddf_dev_get_name(ns->dev));395 ret = ENOENT;396 goto failed;397 }398 399 392 /* Get hw resources. */ 400 ret = hw_res_get_resource_list( parent_sess, &hw_resources);393 ret = hw_res_get_resource_list(ns->parent_sess, &hw_resources); 401 394 if (ret != EOK) { 402 395 ddf_msg(LVL_ERROR, "Failed to get HW resources for device " … … 485 478 { 486 479 /* Enable interrupt using IRC service. */ 487 int rc = irc_enable_interrupt(ns->irq);480 int rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq); 488 481 if (rc != EOK) 489 482 return EIO; … … 778 771 779 772 ns8250_read_from_device(ns); 780 irc_disable_interrupt(ns->irq);773 hw_res_clear_interrupt(ns->parent_sess, ns->irq); 781 774 } 782 775 … … 797 790 static inline int ns8250_unregister_interrupt_handler(ns8250_t *ns) 798 791 { 799 return unregister_interrupt_handler(ns->dev, ns->irq );792 return unregister_interrupt_handler(ns->dev, ns->irq_cap); 800 793 } 801 794 … … 828 821 ns->dev = dev; 829 822 823 ns->parent_sess = ddf_dev_parent_sess_get(ns->dev); 824 if (ns->parent_sess == NULL) { 825 ddf_msg(LVL_ERROR, "Failed to connect to parent driver of " 826 "device %s.", ddf_dev_get_name(ns->dev)); 827 rc = EIO; 828 goto fail; 829 } 830 830 831 rc = ns8250_dev_initialize(ns); 831 832 if (rc != EOK) … … 849 850 850 851 /* Register interrupt handler. */ 851 if (ns8250_register_interrupt_handler(ns) != EOK) { 852 ns->irq_cap = ns8250_register_interrupt_handler(ns); 853 if (ns->irq_cap < 0) { 852 854 ddf_msg(LVL_ERROR, "Failed to register interrupt handler."); 853 855 rc = EADDRNOTAVAIL;
Note:
See TracChangeset
for help on using the changeset viewer.