driver/sensor: add name prefix "sensor_" for sensor register

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-03-29 11:39:44 +08:00 committed by Xiang Xiao
parent 26dbdba5d8
commit 3fdd036ba6

View File

@ -46,8 +46,7 @@
/* Device naming ************************************************************/
#define ROUNDUP(x, esize) ((x + (esize - 1)) / (esize)) * (esize)
#define DEVNAME_FMT "/dev/sensor/%s%s%d"
#define DEVNAME_MAX 64
#define DEVNAME_FMT "/dev/sensor/sensor_%s%s%d"
#define DEVNAME_UNCAL "_uncal"
/****************************************************************************
@ -880,11 +879,11 @@ static void sensor_notify_event(FAR void *priv)
int sensor_register(FAR struct sensor_lowerhalf_s *lower, int devno)
{
char path[DEVNAME_MAX];
char path[PATH_MAX];
DEBUGASSERT(lower != NULL);
snprintf(path, DEVNAME_MAX, DEVNAME_FMT,
snprintf(path, PATH_MAX, DEVNAME_FMT,
g_sensor_info[lower->type].name,
lower->uncalibrated ? DEVNAME_UNCAL : "",
devno);
@ -1007,9 +1006,9 @@ drv_err:
void sensor_unregister(FAR struct sensor_lowerhalf_s *lower, int devno)
{
char path[DEVNAME_MAX];
char path[PATH_MAX];
snprintf(path, DEVNAME_MAX, DEVNAME_FMT,
snprintf(path, PATH_MAX, DEVNAME_FMT,
g_sensor_info[lower->type].name,
lower->uncalibrated ? DEVNAME_UNCAL : "",
devno);