Changeset 2489353 in mainline for uspace/lib/usbdev/src/devdrv.c


Ignore:
Timestamp:
2018-01-13T20:47:58Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7dddd7b
Parents:
1ed3eb4
git-author:
Petr Manek <petr.manek@…> (2018-01-13 18:38:22)
git-committer:
Petr Manek <petr.manek@…> (2018-01-13 20:47:58)
Message:

usbdev: driver can destroy endpoint mappings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/devdrv.c

    r1ed3eb4 r2489353  
    4848#include <devman.h>
    4949#include <errno.h>
     50#include <str_error.h>
    5051#include <stdlib.h>
    5152
     
    299300
    300301        /* Destroy the pipes. */
     302        int rc;
    301303        for (size_t i = 0; i < usb_dev->pipes_count; ++i) {
    302304                usb_log_debug2("Unregistering pipe %zu: %spresent.\n",
    303305                    i, usb_dev->pipes[i].present ? "" : "not ");
    304                 if (usb_dev->pipes[i].present)
    305                         usb_pipe_unregister(&usb_dev->pipes[i].pipe);
     306
     307                rc = usb_device_unmap_ep(usb_dev->pipes + i);
     308                if (rc != EOK && rc != ENOENT)
     309                        usb_log_warning("Unregistering pipe %zu failed: %s", i, str_error(rc));
    306310        }
    307311
     
    337341        }
    338342        return NULL;
     343}
     344
     345int usb_device_unmap_ep(usb_endpoint_mapping_t *epm)
     346{
     347        assert(epm);
     348
     349        if (!epm->present)
     350                return ENOENT;
     351
     352        const int rc = usb_pipe_unregister(&epm->pipe);
     353        if (rc != EOK)
     354                return rc;
     355
     356        epm->present = false;
     357        return EOK;
    339358}
    340359
Note: See TracChangeset for help on using the changeset viewer.