!198 优化quickstart宏定义

Merge pull request !198 from boxi/master
This commit is contained in:
openharmony_ci 2021-04-29 14:09:51 +08:00 committed by Gitee
commit 8592e04c78
2 changed files with 4 additions and 6 deletions

View File

@ -55,18 +55,16 @@ typedef enum {
QS_CTL_LIMIT QS_CTL_LIMIT
} QuickstartConctrl; } 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_IOC_MAGIC 'T'
#define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, QS_UNREGISTER) #define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, QS_UNREGISTER)
#define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY) #define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY)
#define QUICKSTART_LISTEN _IO(QUICKSTART_IOC_MAGIC, QS_LISTEN) #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 QUICKSTART_NODE "/dev/quickstart"
#define QS_STAGE_CNT (QS_STAGE_LIMIT - QS_STAGE1)
typedef void (*SysteminitHook)(void); typedef void (*SysteminitHook)(void);
typedef struct { typedef struct {

View File

@ -100,7 +100,7 @@ static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg)
QuickstartListen(arg); QuickstartListen(arg);
break; break;
default: 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; break;
} }
return 0; return 0;