mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-07-19 16:24:45 -04:00
platform driver log format fix
This commit is contained in:
@@ -71,7 +71,7 @@ void GpioCntlrRemove(struct GpioCntlr *cntlr)
|
||||
}
|
||||
|
||||
if (cntlr->device == NULL) {
|
||||
HDF_LOGE("GpioCntlrRemove: no device associated!\n");
|
||||
HDF_LOGE("GpioCntlrRemove: no device associated!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ static struct GpioCntlr *GpioGetCntlr(void)
|
||||
}
|
||||
service = (struct GpioCntlr*)DevSvcManagerClntGetService("HDF_PLATFORM_GPIO");
|
||||
if (service == NULL) {
|
||||
HDF_LOGE("GpioGetCntlr: get service fail!\n");
|
||||
HDF_LOGE("GpioGetCntlr: get service fail!");
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
@@ -41,12 +41,12 @@ int32_t I2cCntlrTransfer(struct I2cCntlr *cntlr, struct I2cMsg *msgs, int16_t co
|
||||
int32_t ret;
|
||||
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("I2cCntlrTransfer: cntlr is null\n");
|
||||
HDF_LOGE("I2cCntlrTransfer: cntlr is null");
|
||||
return HDF_ERR_INVALID_OBJECT;
|
||||
}
|
||||
|
||||
if (cntlr->ops == NULL || cntlr->ops->transfer == NULL) {
|
||||
HDF_LOGE("I2cCntlrTransfer: ops or transfer is null\n");
|
||||
HDF_LOGE("I2cCntlrTransfer: ops or transfer is null");
|
||||
return HDF_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ int32_t I2cCntlrAdd(struct I2cCntlr *cntlr)
|
||||
}
|
||||
|
||||
if (cntlr->device == NULL) {
|
||||
HDF_LOGE("I2cCntlrAdd: no device associated!\n");
|
||||
HDF_LOGE("I2cCntlrAdd: no device associated!");
|
||||
return HDF_ERR_INVALID_OBJECT;
|
||||
}
|
||||
|
||||
if (cntlr->ops == NULL) {
|
||||
HDF_LOGE("I2cCntlrAdd: no ops supplied!\n");
|
||||
HDF_LOGE("I2cCntlrAdd: no ops supplied!");
|
||||
return HDF_ERR_INVALID_OBJECT;
|
||||
}
|
||||
if (OsalMutexInit(&cntlr->lock) != HDF_SUCCESS) {
|
||||
HDF_LOGE("I2cCntlrAdd: init lock fail!\n");
|
||||
HDF_LOGE("I2cCntlrAdd: init lock fail!");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
cntlr->device->service = &cntlr->service;
|
||||
@@ -84,7 +84,7 @@ void I2cCntlrRemove(struct I2cCntlr *cntlr)
|
||||
}
|
||||
|
||||
if (cntlr->device == NULL) {
|
||||
HDF_LOGE("I2cCntlrBind: no device associated!\n");
|
||||
HDF_LOGE("I2cCntlrBind: no device associated!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ static struct I2cCntlr *I2cCntlrGetByNumber(int16_t num)
|
||||
char *cntlrName = NULL;
|
||||
|
||||
if (num < 0 || num >= I2C_BUS_MAX) {
|
||||
HDF_LOGE("I2cCntlrGetByNumber: invalid num:%d\n", num);
|
||||
HDF_LOGE("I2cCntlrGetByNumber: invalid num:%d", num);
|
||||
return NULL;
|
||||
}
|
||||
cntlrName = OsalMemCalloc(SERVICE_NAME_LEN + 1);
|
||||
@@ -57,13 +57,13 @@ static struct I2cCntlr *I2cCntlrGetByNumber(int16_t num)
|
||||
}
|
||||
if (snprintf_s(cntlrName, SERVICE_NAME_LEN + 1, SERVICE_NAME_LEN,
|
||||
"HDF_PLATFORM_I2C_%d", num) < 0) {
|
||||
HDF_LOGE("I2cCntlrGetByNumber: format cntlr name fail!\n");
|
||||
HDF_LOGE("I2cCntlrGetByNumber: format cntlr name fail!");
|
||||
OsalMemFree(cntlrName);
|
||||
return NULL;
|
||||
}
|
||||
cntlr = (struct I2cCntlr *)DevSvcManagerClntGetService(cntlrName);
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("I2cCntlrGetByNumber: get cntlr fail!\n");
|
||||
HDF_LOGE("I2cCntlrGetByNumber: get cntlr fail!");
|
||||
}
|
||||
OsalMemFree(cntlrName);
|
||||
return cntlr;
|
||||
|
||||
@@ -42,11 +42,11 @@ int32_t SpiCntlrTransfer(struct SpiCntlr *cntlr, uint32_t csNum, struct SpiMsg *
|
||||
int32_t ret;
|
||||
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("%s: invalid parameter\n", __func__);
|
||||
HDF_LOGE("%s: invalid parameter", __func__);
|
||||
return HDF_ERR_INVALID_PARAM;
|
||||
}
|
||||
if (cntlr->method == NULL || cntlr->method->Transfer == NULL) {
|
||||
HDF_LOGE("%s: transfer not support\n", __func__);
|
||||
HDF_LOGE("%s: transfer not support", __func__);
|
||||
return HDF_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ int32_t SpiCntlrSetCfg(struct SpiCntlr *cntlr, uint32_t csNum, struct SpiCfg *cf
|
||||
int32_t ret;
|
||||
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("%s: invalid parameter\n", __func__);
|
||||
HDF_LOGE("%s: invalid parameter", __func__);
|
||||
return HDF_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (cntlr->method == NULL || cntlr->method->SetCfg == NULL) {
|
||||
HDF_LOGE("%s: not support\n", __func__);
|
||||
HDF_LOGE("%s: not support", __func__);
|
||||
return HDF_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ int32_t SpiCntlrGetCfg(struct SpiCntlr *cntlr, uint32_t csNum, struct SpiCfg *cf
|
||||
int32_t ret;
|
||||
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("%s: invalid parameter\n", __func__);
|
||||
HDF_LOGE("%s: invalid parameter", __func__);
|
||||
return HDF_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (cntlr->method == NULL || cntlr->method->GetCfg == NULL) {
|
||||
HDF_LOGE("%s: not support\n", __func__);
|
||||
HDF_LOGE("%s: not support", __func__);
|
||||
return HDF_ERR_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
@@ -113,13 +113,13 @@ struct SpiCntlr *SpiCntlrCreate(struct HdfDeviceObject *device)
|
||||
struct SpiCntlr *cntlr = NULL;
|
||||
|
||||
if (device == NULL) {
|
||||
HDF_LOGE("%s: invalid parameter\n", __func__);
|
||||
HDF_LOGE("%s: invalid parameter", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cntlr = (struct SpiCntlr *)OsalMemCalloc(sizeof(*cntlr));
|
||||
if (cntlr == NULL) {
|
||||
HDF_LOGE("%s: OsalMemCalloc error\n", __func__);
|
||||
HDF_LOGE("%s: OsalMemCalloc error", __func__);
|
||||
return NULL;
|
||||
}
|
||||
cntlr->device = device;
|
||||
|
||||
@@ -56,7 +56,7 @@ static struct SpiCntlr *SpiGetCntlrByBusNum(uint32_t num)
|
||||
}
|
||||
ret = snprintf_s(name, HOST_NAME_LEN + 1, HOST_NAME_LEN, "HDF_PLATFORM_SPI_%u", num);
|
||||
if (ret < 0) {
|
||||
HDF_LOGE("%s: snprintf_s failed\n", __func__);
|
||||
HDF_LOGE("%s: snprintf_s failed", __func__);
|
||||
OsalMemFree(name);
|
||||
return NULL;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ int32_t SpiGetCfg(struct DevHandle *handle, struct SpiCfg *cfg)
|
||||
void SpiClose(struct DevHandle *handle)
|
||||
{
|
||||
if (handle == NULL) {
|
||||
HDF_LOGE("%s: handle is NULL\n", __func__);
|
||||
HDF_LOGE("%s: handle is NULL", __func__);
|
||||
return;
|
||||
}
|
||||
if (handle->object != NULL) {
|
||||
@@ -147,12 +147,12 @@ struct DevHandle *SpiOpen(const struct SpiDevInfo *info)
|
||||
}
|
||||
handle = (struct DevHandle *)OsalMemCalloc(sizeof(*handle));
|
||||
if (handle == NULL) {
|
||||
HDF_LOGE("%s: handle malloc error\n", __func__);
|
||||
HDF_LOGE("%s: handle malloc error", __func__);
|
||||
return NULL;
|
||||
}
|
||||
object = (struct SpiObject *)OsalMemCalloc(sizeof(*object));
|
||||
if (object == NULL) {
|
||||
HDF_LOGE("%s: object malloc error\n", __func__);
|
||||
HDF_LOGE("%s: object malloc error", __func__);
|
||||
OsalMemFree(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -50,12 +50,12 @@ struct UartHost *UartHostCreate(struct HdfDeviceObject *device)
|
||||
struct UartHost *host = NULL;
|
||||
|
||||
if (device == NULL) {
|
||||
HDF_LOGE("%s: invalid parameter\n", __func__);
|
||||
HDF_LOGE("%s: invalid parameter", __func__);
|
||||
return NULL;
|
||||
}
|
||||
host = (struct UartHost *)OsalMemCalloc(sizeof(*host));
|
||||
if (host == NULL) {
|
||||
HDF_LOGE("%s: OsalMemCalloc error\n", __func__);
|
||||
HDF_LOGE("%s: OsalMemCalloc error", __func__);
|
||||
return NULL;
|
||||
}
|
||||
host->device = device;
|
||||
|
||||
@@ -52,7 +52,7 @@ static struct UartHost *UartGetHostByBusNum(uint32_t num)
|
||||
ret = snprintf_s(name, UART_HOST_NAME_LEN + 1, UART_HOST_NAME_LEN,
|
||||
"HDF_PLATFORM_UART_%u", num);
|
||||
if (ret < 0) {
|
||||
HDF_LOGE("%s: snprintf_s failed\n", __func__);
|
||||
HDF_LOGE("%s: snprintf_s failed", __func__);
|
||||
OsalMemFree(name);
|
||||
return NULL;
|
||||
}
|
||||
@@ -68,16 +68,16 @@ struct DevHandle *UartOpen(uint32_t port)
|
||||
|
||||
host = UartGetHostByBusNum(port);
|
||||
if (host == NULL) {
|
||||
HDF_LOGE("%s: get host error\n", __func__);
|
||||
HDF_LOGE("%s: get host error", __func__);
|
||||
return NULL;
|
||||
}
|
||||
handle = (struct DevHandle *)OsalMemCalloc(sizeof(*handle));
|
||||
if (handle == NULL) {
|
||||
HDF_LOGE("%s: handle malloc error\n", __func__);
|
||||
HDF_LOGE("%s: handle malloc error", __func__);
|
||||
return NULL;
|
||||
}
|
||||
if (UartHostInit(host) != HDF_SUCCESS) {
|
||||
HDF_LOGE("%s: UartHostInit error\n", __func__);
|
||||
HDF_LOGE("%s: UartHostInit error", __func__);
|
||||
OsalMemFree(handle);
|
||||
return NULL;
|
||||
}
|
||||
@@ -88,11 +88,11 @@ struct DevHandle *UartOpen(uint32_t port)
|
||||
void UartClose(struct DevHandle *handle)
|
||||
{
|
||||
if (handle == NULL) {
|
||||
HDF_LOGE("%s: handle is NULL\n", __func__);
|
||||
HDF_LOGE("%s: handle is NULL", __func__);
|
||||
return;
|
||||
}
|
||||
if (UartHostDeinit((struct UartHost *)handle->object) != HDF_SUCCESS) {
|
||||
HDF_LOGE("%s: UartHostDeinit error\n", __func__);
|
||||
HDF_LOGE("%s: UartHostDeinit error", __func__);
|
||||
}
|
||||
OsalMemFree(handle);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ static struct Watchdog *WatchdogGetById(int16_t wdtId)
|
||||
struct Watchdog *service = NULL;
|
||||
|
||||
if (wdtId < 0 || wdtId >= WATCHDOG_ID_MAX) {
|
||||
HDF_LOGE("WatchdogGetById: invalid id:%d\n", wdtId);
|
||||
HDF_LOGE("WatchdogGetById: invalid id:%d", wdtId);
|
||||
return NULL;
|
||||
}
|
||||
serviceName = OsalMemCalloc(WATCHDOG_NAME_LEN + 1);
|
||||
@@ -57,13 +57,13 @@ static struct Watchdog *WatchdogGetById(int16_t wdtId)
|
||||
}
|
||||
if (snprintf_s(serviceName, WATCHDOG_NAME_LEN + 1, WATCHDOG_NAME_LEN,
|
||||
"HDF_PLATFORM_WATCHDOG_%d", wdtId) < 0) {
|
||||
HDF_LOGE("WatchdogGetById: format service name fail!\n");
|
||||
HDF_LOGE("WatchdogGetById: format service name fail!");
|
||||
OsalMemFree(serviceName);
|
||||
return NULL;
|
||||
}
|
||||
service = (struct Watchdog *)DevSvcManagerClntGetService(serviceName);
|
||||
if (service == NULL) {
|
||||
HDF_LOGE("WatchdogGetById: get service fail!\n");
|
||||
HDF_LOGE("WatchdogGetById: get service fail!");
|
||||
}
|
||||
OsalMemFree(serviceName);
|
||||
return service;
|
||||
|
||||
Reference in New Issue
Block a user