diff --git a/adapter/khdf/linux/manager/src/devmgr_pm_reg.c b/adapter/khdf/linux/manager/src/devmgr_pm_reg.c index 8dceb409b4e0e5977fc909c9442b6d213a739b8b..a09da880546bdbcb566b5fccbf18685fa11f8fa7 100644 --- a/adapter/khdf/linux/manager/src/devmgr_pm_reg.c +++ b/adapter/khdf/linux/manager/src/devmgr_pm_reg.c @@ -27,8 +27,9 @@ static int DevmgrPmSuspend(void) { + struct IDevmgrService *devmgrService = NULL; HDF_LOGD("%s enter", __func__); - struct IDevmgrService *devmgrService = DevmgrServiceGetInstance(); + devmgrService = DevmgrServiceGetInstance(); if (devmgrService == NULL) { return HDF_FAILURE; } @@ -44,8 +45,9 @@ static int DevmgrPmSuspend(void) static int DevmgrPmResume(void) { + struct IDevmgrService *devmgrService = NULL; HDF_LOGD("%s enter", __func__); - struct IDevmgrService *devmgrService = DevmgrServiceGetInstance(); + devmgrService = DevmgrServiceGetInstance(); if (devmgrService == NULL) { return HDF_FAILURE; } diff --git a/framework/core/host/src/hdf_device_node.c b/framework/core/host/src/hdf_device_node.c index f8bc59aa162e41a973ab08963c21984fc15a0d23..a394db72f0701447f274155ba3c1aa0e2e593820 100644 --- a/framework/core/host/src/hdf_device_node.c +++ b/framework/core/host/src/hdf_device_node.c @@ -149,11 +149,11 @@ void HdfDeviceNodeRemovePowerStateListener( int HdfDeviceNodePublishPublicService(struct HdfDeviceNode *devNode) { int ret; + struct HdfServiceInfo servInfo; if (devNode == NULL || devNode->deviceObject.service == NULL) { HDF_LOGE("failed to publish public service, devNode is NULL"); return HDF_FAILURE; } - struct HdfServiceInfo servInfo; HdfServiceInfoInit(&servInfo, devNode); ret = DevSvcManagerClntAddService(&devNode->deviceObject, &servInfo); if (ret == HDF_SUCCESS) { diff --git a/framework/core/host/src/hdf_device_object.c b/framework/core/host/src/hdf_device_object.c index 16f10209427e0fcebe4ecbeb82d667d26715ba5a..e913643c5e2bab2708cc78c4b050b75a8436680a 100644 --- a/framework/core/host/src/hdf_device_object.c +++ b/framework/core/host/src/hdf_device_object.c @@ -303,11 +303,12 @@ int HdfDeviceObjectRemoveService(struct HdfDeviceObject *dev) } int HdfDeviceObjectSetServInfo(struct HdfDeviceObject *dev, const char *info) { + struct HdfDeviceNode *devNode = NULL; if (dev == NULL || info == NULL || strlen(info) > SERVICE_INFO_LEN_MAX) { return HDF_ERR_INVALID_PARAM; } - struct HdfDeviceNode *devNode = CONTAINER_OF(dev, struct HdfDeviceNode, deviceObject); + devNode = CONTAINER_OF(dev, struct HdfDeviceNode, deviceObject); if (devNode->servInfo != NULL) { OsalMemFree((char *)devNode->servInfo); } @@ -320,11 +321,11 @@ int HdfDeviceObjectSetServInfo(struct HdfDeviceObject *dev, const char *info) int HdfDeviceObjectUpdate(struct HdfDeviceObject *dev) { + struct HdfServiceInfo servInfo; struct HdfDeviceNode *devNode = CONTAINER_OF(dev, struct HdfDeviceNode, deviceObject); if (dev == NULL) { return HDF_ERR_INVALID_PARAM; } - struct HdfServiceInfo servInfo; HdfServiceInfoInit(&servInfo, devNode); return DevSvcManagerClntUpdateService(&devNode->deviceObject, &servInfo); } @@ -344,4 +345,4 @@ bool __attribute__((weak)) HdfDeviceObjectCheckInterfaceDesc(struct HdfDeviceObj (void)dev; (void)data; return true; -} \ No newline at end of file +} diff --git a/framework/core/manager/src/devmgr_service.c b/framework/core/manager/src/devmgr_service.c index 7082b438e26726c22fec5551db720a3acd8721a5..c9f6a214bbc7b173798feaa68838266ba5a2dc1d 100644 --- a/framework/core/manager/src/devmgr_service.c +++ b/framework/core/manager/src/devmgr_service.c @@ -359,6 +359,7 @@ static int32_t DevmgrServiceListAllDevice(struct IDevmgrService *inst, struct Hd struct HdfSListIterator iterator; struct HdfSListNode *node = NULL; const char *name = NULL; + struct DeviceTokenClnt *tokenClnt = NULL; if (devMgrSvc == NULL || reply == NULL) { HDF_LOGE("%{public}s failed, parameter is null", __func__); @@ -373,7 +374,7 @@ static int32_t DevmgrServiceListAllDevice(struct IDevmgrService *inst, struct Hd HdfSListIteratorInit(&iterator, &hostClnt->devices); while (HdfSListIteratorHasNext(&iterator)) { node = HdfSListIteratorNext(&iterator); - struct DeviceTokenClnt *tokenClnt = (struct DeviceTokenClnt *)node; + tokenClnt = (struct DeviceTokenClnt *)node; if (tokenClnt != NULL && tokenClnt->tokenIf != NULL) { name = (tokenClnt->tokenIf->deviceName == NULL) ? "" : tokenClnt->tokenIf->deviceName; HdfSbufWriteString(reply, name); diff --git a/framework/core/manager/src/devsvc_manager.c b/framework/core/manager/src/devsvc_manager.c index 3374a2fb3c916fb494e5516f9967dec61b705c8d..af520fa86e445bda2341ed9137feae5301ff9c26 100644 --- a/framework/core/manager/src/devsvc_manager.c +++ b/framework/core/manager/src/devsvc_manager.c @@ -66,15 +66,15 @@ static void NotifyServiceStatusOnRegisterLocked( { struct DevSvcRecord *record = NULL; DLIST_FOR_EACH_ENTRY(record, &devSvcManager->services, struct DevSvcRecord, entry) { - if ((listenerHolder->listenClass & record->devClass) == 0) { - continue; - } struct ServiceStatus svcstat = { .deviceClass = record->devClass, .serviceName = record->servName, .status = SERVIE_STATUS_START, .info = record->servInfo, }; + if ((listenerHolder->listenClass & record->devClass) == 0) { + continue; + } if (listenerHolder->NotifyStatus != NULL) { listenerHolder->NotifyStatus(listenerHolder, &svcstat); } @@ -413,12 +413,12 @@ struct HdfObject *DevSvcManagerCreate(void) void DevSvcManagerRelease(struct IDevSvcManager *inst) { + struct DevSvcRecord *record = NULL; + struct DevSvcRecord *tmp = NULL; struct DevSvcManager *devSvcManager = CONTAINER_OF(inst, struct DevSvcManager, super); if (inst == NULL) { return; } - struct DevSvcRecord *record = NULL; - struct DevSvcRecord *tmp = NULL; DLIST_FOR_EACH_ENTRY_SAFE(record, tmp, &devSvcManager->services, struct DevSvcRecord, entry) { DevSvcRecordFreeInstance(record); } diff --git a/framework/core/manager/src/servstat_listener_holder.c b/framework/core/manager/src/servstat_listener_holder.c index b73ebbff5613d586d45356ac6c262ec5072f2c1f..3f00a9abebdb83fa1eaf7af37a66dd74fb27966d 100644 --- a/framework/core/manager/src/servstat_listener_holder.c +++ b/framework/core/manager/src/servstat_listener_holder.c @@ -39,16 +39,18 @@ void ServStatListenerHolderinit(void) int32_t KServStatListenerHolderNotifyStatus(struct ServStatListenerHolder *holder, struct ServiceStatus *status) { + struct KServStatListenerHolder *holderInst = NULL; + struct HdfSBuf *data = NULL; if (holder == NULL || status == NULL) { return HDF_ERR_INVALID_PARAM; } - struct KServStatListenerHolder *holderInst = CONTAINER_OF(holder, struct KServStatListenerHolder, holder); + holderInst = CONTAINER_OF(holder, struct KServStatListenerHolder, holder); if (holderInst->listenerClient == NULL) { HDF_LOGE("failed to notify service status, invalid holder"); return HDF_ERR_INVALID_PARAM; } - struct HdfSBuf *data = HdfSbufObtainDefaultSize(); + data = HdfSbufObtainDefaultSize(); if (data == NULL) { HDF_LOGE("failed to notify service status, oom"); return HDF_ERR_MALLOC_FAIL; diff --git a/framework/model/input/driver/event_hub.h b/framework/model/input/driver/event_hub.h index f7ed1a1aac6015d085130b3687f7795ba2bdb514..03f24de2c78e2a424ff73776cd118d7dd2f118a6 100644 --- a/framework/model/input/driver/event_hub.h +++ b/framework/model/input/driver/event_hub.h @@ -9,7 +9,11 @@ #ifndef EVENT_HUB_H #define EVENT_HUB_H +#ifdef __LITEOS__ #include "input-event-codes.h" +#else +#include +#endif #include "hdf_input_device_manager.h" #include "osal_time.h" diff --git a/framework/model/input/driver/hdf_hid_adapter.c b/framework/model/input/driver/hdf_hid_adapter.c index a5f714c6205a8e5642505fdc0df354b4a7987717..ef2128039b79f27ba4c4c9e0215900c5fcff4416 100644 --- a/framework/model/input/driver/hdf_hid_adapter.c +++ b/framework/model/input/driver/hdf_hid_adapter.c @@ -288,6 +288,7 @@ static void RepateEvent(const InputDevice *device) void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t value) { + InputDevice *device = NULL; bool loaded = InputDriverLoaded(); if (!loaded) { HDF_LOGD("%s: device not loaded", __func__); @@ -297,7 +298,7 @@ void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t if (type == EV_KEY && code == KEY_POWER) hung_wp_screen_powerkey_ncb(value); #endif - InputDevice *device = (InputDevice *)inputDev; + device = (InputDevice *)inputDev; PushOnePackage(device, type, code, value); if (type == EV_KEY && KEY_RESERVED < code && code < KEY_MAX && value == 0 && code == g_kbdcode) { OsalTimerDelete(&g_timer); @@ -312,8 +313,8 @@ void HidReportEvent(const void *inputDev, uint32_t type, uint32_t code, int32_t static int32_t HdfHIDDriverInit(struct HdfDeviceObject *device) { - (void)device; static bool cachedHidRegistered = false; + (void)device; if (!cachedHidRegistered) { cachedHidRegistered = true; LoadCachedHid(); @@ -324,8 +325,8 @@ static int32_t HdfHIDDriverInit(struct HdfDeviceObject *device) static int32_t HidGetDevType(InputDevice *inputDev, struct HdfSBuf *reply) { uint32_t devType = inputDev->devType; - HDF_LOGI("%s: enter, devType is %u", __func__, devType); bool ret = HdfSbufWriteUint32(reply, devType); + HDF_LOGI("%s: enter, devType is %u", __func__, devType); if (!ret) { HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; @@ -336,6 +337,7 @@ static int32_t HidGetDevType(InputDevice *inputDev, struct HdfSBuf *reply) static int32_t HidGetDeviceStrInfo(InputDevice *inputDev, int32_t cmd, struct HdfSBuf *reply) { const char *info = NULL; + bool ret; if (inputDev == NULL) { HDF_LOGE("%s: parameter invalid", __func__); return HDF_ERR_INVALID_PARAM; @@ -356,7 +358,7 @@ static int32_t HidGetDeviceStrInfo(InputDevice *inputDev, int32_t cmd, struct Hd break; } - bool ret = HdfSbufWriteString(reply, info); + ret = HdfSbufWriteString(reply, info); if (!ret) { HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; @@ -402,9 +404,9 @@ static int32_t HidGetDeviceAbility(InputDevice *inputDev, struct HdfSBuf *reply) static int32_t HdfHIDDispatch(struct HdfDeviceIoClient *client, int cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { - (void)cmd; int32_t ret; InputDevice *inputDev = NULL; + (void)cmd; if (client == NULL || data == NULL || reply == NULL) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; @@ -442,12 +444,12 @@ static int32_t HdfHIDDispatch(struct HdfDeviceIoClient *client, int cmd, struct static int32_t HdfHIDDriverBind(struct HdfDeviceObject *device) { - if (device == NULL) { - return HDF_ERR_INVALID_PARAM; - } static struct IDeviceIoService hidService = { .Dispatch = HdfHIDDispatch, }; + if (device == NULL) { + return HDF_ERR_INVALID_PARAM; + } device->service = &hidService; return HDF_SUCCESS; } diff --git a/framework/model/input/driver/hdf_hid_adapter.h b/framework/model/input/driver/hdf_hid_adapter.h index 83efe6140afc619894f529c24ee6ec20b34551ff..f8599b986592c7f0d238eea2b9aea04e31e7f1d6 100644 --- a/framework/model/input/driver/hdf_hid_adapter.h +++ b/framework/model/input/driver/hdf_hid_adapter.h @@ -11,10 +11,17 @@ #include "hdf_input_device_manager.h" +#ifdef __LITEOS__ #ifdef DIV_ROUND_UP #undef DIV_ROUND_UP #endif #define DIV_ROUND_UP(nr, d) (((nr) + (d) - 1) / (d)) +#else +#ifdef DIV_ROUND_UP_TO_INTEGER +#undef DIV_ROUND_UP_TO_INTEGER +#endif +#define DIV_ROUND_UP_TO_INTEGER(nr, d) (((nr) + (d) - 1) / (d)) +#endif #ifdef BYTE_HAS_BITS #undef BYTE_HAS_BITS @@ -24,7 +31,12 @@ #ifdef BITS_TO_LONG #undef BITS_TO_LONG #endif + +#ifdef __LITEOS__ #define BITS_TO_LONG(count) DIV_ROUND_UP(count, BYTE_HAS_BITS * sizeof(unsigned long)) +#else +#define BITS_TO_LONG(count) DIV_ROUND_UP_TO_INTEGER(count, BYTE_HAS_BITS * sizeof(unsigned long)) +#endif #define INPUT_PROP_MAX 0x1f #define HDF_INPUT_PROP_CNT (INPUT_PROP_MAX + 1) @@ -42,7 +54,6 @@ #define HDF_LED_CNT (LED_MAX + 1) #define MSC_MAX 0x07 #define HDF_MSC_CNT (MSC_MAX + 1) -#define SW_MAX 0x0f #define HDF_SW_CNT (SW_MAX + 1) #define FF_MAX 0x7f #define HDF_FF_CNT (FF_MAX + 1) diff --git a/framework/model/input/driver/hdf_infrared.c b/framework/model/input/driver/hdf_infrared.c index 00ac8b1c5c4c3b06aee56119dc73b2be132a847c..d75623a6490e0d29904dcd2869cfedc6a5e9dadf 100644 --- a/framework/model/input/driver/hdf_infrared.c +++ b/framework/model/input/driver/hdf_infrared.c @@ -7,8 +7,12 @@ */ #include "hdf_infrared.h" -#include "hdf_device_desc.h" +#ifdef __LITEOS__ #include "input-event-codes.h" +#else +#include +#endif +#include "hdf_device_desc.h" #include "osal_mem.h" #include "gpio_if.h" #include "hdf_log.h" diff --git a/framework/model/input/driver/hdf_input_device_manager.c b/framework/model/input/driver/hdf_input_device_manager.c index 175a74d78ac3bc392241c0b822e9683dd10633ae..44d762e99157bf2881ff08687b1e4bc13cd91691 100644 --- a/framework/model/input/driver/hdf_input_device_manager.c +++ b/framework/model/input/driver/hdf_input_device_manager.c @@ -171,6 +171,8 @@ static int32_t CheckInputDevice(InputDevice *inputDev) static int32_t DeleteInputDevice(InputDevice *inputDev) { + InputDevice *preNode = g_inputManager->inputDevList; + InputDevice *tmpDev = preNode->next; if (g_inputManager->inputDevList == NULL) { return HDF_FAILURE; } else { @@ -179,8 +181,6 @@ static int32_t DeleteInputDevice(InputDevice *inputDev) goto EXIT; } - InputDevice *preNode = g_inputManager->inputDevList; - InputDevice *tmpDev = preNode->next; while (tmpDev != NULL) { if (tmpDev->devId == inputDev->devId) { preNode->next = tmpDev->next; @@ -429,8 +429,8 @@ static int32_t ScanAllDev(struct HdfSBuf *reply) static int32_t ScanDevice(struct HdfDeviceIoClient *client, int32_t cmd, struct HdfSBuf *data, struct HdfSBuf *reply) { - (void)cmd; int32_t ret; + (void)cmd; if ((client == NULL) || (data == NULL) || (reply == NULL)) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; @@ -444,16 +444,16 @@ static int32_t ScanDevice(struct HdfDeviceIoClient *client, int32_t cmd, static int32_t HdfInputManagerBind(struct HdfDeviceObject *device) { - if (device == NULL) { - HDF_LOGE("%s: device is null", __func__); - return HDF_ERR_INVALID_PARAM; - } - static IInputManagerService managerService = { .getDeviceCount = GetDeviceCount, .ioService.Dispatch = ScanDevice, }; + if (device == NULL) { + HDF_LOGE("%s: device is null", __func__); + return HDF_ERR_INVALID_PARAM; + } + device->service = &managerService.ioService; return HDF_SUCCESS; } diff --git a/framework/model/input/driver/hdf_input_device_manager.h b/framework/model/input/driver/hdf_input_device_manager.h index 74ecd6cabc7387361638f012d9372b8ca5165226..8d543963ae33d43d74042d7a8fba6c466a18c548 100644 --- a/framework/model/input/driver/hdf_input_device_manager.h +++ b/framework/model/input/driver/hdf_input_device_manager.h @@ -9,7 +9,11 @@ #ifndef HDF_INPUT_DEVICE_MANAGER_H #define HDF_INPUT_DEVICE_MANAGER_H +#ifdef __LITEOS__ #include "input-event-codes.h" +#else +#include +#endif #include "osal_mutex.h" #include "osal_spinlock.h" #include "hdf_types.h" @@ -26,13 +30,25 @@ #define ONLINE 0 #define OFFLINE 1 +#ifdef __LITEOS__ #ifdef DIV_ROUND_UP #undef DIV_ROUND_UP #endif #define DIV_ROUND_UP(nr, d) (((nr) + (d) - 1) / (d)) +#else +#ifdef DIV_ROUND_UP_TO_INTEGER +#undef DIV_ROUND_UP_TO_INTEGER +#endif +#define DIV_ROUND_UP_TO_INTEGER(nr, d) (((nr) + (d) - 1) / (d)) +#endif #define BYTE_HAS_BITS 8 + +#ifdef __LITEOS__ #define BITS_TO_UINT64(count) DIV_ROUND_UP(count, BYTE_HAS_BITS * sizeof(unsigned long)) +#else +#define BITS_TO_UINT64(count) DIV_ROUND_UP_TO_INTEGER(count, BYTE_HAS_BITS * sizeof(unsigned long)) +#endif #ifndef BITS_PER_LONG #define BITS_PER_LONG 32 @@ -40,7 +56,7 @@ #define SET_BIT(nr) (1UL << ((nr) % BITS_PER_LONG)) #define FF_MAX 0x7f -#define FF_CNT (FF_MAX + 1) +#define FF_CNT (FF_MAX + 1) #define CHECK_RETURN_VALUE(ret) do { \ if ((ret) != HDF_SUCCESS) { \ @@ -176,4 +192,4 @@ InputManager* GetInputManager(void); int32_t RegisterInputDevice(InputDevice *inputDev); void UnregisterInputDevice(InputDevice *inputDev); -#endif \ No newline at end of file +#endif diff --git a/framework/model/input/driver/hdf_key.c b/framework/model/input/driver/hdf_key.c index 6b1de392b38deb73b4cfc245ab858caeffabd4cb..750213fecb530727b4798d9048188a2682d37647 100644 --- a/framework/model/input/driver/hdf_key.c +++ b/framework/model/input/driver/hdf_key.c @@ -25,12 +25,10 @@ int32_t KeyIrqHandle(uint16_t intGpioNum, void *data) { int32_t ret; uint16_t gpioValue = 0; + uint64_t curTime; KeyDriver *driver = (KeyDriver *)data; - if (driver == NULL) { - return HDF_FAILURE; - } KeyEventData *event = &driver->eventData; - if (event == NULL) { + if (driver == NULL || event == NULL) { return HDF_FAILURE; } ret = GpioDisableIrq(intGpioNum); @@ -43,7 +41,7 @@ int32_t KeyIrqHandle(uint16_t intGpioNum, void *data) HDF_LOGE("%s: gpio read failed, ret %d", __func__, ret); return HDF_FAILURE; } - uint64_t curTime = OsalGetSysTimeMs(); + curTime = OsalGetSysTimeMs(); driver->preStatus = gpioValue; driver->timeStamp = curTime; @@ -144,6 +142,7 @@ static int32_t RegisterKeyDevice(KeyChipCfg *keyCfg) { int32_t ret; KeyDriver *keyDrv = KeyDriverInstance(keyCfg); + InputDevice *inputDev = NULL; if (keyDrv == NULL) { HDF_LOGE("%s: instance key config failed", __func__); return HDF_ERR_MALLOC_FAIL; @@ -155,7 +154,7 @@ static int32_t RegisterKeyDevice(KeyChipCfg *keyCfg) goto EXIT; } - InputDevice *inputDev = InputDeviceInstance(keyDrv); + inputDev = InputDeviceInstance(keyDrv); if (inputDev == NULL) { HDF_LOGE("%s: instance input device failed", __func__); goto EXIT; @@ -179,12 +178,13 @@ EXIT: static int32_t HdfKeyDriverInit(struct HdfDeviceObject *device) { int32_t ret; + KeyChipCfg *keyCfg = NULL; HDF_LOGI("%s: enter", __func__); if (device == NULL) { return HDF_ERR_INVALID_PARAM; } - KeyChipCfg *keyCfg = KeyConfigInstance(device); + keyCfg = KeyConfigInstance(device); if (keyCfg == NULL) { HDF_LOGE("%s: instance key config failed", __func__); return HDF_ERR_MALLOC_FAIL; @@ -214,13 +214,13 @@ static int32_t HdfKeyDispatch(struct HdfDeviceIoClient *client, int cmd, struct static int32_t HdfKeyDriverBind(struct HdfDeviceObject *device) { - if (device == NULL) { - return HDF_ERR_INVALID_PARAM; - } static struct IDeviceIoService keyService = { .object.objectId = 1, .Dispatch = HdfKeyDispatch, }; + if (device == NULL) { + return HDF_ERR_INVALID_PARAM; + } device->service = &keyService; return HDF_SUCCESS; } diff --git a/framework/model/input/driver/hdf_touch.c b/framework/model/input/driver/hdf_touch.c index 8838ad5c3e53b07b495c36043db3d51d178bb299..c650e533d3de333295bb4ab73803fa4c313d909a 100644 --- a/framework/model/input/driver/hdf_touch.c +++ b/framework/model/input/driver/hdf_touch.c @@ -37,6 +37,8 @@ #define GTP_REG_CMD_1 0x8041 unsigned long g_timeout; static int32_t ChipCheckResetRetry(ChipDevice *chipDev); +#else +#define GTP_ESD_PROTECT 0 #endif static TouchDriver *g_touchDriverList[MAX_TOUCH_DEVICE]; @@ -86,15 +88,16 @@ static int32_t HandleResetEvent(ChipDevice *chipDev, uint32_t *timing, uint32_t { int32_t ret = 0; uint16_t gpio; + uint32_t type = timing[PWR_TYPE_INDEX]; + uint32_t status = timing[PWR_STATUS_INDEX]; + uint32_t dir = timing[PWR_DIR_INDEX]; + uint32_t delay = timing[PWR_DELAY_INDEX]; if (length <= PWR_DELAY_INDEX) { HDF_LOGE("%s: invalid param", __func__); return HDF_FAILURE; } - uint32_t type = timing[PWR_TYPE_INDEX]; - uint32_t status = timing[PWR_STATUS_INDEX]; - uint32_t dir = timing[PWR_DIR_INDEX]; - uint32_t delay = timing[PWR_DELAY_INDEX]; + HDF_LOGD("%s: type = %u, status = %u, dir = %u, delay = %u", __func__, type, status, dir, delay); switch (type) { @@ -123,15 +126,16 @@ static int32_t HandlePowerEvent(ChipDevice *chipDev, uint32_t *timing, uint32_t { int32_t ret = 0; uint16_t gpio; + uint32_t type = timing[PWR_TYPE_INDEX]; + uint32_t status = timing[PWR_STATUS_INDEX]; + uint32_t dir = timing[PWR_DIR_INDEX]; + uint32_t delay = timing[PWR_DELAY_INDEX]; if (length <= PWR_DELAY_INDEX) { HDF_LOGE("%s: invalid param", __func__); return HDF_FAILURE; } - uint32_t type = timing[PWR_TYPE_INDEX]; - uint32_t status = timing[PWR_STATUS_INDEX]; - uint32_t dir = timing[PWR_DIR_INDEX]; - uint32_t delay = timing[PWR_DELAY_INDEX]; + HDF_LOGD("%s: type = %u, status = %u, dir = %u, delay = %u", __func__, type, status, dir, delay); switch (type) { @@ -161,11 +165,11 @@ static int32_t HandlePowerEvent(ChipDevice *chipDev, uint32_t *timing, uint32_t static int32_t InputPinMuxCfg(uint32_t regAddr, int32_t regSize, uint32_t regValue) { + uint8_t *base = NULL; #if defined(CONFIG_ARCH_SPRD) || defined(CONFIG_ARCH_ROCKCHIP) || defined(LOSCFG_PLATFORM_STM32MP157) || \ defined(CONFIG_ARCH_MESON) || defined(CONFIG_ARCH_NXP_TOUCH) return HDF_SUCCESS; #endif - uint8_t *base = NULL; if (regAddr == 0) { HDF_LOGE("%s: regAddr invalid", __func__); return HDF_FAILURE; @@ -720,8 +724,8 @@ EXIT: static int32_t TouchGetDevType(TouchDriver *driver, struct HdfSBuf *reply) { uint32_t devType = driver->devType; - HDF_LOGI("%s: enter, devType is %u", __func__, devType); bool ret = HdfSbufWriteUint32(reply, devType); + HDF_LOGI("%s: enter, devType is %u", __func__, devType); if (!ret) { HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; @@ -757,6 +761,7 @@ static int32_t TouchGetPowerStatus(TouchDriver *driver, struct HdfSBuf *reply) static int32_t TouchGetDeviceStrInfo(TouchDriver *driver, int32_t cmd, struct HdfSBuf *reply) { const char *info = NULL; + bool ret; if ((driver->device == NULL) || (driver->device->chipCfg == NULL)) { HDF_LOGE("%s: parameter invalid", __func__); return HDF_ERR_INVALID_PARAM; @@ -777,7 +782,7 @@ static int32_t TouchGetDeviceStrInfo(TouchDriver *driver, int32_t cmd, struct Hd break; } - bool ret = HdfSbufWriteString(reply, info); + ret = HdfSbufWriteString(reply, info); if (!ret) { HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__); return HDF_FAILURE; @@ -1033,15 +1038,14 @@ static void AddTouchDriver(TouchDriver *driver) static int32_t HdfTouchDriverBind(struct HdfDeviceObject *device) { + static struct IDeviceIoService touchService = { + .Dispatch = HdfTouchDispatch, + }; if (device == NULL) { HDF_LOGE("%s: param is null", __func__); return HDF_ERR_INVALID_PARAM; } - static struct IDeviceIoService touchService = { - .Dispatch = HdfTouchDispatch, - }; - device->service = &touchService; return HDF_SUCCESS; } @@ -1208,4 +1212,4 @@ struct HdfDriverEntry g_hdfTouchEntry = { .Release = HdfTouchDriverRelease, }; -HDF_INIT(g_hdfTouchEntry); \ No newline at end of file +HDF_INIT(g_hdfTouchEntry); diff --git a/framework/model/input/driver/input_config_parser.c b/framework/model/input/driver/input_config_parser.c index d60edc4fbb806a92908f35e79594ebdd3845d746..c5bf6878b81309a90b4127fe17d24e9ef88cfac3 100644 --- a/framework/model/input/driver/input_config_parser.c +++ b/framework/model/input/driver/input_config_parser.c @@ -27,6 +27,7 @@ int32_t ParseInfraredConfig(const struct DeviceResourceNode *node, InfraredCfg * { int32_t ret; struct DeviceResourceIface *parser = NULL; + const struct DeviceResourceNode *infraredNode = node; if (node == NULL || config == NULL) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; @@ -38,7 +39,6 @@ int32_t ParseInfraredConfig(const struct DeviceResourceNode *node, InfraredCfg * return HDF_FAILURE; } - const struct DeviceResourceNode *infraredNode = node; ret = parser->GetString(infraredNode, "infraredName", &config->infraredName, NULL); CHECK_PARSER_RET(ret, "GetString"); ret = parser->GetUint8(infraredNode, "inputType", &config->devType, 0); @@ -55,6 +55,7 @@ int32_t ParseKeyConfig(const struct DeviceResourceNode *node, KeyChipCfg *config { int32_t ret; struct DeviceResourceIface *parser = NULL; + const struct DeviceResourceNode *keyNode = node; if (node == NULL || config == NULL) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; @@ -66,7 +67,6 @@ int32_t ParseKeyConfig(const struct DeviceResourceNode *node, KeyChipCfg *config return HDF_FAILURE; } - const struct DeviceResourceNode *keyNode = node; ret = parser->GetString(keyNode, "keyName", &config->keyName, NULL); CHECK_PARSER_RET(ret, "GetString"); ret = parser->GetUint8(keyNode, "inputType", &config->devType, 0); @@ -83,20 +83,21 @@ int32_t ParseKeyConfig(const struct DeviceResourceNode *node, KeyChipCfg *config int32_t ParseEncoderConfig(const struct DeviceResourceNode *node, EncoderCfg *config) { + struct DeviceResourceIface *parser = NULL; + const struct DeviceResourceNode *encoderNode = node; + int32_t ret; if (node == NULL || config == NULL) { HDF_LOGE("%s: param is null", __func__); return HDF_FAILURE; } - struct DeviceResourceIface *parser = NULL; parser = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); if (parser == NULL) { HDF_LOGE("%s: instance parser failed", __func__); return HDF_FAILURE; } - const struct DeviceResourceNode *encoderNode = node; - int32_t ret = parser->GetUint8(encoderNode, "inputType", &config->devType, 0); + ret = parser->GetUint8(encoderNode, "inputType", &config->devType, 0); CHECK_PARSER_RET(ret, "GetUint8"); ret = parser->GetUint16(encoderNode, "gpioClk", &config->gpioClk, 0); CHECK_PARSER_RET(ret, "GetUint16"); @@ -214,6 +215,11 @@ int32_t ParseTouchBoardConfig(const struct DeviceResourceNode *node, TouchBoardC { int32_t ret; struct DeviceResourceIface *parser = NULL; + const struct DeviceResourceNode *attrNode = NULL; + const struct DeviceResourceNode *busNode = NULL; + const struct DeviceResourceNode *pinsNode = NULL; + const struct DeviceResourceNode *powerNode = NULL; + const struct DeviceResourceNode *featureNode = NULL; if (node == NULL || config == NULL) { HDF_LOGE("%s: input param is null", __func__); @@ -225,11 +231,11 @@ int32_t ParseTouchBoardConfig(const struct DeviceResourceNode *node, TouchBoardC return HDF_FAILURE; } config->boardNode = node; - const struct DeviceResourceNode *attrNode = parser->GetChildNode(node, "inputAttr"); - const struct DeviceResourceNode *busNode = parser->GetChildNode(node, "busConfig"); - const struct DeviceResourceNode *pinsNode = parser->GetChildNode(node, "pinConfig"); - const struct DeviceResourceNode *powerNode = parser->GetChildNode(node, "powerConfig"); - const struct DeviceResourceNode *featureNode = parser->GetChildNode(node, "featureConfig"); + attrNode = parser->GetChildNode(node, "inputAttr"); + busNode = parser->GetChildNode(node, "busConfig"); + pinsNode = parser->GetChildNode(node, "pinConfig"); + powerNode = parser->GetChildNode(node, "powerConfig"); + featureNode = parser->GetChildNode(node, "featureConfig"); if (attrNode == NULL || busNode == NULL || pinsNode == NULL || powerNode == NULL || featureNode == NULL) { HDF_LOGE("%s: get child node fail!", __func__); return HDF_FAILURE; @@ -307,6 +313,7 @@ int32_t ParseTouchChipConfig(const struct DeviceResourceNode *node, TouchChipCfg { int32_t ret; struct DeviceResourceIface *parser = NULL; + const struct DeviceResourceNode *pwrSeqNode = NULL; if (node == NULL || config == NULL) { HDF_LOGE("%s: point is null", __func__); return HDF_FAILURE; @@ -345,7 +352,7 @@ int32_t ParseTouchChipConfig(const struct DeviceResourceNode *node, TouchChipCfg ret = parser->GetUint32(node, "maxSpeed", &config->bus.chipSpi.maxSpeed, DEFAULT_SPI_SPEED); CHECK_PARSER_RET(ret, "GetUint32"); } - const struct DeviceResourceNode *pwrSeqNode = parser->GetChildNode(node, "powerSequence"); + pwrSeqNode = parser->GetChildNode(node, "powerSequence"); if (pwrSeqNode == NULL) { HDF_LOGE("%s: get powerSequence child node failed", __func__); return HDF_FAILURE; @@ -354,4 +361,4 @@ int32_t ParseTouchChipConfig(const struct DeviceResourceNode *node, TouchChipCfg return HDF_FAILURE; } return HDF_SUCCESS; -} \ No newline at end of file +} diff --git a/framework/utils/src/hdf_sbuf.c b/framework/utils/src/hdf_sbuf.c index a8bec65f227d0c1f37f0c089eefb9e63d164fb21..823597299ab0f64d6729ee6005fc8e5525bc426c 100644 --- a/framework/utils/src/hdf_sbuf.c +++ b/framework/utils/src/hdf_sbuf.c @@ -63,6 +63,7 @@ static const struct HdfSbufConstructor g_sbufConstructorMap[SBUF_TYPE_MAX] = { }, }; +#ifndef __KERNEL__ static const struct HdfSbufConstructor *HdfSbufConstructorGet(uint32_t type) { if (type >= SBUF_TYPE_MAX) { @@ -71,6 +72,7 @@ static const struct HdfSbufConstructor *HdfSbufConstructorGet(uint32_t type) return &g_sbufConstructorMap[type]; } +#endif uint8_t *HdfSbufGetData(const struct HdfSBuf *sbuf) { @@ -492,4 +494,4 @@ struct HdfSBufImpl *HdfSbufGetImpl(struct HdfSBuf *sbuf) } return NULL; -} \ No newline at end of file +}