Changeset 98abd40 in mainline for uspace/drv/char/ns8250/ns8250.c


Ignore:
Timestamp:
2013-07-06T21:57:22Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c8bb1633, cdc8a391
Parents:
b8e72fd1 (diff), 507c6f3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ns8250/ns8250.c

    rb8e72fd1 r98abd40  
    160160        /** I/O registers **/
    161161        ns8250_regs_t *regs;
    162         /** Is there any client connected to the device? */
    163         bool client_connected;
     162        /** Are there any clients connected to the device? */
     163        unsigned client_connections;
    164164        /** The irq assigned to this device. */
    165165        int irq;
     
    753753                        uint8_t val = ns8250_read_8(regs);
    754754                       
    755                         if (ns->client_connected) {
     755                        if (ns->client_connections > 0) {
    756756                                bool buf_was_empty = buf_is_empty(&ns->input_buffer);
    757757                                if (!buf_push_back(&ns->input_buffer, val)) {
     
    914914       
    915915        fibril_mutex_lock(&ns->mutex);
    916         if (ns->client_connected) {
     916                if (ns->client_connections > 0) {
    917917                fibril_mutex_unlock(&ns->mutex);
    918918                return EBUSY;
     
    948948       
    949949        fibril_mutex_lock(&ns->mutex);
    950         if (ns->client_connected) {
    951                 res = ELIMIT;
    952         } else if (ns->removed) {
     950        if (ns->removed) {
    953951                res = ENXIO;
    954952        } else {
    955953                res = EOK;
    956                 ns->client_connected = true;
     954                ns->client_connections++;
    957955        }
    958956        fibril_mutex_unlock(&ns->mutex);
     
    974972        fibril_mutex_lock(&data->mutex);
    975973       
    976         assert(data->client_connected);
    977        
    978         data->client_connected = false;
    979         buf_clear(&data->input_buffer);
     974        assert(data->client_connections > 0);
     975       
     976        if (!(--data->client_connections))
     977                buf_clear(&data->input_buffer);
    980978       
    981979        fibril_mutex_unlock(&data->mutex);
Note: See TracChangeset for help on using the changeset viewer.