Exemplo n.º 1
0
static uint8_t gb_control_connected(struct gb_operation *operation)
{
    int retval;
    struct gb_control_connected_request *request =
        gb_operation_get_request_payload(operation);

    if (gb_operation_get_request_payload_size(operation) < sizeof(*request)) {
        gb_error("dropping short message\n");
        return GB_OP_INVALID;
    }

    retval = gb_listen(le16_to_cpu(request->cport_id));
    if (retval) {
        gb_error("Can not connect cport %d: error %d\n",
                 le16_to_cpu(request->cport_id), retval);
        return GB_OP_INVALID;
    }

    retval = gb_notify(le16_to_cpu(request->cport_id), GB_EVT_CONNECTED);
    if (retval)
        goto error_notify;

    return GB_OP_SUCCESS;

error_notify:
    gb_stop_listening(le16_to_cpu(request->cport_id));

    return gb_errno_to_op_result(retval);
}
Exemplo n.º 2
0
static uint8_t gb_control_disconnected(struct gb_operation *operation)
{
    int retval;
    struct gb_control_connected_request *request =
        gb_operation_get_request_payload(operation);

    if (gb_operation_get_request_payload_size(operation) < sizeof(*request)) {
        gb_error("dropping short message\n");
        return GB_OP_INVALID;
    }

    retval = gb_notify(le16_to_cpu(request->cport_id), GB_EVT_DISCONNECTED);
    if (retval) {
        gb_error("Cannot notify GB driver of disconnect event.\n");
        /*
         * don't return, we still want to reset the cport and stop listening
         * on the CPort.
         */
    }

#ifdef CONFIG_ARCH_CHIP_TSB
    unipro_reset_cport(le16_to_cpu(request->cport_id), NULL, NULL);
#endif

    retval = gb_stop_listening(le16_to_cpu(request->cport_id));
    if (retval) {
        gb_error("Can not disconnect cport %d: error %d\n",
                 le16_to_cpu(request->cport_id), retval);
        return GB_OP_INVALID;
    }

    return GB_OP_SUCCESS;
}
Exemplo n.º 3
0
static uint8_t gb_control_disconnected(struct gb_operation *operation)
{
    int retval;
    struct gb_control_connected_request *request =
        gb_operation_get_request_payload(operation);

    if (gb_operation_get_request_payload_size(operation) < sizeof(*request)) {
        gb_error("dropping short message\n");
        return GB_OP_INVALID;
    }

    unipro_reset_cport(le16_to_cpu(request->cport_id), NULL, NULL);

    retval = gb_stop_listening(le16_to_cpu(request->cport_id));
    if (retval) {
        gb_error("Can not disconnect cport %d: error %d\n",
                 le16_to_cpu(request->cport_id), retval);
        return GB_OP_INVALID;
    }

    return GB_OP_SUCCESS;
}