mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
register_driver: fix driver modes accross the code
State of problem: - Some drivers that do not support write operations (does not have write handler or ioctl do not perform any write actions) are registered with write permissions - Some drivers that do not support read operation (does not have read handler or ioctl do not perform any read actions) are registered with read permissions - Some drivers are registered with execute permissions Solution: - Iterate code where register_driver() is used and change 'mode' parameter to reflect the actual read/write operations executed by a driver - Remove execute permissions from 'mode' parameter Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
1d89d9ae4b
commit
41c95da594
@@ -67,7 +67,7 @@ static const struct file_operations g_ge2dfops =
|
|||||||
.close = ge2d_close,
|
.close = ge2d_close,
|
||||||
.read = ge2d_read,
|
.read = ge2d_read,
|
||||||
.write = ge2d_write,
|
.write = ge2d_write,
|
||||||
.seek = 0,
|
.seek = NULL,
|
||||||
.ioctl = ge2d_ioctl,
|
.ioctl = ge2d_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ static int cxd56_sphirqhandler(int irq, FAR void *context, FAR void *arg);
|
|||||||
static const struct file_operations sph_fops =
|
static const struct file_operations sph_fops =
|
||||||
{
|
{
|
||||||
.open = sph_open,
|
.open = sph_open,
|
||||||
.close = 0,
|
.close = NULL,
|
||||||
.read = 0,
|
.read = NULL,
|
||||||
.write = 0,
|
.write = NULL,
|
||||||
.seek = 0,
|
.seek = NULL,
|
||||||
.ioctl = sph_ioctl,
|
.ioctl = sph_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ static const struct file_operations g_uart0fops =
|
|||||||
.close = uart0_close,
|
.close = uart0_close,
|
||||||
.read = uart0_read,
|
.read = uart0_read,
|
||||||
.write = uart0_write,
|
.write = uart0_write,
|
||||||
.seek = 0,
|
.seek = NULL,
|
||||||
.ioctl = uart0_ioctl,
|
.ioctl = uart0_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ static ssize_t nrf52_rng_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
void devrandom_register(void)
|
void devrandom_register(void)
|
||||||
{
|
{
|
||||||
nrf52_rng_initialize();
|
nrf52_rng_initialize();
|
||||||
register_driver("/dev/random", FAR & g_rngops, 0444, NULL);
|
register_driver("/dev/random", &g_rngops, 0444, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ void devurandom_register(void)
|
|||||||
#ifndef CONFIG_DEV_RANDOM
|
#ifndef CONFIG_DEV_RANDOM
|
||||||
nrf52_rng_initialize();
|
nrf52_rng_initialize();
|
||||||
#endif
|
#endif
|
||||||
register_driver("dev/urandom", FAR & g_rngops, 0444, NULL);
|
register_driver("dev/urandom", &g_rngops, 0444, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ static const struct file_operations g_trngops =
|
|||||||
NULL, /* seek */
|
NULL, /* seek */
|
||||||
NULL, /* ioctl */
|
NULL, /* ioctl */
|
||||||
NULL /* poll */
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -400,7 +403,7 @@ void devrandom_register(void)
|
|||||||
ret = sam_rng_initialize();
|
ret = sam_rng_initialize();
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
ret = register_driver("/dev/random", &g_trngops, 0644, NULL);
|
ret = register_driver("/dev/random", &g_trngops, 0444, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to register /dev/random\n");
|
ferr("ERROR: Failed to register /dev/random\n");
|
||||||
@@ -433,7 +436,7 @@ void devurandom_register(void)
|
|||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = register_driver("/dev/urandom", &g_trngops, 0644, NULL);
|
ret = register_driver("/dev/urandom", &g_trngops, 0444, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to register /dev/urandom\n");
|
ferr("ERROR: Failed to register /dev/urandom\n");
|
||||||
|
|||||||
@@ -238,6 +238,9 @@ static const struct file_operations g_tsdops =
|
|||||||
NULL, /* seek */
|
NULL, /* seek */
|
||||||
sam_tsd_ioctl, /* ioctl */
|
sam_tsd_ioctl, /* ioctl */
|
||||||
sam_tsd_poll /* poll */
|
sam_tsd_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The driver state structure is pre-allocated. */
|
/* The driver state structure is pre-allocated. */
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ static const struct file_operations g_trngops =
|
|||||||
NULL, /* seek */
|
NULL, /* seek */
|
||||||
NULL, /* ioctl */
|
NULL, /* ioctl */
|
||||||
NULL /* poll */
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -402,7 +405,7 @@ void devrandom_register(void)
|
|||||||
ret = sam_rng_initialize();
|
ret = sam_rng_initialize();
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
ret = register_driver("/dev/random", &g_trngops, 0644, NULL);
|
ret = register_driver("/dev/random", &g_trngops, 0444, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to register /dev/random\n");
|
ferr("ERROR: Failed to register /dev/random\n");
|
||||||
@@ -435,7 +438,7 @@ void devurandom_register(void)
|
|||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ret = register_driver("/dev/urandom", &g_trngops, 0644, NULL);
|
ret = register_driver("/dev/urandom", &g_trngops, 0444, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ferr("ERROR: Failed to register /dev/urandom\n");
|
ferr("ERROR: Failed to register /dev/urandom\n");
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ static const struct file_operations g_rngops =
|
|||||||
NULL, /* ioctl */
|
NULL, /* ioctl */
|
||||||
NULL /* poll */
|
NULL /* poll */
|
||||||
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
, 0 /* unlink */
|
, NULL /* unlink */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -256,9 +256,13 @@ static const struct file_operations g_keypadops =
|
|||||||
keypad_open, /* open */
|
keypad_open, /* open */
|
||||||
keypad_close, /* close */
|
keypad_close, /* close */
|
||||||
keypad_read, /* read */
|
keypad_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
0, /* ioctl */
|
NULL, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -238,7 +238,11 @@ static const struct file_operations g_vgaops =
|
|||||||
vga_read, /* read */
|
vga_read, /* read */
|
||||||
vga_write, /* write */
|
vga_write, /* write */
|
||||||
vga_seek, /* seek */
|
vga_seek, /* seek */
|
||||||
0, /* ioctl */
|
NULL, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -151,13 +151,16 @@ irqstate_t spinlock_flags;
|
|||||||
|
|
||||||
static const struct file_operations g_himemfops =
|
static const struct file_operations g_himemfops =
|
||||||
{
|
{
|
||||||
himem_open,
|
himem_open, /* open */
|
||||||
himem_close,
|
himem_close, /* close */
|
||||||
himem_read,
|
himem_read, /* read */
|
||||||
himem_write,
|
himem_write, /* write */
|
||||||
NULL,
|
NULL, /* seek */
|
||||||
himem_ioctl,
|
himem_ioctl, /* ioctl */
|
||||||
NULL
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -294,9 +294,13 @@ static const struct file_operations g_bmi160gyrofops =
|
|||||||
bmi160_open_gyro, /* open */
|
bmi160_open_gyro, /* open */
|
||||||
bmi160_close_gyro, /* close */
|
bmi160_close_gyro, /* close */
|
||||||
bmi160_read, /* read */
|
bmi160_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
bmi160_ioctl, /* ioctl */
|
bmi160_ioctl, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations g_bmi160accelfops =
|
static const struct file_operations g_bmi160accelfops =
|
||||||
@@ -304,9 +308,13 @@ static const struct file_operations g_bmi160accelfops =
|
|||||||
bmi160_open_accel, /* open */
|
bmi160_open_accel, /* open */
|
||||||
bmi160_close_accel, /* close */
|
bmi160_close_accel, /* close */
|
||||||
bmi160_read, /* read */
|
bmi160_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
bmi160_ioctl, /* ioctl */
|
bmi160_ioctl, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SCU instructions for pick gyro sensing data. */
|
/* SCU instructions for pick gyro sensing data. */
|
||||||
|
|||||||
@@ -83,12 +83,16 @@ static uint8_t const g_chsensor[NSENSORS] =
|
|||||||
|
|
||||||
static const struct file_operations tsi_ops =
|
static const struct file_operations tsi_ops =
|
||||||
{
|
{
|
||||||
0, /* open */
|
NULL, /* open */
|
||||||
0, /* close */
|
NULL, /* close */
|
||||||
tsi_read, /* read */
|
tsi_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
0, /* ioctl */
|
NULL, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -84,12 +84,16 @@ static uint8_t const g_chsensor[NSENSORS] =
|
|||||||
|
|
||||||
static const struct file_operations tsi_ops =
|
static const struct file_operations tsi_ops =
|
||||||
{
|
{
|
||||||
0, /* open */
|
NULL, /* open */
|
||||||
0, /* close */
|
NULL, /* close */
|
||||||
tsi_read, /* read */
|
tsi_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
0, /* ioctl */
|
NULL, /* ioctl */
|
||||||
|
NULL /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -300,13 +300,16 @@ static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
|
|
||||||
static const struct file_operations g_slcdops =
|
static const struct file_operations g_slcdops =
|
||||||
{
|
{
|
||||||
0, /* open */
|
NULL, /* open */
|
||||||
0, /* close */
|
NULL, /* close */
|
||||||
slcd_read, /* read */
|
slcd_read, /* read */
|
||||||
slcd_write, /* write */
|
slcd_write, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
slcd_ioctl, /* ioctl */
|
slcd_ioctl, /* ioctl */
|
||||||
slcd_poll /* poll */
|
slcd_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* LCD state data */
|
/* LCD state data */
|
||||||
|
|||||||
@@ -265,10 +265,13 @@ static const struct file_operations tc_fops =
|
|||||||
tc_open, /* open */
|
tc_open, /* open */
|
||||||
tc_close, /* close */
|
tc_close, /* close */
|
||||||
tc_read, /* read */
|
tc_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
tc_ioctl, /* ioctl */
|
tc_ioctl, /* ioctl */
|
||||||
tc_poll /* poll */
|
tc_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* If only a single touchscreen device is supported, then the driver state
|
/* If only a single touchscreen device is supported, then the driver state
|
||||||
|
|||||||
@@ -616,8 +616,7 @@ int stm32_powerled_setup(void)
|
|||||||
* All control should be done via POWERLED character driver.
|
* All control should be done via POWERLED character driver.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = powerled_register(CONFIG_EXAMPLES_POWERLED_DEVPATH, powerled,
|
ret = powerled_register("/dev/powerled0", powerled, (void *)lower);
|
||||||
(void *)lower);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
pwrerr("ERROR: powerled_register failed: %d\n", ret);
|
pwrerr("ERROR: powerled_register failed: %d\n", ret);
|
||||||
|
|||||||
@@ -350,13 +350,16 @@ static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
|
|
||||||
static const struct file_operations g_slcdops =
|
static const struct file_operations g_slcdops =
|
||||||
{
|
{
|
||||||
0, /* open */
|
NULL, /* open */
|
||||||
0, /* close */
|
NULL, /* close */
|
||||||
slcd_read, /* read */
|
slcd_read, /* read */
|
||||||
slcd_write, /* write */
|
slcd_write, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
slcd_ioctl, /* ioctl */
|
slcd_ioctl, /* ioctl */
|
||||||
slcd_poll /* poll */
|
slcd_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* LCD state data */
|
/* LCD state data */
|
||||||
|
|||||||
@@ -246,10 +246,13 @@ static const struct file_operations tc_fops =
|
|||||||
tc_open, /* open */
|
tc_open, /* open */
|
||||||
tc_close, /* close */
|
tc_close, /* close */
|
||||||
tc_read, /* read */
|
tc_read, /* read */
|
||||||
0, /* write */
|
NULL, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
tc_ioctl, /* ioctl */
|
tc_ioctl, /* ioctl */
|
||||||
tc_poll /* poll */
|
tc_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* If only a single touchscreen device is supported, then the driver state
|
/* If only a single touchscreen device is supported, then the driver state
|
||||||
|
|||||||
@@ -184,13 +184,16 @@ static int lcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||||||
|
|
||||||
static const struct file_operations g_lcdops =
|
static const struct file_operations g_lcdops =
|
||||||
{
|
{
|
||||||
0, /* open */
|
NULL, /* open */
|
||||||
0, /* close */
|
NULL, /* close */
|
||||||
lcd_read, /* read */
|
lcd_read, /* read */
|
||||||
lcd_write, /* write */
|
lcd_write, /* write */
|
||||||
0, /* seek */
|
NULL, /* seek */
|
||||||
lcd_ioctl, /* ioctl */
|
lcd_ioctl, /* ioctl */
|
||||||
lcd_poll /* poll */
|
lcd_poll /* poll */
|
||||||
|
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
|
||||||
|
, NULL /* unlink */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is the driver state structure */
|
/* This is the driver state structure */
|
||||||
|
|||||||
+1
-13
@@ -74,8 +74,6 @@
|
|||||||
|
|
||||||
static int dac_open(FAR struct file *filep);
|
static int dac_open(FAR struct file *filep);
|
||||||
static int dac_close(FAR struct file *filep);
|
static int dac_close(FAR struct file *filep);
|
||||||
static ssize_t dac_read(FAR struct file *filep, FAR char *buffer,
|
|
||||||
size_t buflen);
|
|
||||||
static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer,
|
static ssize_t dac_write(FAR struct file *filep, FAR const char *buffer,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
static int dac_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
static int dac_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
|
||||||
@@ -88,7 +86,7 @@ static const struct file_operations dac_fops =
|
|||||||
{
|
{
|
||||||
dac_open, /* open */
|
dac_open, /* open */
|
||||||
dac_close, /* close */
|
dac_close, /* close */
|
||||||
dac_read, /* read */
|
NULL, /* read */
|
||||||
dac_write, /* write */
|
dac_write, /* write */
|
||||||
NULL, /* seek */
|
NULL, /* seek */
|
||||||
dac_ioctl, /* ioctl */
|
dac_ioctl, /* ioctl */
|
||||||
@@ -224,16 +222,6 @@ static int dac_close(FAR struct file *filep)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: dac_read
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
static ssize_t dac_read(FAR struct file *filep, FAR char *buffer,
|
|
||||||
size_t buflen)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: dac_xmit
|
* Name: dac_xmit
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ int opamp_register(FAR const char *path, FAR struct opamp_dev_s *dev)
|
|||||||
|
|
||||||
/* Register the OPAMP character driver */
|
/* Register the OPAMP character driver */
|
||||||
|
|
||||||
ret = register_driver(path, &opamp_fops, 0444, dev);
|
ret = register_driver(path, &opamp_fops, 0444, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&dev->ad_closesem);
|
nxsem_destroy(&dev->ad_closesem);
|
||||||
|
|||||||
+19
-18
@@ -284,29 +284,30 @@ static int pca9635pw_ioctl(FAR struct file *filep, int cmd,
|
|||||||
* Arg: pca9635pw_brightness_s pointer.
|
* Arg: pca9635pw_brightness_s pointer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case PWMIOC_SETLED_BRIGHTNESS:
|
case PWMIOC_SETLED_BRIGHTNESS:
|
||||||
{
|
{
|
||||||
/* Retrieve the information handed over as argument for this ioctl */
|
/* Retrieve the information handed over as argument for this ioctl
|
||||||
|
*/
|
||||||
|
|
||||||
FAR const struct pca9635pw_brightness_s *ptr =
|
FAR const struct pca9635pw_brightness_s *ptr =
|
||||||
(FAR const struct pca9635pw_brightness_s *)((uintptr_t)arg);
|
(FAR const struct pca9635pw_brightness_s *)((uintptr_t)arg);
|
||||||
|
|
||||||
DEBUGASSERT(ptr != NULL);
|
DEBUGASSERT(ptr != NULL);
|
||||||
|
|
||||||
/* Set the brighntess of the led */
|
/* Set the brightness of the led */
|
||||||
|
|
||||||
ret = pca9635pw_i2c_write_byte(priv, ptr->led, ptr->brightness);
|
ret = pca9635pw_i2c_write_byte(priv, ptr->led, ptr->brightness);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The used ioctl command was invalid */
|
/* The used ioctl command was invalid */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
lcderr("ERROR: Unrecognized cmd: %d\n", cmd);
|
lcderr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||||
ret = -ENOTTY;
|
ret = -ENOTTY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -357,7 +358,7 @@ int pca9635pw_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
|||||||
|
|
||||||
/* Register the character driver */
|
/* Register the character driver */
|
||||||
|
|
||||||
int const ret = register_driver(devpath, &g_pca9635pw_fileops, 0666, priv);
|
int const ret = register_driver(devpath, &g_pca9635pw_fileops, 0222, priv);
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
lcderr("ERROR: Failed to register driver: %d\n", ret);
|
lcderr("ERROR: Failed to register driver: %d\n", ret);
|
||||||
|
|||||||
@@ -845,7 +845,7 @@ int foc_register(FAR const char *path, FAR struct foc_dev_s *dev)
|
|||||||
|
|
||||||
/* Register the FOC character driver */
|
/* Register the FOC character driver */
|
||||||
|
|
||||||
ret = register_driver(path, &g_foc_fops, 0444, dev);
|
ret = register_driver(path, &g_foc_fops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&dev->closesem);
|
nxsem_destroy(&dev->closesem);
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ int motor_register(FAR const char *path,
|
|||||||
|
|
||||||
/* Register the motor character driver */
|
/* Register the motor character driver */
|
||||||
|
|
||||||
ret = register_driver(path, &motor_fops, 0444, upper);
|
ret = register_driver(path, &motor_fops, 0666, upper);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&upper->closesem);
|
nxsem_destroy(&upper->closesem);
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ int battery_charger_register(FAR const char *devpath,
|
|||||||
|
|
||||||
/* Register the character driver */
|
/* Register the character driver */
|
||||||
|
|
||||||
ret = register_driver(devpath, &g_batteryops, 0555, dev);
|
ret = register_driver(devpath, &g_batteryops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
_err("ERROR: Failed to register driver: %d\n", ret);
|
_err("ERROR: Failed to register driver: %d\n", ret);
|
||||||
|
|||||||
@@ -479,7 +479,7 @@ int battery_gauge_register(FAR const char *devpath,
|
|||||||
|
|
||||||
/* Register the character driver */
|
/* Register the character driver */
|
||||||
|
|
||||||
ret = register_driver(devpath, &g_batteryops, 0555, dev);
|
ret = register_driver(devpath, &g_batteryops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
_err("ERROR: Failed to register driver: %d\n", ret);
|
_err("ERROR: Failed to register driver: %d\n", ret);
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ int powerled_register(FAR const char *path, FAR struct powerled_dev_s *dev,
|
|||||||
|
|
||||||
/* Register the POWERLED character driver */
|
/* Register the POWERLED character driver */
|
||||||
|
|
||||||
ret = register_driver(path, &powerled_fops, 0444, dev);
|
ret = register_driver(path, &powerled_fops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&dev->closesem);
|
nxsem_destroy(&dev->closesem);
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ int smps_register(FAR const char *path, FAR struct smps_dev_s *dev,
|
|||||||
|
|
||||||
/* Register the SMPS character driver */
|
/* Register the SMPS character driver */
|
||||||
|
|
||||||
ret = register_driver(path, &smps_fops, 0444, dev);
|
ret = register_driver(path, &smps_fops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&dev->closesem);
|
nxsem_destroy(&dev->closesem);
|
||||||
|
|||||||
@@ -947,7 +947,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev)
|
|||||||
nxsem_set_protocol(&priv->sem, SEM_PRIO_NONE);
|
nxsem_set_protocol(&priv->sem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
snprintf(name, 32, "/dev/rptun/%s", RPTUN_GET_CPUNAME(dev));
|
snprintf(name, 32, "/dev/rptun/%s", RPTUN_GET_CPUNAME(dev));
|
||||||
ret = register_driver(name, &g_rptun_devops, 0666, priv);
|
ret = register_driver(name, &g_rptun_devops, 0222, priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
goto err_driver;
|
goto err_driver;
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ int adxl345_register(ADXL345_HANDLE handle, int minor)
|
|||||||
/* Register the character driver */
|
/* Register the character driver */
|
||||||
|
|
||||||
snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor);
|
snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor);
|
||||||
ret = register_driver(devname, &g_adxl345fops, 0666, priv);
|
ret = register_driver(devname, &g_adxl345fops, 0444, priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Failed to register driver %s: %d\n", devname, ret);
|
snerr("ERROR: Failed to register driver %s: %d\n", devname, ret);
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ int fxos8700cq_register(FAR const char *devpath,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = register_driver(devpath, &g_fxos8700cqfops, 0666, priv);
|
ret = register_driver(devpath, &g_fxos8700cqfops, 0444, priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("Failed to register driver: %d\n", ret);
|
snerr("Failed to register driver: %d\n", ret);
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ int xen1210_register(XEN1210_HANDLE handle, int minor)
|
|||||||
/* Register the character driver */
|
/* Register the character driver */
|
||||||
|
|
||||||
snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor);
|
snprintf(devname, DEV_NAMELEN, DEV_FORMAT, minor);
|
||||||
ret = register_driver(devname, &g_xen1210fops, 0666, priv);
|
ret = register_driver(devname, &g_xen1210fops, 0444, priv);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Failed to register driver %s: %d\n", devname, ret);
|
snerr("ERROR: Failed to register driver %s: %d\n", devname, ret);
|
||||||
|
|||||||
@@ -226,16 +226,16 @@ struct geometry
|
|||||||
|
|
||||||
struct partition_info_s
|
struct partition_info_s
|
||||||
{
|
{
|
||||||
size_t numsectors; /* Number of sectors in the partition */
|
size_t numsectors; /* Number of sectors in the partition */
|
||||||
size_t sectorsize; /* Size in bytes of a single sector */
|
size_t sectorsize; /* Size in bytes of a single sector */
|
||||||
off_t startsector; /* Offset to the first section/block of the
|
off_t startsector; /* Offset to the first section/block of the
|
||||||
* managed sub-region */
|
* managed sub-region */
|
||||||
|
|
||||||
/* NULL-terminated string representing the name of the parent node of the
|
/* NULL-terminated string representing the name of the parent node of the
|
||||||
* partition.
|
* partition.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char parent[NAME_MAX + 1];
|
char parent[NAME_MAX + 1];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure is provided by block devices when they register with the
|
/* This structure is provided by block devices when they register with the
|
||||||
|
|||||||
@@ -855,8 +855,8 @@ void nxsem_add_holder_tcb(FAR struct tcb_s *htcb, FAR sem_t *sem)
|
|||||||
{
|
{
|
||||||
FAR struct semholder_s *pholder;
|
FAR struct semholder_s *pholder;
|
||||||
|
|
||||||
/* If priority inheritance is disabled for this thread or it is IDLE hread,
|
/* If priority inheritance is disabled for this thread or it is IDLE
|
||||||
* then do not add the holder.
|
* thread, then do not add the holder.
|
||||||
* If there are never holders of the semaphore, the priority
|
* If there are never holders of the semaphore, the priority
|
||||||
* inheritance is effectively disabled.
|
* inheritance is effectively disabled.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user