Changeset 5a6cc679 in mainline for uspace/drv/bus/usb/usbhub


Ignore:
Timestamp:
2018-01-31T02:21:24Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0a9cc2
Parents:
132ab5d1
Message:

Merge commit '50f19b7ee8e94570b5c63896736c4eb49cfa18db' into forwardport

Not all ints are converted to errno_t in xhci tree yet, however it compiles and works :)

Location:
uspace/drv/bus/usb/usbhub
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    r132ab5d1 r5a6cc679  
    101101 * Routine for adding a new device in USB2.
    102102 */
    103 static int enumerate_device_usb2(usb_hub_port_t *port, async_exch_t *exch)
    104 {
    105         int err;
     103static errno_t enumerate_device_usb2(usb_hub_port_t *port, async_exch_t *exch)
     104{
     105        errno_t err;
    106106
    107107        port_log(debug, port, "Requesting default address.");
     
    145145 * Routine for adding a new device in USB 3.
    146146 */
    147 static int enumerate_device_usb3(usb_hub_port_t *port, async_exch_t *exch)
    148 {
    149         int err;
     147static errno_t enumerate_device_usb3(usb_hub_port_t *port, async_exch_t *exch)
     148{
     149        errno_t err;
    150150
    151151        port_log(debug, port, "Issuing a warm reset.");
     
    170170}
    171171
    172 static int enumerate_device(usb_port_t *port_base)
     172static errno_t enumerate_device(usb_port_t *port_base)
    173173{
    174174        usb_hub_port_t *port = get_hub_port(port_base);
     
    181181        }
    182182
    183         const int err = port->hub->speed == USB_SPEED_SUPER
     183        const errno_t err = port->hub->speed == USB_SPEED_SUPER
    184184                ? enumerate_device_usb3(port, exch)
    185185                : enumerate_device_usb2(port, exch);
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r132ab5d1 r5a6cc679  
    9999};
    100100
    101 static int usb_set_first_configuration(usb_device_t *);
    102 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *);
     101static errno_t usb_set_first_configuration(usb_device_t *);
     102static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *);
    103103static void usb_hub_over_current(const usb_hub_dev_t *, usb_hub_status_t);
    104 static int usb_hub_polling_init(usb_hub_dev_t *, usb_endpoint_mapping_t *);
     104static errno_t usb_hub_polling_init(usb_hub_dev_t *, usb_endpoint_mapping_t *);
    105105static void usb_hub_global_interrupt(const usb_hub_dev_t *);
    106106
    107107static bool usb_hub_polling_error_callback(usb_device_t *dev,
    108         int err_code, void *arg)
     108        errno_t err_code, void *arg)
    109109{
    110110        assert(dev);
     
    125125 * @return error code
    126126 */
    127 int usb_hub_device_add(usb_device_t *usb_dev)
     127errno_t usb_hub_device_add(usb_device_t *usb_dev)
    128128{
    129129        int err;
     
    198198}
    199199
    200 static int usb_hub_cleanup(usb_hub_dev_t *hub)
     200static errno_t usb_hub_cleanup(usb_hub_dev_t *hub)
    201201{
    202202        free(hub->polling.buffer);
     
    228228 * @return error code
    229229 */
    230 int usb_hub_device_remove(usb_device_t *usb_dev)
     230errno_t usb_hub_device_remove(usb_device_t *usb_dev)
    231231{
    232232        assert(usb_dev);
     
    249249 * @return error code
    250250 */
    251 int usb_hub_device_gone(usb_device_t *usb_dev)
     251errno_t usb_hub_device_gone(usb_device_t *usb_dev)
    252252{
    253253        assert(usb_dev);
     
    270270 * @param mapping The mapping of Status Change Endpoint
    271271 */
    272 static int usb_hub_polling_init(usb_hub_dev_t *hub_dev,
     272static errno_t usb_hub_polling_init(usb_hub_dev_t *hub_dev,
    273273        usb_endpoint_mapping_t *mapping)
    274274{
    275         int err;
     275        errno_t err;
    276276        usb_polling_t *polling = &hub_dev->polling;
    277277
     
    369369 * @return error code
    370370 */
    371 static int usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
     371static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
    372372{
    373373        assert(hub_dev);
     
    382382        usb_hub_descriptor_header_t descriptor;
    383383        size_t received_size;
    384         int opResult = usb_request_get_descriptor(control_pipe,
     384        errno_t opResult = usb_request_get_descriptor(control_pipe,
    385385            USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE,
    386386            desc_type, 0, 0, &descriptor,
     
    436436 * @return error code
    437437 */
    438 static int usb_set_first_configuration(usb_device_t *usb_device)
     438static errno_t usb_set_first_configuration(usb_device_t *usb_device)
    439439{
    440440        assert(usb_device);
     
    462462        /* Set configuration. Use the configuration that was in
    463463         * usb_device->descriptors.configuration i.e. The first one. */
    464         int opResult = usb_request_set_configuration(
     464        errno_t opResult = usb_request_set_configuration(
    465465            usb_device_get_default_pipe(usb_device),
    466466            config_descriptor->configuration_number);
     
    500500        /* Over-current condition is gone, it is safe to turn the ports on. */
    501501        for (size_t port = 0; port < hub_dev->port_count; ++port) {
    502                 const int ret = usb_hub_set_port_feature(hub_dev, port,
     502                const errno_t ret = usb_hub_set_port_feature(hub_dev, port,
    503503                    USB_HUB_FEATURE_PORT_POWER);
    504504                if (ret != EOK) {
     
    637637        /* NOTE: We can't use standard USB GET_STATUS request, because
    638638         * hubs reply is 4byte instead of 2 */
    639         const int opResult = usb_pipe_control_read(control_pipe,
     639        const errno_t opResult = usb_pipe_control_read(control_pipe,
    640640            &get_hub_status_request, sizeof(get_hub_status_request),
    641641            &status, sizeof(usb_hub_status_t), &rcvd_size);
     
    655655                usb_hub_over_current(hub_dev, status);
    656656                /* Ack change in hub OC flag */
    657                 const int ret = usb_request_clear_feature(
     657                const errno_t ret = usb_request_clear_feature(
    658658                    control_pipe, USB_REQUEST_TYPE_CLASS,
    659659                    USB_REQUEST_RECIPIENT_DEVICE,
     
    679679                 * Just ACK the change.
    680680                 */
    681                 const int ret = usb_request_clear_feature(
     681                const errno_t ret = usb_request_clear_feature(
    682682                    control_pipe, USB_REQUEST_TYPE_CLASS,
    683683                    USB_REQUEST_RECIPIENT_DEVICE,
  • uspace/drv/bus/usb/usbhub/usbhub.h

    r132ab5d1 r5a6cc679  
    7878extern const usb_endpoint_description_t *usb_hub_endpoints [];
    7979
    80 int usb_hub_device_add(usb_device_t *);
    81 int usb_hub_device_remove(usb_device_t *);
    82 int usb_hub_device_gone(usb_device_t *);
     80errno_t usb_hub_device_add(usb_device_t *);
     81errno_t usb_hub_device_remove(usb_device_t *);
     82errno_t usb_hub_device_gone(usb_device_t *);
    8383
    84 int usb_hub_set_depth(const usb_hub_dev_t *);
    85 int usb_hub_get_port_status(const usb_hub_dev_t *, size_t, usb_port_status_t *);
    86 int usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);
    87 int usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);
     84errno_t usb_hub_set_depth(const usb_hub_dev_t *);
     85errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t, usb_port_status_t *);
     86errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);
     87errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t, usb_hub_class_feature_t);
    8888
    8989bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *);
    9090
    91 int usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, usb_port_t *);
    92 int usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *);
     91errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *, usb_port_t *);
     92errno_t usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *);
    9393
    9494#endif
Note: See TracChangeset for help on using the changeset viewer.