Changeset 57e06ef in mainline


Ignore:
Timestamp:
2011-10-28T22:19:29Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fd1f0c6
Parents:
48ae3ef
Message:

ohci: Minor improvements.

Remove unused member.
Fix comments.
Add const qualifiers and asserts.

Location:
uspace/drv/bus/usb/ohci
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/endpoint_list.c

    r48ae3ef r57e06ef  
    7373 * Does not check whether this replaces an existing list.
    7474 */
    75 void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next)
     75void endpoint_list_set_next(
     76    const endpoint_list_t *instance, const endpoint_list_t *next)
    7677{
    7778        assert(instance);
  • uspace/drv/bus/usb/ohci/endpoint_list.h

    r48ae3ef r57e06ef  
    6868
    6969int endpoint_list_init(endpoint_list_t *instance, const char *name);
    70 void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next);
     70void endpoint_list_set_next(
     71    const endpoint_list_t *instance, const endpoint_list_t *next);
    7172void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep);
    7273void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep);
  • uspace/drv/bus/usb/ohci/hc.c

    r48ae3ef r57e06ef  
    221221}
    222222/*----------------------------------------------------------------------------*/
    223 void hc_enqueue_endpoint(hc_t *instance, endpoint_t *ep)
    224 {
     223void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
     224{
     225        assert(instance);
     226        assert(ep);
     227
    225228        endpoint_list_t *list = &instance->lists[ep->transfer_type];
    226229        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
     230        assert(list);
     231        assert(ohci_ep);
     232
    227233        /* Enqueue ep */
    228234        switch (ep->transfer_type) {
     
    247253}
    248254/*----------------------------------------------------------------------------*/
    249 void hc_dequeue_endpoint(hc_t *instance, endpoint_t *ep)
    250 {
     255void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
     256{
     257        assert(instance);
     258        assert(ep);
     259
    251260        /* Dequeue ep */
    252261        endpoint_list_t *list = &instance->lists[ep->transfer_type];
    253262        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
     263
     264        assert(list);
     265        assert(ohci_ep);
    254266        switch (ep->transfer_type) {
    255267        case USB_TRANSFER_CONTROL:
  • uspace/drv/bus/usb/ohci/hc.h

    r48ae3ef r57e06ef  
    8686static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
    8787
    88 void hc_enqueue_endpoint(hc_t *instance, endpoint_t *ep);
    89 void hc_dequeue_endpoint(hc_t *instance, endpoint_t *ep);
     88void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep);
     89void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep);
    9090
    9191void hc_interrupt(hc_t *instance, uint32_t status);
  • uspace/drv/bus/usb/ohci/ohci_endpoint.c

    r48ae3ef r57e06ef  
    6565 *
    6666 * @param[in] ep USBD endpoint structure
    67  * @return pointer to a new hcd endpoint structure, NULL on failure.
     67 * @return Error code.
    6868 */
    6969int ohci_endpoint_init(hcd_t *hcd, endpoint_t *ep)
     
    9090        endpoint_set_hc_data(
    9191            ep, ohci_ep, ohci_ep_toggle_get, ohci_ep_toggle_set);
    92         ohci_ep->hcd = hcd;
    9392        hc_enqueue_endpoint(hcd->private_data, ep);
    9493        return EOK;
     
    9796/** Disposes hcd endpoint structure
    9897 *
    99  * @param[in] hcd_ep endpoint structure
     98 * @param[in] hcd driver using this instance.
     99 * @param[in] ep endpoint structure.
    100100 */
    101101void ohci_endpoint_fini(hcd_t *hcd, endpoint_t *ep)
  • uspace/drv/bus/usb/ohci/ohci_endpoint.h

    r48ae3ef r57e06ef  
    5151        /** Linked list used by driver software */
    5252        link_t link;
    53         /** Device using this ep */
    54         hcd_t *hcd;
    5553} ohci_endpoint_t;
    5654
     
    6260 * @return Pointer to assigned hcd endpoint structure
    6361 */
    64 static inline ohci_endpoint_t * ohci_endpoint_get(endpoint_t *ep)
     62static inline ohci_endpoint_t * ohci_endpoint_get(const endpoint_t *ep)
    6563{
    6664        assert(ep);
Note: See TracChangeset for help on using the changeset viewer.