From f7ae7f290be4ed2004509b9b0985dc60b4edb8d9 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Wed, 3 Jul 2024 18:00:42 +0800 Subject: [PATCH 1/3] fix build warning Signed-off-by: Wu Xiaotian --- adapter/khdf/linux/model/usb/host/src/usb_pnp_notify.c | 6 ++++-- .../model/audio/dispatch/src/audio_control_dispatch.c | 2 +- .../model/audio/dispatch/src/audio_stream_dispatch.c | 6 +++--- .../model/audio/usb/src/audio_usb_parse_interface.c | 3 ++- framework/model/audio/usb/src/audio_usb_validate_desc.c | 7 ++++--- framework/model/input/driver/touchscreen/touch_gt911.c | 9 ++++++--- 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/adapter/khdf/linux/model/usb/host/src/usb_pnp_notify.c b/adapter/khdf/linux/model/usb/host/src/usb_pnp_notify.c index 1ab1c7140..9628e22d3 100644 --- a/adapter/khdf/linux/model/usb/host/src/usb_pnp_notify.c +++ b/adapter/khdf/linux/model/usb/host/src/usb_pnp_notify.c @@ -216,7 +216,8 @@ OUT: static void UsbPnpNotifyAddInterfaceInitInfo(struct UsbPnpDeviceInfo *deviceInfo, union UsbPnpDeviceInfoData infoData, struct UsbPnpNotifyMatchInfoTable *infoTable) { - for (uint8_t i = 0; i < deviceInfo->info.numInfos; i++) { + uint8_t i; + for (i = 0; i < deviceInfo->info.numInfos; i++) { if ((infoData.infoData->interfaceClass == deviceInfo->info.interfaceInfo[i].interfaceClass) && (infoData.infoData->interfaceSubClass == deviceInfo->info.interfaceInfo[i].interfaceSubClass) && (infoData.infoData->interfaceProtocol == deviceInfo->info.interfaceInfo[i].interfaceProtocol) && @@ -465,8 +466,9 @@ static void TestPnpNotifyFillInfoTable(struct UsbPnpNotifyMatchInfoTable *infoTa infoTable->removeType = g_usbPnpNotifyRemoveType; if (g_usbPnpNotifyCmdType != USB_PNP_NOTIFY_REMOVE_TEST) { + int8_t i; infoTable->numInfos = g_testUsbPnpInfo->numInfos; - for (int8_t i = 0; i < infoTable->numInfos; i++) { + for (i = 0; i < infoTable->numInfos; i++) { infoTable->interfaceInfo[i].interfaceClass = g_testUsbPnpInfo->interfaceInfo[i].interfaceClass; infoTable->interfaceInfo[i].interfaceSubClass = g_testUsbPnpInfo->interfaceInfo[i].interfaceSubClass; infoTable->interfaceInfo[i].interfaceProtocol = g_testUsbPnpInfo->interfaceInfo[i].interfaceProtocol; diff --git a/framework/model/audio/dispatch/src/audio_control_dispatch.c b/framework/model/audio/dispatch/src/audio_control_dispatch.c index ba6d2ce4b..5b49a7896 100644 --- a/framework/model/audio/dispatch/src/audio_control_dispatch.c +++ b/framework/model/audio/dispatch/src/audio_control_dispatch.c @@ -111,8 +111,8 @@ static int32_t ControlHostElemInfoSub(struct HdfSBuf *rspData, const struct Audi static int32_t ControlHostElemInfo(const struct HdfDeviceIoClient *client, struct HdfSBuf *reqData, struct HdfSBuf *rspData) { - ADM_LOG_DEBUG("entry."); struct AudioCtrlElemId id; + ADM_LOG_DEBUG("entry."); if (reqData == NULL) { ADM_LOG_ERR("Input ElemInfo params check error: reqData is NULL."); diff --git a/framework/model/audio/dispatch/src/audio_stream_dispatch.c b/framework/model/audio/dispatch/src/audio_stream_dispatch.c index 4e478490a..fc52043e3 100644 --- a/framework/model/audio/dispatch/src/audio_stream_dispatch.c +++ b/framework/model/audio/dispatch/src/audio_stream_dispatch.c @@ -665,8 +665,8 @@ static int32_t StreamHostRenderPrepare(const struct HdfDeviceIoClient *client, s static int32_t StreamHostRenderOpen(const struct HdfDeviceIoClient *client, struct HdfSBuf *data, struct HdfSBuf *reply) { - ADM_LOG_INFO("entry."); struct AudioCard *audioCard = NULL; + ADM_LOG_INFO("entry."); (void)reply; (void)client; @@ -1181,9 +1181,9 @@ static int32_t StreamHostRenderStop(const struct HdfDeviceIoClient *client, stru static int32_t StreamHostRenderClose(const struct HdfDeviceIoClient *client, struct HdfSBuf *data, struct HdfSBuf *reply) { - ADM_LOG_INFO("entry."); struct AudioCard *audioCard = NULL; int32_t ret; + ADM_LOG_INFO("entry."); if (data == NULL) { ADM_LOG_ERR("RenderClose input param is NULL."); @@ -1264,9 +1264,9 @@ static int32_t StreamHostCaptureStop(const struct HdfDeviceIoClient *client, static int32_t StreamHostCaptureClose(const struct HdfDeviceIoClient *client, struct HdfSBuf *data, struct HdfSBuf *reply) { - ADM_LOG_INFO("entry."); struct AudioCard *audioCard = NULL; int32_t ret; + ADM_LOG_INFO("entry."); if (data == NULL) { ADM_LOG_ERR("CaptureClose input param is NULL."); diff --git a/framework/model/audio/usb/src/audio_usb_parse_interface.c b/framework/model/audio/usb/src/audio_usb_parse_interface.c index 6527c7d03..2bc1aeb98 100644 --- a/framework/model/audio/usb/src/audio_usb_parse_interface.c +++ b/framework/model/audio/usb/src/audio_usb_parse_interface.c @@ -325,11 +325,12 @@ static void AudioUsbPcmFormatSub( static uint64_t ParseAudioFormatType( struct AudioUsbDriver *audioUsbDriver, struct AudioUsbFormat *audioUsbFormat, uint64_t format, void *pFmt) { + int32_t ret; uint64_t pcmFormats = 0; struct AudioFmtInfo audioFmtInfo; (void)memset_s(&audioFmtInfo, sizeof(struct AudioFmtInfo), 0, sizeof(struct AudioFmtInfo)); - int32_t ret = AudioUsbFormatTypeInit(audioUsbFormat, &audioFmtInfo, pFmt, &format); + ret = AudioUsbFormatTypeInit(audioUsbFormat, &audioFmtInfo, pFmt, &format); if (ret == HDF_ERR_INVALID_PARAM) { return 0; /* invalid format, return 0 */ } diff --git a/framework/model/audio/usb/src/audio_usb_validate_desc.c b/framework/model/audio/usb/src/audio_usb_validate_desc.c index d3c7b03fa..546c1addd 100644 --- a/framework/model/audio/usb/src/audio_usb_validate_desc.c +++ b/framework/model/audio/usb/src/audio_usb_validate_desc.c @@ -489,8 +489,8 @@ static bool ValidateSelectorUnit(const void *ptr, const struct UsbDescValidator static bool ValidateUac1FeatureUnit(const void *ptr, const struct UsbDescValidator *usbDesc) { - (void)usbDesc; const struct uac_feature_unit_descriptor *featureDesc = ptr; + (void)usbDesc; if (featureDesc->bLength < sizeof(*featureDesc) || !featureDesc->bControlSize) { return false; @@ -501,8 +501,8 @@ static bool ValidateUac1FeatureUnit(const void *ptr, const struct UsbDescValidat static bool ValidateUac2FeatureUnit(const void *ptr, const struct UsbDescValidator *usbDesc) { - (void)usbDesc; const struct uac2_feature_unit_descriptor *featureDesc = ptr; + (void)usbDesc; if (featureDesc->bLength < sizeof(*featureDesc)) { return false; @@ -536,12 +536,13 @@ static const struct UsbDescValidator audioValidators[] = { bool AudioUsbValidateAudioDesc(void *ptr, int32_t protocol) { + bool valid = false; if (ptr == NULL) { AUDIO_DRIVER_LOG_ERR("input para is NULL."); return false; } - bool valid = ValidateDesc(ptr, protocol, audioValidators); + valid = ValidateDesc(ptr, protocol, audioValidators); return valid; } diff --git a/framework/model/input/driver/touchscreen/touch_gt911.c b/framework/model/input/driver/touchscreen/touch_gt911.c index ff37c8c3c..2ab5ed5fa 100644 --- a/framework/model/input/driver/touchscreen/touch_gt911.c +++ b/framework/model/input/driver/touchscreen/touch_gt911.c @@ -106,7 +106,8 @@ static int ChipCleanBuffer(InputI2cClient *i2cClient) static void ChipVersionDefault(ChipDevice *device, FrameData *frame, const uint8_t *buf, uint8_t pointNum) { - for (uint8_t i = 0; i < pointNum; i++) { // chipversion A:gt911_zsj5p5 + uint8_t i; + for (i = 0; i < pointNum; i++) { // chipversion A:gt911_zsj5p5 frame->fingers[i].trackId = buf[GT_POINT_SIZE * i + GT_TRACK_ID]; #if defined(CONFIG_ARCH_SPRD) int32_t resX = device->driver->boardCfg->attr.resolutionX; @@ -152,9 +153,10 @@ static void ChipVersionDefault(ChipDevice *device, FrameData *frame, const uint8 static void ChipVersionIsOne(ChipDevice *device, FrameData *frame, const uint8_t *buf, uint8_t pointNum) { + int8_t i; int32_t resX = device->driver->boardCfg->attr.resolutionX; int32_t resY = device->driver->boardCfg->attr.resolutionY; - for (uint8_t i = 0; i < pointNum; i++) { + for (i = 0; i < pointNum; i++) { frame->fingers[i].x = resX - 1 - ((buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_X_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); frame->fingers[i].y = resY - 1 - ((buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | @@ -165,9 +167,10 @@ static void ChipVersionIsOne(ChipDevice *device, FrameData *frame, const uint8_t static void ChipVersionIsExt(ChipDevice *device, FrameData *frame, const uint8_t *buf, uint8_t pointNum) { + int8_t i; int32_t resX = device->driver->boardCfg->attr.resolutionX; int32_t resY = device->driver->boardCfg->attr.resolutionY; - for (uint8_t i = 0; i < pointNum; i++) { + for (i = 0; i < pointNum; i++) { frame->fingers[i].x = resX - 1 - ((buf[GT_POINT_SIZE * i + GT_Y_LOW] & ONE_BYTE_MASK) | ((buf[GT_POINT_SIZE * i + GT_Y_HIGH] & ONE_BYTE_MASK) << ONE_BYTE_OFFSET)); frame->fingers[i].y = resY - 1 - ((buf[GT_POINT_SIZE * i + GT_X_LOW] & ONE_BYTE_MASK) | -- Gitee From ef402ed46a2f8d45e011e94df9dfb502ce5a1946 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Wed, 3 Jul 2024 18:01:15 +0800 Subject: [PATCH 2/3] replace get_fs()/set_fs() with force_uaccess_begin()/force_uaccess_end() Signed-off-by: Wu Xiaotian --- .../khdf/linux/platform/fwk/platform_trace.c | 17 +++++-- .../khdf/linux/platform/uart/uart_adapter.c | 48 ++++++++++++++----- .../platform/watchdog/watchdog_adapter.c | 32 +++++++++++++ interfaces/inner_api/utils/hdf_base.h | 2 +- 4 files changed, 82 insertions(+), 17 deletions(-) diff --git a/adapter/khdf/linux/platform/fwk/platform_trace.c b/adapter/khdf/linux/platform/fwk/platform_trace.c index d42ce9532..3835cde67 100644 --- a/adapter/khdf/linux/platform/fwk/platform_trace.c +++ b/adapter/khdf/linux/platform/fwk/platform_trace.c @@ -21,6 +21,7 @@ #include "stdarg.h" #include #include +#include #define CREATE_TRACE_POINTS #include @@ -124,14 +125,18 @@ static ssize_t TraceFileWrite(OsalFile *file, const char *string, uint32_t lengt } fp = (struct file *)file->realFile; pos = fp->f_pos; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) org_fs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + org_fs = force_uaccess_begin(); #endif ret = vfs_write(fp, string, length, &pos); -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(org_fs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(org_fs); #endif if (ret < 0) { HDF_LOGE("TraceFileWrite: write file length %d fail, ret: %d!", length, ret); @@ -155,15 +160,19 @@ static ssize_t TraceFileRead(OsalFile *file, char *buf, uint32_t length) return HDF_ERR_INVALID_PARAM; } fp = (struct file *)file->realFile; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) org_fs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + org_fs = force_uaccess_begin(); #endif pos = fp->f_pos; ret = vfs_read(fp, buf, length, &pos); -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(org_fs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(org_fs); #endif if (ret < 0) { HDF_LOGE("TraceFileRead: read file length %d fail, ret: %d!", length, ret); diff --git a/adapter/khdf/linux/platform/uart/uart_adapter.c b/adapter/khdf/linux/platform/uart/uart_adapter.c index d61aba92f..426000d8f 100644 --- a/adapter/khdf/linux/platform/uart/uart_adapter.c +++ b/adapter/khdf/linux/platform/uart/uart_adapter.c @@ -52,20 +52,26 @@ static int32_t UartAdapterInit(struct UartHost *host) if (sprintf_s(name, UART_PATHNAME_LEN - 1, "/dev/%s%d", g_driverName, host->num) < 0) { return HDF_FAILURE; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); #endif fp = filp_open(name, O_RDWR | O_NOCTTY | O_NDELAY, 0600); /* 0600 : file mode */ if (IS_ERR(fp)) { HDF_LOGE("UartAdapterInit: filp_open %s fail!", name); -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif return HDF_FAILURE; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif host->priv = fp; return HDF_SUCCESS; @@ -84,15 +90,19 @@ static int32_t UartAdapterDeInit(struct UartHost *host) } fp = (struct file *)host->priv; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); #endif if (!IS_ERR(fp) && fp) { filp_close(fp, NULL); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif host->priv = NULL; return HDF_SUCCESS; @@ -115,9 +125,11 @@ static int32_t UartAdapterRead(struct UartHost *host, uint8_t *data, uint32_t si } fp = (struct file *)host->priv; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); #endif while (size >= tmp) { ret = vfs_read(fp, p + tmp, 1, &pos); @@ -127,8 +139,10 @@ static int32_t UartAdapterRead(struct UartHost *host, uint8_t *data, uint32_t si } tmp++; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif return tmp; } @@ -149,20 +163,26 @@ static int32_t UartAdapterWrite(struct UartHost *host, uint8_t *data, uint32_t s } fp = (struct file *)host->priv; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); #endif ret = vfs_write(fp, p, size, &pos); if (ret < 0) { HDF_LOGE("UartAdapterWrite: vfs_write fail, ret: %d!", ret); -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif return HDF_FAILURE; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif return HDF_SUCCESS; } @@ -178,15 +198,19 @@ static int UartAdapterIoctlInner(struct file *fp, unsigned cmd, unsigned long ar HDF_LOGE("UartAdapterIoctlInner: fp is null!"); return HDF_FAILURE; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); #endif if (fp->f_op->unlocked_ioctl != NULL) { ret = fp->f_op->unlocked_ioctl(fp, cmd, arg); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); #endif return ret; } diff --git a/adapter/khdf/linux/platform/watchdog/watchdog_adapter.c b/adapter/khdf/linux/platform/watchdog/watchdog_adapter.c index 8ded4e61f..0707296a9 100644 --- a/adapter/khdf/linux/platform/watchdog/watchdog_adapter.c +++ b/adapter/khdf/linux/platform/watchdog/watchdog_adapter.c @@ -39,12 +39,20 @@ static int WdtAdapterIoctlInner(struct file *fp, unsigned cmd, unsigned long arg int ret = HDF_FAILURE; mm_segment_t oldfs; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); +#endif if (fp->f_op->unlocked_ioctl) { ret = fp->f_op->unlocked_ioctl(fp, cmd, arg); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); +#endif return ret; } @@ -62,19 +70,35 @@ static int32_t WdtOpenFile(struct WatchdogCntlr *wdt) HDF_LOGE("WdtOpenFile: sprintf_s fail!"); return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); +#endif fp = filp_open(name, O_RDWR, 0600); /* 0600 : for open mode */ if (IS_ERR(fp)) { HDF_LOGE("WdtOpenFile: filp_open %s fail!", name); if (PTR_ERR(fp) == HDF_ERR_DEVICE_BUSY) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); +#endif return HDF_ERR_DEVICE_BUSY; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); +#endif return HDF_FAILURE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); +#endif wdt->priv = fp; return HDF_SUCCESS; } @@ -84,12 +108,20 @@ static void WdtAdapterClose(struct WatchdogCntlr *wdt) mm_segment_t oldfs; struct file *fp = (struct file *)wdt->priv; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) oldfs = get_fs(); set_fs(KERNEL_DS); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + oldfs = force_uaccess_begin(); +#endif if (!IS_ERR(fp) && fp) { (void)filp_close(fp, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) set_fs(oldfs); +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) + force_uaccess_end(oldfs); +#endif wdt->priv = NULL; } diff --git a/interfaces/inner_api/utils/hdf_base.h b/interfaces/inner_api/utils/hdf_base.h index 165b4b995..bbeed462d 100644 --- a/interfaces/inner_api/utils/hdf_base.h +++ b/interfaces/inner_api/utils/hdf_base.h @@ -125,7 +125,7 @@ typedef enum { /** * @brief Declares the full path of the HDF module library. */ -#if (defined(__aarch64__) || defined(__x86_64__)) +#if (defined(__aarch64__) || defined(__x86_64__) || defined(__loongarch_lp64)) #define HDF_LIBRARY_FULL_PATH(x) "/vendor/lib64/" x ".z.so" #else #define HDF_LIBRARY_FULL_PATH(x) "/vendor/lib/" x ".z.so" -- Gitee From 7959c4abcdf7411a6c8ce210431065db252824c3 Mon Sep 17 00:00:00 2001 From: bi1tor Date: Fri, 12 Jul 2024 18:19:34 +0800 Subject: [PATCH 3/3] fix default page size Signed-off-by: Xiaotian Wu --- adapter/uhdf2/host/BUILD.gn | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/adapter/uhdf2/host/BUILD.gn b/adapter/uhdf2/host/BUILD.gn index 859bd4fd5..4b0d3a77a 100644 --- a/adapter/uhdf2/host/BUILD.gn +++ b/adapter/uhdf2/host/BUILD.gn @@ -140,10 +140,13 @@ if (defined(ohos_lite)) { } # Ensure that the maximum page size is 4096 and the load section is aligned - ldflags = [ - "-Wl,-z,max-page-size=4096", - "-Wl,-z,separate-code", - ] + ldflags = [ "-Wl,-z,separate-code" ] + + if (target_cpu == "loongarch64") { + ldflags += [ "-Wl,-z,max-page-size=16384" ] + } else { + ldflags += [ "-Wl,-z,max-page-size=4096" ] + } install_enable = true install_images = [ chipset_base_dir ] -- Gitee