1.修改ioctl返回值为int。

This commit is contained in:
MacRsh
2024-01-19 20:42:34 +08:00
parent dffa5fba52
commit 6894b544bc
13 changed files with 23 additions and 23 deletions

View File

@@ -26,7 +26,7 @@ static int msh_update_path(int desc)
int offset;
/* Update the path */
int ret = (int)mr_dev_ioctl(desc, MR_CTL_GET_PATH, &path);
int ret = mr_dev_ioctl(desc, MR_CTL_GET_PATH, &path);
if (ret < 0)
{
return ret;
@@ -242,7 +242,7 @@ static int msh_dioctl_bufsz(int argc, void *argv)
}
/* Set/get the buffer size */
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), cmd, &bufsz);
ret = mr_dev_ioctl(MSH_GET_DESC(), cmd, &bufsz);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));
@@ -295,7 +295,7 @@ static int msh_dioctl_datasz(int argc, void *argv)
}
/* Set/get the buffer size */
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), cmd, &datasz);
ret = mr_dev_ioctl(MSH_GET_DESC(), cmd, &datasz);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));
@@ -330,7 +330,7 @@ static int msh_cmd_dioctl_cfg(int argc, void *argv)
if (strncmp(MR_MSH_GET_ARG(2), "-g", 2) == 0)
{
/* Get the config */
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), MR_CTL_GET_CONFIG, cfg);
ret = mr_dev_ioctl(MSH_GET_DESC(), MR_CTL_GET_CONFIG, cfg);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));
@@ -355,7 +355,7 @@ static int msh_cmd_dioctl_cfg(int argc, void *argv)
}
/* Set the config */
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), MR_CTL_SET_CONFIG, cfg);
ret = mr_dev_ioctl(MSH_GET_DESC(), MR_CTL_SET_CONFIG, cfg);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));
@@ -458,7 +458,7 @@ static int msh_dioctl_cmd(int argc, void *argv)
if (cmd < 0)
{
/* Get the arguments */
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), cmd, args);
ret = mr_dev_ioctl(MSH_GET_DESC(), cmd, args);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));
@@ -481,7 +481,7 @@ static int msh_dioctl_cmd(int argc, void *argv)
goto usage;
}
}
ret = (int)mr_dev_ioctl(MSH_GET_DESC(), cmd, args);
ret = mr_dev_ioctl(MSH_GET_DESC(), cmd, args);
if (ret < 0)
{
mr_msh_printf("error: %s\r\n", mr_strerror(ret));

View File

@@ -103,7 +103,7 @@ static ssize_t mr_adc_read(struct mr_dev *dev, int off, void *buf, size_t size,
return rd_size;
}
static ssize_t mr_adc_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_adc_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_adc *adc = (struct mr_adc *)dev;

View File

@@ -269,7 +269,7 @@ static ssize_t mr_can_dev_write(struct mr_dev *dev, int off, const void *buf, si
return ret;
}
static ssize_t mr_can_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_can_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_can_dev *can_dev = (struct mr_can_dev *)dev;

View File

@@ -103,7 +103,7 @@ static ssize_t mr_dac_write(struct mr_dev *dev, int off, const void *buf, size_t
return wr_size;
}
static ssize_t mr_dac_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_dac_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_dac *dac = (struct mr_dac *)dev;

View File

@@ -298,7 +298,7 @@ static ssize_t mr_i2c_dev_write(struct mr_dev *dev, int off, const void *buf, si
return ret;
}
static ssize_t mr_i2c_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_i2c_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_i2c_dev *i2c_dev = (struct mr_i2c_dev *)dev;

View File

@@ -137,7 +137,7 @@ static ssize_t mr_pin_write(struct mr_dev *dev, int off, const void *buf, size_t
return wr_size;
}
static ssize_t mr_pin_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_pin_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_pin *pin = (struct mr_pin *)dev;

View File

@@ -218,7 +218,7 @@ static ssize_t mr_pwm_write(struct mr_dev *dev, int off, const void *buf, size_t
return wr_size;
}
static ssize_t mr_pwm_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_pwm_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_pwm *pwm = (struct mr_pwm *)dev;
struct mr_pwm_ops *ops = (struct mr_pwm_ops *)dev->drv->ops;

View File

@@ -88,7 +88,7 @@ static ssize_t mr_serial_write(struct mr_dev *dev, int off, const void *buf, siz
return wr_size;
}
static ssize_t mr_serial_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_serial_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_serial *serial = (struct mr_serial *)dev;
struct mr_serial_ops *ops = (struct mr_serial_ops *)dev->drv->ops;

View File

@@ -498,7 +498,7 @@ static ssize_t mr_spi_dev_write(struct mr_dev *dev, int off, const void *buf, si
return ret;
}
static ssize_t mr_spi_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_spi_dev_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_spi_dev *spi_dev = (struct mr_spi_dev *)dev;

View File

@@ -177,7 +177,7 @@ static ssize_t mr_timer_write(struct mr_dev *dev, int off, const void *buf, size
return wr_size;
}
static ssize_t mr_timer_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
static int mr_timer_ioctl(struct mr_dev *dev, int off, int cmd, void *args)
{
struct mr_timer *timer = (struct mr_timer *)dev;

View File

@@ -107,7 +107,7 @@ int mr_dev_open(const char *path, int oflags);
int mr_dev_close(int desc);
ssize_t mr_dev_read(int desc, void *buf, size_t size);
ssize_t mr_dev_write(int desc, const void *buf, size_t size);
ssize_t mr_dev_ioctl(int desc, int cmd, void *args);
int mr_dev_ioctl(int desc, int cmd, void *args);
int mr_dev_is_valid(int desc);
/** @} */

View File

@@ -351,7 +351,7 @@ MR_INLINE ssize_t dev_write(struct mr_dev *dev, int offset, const void *buf, siz
return ret;
}
MR_INLINE ssize_t dev_ioctl(struct mr_dev *dev, int desc, int off, int cmd, void *args)
MR_INLINE int dev_ioctl(struct mr_dev *dev, int desc, int off, int cmd, void *args)
{
/* Check whether the device has an ioctl function */
if (dev->ops->ioctl == MR_NULL)
@@ -447,7 +447,7 @@ MR_INLINE ssize_t dev_ioctl(struct mr_dev *dev, int desc, int off, int cmd, void
#endif /* MR_USING_RDWR_CTL */
/* I/O control to the device */
ssize_t ret = dev->ops->ioctl(dev, off, cmd, args);
int ret = dev->ops->ioctl(dev, off, cmd, args);
#ifdef MR_USING_RDWR_CTL
dev_lock_release(dev, MR_LFLAG_RDWR);
@@ -759,7 +759,7 @@ ssize_t mr_dev_write(int desc, const void *buf, size_t size)
*
* @return The arguments of the device, otherwise an error code.
*/
ssize_t mr_dev_ioctl(int desc, int cmd, void *args)
int mr_dev_ioctl(int desc, int cmd, void *args)
{
MR_DESC_CHECK(desc);

View File

@@ -12,13 +12,13 @@ static int start(void)
{
return 0;
}
MR_INIT_EXPORT(start, "0");
_MR_INIT_EXPORT(start, "0");
static int end(void)
{
return 0;
}
MR_INIT_EXPORT(end, "5.end");
_MR_INIT_EXPORT(end, "5.end");
/**
* @brief This function is auto initialized.
@@ -106,7 +106,7 @@ MR_WEAK int mr_printf_output(const char *buf, size_t size)
#ifndef MR_USING_PRINTF_NONBLOCKING
desc = mr_dev_open(MR_CFG_PRINTF_DEV_NAME, MR_OFLAG_RDWR);
#else
console = mr_dev_open(MR_CFG_PRINTF_DEV_NAME, MR_OFLAG_RDWR | MR_OFLAG_NONBLOCK);
desc = mr_dev_open(MR_CFG_PRINTF_DEV_NAME, MR_OFLAG_RDWR | MR_OFLAG_NONBLOCK);
#endif /* MR_USING_PRINTF_NONBLOCKING */
if (mr_dev_is_valid(desc) == MR_FALSE)
{