drivers: Format pointer through "%p" for kthread_create
to remove the unnecessary cast and unify the usage Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
c267791f06
commit
fc5e85da1b
@ -601,7 +601,7 @@ static int nuttx_task_hook(int argc, char *argv[])
|
|||||||
struct task_struct *task;
|
struct task_struct *task;
|
||||||
struct nthread_wrapper *wrap;
|
struct nthread_wrapper *wrap;
|
||||||
task = (struct task_struct *)
|
task = (struct task_struct *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
if (!task || !task->priv)
|
if (!task || !task->priv)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -624,7 +624,7 @@ int rtw_create_task(struct task_struct *task, const char *name,
|
|||||||
char *argv[2];
|
char *argv[2];
|
||||||
char arg1[16];
|
char arg1[16];
|
||||||
int pid;
|
int pid;
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)task);
|
snprintf(arg1, 16, "%p", task);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
wrap = malloc(sizeof(*wrap));
|
wrap = malloc(sizeof(*wrap));
|
||||||
|
@ -1269,8 +1269,8 @@ int mpfs_ihc_init(void)
|
|||||||
|
|
||||||
/* Thread initialization */
|
/* Thread initialization */
|
||||||
|
|
||||||
snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR,
|
snprintf(arg1, sizeof(arg1), "%p",
|
||||||
(uintptr_t)g_mpfs_virtqueue_table);
|
g_mpfs_virtqueue_table);
|
||||||
argv[0] = "mpfs_ihc_thread";
|
argv[0] = "mpfs_ihc_thread";
|
||||||
argv[1] = arg1;
|
argv[1] = arg1;
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
|
@ -340,7 +340,7 @@ int sam_usbhost_initialize(void)
|
|||||||
|
|
||||||
pid = kthread_create("OHCI Monitor", CONFIG_JUPITERNANO_USBHOST_PRIO,
|
pid = kthread_create("OHCI Monitor", CONFIG_JUPITERNANO_USBHOST_PRIO,
|
||||||
CONFIG_JUPITERNANO_USBHOST_STACKSIZE,
|
CONFIG_JUPITERNANO_USBHOST_STACKSIZE,
|
||||||
(main_t)ohci_waiter, (char * const *)NULL);
|
ohci_waiter, NULL);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret);
|
uerr("ERROR: Failed to create ohci_waiter task: %d\n", ret);
|
||||||
@ -362,7 +362,7 @@ int sam_usbhost_initialize(void)
|
|||||||
|
|
||||||
pid = kthread_create("EHCI Monitor", CONFIG_JUPITERNANO_USBHOST_PRIO,
|
pid = kthread_create("EHCI Monitor", CONFIG_JUPITERNANO_USBHOST_PRIO,
|
||||||
CONFIG_JUPITERNANO_USBHOST_STACKSIZE,
|
CONFIG_JUPITERNANO_USBHOST_STACKSIZE,
|
||||||
(main_t)ehci_waiter, (char * const *)NULL);
|
ehci_waiter, NULL);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
|
uerr("ERROR: Failed to create ehci_waiter task: %d\n", ret);
|
||||||
|
@ -228,8 +228,8 @@ int stm32_usbhost_initialize(void)
|
|||||||
uinfo("Start usbhost_waiter\n");
|
uinfo("Start usbhost_waiter\n");
|
||||||
|
|
||||||
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
||||||
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
||||||
usbhost_waiter, NULL);
|
usbhost_waiter, NULL);
|
||||||
return ret < 0 ? -ENOEXEC : OK;
|
return ret < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ int stm32_usbhost_initialize(void)
|
|||||||
uinfo("Start usbhost_waiter\n");
|
uinfo("Start usbhost_waiter\n");
|
||||||
|
|
||||||
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
||||||
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
||||||
(main_t)usbhost_waiter, (char * const *)NULL);
|
usbhost_waiter, NULL);
|
||||||
return ret < 0 ? -ENOEXEC : OK;
|
return ret < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +235,8 @@ int stm32_usbhost_initialize(void)
|
|||||||
uinfo("Start usbhost_waiter\n");
|
uinfo("Start usbhost_waiter\n");
|
||||||
|
|
||||||
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
ret = kthread_create("usbhost", CONFIG_STM32F7F4DISCO_USBHOST_PRIO,
|
||||||
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
CONFIG_STM32F7F4DISCO_USBHOST_STACKSIZE,
|
||||||
(main_t)usbhost_waiter, (char * const *)NULL);
|
usbhost_waiter, NULL);
|
||||||
return ret < 0 ? -ENOEXEC : OK;
|
return ret < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ int stm32_usbhost_initialize(void)
|
|||||||
|
|
||||||
pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
|
pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
|
||||||
CONFIG_USBHOST_STACKSIZE,
|
CONFIG_USBHOST_STACKSIZE,
|
||||||
(main_t)usbhost_waiter, (FAR char * const *)NULL);
|
usbhost_waiter, NULL);
|
||||||
return pid < 0 ? -ENOEXEC : OK;
|
return pid < 0 ? -ENOEXEC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,7 +1098,7 @@ static int alt1250_start_rxthread(FAR struct alt1250_dev_s *dev,
|
|||||||
SCHED_PRIORITY_DEFAULT,
|
SCHED_PRIORITY_DEFAULT,
|
||||||
CONFIG_DEFAULT_TASK_STACKSIZE,
|
CONFIG_DEFAULT_TASK_STACKSIZE,
|
||||||
altcom_recvthread,
|
altcom_recvthread,
|
||||||
(FAR char * const *)NULL);
|
NULL);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ static int rptun_thread(int argc, FAR char *argv[])
|
|||||||
{
|
{
|
||||||
FAR struct rptun_priv_s *priv;
|
FAR struct rptun_priv_s *priv;
|
||||||
|
|
||||||
priv = (FAR struct rptun_priv_s *)((uintptr_t)strtoul(argv[2], NULL, 0));
|
priv = (FAR struct rptun_priv_s *)((uintptr_t)strtoul(argv[2], NULL, 16));
|
||||||
priv->tid = nxsched_gettid();
|
priv->tid = nxsched_gettid();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@ -1213,7 +1213,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
|||||||
nxsem_init(&priv->semrx, 0, 0);
|
nxsem_init(&priv->semrx, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR, (uintptr_t)priv);
|
snprintf(arg1, sizeof(arg1), "%p", priv);
|
||||||
argv[0] = (void *)RPTUN_GET_CPUNAME(dev);
|
argv[0] = (void *)RPTUN_GET_CPUNAME(dev);
|
||||||
argv[1] = arg1;
|
argv[1] = arg1;
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
|
@ -811,7 +811,7 @@ static int ds18b20_thread(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
uint16_t orawdata;
|
uint16_t orawdata;
|
||||||
FAR struct ds18b20_dev_s *priv = (FAR struct ds18b20_dev_s *)
|
FAR struct ds18b20_dev_s *priv = (FAR struct ds18b20_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
|
|
||||||
/* Set initial value to out of measurement range to ensure that the first
|
/* Set initial value to out of measurement range to ensure that the first
|
||||||
* data read leads to an upper notification.
|
* data read leads to an upper notification.
|
||||||
@ -971,7 +971,7 @@ int ds18b20_register(int devno, FAR struct onewire_master_s *onewire,
|
|||||||
|
|
||||||
/* Create thread for polling sensor data */
|
/* Create thread for polling sensor data */
|
||||||
|
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
|
snprintf(arg1, 16, "%p", priv);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
ret = kthread_create("ds18b20_thread", SCHED_PRIORITY_DEFAULT,
|
ret = kthread_create("ds18b20_thread", SCHED_PRIORITY_DEFAULT,
|
||||||
|
@ -304,7 +304,7 @@ void fakesensor_push_event(FAR struct sensor_lowerhalf_s *lower,
|
|||||||
static int fakesensor_thread(int argc, char** argv)
|
static int fakesensor_thread(int argc, char** argv)
|
||||||
{
|
{
|
||||||
FAR struct fakesensor_s *sensor = (FAR struct fakesensor_s *)
|
FAR struct fakesensor_s *sensor = (FAR struct fakesensor_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -781,7 +781,7 @@ static int hyt271_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
|||||||
static int hyt271_thread(int argc, char** argv)
|
static int hyt271_thread(int argc, char** argv)
|
||||||
{
|
{
|
||||||
FAR struct hyt271_dev_s *priv = (FAR struct hyt271_dev_s *)
|
FAR struct hyt271_dev_s *priv = (FAR struct hyt271_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
uint32_t orawdata = 0;
|
uint32_t orawdata = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@ -954,7 +954,7 @@ int hyt271_register(int devno, FAR struct i2c_master_s *i2c, uint8_t addr,
|
|||||||
#ifdef CONFIG_SENSORS_HYT271_POLL
|
#ifdef CONFIG_SENSORS_HYT271_POLL
|
||||||
/* Create thread for sensor */
|
/* Create thread for sensor */
|
||||||
|
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
|
snprintf(arg1, 16, "%p", priv);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
ret = kthread_create("hyt271_thread", SCHED_PRIORITY_DEFAULT,
|
ret = kthread_create("hyt271_thread", SCHED_PRIORITY_DEFAULT,
|
||||||
|
@ -505,7 +505,7 @@ err_out:
|
|||||||
static int ltr308_thread(int argc, char** argv)
|
static int ltr308_thread(int argc, char** argv)
|
||||||
{
|
{
|
||||||
FAR struct ltr308_dev_s *priv = (FAR struct ltr308_dev_s *)
|
FAR struct ltr308_dev_s *priv = (FAR struct ltr308_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
struct sensor_light light;
|
struct sensor_light light;
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
bool data_pending;
|
bool data_pending;
|
||||||
@ -628,7 +628,7 @@ int ltr308_register(int devno, FAR struct i2c_master_s *i2c)
|
|||||||
|
|
||||||
/* Create thread for polling sensor data */
|
/* Create thread for polling sensor data */
|
||||||
|
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
|
snprintf(arg1, 16, "%p", priv);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
ret = kthread_create("ltr308_thread", SCHED_PRIORITY_DEFAULT,
|
ret = kthread_create("ltr308_thread", SCHED_PRIORITY_DEFAULT,
|
||||||
|
@ -1849,7 +1849,7 @@ static void mpu9250_mag_data(FAR struct mpu9250_sensor_s *priv,
|
|||||||
static int mpu9250_thread(int argc, FAR char **argv)
|
static int mpu9250_thread(int argc, FAR char **argv)
|
||||||
{
|
{
|
||||||
FAR struct mpu9250_dev_s *dev = (FAR struct mpu9250_dev_s *)
|
FAR struct mpu9250_dev_s *dev = (FAR struct mpu9250_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
FAR struct mpu9250_sensor_s *accel = &dev->priv[MPU9250_ACCEL_IDX];
|
FAR struct mpu9250_sensor_s *accel = &dev->priv[MPU9250_ACCEL_IDX];
|
||||||
FAR struct mpu9250_sensor_s *gyro = &dev->priv[MPU9250_GYRO_IDX];
|
FAR struct mpu9250_sensor_s *gyro = &dev->priv[MPU9250_GYRO_IDX];
|
||||||
FAR struct mpu9250_sensor_s *mag = &dev->priv[MPU9250_MAG_IDX];
|
FAR struct mpu9250_sensor_s *mag = &dev->priv[MPU9250_MAG_IDX];
|
||||||
@ -2019,7 +2019,7 @@ int mpu9250_register(int devno, FAR struct mpu9250_config_s *config)
|
|||||||
|
|
||||||
/* Create thread for polling sensor data */
|
/* Create thread for polling sensor data */
|
||||||
|
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)dev);
|
snprintf(arg1, 16, "%p", dev);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ static inline void baro_measure_read(FAR struct ms5611_dev_s *priv,
|
|||||||
static int ms5611_thread(int argc, char **argv)
|
static int ms5611_thread(int argc, char **argv)
|
||||||
{
|
{
|
||||||
FAR struct ms5611_dev_s *priv = (FAR struct ms5611_dev_s *)
|
FAR struct ms5611_dev_s *priv = (FAR struct ms5611_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
|
|
||||||
struct sensor_baro baro_data;
|
struct sensor_baro baro_data;
|
||||||
|
|
||||||
@ -687,7 +687,7 @@ int ms5611_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr)
|
|||||||
|
|
||||||
/* Create thread for polling sensor data */
|
/* Create thread for polling sensor data */
|
||||||
|
|
||||||
snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
|
snprintf(arg1, 16, "%p", priv);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
ret = kthread_create("ms5611_thread", SCHED_PRIORITY_DEFAULT,
|
ret = kthread_create("ms5611_thread", SCHED_PRIORITY_DEFAULT,
|
||||||
|
@ -391,7 +391,7 @@ static bool wtgahrs2_process_data(FAR struct wtgahrs2_dev_s *rtdata,
|
|||||||
static int wtgahrs2_thread(int argc, FAR char *argv[])
|
static int wtgahrs2_thread(int argc, FAR char *argv[])
|
||||||
{
|
{
|
||||||
FAR struct wtgahrs2_dev_s *rtdata = (FAR struct wtgahrs2_dev_s *)
|
FAR struct wtgahrs2_dev_s *rtdata = (FAR struct wtgahrs2_dev_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
(uintptr_t)strtoul(argv[1], NULL, 16);
|
||||||
unsigned char buffer[8 * WTGAHRS2_RSP_LENGTH];
|
unsigned char buffer[8 * WTGAHRS2_RSP_LENGTH];
|
||||||
ssize_t count = 0;
|
ssize_t count = 0;
|
||||||
ssize_t pos;
|
ssize_t pos;
|
||||||
@ -542,7 +542,7 @@ int wtgahrs2_initialize(FAR const char *path, int devno)
|
|||||||
|
|
||||||
wtgahrs2_sendcmd(rtdata, g_wtgahrs2_enable_sensor);
|
wtgahrs2_sendcmd(rtdata, g_wtgahrs2_enable_sensor);
|
||||||
|
|
||||||
snprintf(arg1, sizeof(arg1), "0x%" PRIxPTR, (uintptr_t)rtdata);
|
snprintf(arg1, sizeof(arg1), "%p", rtdata);
|
||||||
argv[0] = arg1;
|
argv[0] = arg1;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ static int work_thread(int argc, FAR char *argv[])
|
|||||||
FAR void *arg;
|
FAR void *arg;
|
||||||
|
|
||||||
wqueue = (FAR struct kwork_wqueue_s *)
|
wqueue = (FAR struct kwork_wqueue_s *)
|
||||||
((uintptr_t)strtoul(argv[1], NULL, 0));
|
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ static int work_thread_create(FAR const char *name, int priority,
|
|||||||
int wndx;
|
int wndx;
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
snprintf(args, sizeof(args), "0x%" PRIxPTR, (uintptr_t)wqueue);
|
snprintf(args, sizeof(args), "%p", wqueue);
|
||||||
argv[0] = args;
|
argv[0] = args;
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user