Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 272f46f8 in mainline


Ignore:
Timestamp:
2011-11-25T18:55:20Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
b4292e7
Parents:
095bddfc
Message:

libdrv/drvusbhc: Remove data_size field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    r095bddfc r272f46f8  
    357357        ipc_callid_t data_caller;
    358358        void *buffer;
    359         size_t size;
    360359} async_transaction_t;
    361360
     
    382381        trans->data_caller = 0;
    383382        trans->buffer = NULL;
    384         trans->size = 0;
    385383
    386384        return trans;
     
    466464    int outcome, void *arg)
    467465{
    468         async_transaction_t *trans = (async_transaction_t *)arg;
     466        async_transaction_t *trans = arg;
    469467
    470468        async_answer_0(trans->caller, outcome);
     
    472470        async_transaction_destroy(trans);
    473471}
    474 
     472/*----------------------------------------------------------------------------*/
    475473static void callback_in(ddf_fun_t *fun,
    476474    int outcome, size_t actual_size, void *arg)
     
    487485        }
    488486
    489         trans->size = actual_size;
    490 
    491487        if (trans->data_caller) {
    492488                async_data_read_finalize(trans->data_caller,
     
    498494        async_transaction_destroy(trans);
    499495}
    500 
     496/*----------------------------------------------------------------------------*/
    501497void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
    502498    ipc_callid_t callid, ipc_call_t *call)
     
    576572        }
    577573
    578         if (!async_data_read_receive(&trans->data_caller, &trans->size)) {
     574        size_t size = 0;
     575        if (!async_data_read_receive(&trans->data_caller, &size)) {
    579576                async_answer_0(callid, EPARTY);
    580577                return;
    581578        }
    582579
    583         trans->buffer = malloc(trans->size);
     580        trans->buffer = malloc(size);
    584581        if (trans->buffer == NULL) {
    585582                async_answer_0(trans->data_caller, ENOMEM);
     
    589586
    590587        const int rc = hc_iface->read(
    591             fun, target, setup, trans->buffer, trans->size, callback_in, trans);
     588            fun, target, setup, trans->buffer, size, callback_in, trans);
    592589
    593590        if (rc != EOK) {
     
    597594        }
    598595}
    599 
     596/*----------------------------------------------------------------------------*/
    600597void remote_usbhc_write(
    601598    ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
     
    624621        }
    625622
     623        size_t size = 0;
    626624        if (data_buffer_len > 0) {
    627                 int rc = async_data_write_accept(&trans->buffer, false,
     625                const int rc = async_data_write_accept(&trans->buffer, false,
    628626                    1, USB_MAX_PAYLOAD_SIZE,
    629                     0, &trans->size);
     627                    0, &size);
    630628
    631629                if (rc != EOK) {
     
    636634        }
    637635
    638         int rc = hc_iface->write(
    639             fun, target, setup, trans->buffer, trans->size, callback_out, trans);
     636        const int rc = hc_iface->write(
     637            fun, target, setup, trans->buffer, size, callback_out, trans);
    640638
    641639        if (rc != EOK) {
     
    644642        }
    645643}
    646 
    647 
    648644/**
    649645 * @}
Note: See TracChangeset for help on using the changeset viewer.