Changes in uspace/drv/char/ns8250/ns8250.c [956d4281:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ns8250/ns8250.c
r956d4281 r3e6a98c5 160 160 /** I/O registers **/ 161 161 ns8250_regs_t *regs; 162 /** Are there any clients connected to the device? */163 unsigned client_connections;162 /** Is there any client conntected to the device? */ 163 bool client_connected; 164 164 /** The irq assigned to this device. */ 165 165 int irq; … … 168 168 /** The i/o port used to access the serial ports registers. */ 169 169 ioport8_t *port; 170 /** The buffer for incom ing data. */170 /** The buffer for incomming data. */ 171 171 cyclic_buffer_t input_buffer; 172 172 /** The fibril mutex for synchronizing the access to the device. */ … … 190 190 } 191 191 192 /** Find out if there is some incom ing data available on the serial port.192 /** Find out if there is some incomming data available on the serial port. 193 193 * 194 194 * @param port The base address of the serial port device's ports. … … 236 236 * 237 237 * @param fun The serial port function 238 * @param buf The ou tput buffer for read data.238 * @param buf The ouput buffer for read data. 239 239 * @param count The number of bytes to be read. 240 240 * … … 420 420 ns->irq = res->res.interrupt.irq; 421 421 irq = true; 422 ddf_msg(LVL_NOTE, "Device %s was as signed irq = 0x%x.",422 ddf_msg(LVL_NOTE, "Device %s was asigned irq = 0x%x.", 423 423 ddf_dev_get_name(ns->dev), ns->irq); 424 424 break; … … 433 433 } 434 434 ioport = true; 435 ddf_msg(LVL_NOTE, "Device %s was as signed I/O address = "435 ddf_msg(LVL_NOTE, "Device %s was asigned I/O address = " 436 436 "0x%x.", ddf_dev_get_name(ns->dev), ns->io_addr); 437 437 break; … … 753 753 uint8_t val = ns8250_read_8(regs); 754 754 755 if (ns->client_connect ions > 0) {755 if (ns->client_connected) { 756 756 bool buf_was_empty = buf_is_empty(&ns->input_buffer); 757 757 if (!buf_push_back(&ns->input_buffer, val)) { … … 827 827 ddf_fun_t *fun = NULL; 828 828 bool need_cleanup = false; 829 bool need_unreg_intr_handler = false;830 829 int rc; 831 830 … … 870 869 goto fail; 871 870 } 872 need_unreg_intr_handler = true;873 871 874 872 /* Enable interrupt. */ … … 905 903 if (fun != NULL) 906 904 ddf_fun_destroy(fun); 907 if (need_unreg_intr_handler)908 ns8250_unregister_interrupt_handler(ns);909 905 if (need_cleanup) 910 906 ns8250_dev_cleanup(ns); … … 918 914 919 915 fibril_mutex_lock(&ns->mutex); 920 if (ns->client_connect ions > 0) {916 if (ns->client_connected) { 921 917 fibril_mutex_unlock(&ns->mutex); 922 918 return EBUSY; … … 952 948 953 949 fibril_mutex_lock(&ns->mutex); 954 if (ns->removed) { 950 if (ns->client_connected) { 951 res = ELIMIT; 952 } else if (ns->removed) { 955 953 res = ENXIO; 956 954 } else { 957 955 res = EOK; 958 ns->client_connect ions++;956 ns->client_connected = true; 959 957 } 960 958 fibril_mutex_unlock(&ns->mutex); … … 976 974 fibril_mutex_lock(&data->mutex); 977 975 978 assert(data->client_connect ions > 0);979 980 if (!(--data->client_connections))981 976 assert(data->client_connected); 977 978 data->client_connected = false; 979 buf_clear(&data->input_buffer); 982 980 983 981 fibril_mutex_unlock(&data->mutex);
Note:
See TracChangeset
for help on using the changeset viewer.