Changeset ee9ea16 in mainline


Ignore:
Timestamp:
2011-09-19T12:29:04Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d46b13d
Parents:
c94f643
Message:

usbhub: Codestyle

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

Legend:

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

    rc94f643 ree9ea16  
    5656
    5757/**
    58  * usb hub driver operations
     58 * USB hub driver operations
    5959 *
    6060 * The most important one is add_device, which is set to usb_hub_add_device.
     
    6464};
    6565
    66 /**
    67  * hub endpoints, excluding control endpoint
    68  */
     66/** Hub endpoints, excluding control endpoint. */
    6967static usb_endpoint_description_t *usb_hub_endpoints[] = {
    7068        &hub_status_change_endpoint_description,
    71         NULL
     69        NULL,
    7270};
    73 
    74 /**
    75  * static usb hub driver information
    76  */
     71/** Static usb hub driver information. */
    7772static usb_driver_t usb_hub_driver = {
    7873        .name = NAME,
     
    8580{
    8681        printf(NAME ": HelenOS USB hub driver.\n");
    87 
    8882        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
    8983
     
    9488 * @}
    9589 */
    96 
  • uspace/drv/bus/usb/usbhub/usbhub.c

    rc94f643 ree9ea16  
    5757
    5858static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev);
    59 
    6059static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info);
    61 
    6260static int usb_hub_set_configuration(usb_hub_info_t *hub_info);
    63 
    6461static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info);
    65 
    6662static int usb_process_hub_over_current(usb_hub_info_t *hub_info,
    6763    usb_hub_status_t status);
    68 
    6964static int usb_process_hub_local_power_change(usb_hub_info_t *hub_info,
    7065    usb_hub_status_t status);
    71 
    7266static void usb_hub_process_global_interrupt(usb_hub_info_t *hub_info);
    73 
    7467static void usb_hub_polling_terminated_callback(usb_device_t *device,
    7568    bool was_error, void *data);
     
    9386        if (!usb_dev) return EINVAL;
    9487        usb_hub_info_t *hub_info = usb_hub_info_create(usb_dev);
     88
    9589        //create hc connection
    9690        usb_log_debug("Initializing USB wire abstraction.\n");
    9791        int opResult = usb_hc_connection_initialize_from_device(
    98             &hub_info->connection,
    99             hub_info->usb_device->ddf_dev);
    100         if (opResult != EOK) {
    101                 usb_log_error("Could not initialize connection to device, "
    102                     " %s\n",
     92            &hub_info->connection, hub_info->usb_device->ddf_dev);
     93        if (opResult != EOK) {
     94                usb_log_error("Could not initialize connection to device: %s\n",
    10395                    str_error(opResult));
    10496                free(hub_info);
     
    109101        opResult = usb_hub_set_configuration(hub_info);
    110102        if (opResult != EOK) {
    111                 usb_log_error("Could not set hub configuration, %s\n",
     103                usb_log_error("Could not set hub configuration: %s\n",
    112104                    str_error(opResult));
    113105                free(hub_info);
     
    190182 * @return basic usb_hub_info_t structure
    191183 */
    192 static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev) {
    193         usb_hub_info_t * result = malloc(sizeof (usb_hub_info_t));
    194         if (!result) return NULL;
     184static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev)
     185{
     186        usb_hub_info_t *result = malloc(sizeof (usb_hub_info_t));
     187        if (!result)
     188            return NULL;
     189
    195190        result->usb_device = usb_dev;
    196191        result->status_change_pipe = usb_dev->pipes[0].pipe;
     
    205200        fibril_condvar_initialize(&result->pending_ops_cv);
    206201        result->pending_ops_count = 0;
     202
    207203        return result;
    208204}
  • uspace/drv/bus/usb/usbhub/usbhub_private.h

    rc94f643 ree9ea16  
    6565 */
    6666static inline void usb_hub_set_descriptor_request(
    67     usb_device_request_setup_packet_t * request
    68     ) {
     67    usb_device_request_setup_packet_t *request )
     68{
    6969        request->index = 0;
    7070        request->request_type = USB_HUB_REQ_TYPE_GET_DESCRIPTOR;
     
    8585 */
    8686static inline int usb_hub_clear_port_feature(usb_pipe_t *pipe,
    87     int port_index,
    88     usb_hub_class_feature_t feature) {
     87    int port_index, usb_hub_class_feature_t feature)
     88{
    8989
    9090        usb_device_request_setup_packet_t clear_request = {
     
    109109 */
    110110static inline int usb_hub_set_port_feature(usb_pipe_t *pipe,
    111     int port_index,
    112     usb_hub_class_feature_t feature) {
     111    int port_index, usb_hub_class_feature_t feature)
     112{
    113113
    114114        usb_device_request_setup_packet_t clear_request = {
     
    152152 */
    153153static inline int usb_hub_set_feature(usb_pipe_t *pipe,
    154     usb_hub_class_feature_t feature) {
     154    usb_hub_class_feature_t feature)
     155{
    155156
    156157        usb_device_request_setup_packet_t clear_request = {
     
    166167
    167168
    168 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t * descriptor);
     169void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor);
    169170
    170 void usb_serialize_hub_descriptor(usb_hub_descriptor_t * descriptor,
    171     void * serialized_descriptor);
     171void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor,
     172    void *serialized_descriptor);
    172173
    173174int usb_deserialize_hub_desriptor(
  • uspace/drv/bus/usb/usbhub/utils.c

    rc94f643 ree9ea16  
    6868        size_t var_size = (descriptor->ports_count + 7) / 8;
    6969        size += 2 * var_size;
    70         uint8_t * result = malloc(size);
     70        uint8_t *result = malloc(size);
    7171        //size
    7272        if (result)
     
    8383 */
    8484void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor,
    85     void * serialized_descriptor) {
     85    void *serialized_descriptor)
     86{
    8687        //base size
    87         uint8_t * sdescriptor = serialized_descriptor;
     88        uint8_t *sdescriptor = serialized_descriptor;
    8889        size_t size = 7;
    8990        //variable size according to port count
     
    109110        }
    110111}
    111 
    112112/*----------------------------------------------------------------------------*/
    113113/**
     
    121121    void *serialized_descriptor, size_t size, usb_hub_descriptor_t *descriptor)
    122122{
    123         uint8_t * sdescriptor = serialized_descriptor;
     123        uint8_t *sdescriptor = serialized_descriptor;
    124124
    125125        if (sdescriptor[1] != USB_DESCTYPE_HUB) {
     
    138138        descriptor->current_requirement = sdescriptor[6];
    139139        const size_t var_size = (descriptor->ports_count + 7) / 8;
    140         //descriptor->devices_removable = (uint8_t*) malloc(var_size);
    141140
    142141        if (size < (7 + var_size)) {
Note: See TracChangeset for help on using the changeset viewer.