11 Star 100 Fork 85

OpenHarmony / vendor_huawei_hdf

 / 详情

[uart_sample.c]将ioService的绑定流程移动到Bind方法中

已完成
任务
创建于  
2020-09-11 17:01

需要把ioService的绑定流程重构到HdfUartSampleBind方法中

static int32_t SampleAttach(struct UartHost *host, struct HdfDeviceObject *device)
{
    int32_t ret;
    struct UartDevice *uartDevice = NULL;
    if (device->property == NULL) {
        HDF_LOGE("%s: property is NULL", __func__);
        return HDF_FAILURE;
    }
    uartDevice = (struct UartDevice *)OsalMemCalloc(sizeof(struct UartDevice));
    if (uartDevice == NULL) {
        HDF_LOGE("%s: OsalMemCalloc uartDevice error", __func__);
        return HDF_ERR_MALLOC_FAIL;
    }
    SampleDispatchConstruct(uartDevice);
    device->service = &uartDevice->ioService; // 服务应该在HdfUartSampleBind方法中进行绑定
    ret = UartDeviceGetResource(uartDevice, device->property);
    if (ret != HDF_SUCCESS) {
        (void)OsalMemFree(uartDevice);
        return HDF_FAILURE;
    }
    host->num = uartDevice->resource.num;
    host->priv = uartDevice;
    UartSampleAddDev(host);
    return UartDeviceInit(uartDevice);
}

评论 (0)

Zhangchunxin 创建了任务
Zhangchunxin 通过openharmony/vendor_huawei_hdf Pull Request !5任务状态待办的 修改为已完成
展开全部操作日志

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(1)
7850629 aqxyjay 1602859273
1
https://gitee.com/openharmony/vendor_huawei_hdf.git
git@gitee.com:openharmony/vendor_huawei_hdf.git
openharmony
vendor_huawei_hdf
vendor_huawei_hdf

搜索帮助