提交 09fd3b19 编写于 作者: Y YOUR_NAME

modify hdf log print none when hilog is disable

Change-Id: I966ecf5dbbf22a917cfdf0acd90a4bfb11745265
上级 c11131d5
......@@ -28,7 +28,7 @@ static struct HdfIoService *GetIoService()
ioService = HdfIoServiceBind(GPIO_SERVICE_NAME);
if (ioService == NULL) {
HDF_LOGE("Failed to get service %{public}s", GPIO_SERVICE_NAME);
HDF_LOGE("Failed to get service %s", GPIO_SERVICE_NAME);
}
return ioService;
}
......@@ -53,7 +53,7 @@ static int32_t GpioOperate(enum GpioOps ops, uint16_t gpio, uint16_t val)
}
ret = service->dispatcher->Dispatch(&service->object, ops, data, NULL);
if (ret != HDF_SUCCESS) {
HDF_LOGE("Failed to send service call, ret: %{public}d", ret);
HDF_LOGE("Failed to send service call, ret: %d", ret);
}
HdfSBufRecycle(data);
return ret;
......
......@@ -25,29 +25,29 @@ int main()
uint16_t dir;
uint16_t val;
if (GpioOpen() != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioOpen failed", __func__);
HDF_LOGE("%s: GpioOpen failed", __func__);
return HDF_FAILURE;
}
if (GpioSetDir(GPIO_PIN, GPIO_DIR_IN) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioSetDir failed, gpio %{public}u, dir %{public}u", __func__, GPIO_PIN, GPIO_DIR_IN);
HDF_LOGE("%s: GpioSetDir failed, gpio %u, dir %u", __func__, GPIO_PIN, GPIO_DIR_IN);
return HDF_FAILURE;
}
if (GpioWrite(GPIO_PIN, GPIO_VAL_HIGH) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioWrite failed, gpio %{public}u, val %{public}u", __func__, GPIO_PIN, GPIO_VAL_HIGH);
HDF_LOGE("%s: GpioWrite failed, gpio %u, val %u", __func__, GPIO_PIN, GPIO_VAL_HIGH);
return HDF_FAILURE;
}
if (GpioGetDir(GPIO_PIN, &dir) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioGetDir failed, gpio %{public}u", __func__, GPIO_PIN);
HDF_LOGE("%s: GpioGetDir failed, gpio %u", __func__, GPIO_PIN);
return HDF_FAILURE;
}
if (GpioRead(GPIO_PIN, &val) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioRead failed, gpio %{public}u", __func__, GPIO_PIN);
HDF_LOGE("%s: GpioRead failed, gpio %u", __func__, GPIO_PIN);
return HDF_FAILURE;
}
if (GpioClose() != HDF_SUCCESS) {
HDF_LOGE("%{public}s: GpioClose failed", __func__);
HDF_LOGE("%s: GpioClose failed", __func__);
return HDF_FAILURE;
}
HDF_LOGD("GPIO %{public}u direction is set to %{public}u, value is set to %{public}u", GPIO_PIN, dir, val);
HDF_LOGD("GPIO %u direction is set to %u, value is set to %u", GPIO_PIN, dir, val);
return HDF_SUCCESS;
}
\ No newline at end of file
......@@ -22,11 +22,11 @@ static int32_t SampleGpioSetDir(struct GpioCntlr *cntlr, struct HdfSBuf *data)
uint16_t gpio;
uint16_t dir;
if (!HdfSbufReadUint16(data, &gpio) || !HdfSbufReadUint16(data, &dir)) {
HDF_LOGE("%{public}s: HdfSbufReadUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufReadUint16 failed", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (cntlr->ops->setDir == NULL) {
HDF_LOGE("%{public}s: cntlr->ops->setDir is NULL", __func__);
HDF_LOGE("%s: cntlr->ops->setDir is NULL", __func__);
return HDF_DEV_ERR_OP;
}
return cntlr->ops->setDir(cntlr, gpio, dir);
......@@ -38,20 +38,20 @@ static int32_t SampleGpioGetDir(struct GpioCntlr *cntlr, struct HdfSBuf *data, s
uint16_t gpio;
uint16_t dir;
if (!HdfSbufReadUint16(data, &gpio)) {
HDF_LOGE("%{public}s: HdfSbufReadUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufReadUint16 failed", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (cntlr->ops->getDir == NULL) {
HDF_LOGE("%{public}s: cntlr->ops->getDir is NULL", __func__);
HDF_LOGE("%s: cntlr->ops->getDir is NULL", __func__);
return HDF_DEV_ERR_OP;
}
ret = cntlr->ops->getDir(cntlr, gpio, &dir);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: cntlr->ops->getDir failed, ret: %{public}d", __func__, ret);
HDF_LOGE("%s: cntlr->ops->getDir failed, ret: %d", __func__, ret);
return ret;
}
if (!HdfSbufWriteUint16(reply, dir)) {
HDF_LOGE("%{public}s: HdfSbufWriteUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufWriteUint16 failed", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
......@@ -62,11 +62,11 @@ static int32_t SampleGpioWrite(struct GpioCntlr *cntlr, struct HdfSBuf *data)
uint16_t gpio;
uint16_t val;
if (!HdfSbufReadUint16(data, &gpio) || !HdfSbufReadUint16(data, &val)) {
HDF_LOGE("%{public}s: HdfSbufReadUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufReadUint16 failed", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (cntlr->ops->write == NULL) {
HDF_LOGE("%{public}s: cntlr->ops->read is NULL", __func__);
HDF_LOGE("%s: cntlr->ops->read is NULL", __func__);
return HDF_DEV_ERR_OP;
}
return cntlr->ops->write(cntlr, gpio, val);
......@@ -78,20 +78,20 @@ static int32_t SampleGpioRead(struct GpioCntlr *cntlr, struct HdfSBuf *data, str
uint16_t gpio;
uint16_t val;
if (!HdfSbufReadUint16(data, &gpio)) {
HDF_LOGE("%{public}s: HdfSbufReadUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufReadUint16 failed", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (cntlr->ops->read == NULL) {
HDF_LOGE("%{public}s: cntlr->ops->read is NULL", __func__);
HDF_LOGE("%s: cntlr->ops->read is NULL", __func__);
return HDF_DEV_ERR_OP;
}
ret = cntlr->ops->read(cntlr, gpio, &val);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: cntlr->ops->read failed, ret: %{public}d", __func__, ret);
HDF_LOGE("%s: cntlr->ops->read failed, ret: %d", __func__, ret);
return ret;
}
if (!HdfSbufWriteUint16(reply, val)) {
HDF_LOGE("%{public}s: HdfSbufWriteUint16 failed", __func__);
HDF_LOGE("%s: HdfSbufWriteUint16 failed", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
......@@ -100,13 +100,13 @@ static int32_t SampleGpioRead(struct GpioCntlr *cntlr, struct HdfSBuf *data, str
int32_t SampleGpioDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply)
{
if (client == NULL || client->device == NULL) {
HDF_LOGE("%{public}s: client or client->device is NULL", __func__);
HDF_LOGE("%s: client or client->device is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
struct GpioCntlr *cntlr = (struct GpioCntlr *)client->device->service;
if (cntlr == NULL || cntlr->ops == NULL) {
HDF_LOGE("%{public}s: cntlr or cntlr->ops is NULL", __func__);
HDF_LOGE("%s: cntlr or cntlr->ops is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
......@@ -120,7 +120,7 @@ int32_t SampleGpioDispatch(struct HdfDeviceIoClient *client, int cmdId, struct H
case GPIO_OPS_READ:
return SampleGpioRead(cntlr, data, reply);
default:
HDF_LOGE("%{public}s: invalid cmdId %{public}d", __func__, cmdId);
HDF_LOGE("%s: invalid cmdId %d", __func__, cmdId);
return HDF_FAILURE;
}
}
\ No newline at end of file
......@@ -24,12 +24,12 @@ int32_t Pl061GetGroupByGpioNum(struct GpioCntlr *cntlr, uint16_t gpio, struct Gp
uint16_t groupIndex = Pl061ToGroupNum(gpio);
if (cntlr == NULL) {
HDF_LOGE("%{public}s: cntlr is NULL", __func__);
HDF_LOGE("%s: cntlr is NULL", __func__);
return HDF_ERR_INVALID_OBJECT;
}
pl061 = ToPl061GpioCntlr(cntlr);
if (groupIndex >= pl061->groupNum) {
HDF_LOGE("%{public}s: err group index:%{public}u", __func__, groupIndex);
HDF_LOGE("%s: err group index:%u", __func__, groupIndex);
return HDF_ERR_INVALID_PARAM;
}
*group = &pl061->groups[groupIndex];
......
......@@ -73,7 +73,7 @@ static void ReleaseGpioCntlrMem(struct Pl061GpioCntlr *cntlr);
/* HdfDriverEntry hook function implementations */
static int32_t SampleGpioDriverBind(struct HdfDeviceObject *device)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
struct Pl061GpioCntlr *pl061Cntlr = &g_samplePl061GpioCntlr;
pl061Cntlr->cntlr.device = device;
device->service = &(pl061Cntlr->cntlr.service);
......@@ -86,34 +86,34 @@ static int32_t SampleGpioDriverInit(struct HdfDeviceObject *device)
int32_t ret;
struct Pl061GpioCntlr *pl061Cntlr = &g_samplePl061GpioCntlr;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (device == NULL || device->property == NULL) {
HDF_LOGE("%{public}s: device or property NULL!", __func__);
HDF_LOGE("%s: device or property NULL!", __func__);
return HDF_ERR_INVALID_OBJECT;
}
ret = GetGpioDeviceResource(pl061Cntlr, device->property);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: get gpio device resource fail:%{public}d", __func__, ret);
HDF_LOGE("%s: get gpio device resource fail:%d", __func__, ret);
return ret;
}
if (pl061Cntlr->groupNum > GROUP_MAX || pl061Cntlr->groupNum <= 0 || pl061Cntlr->bitNum > BIT_MAX ||
pl061Cntlr->bitNum <= 0) {
HDF_LOGE("%{public}s: invalid groupNum:%{public}u or bitNum:%{public}u", __func__, pl061Cntlr->groupNum,
HDF_LOGE("%s: invalid groupNum:%u or bitNum:%u", __func__, pl061Cntlr->groupNum,
pl061Cntlr->bitNum);
return HDF_ERR_INVALID_PARAM;
}
pl061Cntlr->regBase = OsalIoRemap(pl061Cntlr->phyBase, pl061Cntlr->groupNum * pl061Cntlr->regStep);
if (pl061Cntlr->regBase == NULL) {
HDF_LOGE("%{public}s: err remap phy:0x%{public}x", __func__, pl061Cntlr->phyBase);
HDF_LOGE("%s: err remap phy:0x%x", __func__, pl061Cntlr->phyBase);
return HDF_ERR_IO;
}
ret = InitGpioCntlrMem(pl061Cntlr);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: err init cntlr mem:%{public}d", __func__, ret);
HDF_LOGE("%s: err init cntlr mem:%d", __func__, ret);
OsalIoUnmap((void *)pl061Cntlr->regBase);
pl061Cntlr->regBase = NULL;
return ret;
......@@ -123,10 +123,10 @@ static int32_t SampleGpioDriverInit(struct HdfDeviceObject *device)
pl061Cntlr->cntlr.ops = &g_sampleGpioMethod;
ret = GpioCntlrAdd(&pl061Cntlr->cntlr);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: err add controller: %{public}d", __func__, ret);
HDF_LOGE("%s: err add controller: %d", __func__, ret);
return ret;
}
HDF_LOGI("%{public}s: dev service:%{public}s init success!", __func__, HdfDeviceGetServiceName(device));
HDF_LOGI("%s: dev service:%s init success!", __func__, HdfDeviceGetServiceName(device));
return ret;
}
......@@ -135,15 +135,15 @@ static void SampleGpioDriverRelease(struct HdfDeviceObject *device)
struct GpioCntlr *gpioCntlr = NULL;
struct Pl061GpioCntlr *pl061GpioCntlr = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (device == NULL) {
HDF_LOGE("%{public}s: device is null!", __func__);
HDF_LOGE("%s: device is null!", __func__);
return;
}
gpioCntlr = GpioCntlrFromDevice(device);
if (gpioCntlr == NULL) {
HDF_LOGE("%{public}s: no service bound!", __func__);
HDF_LOGE("%s: no service bound!", __func__);
return;
}
GpioCntlrRemove(gpioCntlr);
......@@ -162,43 +162,43 @@ static int32_t GetGpioDeviceResource(struct Pl061GpioCntlr *cntlr, const struct
dri = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE);
if (dri == NULL || dri->GetUint8 == NULL || dri->GetUint16 == NULL || dri->GetUint32 == NULL) {
HDF_LOGE("%{public}s: invalid dri ops fail!", __func__);
HDF_LOGE("%s: invalid dri ops fail!", __func__);
return HDF_FAILURE;
}
ret = dri->GetUint32(node, "regBase", &cntlr->phyBase, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read regBase fail!", __func__);
HDF_LOGE("%s: read regBase fail!", __func__);
return ret;
}
ret = dri->GetUint32(node, "regStep", &cntlr->regStep, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read regStep fail!", __func__);
HDF_LOGE("%s: read regStep fail!", __func__);
return ret;
}
ret = dri->GetUint16(node, "groupNum", &cntlr->groupNum, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read groupNum fail!", __func__);
HDF_LOGE("%s: read groupNum fail!", __func__);
return ret;
}
ret = dri->GetUint16(node, "bitNum", &cntlr->bitNum, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read bitNum fail!", __func__);
HDF_LOGE("%s: read bitNum fail!", __func__);
return ret;
}
ret = dri->GetUint32(node, "irqStart", &cntlr->irqStart, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read irqStart fail!", __func__);
HDF_LOGE("%s: read irqStart fail!", __func__);
return ret;
}
ret = dri->GetUint8(node, "irqShare", &cntlr->irqShare, 0);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read irqShare fail!", __func__);
HDF_LOGE("%s: read irqShare fail!", __func__);
return ret;
}
......@@ -252,7 +252,7 @@ static void ReleaseGpioCntlrMem(struct Pl061GpioCntlr *cntlr)
/* GPIO function implementations */
static int32_t SampleGpioWrite(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t val)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int32_t ret;
uint32_t irqSave;
......@@ -278,13 +278,13 @@ static int32_t SampleGpioWrite(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t
}
OSAL_WRITEL(valCur, addr);
(void)OsalSpinUnlockIrqRestore(&group->lock, &irqSave);
HDF_LOGD("%{public}s: gpio:%{public}u, val:%{public}u", __func__, gpio, val);
HDF_LOGD("%s: gpio:%u, val:%u", __func__, gpio, val);
return HDF_SUCCESS;
}
static int32_t SampleGpioRead(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *val)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int32_t ret;
unsigned int valCur;
......@@ -304,13 +304,13 @@ static int32_t SampleGpioRead(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *
} else {
*val = GPIO_VAL_LOW;
}
HDF_LOGD("%{public}s: gpio:%{public}u, val:%{public}u", __func__, gpio, *val);
HDF_LOGD("%s: gpio:%u, val:%u", __func__, gpio, *val);
return HDF_SUCCESS;
}
static int32_t SampleGpioSetDirection(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t dir)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int32_t ret;
uint32_t irqSave;
......@@ -319,7 +319,7 @@ static int32_t SampleGpioSetDirection(struct GpioCntlr *cntlr, uint16_t gpio, ui
unsigned int bitNum = Pl061ToBitNum(gpio);
struct GpioGroup *group = NULL;
HDF_LOGD("%{public}s: gpio:%{public}u, dir:%{public}d", __func__, gpio, dir);
HDF_LOGD("%s: gpio:%u, dir:%d", __func__, gpio, dir);
ret = Pl061GetGroupByGpioNum(cntlr, gpio, &group);
if (ret != HDF_SUCCESS) {
return ret;
......@@ -341,7 +341,7 @@ static int32_t SampleGpioSetDirection(struct GpioCntlr *cntlr, uint16_t gpio, ui
}
static int32_t SampleGpioGetDirection(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *dir)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int32_t ret;
unsigned int val;
......@@ -349,7 +349,7 @@ static int32_t SampleGpioGetDirection(struct GpioCntlr *cntlr, uint16_t gpio, ui
unsigned int bitNum = Pl061ToBitNum(gpio);
struct GpioGroup *group = NULL;
HDF_LOGD("%{public}s: gpio:%{public}u, dir:%{public}d", __func__, gpio, dir);
HDF_LOGD("%s: gpio:%u, dir:%d", __func__, gpio, dir);
ret = Pl061GetGroupByGpioNum(cntlr, gpio, &group);
if (ret != HDF_SUCCESS) {
return ret;
......
......@@ -42,7 +42,7 @@ int main()
msg.speed = 115200; /* Speed of this transfer */
ret = SpiTransfer(spiHandle, &msg);
if (ret != HDF_SUCCESS) {
HDF_LOGE("SpiTransfer failed, ret %{public}d", ret);
HDF_LOGE("SpiTransfer failed, ret %d", ret);
return ret;
}
SpiClose(spiHandle);
......
......@@ -22,21 +22,21 @@
static int32_t SampleSpiTransfer(struct SpiCntlr *cntlr, struct HdfSBuf *txBuf)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
uint32_t readSize = sizeof(struct SpiMsg);
struct SpiMsg *msg = NULL;
if (cntlr == NULL || cntlr->priv == NULL || txBuf == NULL) {
HDF_LOGE("%{public}s: invalid parameter", __func__);
HDF_LOGE("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
if (!HdfSbufReadBuffer(txBuf, (const void **)&msg, &readSize)) {
HDF_LOGE("%{public}s: Failed to read sbuf", __func__);
HDF_LOGE("%s: Failed to read sbuf", __func__);
return HDF_DEV_ERR_NO_MEMORY;
}
if (SampleSpiCntlrTransfer(cntlr, msg, msg->len) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: SampleSpiCntlrTransfer error", __func__);
HDF_LOGE("%s: SampleSpiCntlrTransfer error", __func__);
return HDF_FAILURE;
}
return HDF_SUCCESS;
......@@ -45,13 +45,13 @@ static int32_t SampleSpiTransfer(struct SpiCntlr *cntlr, struct HdfSBuf *txBuf)
int32_t SampleSpiDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply)
{
if (client == NULL || client->device == NULL) {
HDF_LOGE("%{public}s: client or client->device is NULL", __func__);
HDF_LOGE("%s: client or client->device is NULL", __func__);
return HDF_FAILURE;
}
struct SpiCntlr *cntlr = (struct SpiCntlr *)client->device->service;
if (cntlr == NULL || cntlr->method == NULL) {
HDF_LOGE("%{public}s: cntlr or cntlr->method is NULL", __func__);
HDF_LOGE("%s: cntlr or cntlr->method is NULL", __func__);
return HDF_FAILURE;
}
......@@ -59,7 +59,7 @@ int32_t SampleSpiDispatch(struct HdfDeviceIoClient *client, int cmdId, struct Hd
case SPI_TRANSFER:
return SampleSpiTransfer(cntlr, data);
default:
HDF_LOGE("%{public}s: invalid cmdId %{public}d", __func__, cmdId);
HDF_LOGE("%s: invalid cmdId %d", __func__, cmdId);
return HDF_FAILURE;
}
}
\ No newline at end of file
......@@ -43,13 +43,13 @@ int ConfigPl022SpiCntlr(struct Pl022SpiCntlr *cntlr)
}
/* Min possible */
if ((cntlr->speed < cntlr->minSpeedHz) || (cntlr->speed == 0)) {
HDF_LOGE("%{public}s: cntlr->speed is %{public}u not support, max %{public}u, min %{public}u", __func__,
HDF_LOGE("%s: cntlr->speed is %u not support, max %u, min %u", __func__,
cntlr->speed, cntlr->maxSpeedHz, cntlr->minSpeedHz);
return HDF_FAILURE;
}
/* Check if we can provide the requested bits_per_word */
if ((cntlr->bitsPerWord < BITS_PER_WORD_MIN) || (cntlr->bitsPerWord > BITS_PER_WORD_MAX)) {
HDF_LOGE("%{public}s: cntlr->bitsPerWord is %{public}u not support", __func__, cntlr->bitsPerWord);
HDF_LOGE("%s: cntlr->bitsPerWord is %u not support", __func__, cntlr->bitsPerWord);
return HDF_FAILURE;
}
/* compute spi speed, speed=clk/(cpsdvsr*(scr+1)) */
......@@ -133,7 +133,7 @@ static int Pl022SampleFlushFifo(const struct Pl022SpiCntlr *cntlr)
break;
}
if (tmp++ > cntlr->fifoSize) {
HDF_LOGE("%{public}s: spi transfer check rx fifo wait timeout", __func__);
HDF_LOGE("%s: spi transfer check rx fifo wait timeout", __func__);
return HDF_ERR_TIMEOUT;
}
OSAL_READL((UINTPTR)(cntlr->regBase) + REG_SPI_PL022_DR);
......@@ -301,7 +301,7 @@ static int32_t Pl022SampleCfgCs(struct Pl022SpiCntlr *cntlr, uint32_t cs)
uint32_t miscCtrlCs;
if ((cs + 1) > cntlr->numCs) {
HDF_LOGE("%{public}s: cs %{public}u is big than cntlr csNum %{public}u", __func__, cs, cntlr->numCs);
HDF_LOGE("%s: cs %u is big than cntlr csNum %u", __func__, cs, cntlr->numCs);
return HDF_FAILURE;
}
if (cntlr->numCs == 1) {
......@@ -335,7 +335,7 @@ static int Pl022SampleCheckTimeout(const struct Pl022SpiCntlr *cntlr)
break;
}
if (tmp++ > MAX_WAIT) {
HDF_LOGE("%{public}s: spi transfer wait timeout", __func__);
HDF_LOGE("%s: spi transfer wait timeout", __func__);
return HDF_ERR_TIMEOUT;
}
OsalUDelay(1);
......
......@@ -60,16 +60,16 @@ static struct SpiDev *FindDeviceByCsNum(const struct Pl022SpiCntlr *pl022Cntlr,
/* HdfDriverEntry hook function implementations */
static int32_t SampleSpiDriverBind(struct HdfDeviceObject *device)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
struct SpiCntlr *cntlr = NULL;
if (device == NULL) {
HDF_LOGE("%{public}s: device is NULL", __func__);
HDF_LOGE("%s: device is NULL", __func__);
return HDF_ERR_INVALID_OBJECT;
}
cntlr = SpiCntlrCreate(device);
if (cntlr == NULL) {
HDF_LOGE("%{public}s: cntlr is NULL", __func__);
HDF_LOGE("%s: cntlr is NULL", __func__);
return HDF_FAILURE;
}
......@@ -79,26 +79,26 @@ static int32_t SampleSpiDriverBind(struct HdfDeviceObject *device)
static int32_t SampleSpiDriverInit(struct HdfDeviceObject *device)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int ret;
struct SpiCntlr *cntlr = NULL;
if (device == NULL || device->property == NULL) {
HDF_LOGE("%{public}s: device or device->property is null", __func__);
HDF_LOGE("%s: device or device->property is null", __func__);
return HDF_ERR_INVALID_OBJECT;
}
cntlr = SpiCntlrFromDevice(device);
if (cntlr == NULL) {
HDF_LOGE("%{public}s: cntlr is null", __func__);
HDF_LOGE("%s: cntlr is null", __func__);
return HDF_ERR_INVALID_OBJECT;
}
ret = InitSpiDevice(cntlr, device->property);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: InitSpiDevice failed", __func__);
HDF_LOGE("%s: InitSpiDevice failed", __func__);
return ret;
}
ret = ConfigSpiDevice(cntlr->priv);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: ConfigSpiDevice failed", __func__);
HDF_LOGE("%s: ConfigSpiDevice failed", __func__);
return ret;
}
return ret;
......@@ -106,15 +106,15 @@ static int32_t SampleSpiDriverInit(struct HdfDeviceObject *device)
static void SampleSpiDriverRelease(struct HdfDeviceObject *device)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
struct SpiCntlr *cntlr = NULL;
if (device == NULL) {
HDF_LOGE("%{public}s: device is null", __func__);
HDF_LOGE("%s: device is null", __func__);
return;
}
cntlr = SpiCntlrFromDevice(device);
if (cntlr == NULL) {
HDF_LOGE("%{public}s: cntlr is null", __func__);
HDF_LOGE("%s: cntlr is null", __func__);
return;
}
if (cntlr->priv != NULL) {
......@@ -126,19 +126,19 @@ static void SampleSpiDriverRelease(struct HdfDeviceObject *device)
/* SPI function implementations */
int32_t SampleSpiCntlrTransfer(struct SpiCntlr *cntlr, struct SpiMsg *msg, uint32_t count)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
int ret;
struct Pl022SpiCntlr *pl022Cntlr = NULL;
struct SpiDev *spiDev = NULL;
if (cntlr == NULL || cntlr->priv == NULL || msg == NULL || count == 0) {
HDF_LOGE("%{public}s: invalid parameter", __func__);
HDF_LOGE("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
pl022Cntlr = (struct Pl022SpiCntlr *)cntlr->priv;
spiDev = FindDeviceByCsNum(pl022Cntlr, cntlr->curCs);
if (spiDev == NULL) {
HDF_LOGE("%{public}s: spiDev is null, curCs %{public}u", __func__, cntlr->curCs);
HDF_LOGE("%s: spiDev is null, curCs %u", __func__, cntlr->curCs);
return HDF_FAILURE;
}
pl022Cntlr->mode = spiDev->mode;
......@@ -149,7 +149,7 @@ int32_t SampleSpiCntlrTransfer(struct SpiCntlr *cntlr, struct SpiMsg *msg, uint3
for (uint32_t i = 0; i < count; i++) {
ret = TransferOneMessage(pl022Cntlr, &(msg[i]));
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: transfer error", __func__);
HDF_LOGE("%s: transfer error", __func__);
return ret;
}
}
......@@ -158,25 +158,25 @@ int32_t SampleSpiCntlrTransfer(struct SpiCntlr *cntlr, struct SpiMsg *msg, uint3
int32_t SampleSpiCntlrSetCfg(struct SpiCntlr *cntlr, struct SpiCfg *cfg)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
struct Pl022SpiCntlr *pl022Cntlr = NULL;
struct SpiDev *spiDev = NULL;
if (cntlr == NULL || cntlr->priv == NULL || cfg == NULL) {
HDF_LOGE("%{public}s: invalid parameter", __func__);
HDF_LOGE("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
pl022Cntlr = (struct Pl022SpiCntlr *)cntlr->priv;
spiDev = FindDeviceByCsNum(pl022Cntlr, cntlr->curCs);
if (spiDev == NULL) {
HDF_LOGE("%{public}s: spiDev is null, curCs %{public}u", __func__, cntlr->curCs);
HDF_LOGE("%s: spiDev is null, curCs %u", __func__, cntlr->curCs);
return HDF_FAILURE;
}
spiDev->mode = cfg->mode;
spiDev->transferMode = cfg->transferMode;
spiDev->bitsPerWord = cfg->bitsPerWord;
if ((cfg->bitsPerWord < BITS_PER_WORD_MIN) || (cfg->bitsPerWord > BITS_PER_WORD_MAX)) {
HDF_LOGE("%{public}s: bitsPerWord %{public}u not support, use default bitsPerWord %{public}u",
HDF_LOGE("%s: bitsPerWord %u not support, use default bitsPerWord %u",
__func__, cfg->bitsPerWord, BITS_PER_WORD_DEFAULT);
spiDev->bitsPerWord = BITS_PER_WORD_DEFAULT;
}
......@@ -188,18 +188,18 @@ int32_t SampleSpiCntlrSetCfg(struct SpiCntlr *cntlr, struct SpiCfg *cfg)
int32_t SampleSpiCntlrGetCfg(struct SpiCntlr *cntlr, struct SpiCfg *cfg)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
struct Pl022SpiCntlr *pl022Cntlr = NULL;
struct SpiDev *spiDev = NULL;
if (cntlr == NULL || cntlr->priv == NULL || cfg == NULL) {
HDF_LOGE("%{public}s: invalid parameter", __func__);
HDF_LOGE("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
pl022Cntlr = (struct Pl022SpiCntlr *)cntlr->priv;
spiDev = FindDeviceByCsNum(pl022Cntlr, cntlr->curCs);
if (spiDev == NULL) {
HDF_LOGE("%{public}s: spiDev is null, curCs %{public}u", __func__, cntlr->curCs);
HDF_LOGE("%s: spiDev is null, curCs %u", __func__, cntlr->curCs);
return HDF_FAILURE;
}
cfg->mode = spiDev->mode;
......@@ -217,12 +217,12 @@ static int InitSpiDevice(struct SpiCntlr *cntlr, const struct DeviceResourceNode
pl022Cntlr = (struct Pl022SpiCntlr *)OsalMemCalloc(sizeof(*pl022Cntlr));
if (pl022Cntlr == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc error", __func__);
HDF_LOGE("%s: OsalMemCalloc error", __func__);
return HDF_FAILURE;
}
ret = InitSpiDeviceResource(pl022Cntlr, property);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: InitSpiDeviceResource error", __func__);
HDF_LOGE("%s: InitSpiDeviceResource error", __func__);
OsalMemFree(pl022Cntlr);
return HDF_FAILURE;
}
......@@ -247,7 +247,7 @@ static int ConfigSpiDevice(struct Pl022SpiCntlr *pl022Cntlr)
ret = ConfigPl022SpiCntlr(pl022Cntlr);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: HiPl022Config error", __func__);
HDF_LOGE("%s: HiPl022Config error", __func__);
}
return ret;
}
......@@ -259,44 +259,44 @@ static int32_t InitSpiDeviceResource(struct Pl022SpiCntlr *pl022Cntlr, const str
resIf = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE);
if (resIf == NULL || resIf->GetUint8 == NULL || resIf->GetUint16 == NULL || resIf->GetUint32 == NULL) {
HDF_LOGE("%{public}s: resource is invalid", __func__);
HDF_LOGE("%s: resource is invalid", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint32(node, "regBase", &tmp, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read regBase fail", __func__);
HDF_LOGE("%s: read regBase fail", __func__);
return HDF_FAILURE;
}
pl022Cntlr->regBase = (void *)(uintptr_t)(IO_DEVICE_ADDR(tmp));
if (resIf->GetUint32(node, "busNum", &pl022Cntlr->busNum, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read busNum fail", __func__);
HDF_LOGE("%s: read busNum fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint32(node, "numCs", &pl022Cntlr->numCs, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read numCs fail", __func__);
HDF_LOGE("%s: read numCs fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint32(node, "speed", &pl022Cntlr->speed, DEFAULT_SPEED) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read speed fail", __func__);
HDF_LOGE("%s: read speed fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint32(node, "fifoSize", &pl022Cntlr->fifoSize, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read fifoSize fail", __func__);
HDF_LOGE("%s: read fifoSize fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint32(node, "clkRate", &pl022Cntlr->clkRate, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read clkRate fail", __func__);
HDF_LOGE("%s: read clkRate fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint16(node, "mode", &pl022Cntlr->mode, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read mode fail", __func__);
HDF_LOGE("%s: read mode fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint8(node, "bitsPerWord", &pl022Cntlr->bitsPerWord, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read bitsPerWord fail", __func__);
HDF_LOGE("%s: read bitsPerWord fail", __func__);
return HDF_FAILURE;
}
if (resIf->GetUint8(node, "transferMode", &pl022Cntlr->transferMode, 0) != HDF_SUCCESS) {
HDF_LOGE("%{public}s: read comMode fail", __func__);
HDF_LOGE("%s: read comMode fail", __func__);
return HDF_FAILURE;
}
pl022Cntlr->regCrg = REG_SPI_CRG;
......@@ -316,7 +316,7 @@ static int32_t CreateSpiDev(struct Pl022SpiCntlr *pl022Cntlr)
for (i = 0; i < pl022Cntlr->numCs; i++) {
device = (struct SpiDev *)OsalMemCalloc(sizeof(*device));
if (device == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc error", __func__);
HDF_LOGE("%s: OsalMemCalloc error", __func__);
return HDF_FAILURE;
}
device->cntlr = pl022Cntlr->cntlr;
......
......@@ -29,16 +29,16 @@ int main(void)
fd = open("/dev/uartdev-5", O_RDWR);
if (fd < 0) {
HDF_LOGE("uartdev-5 open failed %{public}d", fd);
HDF_LOGE("uartdev-5 open failed %d", fd);
return -1;
}
ret = write(fd, info, INFO_SIZE);
if (ret != 0) {
HDF_LOGE("write uartdev-5 ret is %{public}d", ret);
HDF_LOGE("write uartdev-5 ret is %d", ret);
}
ret = close(fd);
if (ret != 0) {
HDF_LOGE("uartdev-5 close failed %{public}d", fd);
HDF_LOGE("uartdev-5 close failed %d", fd);
return -1;
}
return ret;
......
......@@ -27,7 +27,7 @@ int main()
struct DevHandle *handle = UartOpen(UART_PORT);
if (handle == NULL) {
HDF_LOGE("Failed to open uart %{public}d", UART_PORT);
HDF_LOGE("Failed to open uart %d", UART_PORT);
return HDF_FAILURE;
}
......
......@@ -49,7 +49,7 @@ struct DevHandle *UartOpen(uint32_t port)
struct HdfIoService *service = HdfIoServiceBind(serviceName);
if (service == NULL) {
HDF_LOGE("Failed to get service %{public}s", serviceName);
HDF_LOGE("Failed to get service %s", serviceName);
OsalMemFree(handle);
OsalMemFree(serviceName);
return NULL;
......
......@@ -35,10 +35,10 @@ static int32_t UartSampleDevOpen(FAR struct file *filep)
inode = (struct inode *)filep->f_inode;
host = (struct UartHost *)inode->i_private;
if (host == NULL) {
HDF_LOGE("%{public}s: host is NULL", __func__);
HDF_LOGE("%s: host is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
HDF_LOGI("%{public}s: open uart%{public}d success", __func__, host->num);
HDF_LOGI("%s: open uart%d success", __func__, host->num);
return HDF_SUCCESS;
}
static int32_t UartSampleRelease(FAR struct file *filep)
......@@ -52,10 +52,10 @@ static int32_t UartSampleRelease(FAR struct file *filep)
inode = (struct inode *)filep->f_inode;
host = (struct UartHost *)inode->i_private;
if (host == NULL) {
HDF_LOGE("%{public}s: host is NULL", __func__);
HDF_LOGE("%s: host is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
HDF_LOGI("%{public}s: close uart%{public}d success", __func__, host->num);
HDF_LOGI("%s: close uart%d success", __func__, host->num);
return HDF_SUCCESS;
}
......@@ -74,7 +74,7 @@ static ssize_t UartSampleRead(FAR struct file *filep, FAR char *buf, size_t coun
if (LOS_IsUserAddressRange((vaddr_t)buf, count)) {
tmpBuf = (uint8_t *)OsalMemCalloc(count);
if (tmpBuf == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc error", __func__);
HDF_LOGE("%s: OsalMemCalloc error", __func__);
return HDF_ERR_MALLOC_FAIL;
}
ret = UartHostRead(host, tmpBuf, count);
......@@ -103,7 +103,7 @@ static ssize_t UartSampleWrite(struct file *filep, const char *buf, size_t count
if (LOS_IsUserAddressRange((vaddr_t)buf, count)) {
tmpBuf = (uint8_t *)OsalMemCalloc(count);
if (tmpBuf == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc error", __func__);
HDF_LOGE("%s: OsalMemCalloc error", __func__);
return HDF_ERR_MALLOC_FAIL;
}
ret = LOS_ArchCopyFromUser(tmpBuf, buf, count);
......@@ -135,13 +135,13 @@ static int32_t UartSampleDevIoctl(FAR struct file *filep, int32_t cmd, unsigned
if (host->priv == NULL) {
return HDF_ERR_INVALID_PARAM;
}
HDF_LOGD("%{public}s: num %{public}d", __func__, host->num);
HDF_LOGD("%s: num %d", __func__, host->num);
switch (cmd) {
case UART_CFG_BAUDRATE:
ret = UartHostSetBaud(host, arg);
break;
default:
HDF_LOGE("%{public}s: cmd %{public}d not support", __func__, cmd);
HDF_LOGE("%s: cmd %d not support", __func__, cmd);
ret = HDF_ERR_NOT_SUPPORT;
break;
}
......@@ -163,29 +163,29 @@ static void AddRemoveUartDev(struct UartHost *host, bool add)
char *devName = NULL;
if (host == NULL || host->priv == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return;
}
devName = (char *)OsalMemCalloc(sizeof(char) * (MAX_DEV_NAME_SIZE + 1));
if (devName == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc error", __func__);
HDF_LOGE("%s: OsalMemCalloc error", __func__);
return;
}
ret = snprintf_s(devName, MAX_DEV_NAME_SIZE + 1, MAX_DEV_NAME_SIZE, "/dev/uartdev-%d", host->num);
if (ret < 0) {
HDF_LOGE("%{public}s: snprintf_s failed", __func__);
HDF_LOGE("%s: snprintf_s failed", __func__);
OsalMemFree(devName);
return;
}
if (add) {
if (register_driver(devName, &g_uartSampleDevFops, HDF_UART_FS_MODE, host)) {
HDF_LOGE("%{public}s: gen /dev/uartdev-%{public}d fail!", __func__, host->num);
HDF_LOGE("%s: gen /dev/uartdev-%d fail!", __func__, host->num);
OsalMemFree(devName);
return;
}
} else {
if (unregister_driver(devName)) {
HDF_LOGE("%{public}s: remove /dev/uartdev-%{public}d fail!", __func__, host->num);
HDF_LOGE("%s: remove /dev/uartdev-%d fail!", __func__, host->num);
OsalMemFree(devName);
return;
}
......
......@@ -30,12 +30,12 @@ static int32_t SampleDispatchWrite(struct UartDevice *device, struct HdfSBuf *tx
struct UartRegisterMap *regMap = (struct UartRegisterMap *)device->resource.physBase;
if (regMap == NULL) {
HDF_LOGE("%{public}s: regMap is NULL", __func__);
HDF_LOGE("%s: regMap is NULL", __func__);
return HDF_FAILURE;
}
if (!HdfSbufReadBuffer(txBuf, (const void **)&data, &dataSize)) {
HDF_LOGE("%{public}s: Failed to read sbuf", __func__);
HDF_LOGE("%s: Failed to read sbuf", __func__);
return HDF_FAILURE;
}
regMap = (struct UartRegisterMap *)device->resource.physBase;
......@@ -49,17 +49,17 @@ int32_t SampleDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSB
{
int32_t result = HDF_FAILURE;
if (client == NULL || client->device == NULL) {
HDF_LOGE("%{public}s: client or client->device is NULL", __func__);
HDF_LOGE("%s: client or client->device is NULL", __func__);
return result;
}
struct UartHost *uartHost = (struct UartHost *)client->device->service;
if (uartHost == NULL) {
HDF_LOGE("%{public}s: uartHost is NULL", __func__);
HDF_LOGE("%s: uartHost is NULL", __func__);
return result;
}
struct UartDevice *uartDevice = (struct UartDevice *)uartHost->priv;
if (uartDevice == NULL) {
HDF_LOGE("%{public}s: uartDevice is NULL", __func__);
HDF_LOGE("%s: uartDevice is NULL", __func__);
return result;
}
switch (cmdId) {
......
......@@ -70,9 +70,9 @@ struct UartHostMethod g_sampleUartHostMethod = {
/* UartHostMethod implementations */
static int32_t SampleUartHostInit(struct UartHost *host)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (host == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
return HDF_SUCCESS;
......@@ -80,9 +80,9 @@ static int32_t SampleUartHostInit(struct UartHost *host)
static int32_t SampleUartHostDeinit(struct UartHost *host)
{
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (host == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
return HDF_SUCCESS;
......@@ -93,15 +93,15 @@ static int32_t SampleUartHostWrite(struct UartHost *host, uint8_t *data, uint32_
uint32_t idx;
struct UartRegisterMap *regMap = NULL;
struct UartDevice *device = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (host == NULL || data == NULL || size == 0) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
device = (struct UartDevice *)host->priv;
if (device == NULL) {
HDF_LOGW("%{public}s: device is NULL", __func__);
HDF_LOGW("%s: device is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
regMap = (struct UartRegisterMap *)device->resource.physBase;
......@@ -116,15 +116,15 @@ static int32_t SampleUartHostSetBaud(struct UartHost *host, uint32_t baudRate)
struct UartDevice *device = NULL;
struct UartRegisterMap *regMap = NULL;
UartPl011Error err;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (host == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
device = (struct UartDevice *)host->priv;
if (device == NULL) {
HDF_LOGW("%{public}s: device is NULL", __func__);
HDF_LOGW("%s: device is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
regMap = (struct UartRegisterMap *)device->resource.physBase;
......@@ -144,15 +144,15 @@ static int32_t SampleUartHostSetBaud(struct UartHost *host, uint32_t baudRate)
static int32_t SampleUartHostGetBaud(struct UartHost *host, uint32_t *baudRate)
{
struct UartDevice *device = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (host == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return HDF_ERR_INVALID_PARAM;
}
device = (struct UartDevice *)host->priv;
if (device == NULL) {
HDF_LOGW("%{public}s: device is NULL", __func__);
HDF_LOGW("%s: device is NULL", __func__);
return HDF_ERR_INVALID_PARAM;
}
*baudRate = device->baudrate;
......@@ -243,12 +243,12 @@ static int32_t AttachUartDevice(struct UartHost *host, struct HdfDeviceObject *d
int32_t ret;
struct UartDevice *uartDevice = NULL;
if (device->property == NULL) {
HDF_LOGW("%{public}s: property is NULL", __func__);
HDF_LOGW("%s: property is NULL", __func__);
return HDF_FAILURE;
}
uartDevice = (struct UartDevice *)OsalMemCalloc(sizeof(struct UartDevice));
if (uartDevice == NULL) {
HDF_LOGE("%{public}s: OsalMemCalloc uartDevice error", __func__);
HDF_LOGE("%s: OsalMemCalloc uartDevice error", __func__);
return HDF_ERR_MALLOC_FAIL;
}
ret = GetUartDeviceResource(uartDevice, device->property);
......@@ -278,7 +278,7 @@ static void DetachUartDevice(struct UartHost *host)
struct UartDevice *uartDevice = NULL;
if (host->priv == NULL) {
HDF_LOGW("%{public}s: invalid parameter", __func__);
HDF_LOGW("%s: invalid parameter", __func__);
return;
}
uartDevice = host->priv;
......@@ -291,7 +291,7 @@ static void DetachUartDevice(struct UartHost *host)
static int32_t SampleUartDriverBind(struct HdfDeviceObject *device)
{
struct UartHost *uartHost = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (device == NULL) {
return HDF_ERR_INVALID_OBJECT;
......@@ -299,7 +299,7 @@ static int32_t SampleUartDriverBind(struct HdfDeviceObject *device)
uartHost = UartHostCreate(device);
if (uartHost == NULL) {
HDF_LOGE("%{public}s: UartHostCreate failed", __func__);
HDF_LOGE("%s: UartHostCreate failed", __func__);
return HDF_FAILURE;
}
uartHost->service.Dispatch = SampleDispatch;
......@@ -310,20 +310,20 @@ static int32_t SampleUartDriverInit(struct HdfDeviceObject *device)
{
int32_t ret;
struct UartHost *host = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (device == NULL) {
HDF_LOGE("%{public}s: device is NULL", __func__);
HDF_LOGE("%s: device is NULL", __func__);
return HDF_ERR_INVALID_OBJECT;
}
host = UartHostFromDevice(device);
if (host == NULL) {
HDF_LOGE("%{public}s: host is NULL", __func__);
HDF_LOGE("%s: host is NULL", __func__);
return HDF_FAILURE;
}
ret = AttachUartDevice(host, device);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%{public}s: attach error", __func__);
HDF_LOGE("%s: attach error", __func__);
return HDF_FAILURE;
}
host->method = &g_sampleUartHostMethod;
......@@ -333,15 +333,15 @@ static int32_t SampleUartDriverInit(struct HdfDeviceObject *device)
static void SampleUartDriverRelease(struct HdfDeviceObject *device)
{
struct UartHost *host = NULL;
HDF_LOGD("%{public}s: Enter", __func__);
HDF_LOGD("%s: Enter", __func__);
if (device == NULL) {
HDF_LOGE("%{public}s: device is NULL", __func__);
HDF_LOGE("%s: device is NULL", __func__);
return;
}
host = UartHostFromDevice(device);
if (host == NULL) {
HDF_LOGE("%{public}s: host is NULL", __func__);
HDF_LOGE("%s: host is NULL", __func__);
return;
}
if (host->priv != NULL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册