Changeset fbe148ee in mainline


Ignore:
Timestamp:
2011-10-30T13:13:14Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
54d1ad9
Parents:
9871bca
Message:

usbhid: Add trivial device_remove implementation.

Add const qualifiers.
Comment fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/main.c

    r9871bca rfbe148ee  
    4646#include "usbhid.h"
    4747
    48 /*----------------------------------------------------------------------------*/
    49 
    5048#define NAME "usbhid"
    5149
     
    6765 *
    6866 * @param dev Device to add.
    69  *
    70  * @retval EOK if successful.
    71  * @retval ENOMEM if there
    72  * @return Other error code inherited from one of functions usb_kbd_init(),
    73  *         ddf_fun_bind() and ddf_fun_add_to_class().
     67 * @return Error code.
    7468 */
    7569static int usb_hid_try_add_device(usb_device_t *dev)
     
    138132        return EOK;
    139133}
    140 
    141134/*----------------------------------------------------------------------------*/
    142135/**
     
    146139 *
    147140 * @param dev Structure representing the new device.
    148  *
    149  * @retval EOK if successful.
    150  * @retval EREFUSED if the device is not supported.
     141 * @return Error code.
    151142 */
    152143static int usb_hid_device_add(usb_device_t *dev)
     
    179170        return EOK;
    180171}
    181 
    182 /*----------------------------------------------------------------------------*/
    183 
     172/*----------------------------------------------------------------------------*/
     173/**
     174 * Callback for a device about to be removed from the driver.
     175 *
     176 * @param dev Structure representing the device.
     177 * @return Error code.
     178 */
     179static int usb_hid_device_rem(usb_device_t *dev)
     180{
     181        return EOK;
     182}
     183/*----------------------------------------------------------------------------*/
    184184/**
    185185 * Callback for removing a device from the driver.
    186186 *
    187187 * @param dev Structure representing the device.
    188  *
    189  * @retval EOK if successful.
    190  * @retval EREFUSED if the device is not supported.
     188 * @return Error code.
    191189 */
    192190static int usb_hid_device_gone(usb_device_t *dev)
     
    198196                if (!tries--) {
    199197                        usb_log_error("Can't remove hub, still running.\n");
    200                         return EINPROGRESS;
     198                        return EBUSY;
    201199                }
    202200        }
     
    207205        return EOK;
    208206}
    209 
     207/*----------------------------------------------------------------------------*/
    210208/** USB generic driver callbacks */
    211 static usb_driver_ops_t usb_hid_driver_ops = {
     209static const usb_driver_ops_t usb_hid_driver_ops = {
    212210        .device_add = usb_hid_device_add,
     211        .device_rem = usb_hid_device_rem,
    213212        .device_gone = usb_hid_device_gone,
    214213};
    215 
    216 
     214/*----------------------------------------------------------------------------*/
    217215/** The driver itself. */
    218 static usb_driver_t usb_hid_driver = {
     216static const usb_driver_t usb_hid_driver = {
    219217        .name = NAME,
    220218        .ops = &usb_hid_driver_ops,
    221219        .endpoints = usb_hid_endpoints
    222220};
    223 
    224 /*----------------------------------------------------------------------------*/
    225 
     221/*----------------------------------------------------------------------------*/
    226222int main(int argc, char *argv[])
    227223{
     
    232228        return usb_driver_main(&usb_hid_driver);
    233229}
    234 
    235230/**
    236231 * @}
Note: See TracChangeset for help on using the changeset viewer.