Changeset a1b7e80 in mainline for uspace/drv/char/ns8250/ns8250.c


Ignore:
Timestamp:
2011-09-02T16:54:18Z (13 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f480d7e
Parents:
7a72ce1a (diff), 224c0e7 (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 basic infrastructure for anticipated device removal from
lp:~jsvoboda/helenos/devrem

File:
1 edited

Legend:

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

    r7a72ce1a ra1b7e80  
    112112        fibril_mutex_t mutex;
    113113} ns8250_t;
    114 
    115 /** Create per-device soft-state structure.
    116  *
    117  * @return      Pointer to soft-state structure.
    118  */
    119 static ns8250_t *ns8250_new(void)
    120 {
    121         ns8250_t *ns;
    122        
    123         ns = (ns8250_t *) calloc(1, sizeof(ns8250_t));
    124         if (ns == NULL)
    125                 return NULL;
    126        
    127         fibril_mutex_initialize(&ns->mutex);
    128         return ns;
    129 }
    130 
    131 /** Delete soft-state structure.
    132  *
    133  * @param ns    The driver data structure.
    134  */
    135 static void ns8250_delete(ns8250_t *ns)
    136 {
    137         assert(ns != NULL);
    138         free(ns);
    139 }
    140114
    141115/** Find out if there is some incomming data available on the serial port.
     
    721695       
    722696        /* Allocate soft-state for the device */
    723         ns = ns8250_new();
     697        ns = ddf_dev_data_alloc(dev, sizeof(ns8250_t));
    724698        if (ns == NULL) {
    725699                rc = ENOMEM;
     
    727701        }
    728702       
     703        fibril_mutex_initialize(&ns->mutex);
    729704        ns->dev = dev;
    730         dev->driver_data = ns;
    731705       
    732706        rc = ns8250_dev_initialize(ns);
     
    792766        if (need_cleanup)
    793767                ns8250_dev_cleanup(ns);
    794         if (ns != NULL)
    795                 ns8250_delete(ns);
    796768        return rc;
    797769}
Note: See TracChangeset for help on using the changeset viewer.