From cb140a4442c02dd0b1925cc58deecbf4da36dcea Mon Sep 17 00:00:00 2001 From: boxi Date: Thu, 29 Apr 2021 11:40:01 +0800 Subject: [PATCH] fix: Optimiz macro of quickstart cmd Optimiz macro of quickstart cmd. Close #I3OSYT Change-Id: I5b96823c6ec7f7eab2c0a80eda8ad30bcf2b9d32 --- drivers/char/quickstart/include/los_dev_quickstart.h | 8 +++----- drivers/char/quickstart/src/quickstart.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/char/quickstart/include/los_dev_quickstart.h b/drivers/char/quickstart/include/los_dev_quickstart.h index 33c8af3b..16b514dc 100644 --- a/drivers/char/quickstart/include/los_dev_quickstart.h +++ b/drivers/char/quickstart/include/los_dev_quickstart.h @@ -55,18 +55,16 @@ typedef enum { QS_CTL_LIMIT } QuickstartConctrl; -#define QS_STAGE_CNT (QS_STAGE_LIMIT - QS_STAGE1) - -#define QS_STAGE_NO(x) QS_STAGE##x - #define QUICKSTART_IOC_MAGIC 'T' #define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, QS_UNREGISTER) #define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY) #define QUICKSTART_LISTEN _IO(QUICKSTART_IOC_MAGIC, QS_LISTEN) -#define QUICKSTART_STAGE(x) _IO(QUICKSTART_IOC_MAGIC, QS_STAGE_NO(x)) +#define QUICKSTART_STAGE(x) _IO(QUICKSTART_IOC_MAGIC, (x)) #define QUICKSTART_NODE "/dev/quickstart" +#define QS_STAGE_CNT (QS_STAGE_LIMIT - QS_STAGE1) + typedef void (*SysteminitHook)(void); typedef struct { diff --git a/drivers/char/quickstart/src/quickstart.c b/drivers/char/quickstart/src/quickstart.c index 5d1a03e9..4e955842 100644 --- a/drivers/char/quickstart/src/quickstart.c +++ b/drivers/char/quickstart/src/quickstart.c @@ -100,7 +100,7 @@ static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg) QuickstartListen(arg); break; default: - QuickstartStageWorking(cmd - QUICKSTART_STAGE(1)); /* ioctl cmd converted to stage level */ + QuickstartStageWorking(cmd - QUICKSTART_STAGE(QS_STAGE1)); /* ioctl cmd converted to stage level */ break; } return 0;