Changes in / [a1b7e80:f480d7e] in mainline


Ignore:
Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    ra1b7e80 rf480d7e  
    9696
    9797static int isa_add_device(ddf_dev_t *dev);
     98static int isa_fun_online(ddf_fun_t *fun);
     99static int isa_fun_offline(ddf_fun_t *fun);
    98100
    99101/** The isa device driver's standard operations */
    100102static driver_ops_t isa_ops = {
    101         .add_device = &isa_add_device
     103        .add_device = &isa_add_device,
     104        .fun_online = &isa_fun_online,
     105        .fun_offline = &isa_fun_offline
    102106};
    103107
     
    495499}
    496500
     501static int isa_fun_online(ddf_fun_t *fun)
     502{
     503        ddf_msg(LVL_DEBUG, "isa_fun_online()");
     504        return ddf_fun_online(fun);
     505}
     506
     507static int isa_fun_offline(ddf_fun_t *fun)
     508{
     509        ddf_msg(LVL_DEBUG, "isa_fun_offline()");
     510        return ddf_fun_offline(fun);
     511}
     512
     513
    497514static void isa_init()
    498515{
  • uspace/drv/char/ns8250/ns8250.c

    ra1b7e80 rf480d7e  
    111111        /** The fibril mutex for synchronizing the access to the device. */
    112112        fibril_mutex_t mutex;
     113        /** True if device is removed. */
     114        bool removed;
    113115} ns8250_t;
    114116
     
    219221
    220222static int ns8250_add_device(ddf_dev_t *dev);
     223static int ns8250_dev_remove(ddf_dev_t *dev);
    221224
    222225/** The serial port device driver's standard operations. */
    223226static driver_ops_t ns8250_ops = {
    224         .add_device = &ns8250_add_device
     227        .add_device = &ns8250_add_device,
     228        .dev_remove = &ns8250_dev_remove
    225229};
    226230
     
    612616}
    613617
     618/** Deinitialize the serial port device.
     619 *
     620 * @param ns            Serial port device
     621 */
     622static void ns8250_port_cleanup(ns8250_t *ns)
     623{
     624        /* Disable FIFO */
     625        pio_write_8(ns->port + 2, 0x00);
     626        /* Disable DTR, RTS, OUT1, OUT2 (int. enable) */
     627        pio_write_8(ns->port + 4, 0x00);
     628        /* Disable all interrupts from the port */
     629        ns8250_port_interrupts_disable(ns->port);
     630}
     631
    614632/** Read the data from the serial port device and store them to the input
    615633 * buffer.
     
    769787}
    770788
     789static int ns8250_dev_remove(ddf_dev_t *dev)
     790{
     791        ns8250_t *ns = NS8250_FROM_DEV(dev);
     792        int rc;
     793       
     794        fibril_mutex_lock(&ns->mutex);
     795        if (ns->client_connected) {
     796                fibril_mutex_unlock(&ns->mutex);
     797                return EBUSY;
     798        }
     799        ns->removed = true;
     800        fibril_mutex_unlock(&ns->mutex);
     801       
     802        rc = ddf_fun_unbind(ns->fun);
     803        if (rc != EOK) {
     804                ddf_msg(LVL_ERROR, "Failed to unbind function.");
     805                return rc;
     806        }
     807       
     808        ddf_fun_destroy(ns->fun);
     809       
     810        ns8250_port_cleanup(ns);
     811        ns8250_unregister_interrupt_handler(ns);
     812        ns8250_dev_cleanup(ns);
     813        return EOK;
     814}
     815
    771816/** Open the device.
    772817 *
     
    778823static int ns8250_open(ddf_fun_t *fun)
    779824{
    780         ns8250_t *data = (ns8250_t *) fun->dev->driver_data;
     825        ns8250_t *ns = NS8250(fun);
    781826        int res;
    782827       
    783         fibril_mutex_lock(&data->mutex);
    784         if (data->client_connected) {
     828        fibril_mutex_lock(&ns->mutex);
     829        if (ns->client_connected) {
    785830                res = ELIMIT;
     831        } else if (ns->removed) {
     832                res = ENXIO;
    786833        } else {
    787834                res = EOK;
    788                 data->client_connected = true;
    789         }
    790         fibril_mutex_unlock(&data->mutex);
     835                ns->client_connected = true;
     836        }
     837        fibril_mutex_unlock(&ns->mutex);
    791838       
    792839        return res;
  • uspace/lib/c/include/errno.h

    ra1b7e80 rf480d7e  
    5555#define EIO           (-265)
    5656#define EMLINK        (-266)
     57#define ENXIO         (-267)
    5758
    5859/** Bad checksum. */
  • uspace/srv/devman/main.c

    ra1b7e80 rf480d7e  
    326326                        }
    327327                       
     328                        /* Verify that driver removed all functions */
     329                        fibril_rwlock_read_lock(&device_tree.rwlock);
     330                        if (!list_empty(&dev->functions)) {
     331                                fibril_rwlock_read_unlock(&device_tree.rwlock);
     332                                return EIO;
     333                        }
     334                        fibril_rwlock_read_unlock(&device_tree.rwlock);
     335                       
    328336                        detach_driver(&device_tree, dev);
    329337                       
Note: See TracChangeset for help on using the changeset viewer.