c89: get rid of designated initializers in common code

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-03-26 21:51:22 +01:00 committed by Xiang Xiao
parent c67272f9c8
commit 98ba65c422
37 changed files with 346 additions and 369 deletions

View File

@ -132,9 +132,9 @@ static int ds_i2c_transfer(FAR struct i2c_master_s *i2cdev,
static const struct i2c_ops_s ds_i2c_ops =
{
.transfer = ds_i2c_transfer
ds_i2c_transfer
#ifdef CONFIG_I2C_RESET
, .reset = ds_i2c_reset
, ds_i2c_reset
#endif
};

View File

@ -71,8 +71,8 @@
#define AD5410_CMD_REXT (1 << 13)
#define AD5410_CMD_OUTEN (1 << 12)
#define AD5410_CMD_SRCLK(x) (x<<8)
#define AD5410_CMD_SRSTEP(x) (x<<5)
#define AD5410_CMD_SRCLK(x) ((x) << 8)
#define AD5410_CMD_SRSTEP(x) ((x) << 5)
#define AD5410_CMD_SREN (1 << 4)
#define AD5410_CMD_DCEN (1 << 3)
#define AD5410_CMD_420MA 0x05
@ -111,20 +111,20 @@ static int dac_ioctl(FAR struct dac_dev_s *dev, int cmd, unsigned long arg);
static const struct dac_ops_s g_dacops =
{
.ao_reset = dac_reset,
.ao_setup = dac_setup,
.ao_shutdown = dac_shutdown,
.ao_txint = dac_txint,
.ao_send = dac_send,
.ao_ioctl = dac_ioctl,
dac_reset, /* ao_reset */
dac_setup, /* ao_setup */
dac_shutdown, /* ao_shutdown */
dac_txint, /* ao_txint */
dac_send, /* ao_send */
dac_ioctl /* ao_ioctl */
};
static struct up_dev_s g_dacpriv;
static struct dac_dev_s g_dacdev =
{
.ad_ops = &g_dacops,
.ad_priv = &g_dacpriv,
&g_dacops, /* ad_ops */
&g_dacpriv /* ad_priv */
};
/****************************************************************************

View File

@ -116,16 +116,16 @@
struct ads1255_dev_s
{
FAR const struct adc_callback_s *cb;
FAR struct spi_dev_s *spi; /* Cached SPI device reference */
struct work_s work;
uint8_t channel;
uint32_t sps;
uint8_t pga;
uint8_t buf;
const uint8_t *mux;
int irq;
int devno;
const uint8_t *mux;
uint16_t sps;
uint8_t channel;
uint8_t pga;
int irq;
FAR const struct adc_callback_s *cb;
struct work_s work;
bool buf;
};
/****************************************************************************
@ -156,29 +156,27 @@ static int adc_interrupt(int irq, void *context, FAR void *arg);
static const struct adc_ops_s g_adcops =
{
.ao_bind = adc_bind, /* ao_bind */
.ao_reset = adc_reset, /* ao_reset */
.ao_setup = adc_setup, /* ao_setup */
.ao_shutdown = adc_shutdown, /* ao_shutdown */
.ao_rxint = adc_rxint, /* ao_rxint */
.ao_ioctl = adc_ioctl /* ao_read */
adc_bind, /* ao_bind */
adc_reset, /* ao_reset */
adc_setup, /* ao_setup */
adc_shutdown, /* ao_shutdown */
adc_rxint, /* ao_rxint */
adc_ioctl /* ao_read */
};
static struct ads1255_dev_s g_adcpriv =
{
.mux = (const uint8_t [])
NULL, 0, (const uint8_t [])
{
CONFIG_ADS1255_MUX, 0
},
.sps = CONFIG_ADS1255_SPS,
.channel = 0,
.irq = CONFIG_ADS1255_IRQ,
CONFIG_ADS1255_SPS, 0, 0, CONFIG_ADS1255_IRQ
};
static struct adc_dev_s g_adcdev =
{
.ad_ops = &g_adcops,
.ad_priv = &g_adcpriv,
&g_adcops, /* ad_ops */
&g_adcpriv /* ad_priv */
};
/****************************************************************************
@ -187,13 +185,13 @@ static struct adc_dev_s g_adcdev =
static uint8_t getspsreg(uint16_t sps)
{
static const unsigned short sps_tab[] =
static const uint16_t sps_tab[] =
{
3, 7, 12, 20, 27, 40, 55, 80,
300, 750, 1500, 3000, 5000, 10000, 20000, 65535,
};
static const unsigned char sps_reg[] =
static const uint8_t sps_reg[] =
{
0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x72,
0x82, 0x92, 0xa1, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
@ -522,7 +520,6 @@ FAR struct adc_dev_s *up_ads1255initialize(FAR struct spi_dev_s *spi,
/* Driver state data */
priv->cb = NULL;
priv->spi = spi;
priv->devno = devno;
return &g_adcdev;

View File

@ -108,20 +108,20 @@ static int ads7828_ioctl(FAR struct adc_dev_s *dev, int cmd,
static const struct adc_ops_s g_adcops =
{
.ao_bind = ads7828_bind, /* ao_bind */
.ao_reset = ads7828_reset, /* ao_reset */
.ao_setup = ads7828_setup, /* ao_setup */
.ao_shutdown = ads7828_shutdown, /* ao_shutdown */
.ao_rxint = ads7828_rxint, /* ao_rxint */
.ao_ioctl = ads7828_ioctl /* ao_read */
ads7828_bind, /* ao_bind */
ads7828_reset, /* ao_reset */
ads7828_setup, /* ao_setup */
ads7828_shutdown, /* ao_shutdown */
ads7828_rxint, /* ao_rxint */
ads7828_ioctl /* ao_read */
};
static struct ads7828_dev_s g_adcpriv;
static struct adc_dev_s g_adcdev =
{
.ad_ops = &g_adcops,
.ad_priv = &g_adcpriv,
&g_adcops, /* ad_ops */
&g_adcpriv /* ad_priv */
};
/****************************************************************************
@ -280,8 +280,7 @@ static int ads7828_bind(FAR struct adc_dev_s *dev,
static void ads7828_reset(FAR struct adc_dev_s *dev)
{
FAR struct ads7828_dev_s *priv =
(FAR struct ads7828_dev_s *)dev->ad_priv;
FAR struct ads7828_dev_s *priv = (FAR struct ads7828_dev_s *)dev->ad_priv;
priv->cmdbyte = 0;
priv->chanstrobed = 0xffu;

View File

@ -86,12 +86,12 @@ static int dac7554_ioctl(FAR struct dac_dev_s *dev, int cmd,
static const struct dac_ops_s g_dacops =
{
.ao_reset = dac7554_reset,
.ao_setup = dac7554_setup,
.ao_shutdown = dac7554_shutdown,
.ao_txint = dac7554_txint,
.ao_send = dac7554_send,
.ao_ioctl = dac7554_ioctl,
dac7554_reset, /* ao_reset */
dac7554_setup, /* ao_setup */
dac7554_shutdown, /* ao_shutdown */
dac7554_txint, /* ao_txint */
dac7554_send, /* ao_send */
dac7554_ioctl /* ao_ioctl */
};
/****************************************************************************

View File

@ -99,18 +99,18 @@ static struct dac7571_dev_s g_dacpriv;
static const struct dac_ops_s g_dacops =
{
.ao_reset = dac7571_reset,
.ao_setup = dac7571_setup,
.ao_shutdown = dac7571_shutdown,
.ao_txint = dac7571_txint,
.ao_send = dac7571_send,
.ao_ioctl = dac7571_ioctl,
dac7571_reset, /* ao_reset */
dac7571_setup, /* ao_setup */
dac7571_shutdown, /* ao_shutdown */
dac7571_txint, /* ao_txint */
dac7571_send, /* ao_send */
dac7571_ioctl /* ao_ioctl */
};
static struct dac_dev_s g_dacdev =
{
.ad_ops = &g_dacops,
.ad_priv = &g_dacpriv,
&g_dacops, /* ad_ops */
&g_dacpriv /* ad_priv */
};
/****************************************************************************

View File

@ -279,36 +279,36 @@ static struct lmp92001_dev_s g_devpriv;
#ifdef CONFIG_DAC
static const struct dac_ops_s g_dacops =
{
.ao_reset = lmp92001_dac_reset,
.ao_setup = lmp92001_dac_setup,
.ao_shutdown = lmp92001_dac_shutdown,
.ao_txint = lmp92001_dac_txint,
.ao_send = lmp92001_dac_send,
.ao_ioctl = lmp92001_dac_ioctl,
lmp92001_dac_reset, /* ao_reset */
lmp92001_dac_setup, /* ao_setup */
lmp92001_dac_shutdown, /* ao_shutdown */
lmp92001_dac_txint, /* ao_txint */
lmp92001_dac_send, /* ao_send */
lmp92001_dac_ioctl /* ao_ioctl */
};
static struct dac_dev_s g_dacdev =
{
.ad_ops = &g_dacops,
.ad_priv = &g_devpriv,
&g_dacops, /* ad_ops */
&g_devpriv /* ad_priv */
};
#endif
#ifdef CONFIG_ADC
static const struct adc_ops_s g_adcops =
{
.ao_bind = lmp92001_adc_bind,
.ao_reset = lmp92001_adc_reset,
.ao_setup = lmp92001_adc_setup,
.ao_shutdown = lmp92001_adc_shutdown,
.ao_rxint = lmp92001_adc_rxint,
.ao_ioctl = lmp92001_adc_ioctl
lmp92001_adc_bind, /* ao_bind */
lmp92001_adc_reset, /* ao_reset */
lmp92001_adc_setup, /* ao_setup */
lmp92001_adc_shutdown, /* ao_shutdown */
lmp92001_adc_rxint, /* ao_rxint */
lmp92001_adc_ioctl /* ao_ioctl */
};
static struct adc_dev_s g_adcdev =
{
.ad_ops = &g_adcops,
.ad_priv = &g_devpriv,
&g_adcops, /* ad_ops */
&g_devpriv /* ad_priv */
};
#endif

View File

@ -87,12 +87,12 @@ static int adc_ioctl(FAR struct adc_dev_s *dev, int cmd, unsigned long arg);
static const struct adc_ops_s g_adcops =
{
.ao_bind = adc_bind, /* ao_bind */
.ao_reset = adc_reset, /* ao_reset */
.ao_setup = adc_setup, /* ao_setup */
.ao_shutdown = adc_shutdown, /* ao_shutdown */
.ao_rxint = adc_rxint, /* ao_rxint */
.ao_ioctl = adc_ioctl /* ao_read */
adc_bind, /* ao_bind */
adc_reset, /* ao_reset */
adc_setup, /* ao_setup */
adc_shutdown, /* ao_shutdown */
adc_rxint, /* ao_rxint */
adc_ioctl /* ao_read */
};
/****************************************************************************

View File

@ -144,20 +144,20 @@ static int max1161x_ioctl(FAR struct adc_dev_s *dev, int cmd,
static const struct adc_ops_s g_adcops =
{
.ao_bind = max1161x_bind, /* ao_bind */
.ao_reset = max1161x_reset, /* ao_reset */
.ao_setup = max1161x_setup, /* ao_setup */
.ao_shutdown = max1161x_shutdown, /* ao_shutdown */
.ao_rxint = max1161x_rxint, /* ao_rxint */
.ao_ioctl = max1161x_ioctl /* ao_read */
max1161x_bind, /* ao_bind */
max1161x_reset, /* ao_reset */
max1161x_setup, /* ao_setup */
max1161x_shutdown, /* ao_shutdown */
max1161x_rxint, /* ao_rxint */
max1161x_ioctl /* ao_read */
};
static struct max1161x_dev_s g_adcpriv;
static struct adc_dev_s g_adcdev =
{
.ad_ops = &g_adcops,
.ad_priv = &g_adcpriv,
&g_adcops, /* ad_ops */
&g_adcpriv /* ad_priv */
};
/****************************************************************************

View File

@ -110,18 +110,18 @@ static struct mcp48xx_dev_s g_devpriv;
static const struct dac_ops_s g_dacops =
{
.ao_reset = mcp48xx_reset,
.ao_setup = mcp48xx_setup,
.ao_shutdown = mcp48xx_shutdown,
.ao_txint = mcp48xx_txint,
.ao_send = mcp48xx_send,
.ao_ioctl = mcp48xx_ioctl,
mcp48xx_reset, /* ao_reset */
mcp48xx_setup, /* ao_setup */
mcp48xx_shutdown, /* ao_shutdown */
mcp48xx_txint, /* ao_txint */
mcp48xx_send, /* ao_send */
mcp48xx_ioctl /* ao_ioctl */
};
static struct dac_dev_s g_dacdev =
{
.ad_ops = &g_dacops,
.ad_priv = &g_devpriv,
&g_dacops, /* ad_ops */
&g_devpriv /* ad_priv */
};
/****************************************************************************

View File

@ -43,8 +43,7 @@
static int opamp_open(FAR struct file *filep);
static int opamp_close(FAR struct file *filep);
static int opamp_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int opamp_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
/****************************************************************************
* Private Data

View File

@ -101,23 +101,26 @@ static void audio_i2s_callback(struct i2s_dev_s *dev,
static const struct audio_ops_s g_audio_i2s_ops =
{
.getcaps = audio_i2s_getcaps,
.configure = audio_i2s_configure,
.shutdown = audio_i2s_shutdown,
.start = audio_i2s_start,
audio_i2s_getcaps, /* getcaps */
audio_i2s_configure, /* configure */
audio_i2s_shutdown, /* shutdown */
audio_i2s_start, /* start */
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
.stop = audio_i2s_stop,
audio_i2s_stop, /* stop */
#endif
#ifndef CONFIG_AUDIO_EXCLUDE_PAUSE_RESUME
.pause = audio_i2s_pause,
.resume = audio_i2s_resume,
audio_i2s_pause, /* pause */
audio_i2s_resume, /* resume */
#endif
.allocbuffer = audio_i2s_allocbuffer,
.freebuffer = audio_i2s_freebuffer,
.enqueuebuffer = audio_i2s_enqueuebuffer,
.ioctl = audio_i2s_ioctl,
.reserve = audio_i2s_reserve,
.release = audio_i2s_release,
audio_i2s_allocbuffer, /* allocbuffer */
audio_i2s_freebuffer, /* freebuffer */
audio_i2s_enqueuebuffer, /* enqueue_buffer */
NULL, /* cancel_buffer */
audio_i2s_ioctl, /* ioctl */
NULL, /* read */
NULL, /* write */
audio_i2s_reserve, /* reserve */
audio_i2s_release /* release */
};
/****************************************************************************

View File

@ -72,7 +72,8 @@ static int null_getcaps(FAR struct audio_lowerhalf_s *dev, int type,
FAR struct audio_caps_s *caps);
#ifdef CONFIG_AUDIO_MULTI_SESSION
static int null_configure(FAR struct audio_lowerhalf_s *dev,
FAR void *session, FAR const struct audio_caps_s *caps);
FAR void *session,
FAR const struct audio_caps_s *caps);
#else
static int null_configure(FAR struct audio_lowerhalf_s *dev,
FAR const struct audio_caps_s *caps);

View File

@ -74,7 +74,10 @@ static void i2c_bitbang_send(FAR struct i2c_bitbang_dev_s *dev,
static const struct i2c_ops_s g_i2c_ops =
{
.transfer = i2c_bitbang_transfer
i2c_bitbang_transfer /* transfer */
#ifdef CONFIG_I2C_RESET
, NULL /* reset */
#endif
};
/****************************************************************************

View File

@ -60,9 +60,10 @@ static uint32_t g_btnnum;
static const struct btn_lowerhalf_s g_btnlower =
{
.bl_supported = btn_supported,
.bl_buttons = btn_buttons,
.bl_enable = btn_enable,
btn_supported, /* bl_supported */
btn_buttons, /* bl_buttons */
btn_enable, /* bl_enable */
NULL /* bl_write */
};
/* Current interrupt handler and argument */

View File

@ -240,18 +240,12 @@ static int mbr3108_i2c_write(FAR struct mbr3108_dev_s *dev, uint8_t reg,
struct i2c_msg_s msgv[2] =
{
{
.frequency = CONFIG_MBR3108_I2C_FREQUENCY,
.addr = dev->addr,
.flags = 0,
.buffer = &reg,
.length = 1
CONFIG_MBR3108_I2C_FREQUENCY,
dev->addr, 0, &reg, sizeof(reg)
},
{
.frequency = CONFIG_MBR3108_I2C_FREQUENCY,
.addr = dev->addr,
.flags = I2C_M_NOSTART,
.buffer = (void *)buf,
.length = buflen
CONFIG_MBR3108_I2C_FREQUENCY,
dev->addr, I2C_M_NOSTART, buf, buflen
}
};
@ -294,18 +288,12 @@ static int mbr3108_i2c_read(FAR struct mbr3108_dev_s *dev, uint8_t reg,
struct i2c_msg_s msgv[2] =
{
{
.frequency = CONFIG_MBR3108_I2C_FREQUENCY,
.addr = dev->addr,
.flags = 0,
.buffer = &reg,
.length = 1
CONFIG_MBR3108_I2C_FREQUENCY,
dev->addr, 0, &reg, sizeof(reg)
},
{
.frequency = CONFIG_MBR3108_I2C_FREQUENCY,
.addr = dev->addr,
.flags = I2C_M_READ,
.buffer = buf,
.length = buflen
CONFIG_MBR3108_I2C_FREQUENCY,
dev->addr, I2C_M_READ, buf, buflen
}
};

View File

@ -59,11 +59,11 @@ static uint32_t g_lednum;
static const struct userled_lowerhalf_s g_userled_lower =
{
.ll_supported = userled_supported,
.ll_setled = userled_setled,
.ll_setall = userled_setall,
userled_supported, /* ll_supported */
userled_setled, /* ll_setled */
userled_setall /* ll_setall */
#ifdef CONFIG_USERLED_LOWER_READSTATE
.ll_getall = userled_getall,
, userled_getall /* ll_getall */
#endif
};

View File

@ -126,7 +126,7 @@ struct lwl_entry_s
static struct lwl_entry_s g_d =
{
.sig = LWL_ID_SIG
LWL_ID_SIG
};
static const struct file_operations g_consoleops =

View File

@ -88,7 +88,7 @@ static const struct file_operations g_foc_fops =
static struct foc_callbacks_s g_foc_callbacks =
{
.notifier = foc_notifier,
foc_notifier
};
/****************************************************************************

View File

@ -43,10 +43,10 @@
struct noteram_info_s
{
unsigned int ni_overwrite;
volatile unsigned int ni_head;
volatile unsigned int ni_tail;
volatile unsigned int ni_read;
unsigned int ni_overwrite;
uint8_t ni_buffer[CONFIG_DRIVER_NOTERAM_BUFSIZE];
};
@ -95,9 +95,9 @@ static const struct file_operations g_noteram_fops =
static struct noteram_info_s g_noteram_info =
{
#ifdef CONFIG_DRIVER_NOTERAM_DEFAULT_NOOVERWRITE
.ni_overwrite = NOTERAM_MODE_OVERWRITE_DISABLE
NOTERAM_MODE_OVERWRITE_DISABLE
#else
.ni_overwrite = NOTERAM_MODE_OVERWRITE_ENABLE
NOTERAM_MODE_OVERWRITE_ENABLE
#endif
};

View File

@ -150,19 +150,16 @@ static void governor_update(int domain, int16_t accum);
struct pm_activity_governor_s g_pm_activity_governor =
{
.pmcount =
{
CONFIG_PM_GOVERNOR_IDLEENTER_COUNT,
CONFIG_PM_GOVERNOR_STANDBYENTER_COUNT,
CONFIG_PM_GOVERNOR_SLEEPENTER_COUNT
},
.pmenterthresh =
{
CONFIG_PM_GOVERNOR_IDLEENTER_THRESH,
CONFIG_PM_GOVERNOR_STANDBYENTER_THRESH,
CONFIG_PM_GOVERNOR_SLEEPENTER_THRESH
},
.pmexitthresh =
{
CONFIG_PM_GOVERNOR_IDLEEXIT_THRESH,
CONFIG_PM_GOVERNOR_STANDBYEXIT_THRESH,
@ -170,7 +167,6 @@ struct pm_activity_governor_s g_pm_activity_governor =
},
#if CONFIG_PM_GOVERNOR_MEMORY > 1
.pmcoeffs =
{
CONFIG_PM_GOVERNOR_COEF1
#if CONFIG_PM_GOVERNOR_MEMORY > 2
@ -192,12 +188,14 @@ struct pm_activity_governor_s g_pm_activity_governor =
#endif
};
struct pm_governor_s g_pmgovernor =
static struct pm_governor_s g_pmgovernor =
{
.initialize = governor_initialize,
.checkstate = governor_checkstate,
.statechanged = governor_statechanged,
.activity = governor_activity
governor_initialize, /* initialize */
NULL, /* deinitialize */
governor_statechanged, /* statechanged */
governor_checkstate, /* checkstate */
governor_activity, /* activity */
NULL /* priv */
};
/****************************************************************************

View File

@ -64,10 +64,12 @@ static enum pm_state_e greedy_governor_checkstate(int domain);
static struct pm_governor_s g_greedy_governor_ops =
{
.initialize = greedy_governor_initialize, /* initialize */
.statechanged = greedy_governor_statechanged, /* statechanged */
.checkstate = greedy_governor_checkstate, /* checkstate */
.activity = NULL, /* activity */
greedy_governor_initialize, /* initialize */
NULL, /* deinitialize */
greedy_governor_statechanged, /* statechanged */
greedy_governor_checkstate, /* checkstate */
NULL, /* activity */
NULL /* priv */
};
/****************************************************************************

View File

@ -50,7 +50,7 @@
struct pm_global_s g_pmglobals =
{
.regsem = SEM_INITIALIZER(1)
SEM_INITIALIZER(1)
};
/****************************************************************************

View File

@ -58,9 +58,14 @@ static int regulator_gpio_is_enabled(FAR struct regulator_dev_s *rdev);
static const struct regulator_ops_s g_regulator_gpio_ops =
{
.enable = regulator_gpio_enable,
.disable = regulator_gpio_disable,
.is_enabled = regulator_gpio_is_enabled,
NULL, /* list_voltage */
NULL, /* set_voltage */
NULL, /* set_voltage_sel */
NULL, /* get_voltage */
NULL, /* get_voltage_sel */
regulator_gpio_enable, /* enable */
regulator_gpio_is_enabled, /* is_enabled */
regulator_gpio_disable /* disable */
};
/****************************************************************************

View File

@ -86,18 +86,18 @@ struct dummy_dev_s
static const struct lirc_ops_s g_dummy_ops =
{
.driver_type = LIRC_DRIVER_IR_RAW,
.open = dummy_open,
.close = dummy_close,
.s_tx_mask = dummy_s_tx_mask,
.s_tx_carrier = dummy_s_tx_carrier,
.s_tx_duty_cycle = dummy_s_tx_duty_cycle,
.s_rx_carrier_range = dummy_s_rx_carrier_range,
.tx_ir = dummy_tx_ir,
.tx_scancode = dummy_tx_scancode,
.s_learning_mode = dummy_s_learning_mode,
.s_carrier_report = dummy_s_carrier_report,
.s_timeout = dummy_s_timeout,
LIRC_DRIVER_IR_RAW, /* driver_type */
dummy_open, /* open */
dummy_close, /* close */
dummy_s_tx_mask, /* s_tx_mask */
dummy_s_tx_carrier, /* s_tx_carrier */
dummy_s_tx_duty_cycle, /* s_tx_duty_cycle */
dummy_s_rx_carrier_range, /* s_rx_carrier_range */
dummy_tx_ir, /* tx_ir */
dummy_tx_scancode, /* tx_scancode */
dummy_s_learning_mode, /* s_learning_mode */
dummy_s_carrier_report, /* s_carrier_report */
dummy_s_timeout /* s_timeout */
};
/****************************************************************************

View File

@ -196,19 +196,18 @@ static void qspi_flash_writeword(FAR struct qspi_flashdev_s *priv,
static const struct qspi_ops_s g_qspiops =
{
.lock = qspi_flash_lock,
.setfrequency = qspi_flash_setfrequency,
.setmode = qspi_flash_setmode,
.setbits = qspi_flash_setbits,
.command = qspi_flash_command,
.memory = qspi_flash_memory,
.alloc = qspi_flash_alloc,
.free = qspi_flash_free
qspi_flash_lock, /* lock */
qspi_flash_setfrequency, /* setfrequency */
qspi_flash_setmode, /* setmode */
qspi_flash_setbits, /* setbits */
qspi_flash_command, /* command */
qspi_flash_memory, /* memory */
qspi_flash_alloc, /* alloc */
qspi_flash_free /* free */
};
struct qspi_flashdev_s g_qspidev =
{
.spidev =
{
&g_qspiops
}

View File

@ -151,15 +151,15 @@
struct spi_flash_dev_s
{
struct spi_dev_s spidev; /* Externally visible part of the SPI interface */
uint32_t selected; /* SPIn base address */
FAR char * name; /* Name of the flash type (m25p, w25, etc.) */
int wren;
int state;
uint32_t read_data;
uint8_t last_cmd;
uint8_t capacity;
FAR const char * name; /* Name of the flash type (m25p, w25, etc.) */
uint8_t manuf;
uint8_t type;
uint8_t capacity;
uint8_t last_cmd;
uint32_t selected; /* SPIn base address */
uint32_t read_data;
int wren;
int state;
unsigned long address;
unsigned char data[CONFIG_SPI_FLASH_SIZE];
};
@ -203,85 +203,87 @@ static uint32_t spi_flash_readword(FAR struct spi_flash_dev_s *priv);
static const struct spi_ops_s g_spiops =
{
.lock = spi_flash_lock,
.select = spi_flash_select,
.setfrequency = spi_flash_setfrequency,
.setmode = spi_flash_setmode,
.setbits = spi_flash_setbits,
spi_flash_lock, /* lock */
spi_flash_select, /* select */
spi_flash_setfrequency, /* setfrequency */
#ifdef CONFIG_SPI_DELAY_CONTROL
NULL, /* setdelay */
#endif
spi_flash_setmode, /* setmode */
spi_flash_setbits, /* setbits */
#ifdef CONFIG_SPI_HWFEATURES
.hwfeatures = 0, /* Not supported */
NULL, /* hwfeatures */
#endif
.status = spi_flash_status,
spi_flash_status, /* status */
#ifdef CONFIG_SPI_CMDDATA
.cmddata = spi_flash_cmddata,
spi_flash_cmddata, /* cmddata */
#endif
.send = spi_flash_send,
spi_flash_send, /* send */
#ifdef CONFIG_SPI_EXCHANGE
.exchange = spi_flash_exchange,
spi_flash_exchange, /* exchange */
#else
.sndblock = spi_flash_sndblock,
.recvblock = spi_flash_recvblock,
spi_flash_sndblock, /* sndblock */
spi_flash_recvblock, /* recvblock */
#endif
.registercallback = 0,
#ifdef CONFIG_SPI_TRIGGER
NULL, /* trigger */
#endif
NULL /* registercallback */
};
#ifdef CONFIG_SPI_FLASH_M25P
struct spi_flash_dev_s g_spidev_m25p =
{
.spidev =
{
&g_spiops
&g_spiops /* spidev */
},
.name = "m25p",
.manuf = 0x20,
.type = 0x20,
.capacity = CONFIG_SPI_FLASH_CAPACITY
"m25p", /* name */
0x20, /* manuf */
0x20, /* type */
CONFIG_SPI_FLASH_CAPACITY /* capacity */
};
#endif
#ifdef CONFIG_SPI_FLASH_SST26
struct spi_flash_dev_s g_spidev_sst26 =
{
.spidev =
{
&g_spiops
&g_spiops /* spidev */
},
.name = "sst26",
.manuf = 0xbf,
"sst26", /* name */
0xbf, /* manuf */
#ifdef CONFIG_SST26_MEMORY_TYPE
.type = CONFIG_SST26_MEMORY_TYPE,
CONFIG_SST26_MEMORY_TYPE, /* type */
#else
.type = 0x25,
0x25, /* type */
#endif
.capacity = CONFIG_SPI_FLASH_CAPACITY_SST26
CONFIG_SPI_FLASH_CAPACITY_SST26 /* capacity */
};
#endif
#ifdef CONFIG_SPI_FLASH_W25
struct spi_flash_dev_s g_spidev_w25 =
{
.spidev =
{
&g_spiops
&g_spiops /* spidev */
},
.name = "w25",
.manuf = 0xef,
.type = 0x30,
.capacity = CONFIG_SPI_FLASH_CAPACITY
"w25", /* name */
0xef, /* manuf */
0x30, /* type */
CONFIG_SPI_FLASH_CAPACITY /* capacity */
};
#endif
#ifdef CONFIG_SPI_FLASH_CUSTOM
struct spi_flash_dev_s g_spidev_custom =
{
.spidev =
{
&g_spiops
&g_spiops /* spidev */
},
.name = "custom",
.manuf = CONFIG_SPI_FLASH_MANUFACTURER,
.type = CONFIG_SPI_FLASH_MEMORY_TYPE,
.capacity = CONFIG_SPI_FLASH_CAPACITY
"custom", /* name */
CONFIG_SPI_FLASH_MANUFACTURER, /* manuf */
CONFIG_SPI_FLASH_MEMORY_TYPE, /* type */
CONFIG_SPI_FLASH_CAPACITY /* capacity */
};
#endif

View File

@ -614,14 +614,14 @@ static uint8_t g_isx012_iso_regval[] =
static struct imgsensor_ops_s g_isx012_ops =
{
.init = isx012_init,
.uninit = isx012_uninit,
.validate_frame_setting = isx012_validate_frame_setting,
.start_capture = isx012_start_capture,
.stop_capture = isx012_stop_capture,
.get_supported_value = isx012_get_supported_value,
.get_value = isx012_get_value,
.set_value = isx012_set_value,
isx012_init, /* init */
isx012_uninit, /* uninit */
isx012_validate_frame_setting, /* validate_frame_setting */
isx012_start_capture, /* start_capture */
isx012_stop_capture, /* stop_capture */
isx012_get_supported_value, /* get_supported_value */
isx012_get_value, /* get_value */
isx012_set_value /* set_value */
};
/****************************************************************************

View File

@ -281,71 +281,71 @@ enum v4l2_scene_mode g_video_scene_mode = V4L2_SCENE_MODE_NONE;
video_scene_params_t g_video_scene_parameter[] =
{
{
.mode = V4L2_SCENE_MODE_NONE,
V4L2_SCENE_MODE_NONE
},
#ifdef CONFIG_VIDEO_SCENE_BACKLIGHT
{
.mode = V4L2_SCENE_MODE_BACKLIGHT,
V4L2_SCENE_MODE_BACKLIGHT
},
#endif /* CONFIG_VIDEO_SCENE_BACKLIGHT */
#ifdef CONFIG_VIDEO_SCENE_BEACHSNOW
{
.mode = V4L2_SCENE_MODE_BEACH_SNOW,
V4L2_SCENE_MODE_BEACH_SNOW
},
#endif /* CONFIG_VIDEO_SCENE_BEACHSNOW */
#ifdef CONFIG_VIDEO_SCENE_CANDLELIGHT
{
.mode = V4L2_SCENE_MODE_CANDLE_LIGHT,
V4L2_SCENE_MODE_CANDLE_LIGHT
},
#endif /* CONFIG_VIDEO_SCENE_CANDLELIGHT */
#ifdef CONFIG_VIDEO_SCENE_DAWNDUSK
{
.mode = V4L2_SCENE_MODE_DAWN_DUSK,
V4L2_SCENE_MODE_DAWN_DUSK
},
#endif /* CONFIG_VIDEO_SCENE_DAWNDUSK */
#ifdef CONFIG_VIDEO_SCENE_FALLCOLORS
{
.mode = V4L2_SCENE_MODE_FALL_COLORS,
V4L2_SCENE_MODE_FALL_COLORS,
},
#endif /* CONFIG_VIDEO_SCENE_FALLCOLORS */
#ifdef CONFIG_VIDEO_SCENE_FIREWORKS
{
.mode = V4L2_SCENE_MODE_FIREWORKS,
V4L2_SCENE_MODE_FIREWORKS
},
#endif /* CONFIG_VIDEO_SCENE_FIREWORKS */
#ifdef CONFIG_VIDEO_SCENE_LANDSCAPE
{
.mode = V4L2_SCENE_MODE_LANDSCAPE,
V4L2_SCENE_MODE_LANDSCAPE
},
#endif /* CONFIG_VIDEO_SCENE_LANDSCAPE */
#ifdef CONFIG_VIDEO_SCENE_NIGHT
{
.mode = V4L2_SCENE_MODE_NIGHT,
V4L2_SCENE_MODE_NIGHT
},
#endif /* CONFIG_VIDEO_SCENE_NIGHT */
#ifdef CONFIG_VIDEO_SCENE_PARTYINDOOR
{
.mode = V4L2_SCENE_MODE_PARTY_INDOOR,
V4L2_SCENE_MODE_PARTY_INDOOR
},
#endif /* CONFIG_VIDEO_SCENE_PARTYINDOOR */
#ifdef CONFIG_VIDEO_SCENE_PORTRAIT
{
.mode = V4L2_SCENE_MODE_PORTRAIT,
V4L2_SCENE_MODE_PORTRAIT
},
#endif /* CONFIG_VIDEO_SCENE_PORTRAIT */
#ifdef CONFIG_VIDEO_SCENE_SPORTS
{
.mode = V4L2_SCENE_MODE_SPORTS,
V4L2_SCENE_MODE_SPORTS
},
#endif /* CONFIG_VIDEO_SCENE_SPORTS */
#ifdef CONFIG_VIDEO_SCENE_SUNSET
{
.mode = V4L2_SCENE_MODE_SUNSET,
V4L2_SCENE_MODE_SUNSET
},
#endif /* CONFIG_VIDEO_SCENE_SUNSET */
#ifdef CONFIG_VIDEO_SCENE_TEXT
{
.mode = V4L2_SCENE_MODE_TEXT,
V4L2_SCENE_MODE_TEXT
},
#endif /* CONFIG_VIDEO_SCENE_TEXT */
};

View File

@ -72,12 +72,14 @@ static const struct file_operations g_sock_fileops =
static struct inode g_sock_inode =
{
.i_crefs = 1,
.i_flags = FSNODEFLAG_TYPE_SOCKET,
.u =
NULL, /* i_parent */
NULL, /* i_peer */
NULL, /* i_child */
1, /* i_crefs */
FSNODEFLAG_TYPE_SOCKET, /* i_flags */
{
.i_ops = &g_sock_fileops,
},
&g_sock_fileops /* u */
}
};
/****************************************************************************

View File

@ -85,12 +85,14 @@ static const struct file_operations g_epoll_ops =
static struct inode g_epoll_inode =
{
.i_crefs = 1,
.i_flags = FSNODEFLAG_TYPE_DRIVER,
.u =
NULL, /* i_parent */
NULL, /* i_peer */
NULL, /* i_child */
1, /* i_crefs */
FSNODEFLAG_TYPE_DRIVER, /* i_flags */
{
.i_ops = &g_epoll_ops,
},
&g_epoll_ops /* u */
}
};
/****************************************************************************

View File

@ -178,6 +178,11 @@ struct adc_ops_s
struct adc_dev_s
{
/* Fields provided by lower half ADC logic */
FAR const struct adc_ops_s *ad_ops; /* Arch-specific operations */
FAR void *ad_priv; /* Used by the arch-specific logic */
#ifdef CONFIG_ADC
/* Fields managed by common upper half ADC logic */
@ -195,11 +200,6 @@ struct adc_dev_s
struct pollfd *fds[CONFIG_ADC_NPOLLWAITERS];
#endif /* CONFIG_ADC */
/* Fields provided by lower half ADC logic */
FAR const struct adc_ops_s *ad_ops; /* Arch-specific operations */
FAR void *ad_priv; /* Used by the arch-specific logic */
};
/****************************************************************************

View File

@ -127,14 +127,14 @@ struct dac_ops_s
struct dac_dev_s
{
const struct dac_ops_s *ad_ops; /* Arch-specific operations */
void *ad_priv; /* Used by the arch-specific logic */
uint8_t ad_ocount; /* The number of times the device has
* been opened */
uint8_t ad_nchannel; /* Number of dac channel */
sem_t ad_closesem; /* Locks out new opens while close is
* in progress */
struct dac_fifo_s ad_xmit; /* Describes receive FIFO */
const struct dac_ops_s *ad_ops; /* Arch-specific operations */
void *ad_priv; /* Used by the arch-specific logic */
};
/****************************************************************************

View File

@ -35,30 +35,9 @@
static struct lconv g_c_lconv =
{
.decimal_point = ".",
.thousands_sep = "",
.grouping = "",
.int_curr_symbol = "",
.currency_symbol = "",
.mon_decimal_point = "",
.mon_thousands_sep = "",
.mon_grouping = "",
.positive_sign = "",
.negative_sign = "",
.int_frac_digits = CHAR_MAX,
.frac_digits = CHAR_MAX,
.p_cs_precedes = CHAR_MAX,
.p_sep_by_space = CHAR_MAX,
.n_cs_precedes = CHAR_MAX,
.n_sep_by_space = CHAR_MAX,
.p_sign_posn = CHAR_MAX,
.n_sign_posn = CHAR_MAX,
.int_p_cs_precedes = CHAR_MAX,
.int_p_sep_by_space = CHAR_MAX,
.int_n_cs_precedes = CHAR_MAX,
.int_n_sep_by_space = CHAR_MAX,
.int_p_sign_posn = CHAR_MAX,
.int_n_sign_posn = CHAR_MAX,
".", "", "", "", "", "", "", "", "", "", CHAR_MAX, CHAR_MAX,
CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX
};
/****************************************************************************

View File

@ -46,11 +46,10 @@
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer,
unsigned int buflen)
{
struct iovec buf =
{
.iov_base = (FAR char *)buffer,
.iov_len = buflen,
};
struct iovec buf;
buf.iov_base = (FAR void *)buffer;
buf.iov_len = buflen;
lib_dumpvbuffer(msg, &buf, 1);
}

View File

@ -43,7 +43,7 @@
struct match_s
{
FAR struct match_s *next;
char name[];
char name[1];
};
/****************************************************************************
@ -71,8 +71,8 @@ static int sort(FAR const void *a, FAR const void *b);
static int append(FAR struct match_s **tail, FAR const char *name,
size_t len, int mark)
{
FAR struct match_s *new = lib_malloc(sizeof(struct match_s) + len + 2);
if (!new)
FAR struct match_s *new = lib_malloc(sizeof(struct match_s) + len + 1);
if (new == NULL)
{
return -1;
}
@ -83,7 +83,7 @@ static int append(FAR struct match_s **tail, FAR const char *name,
if (mark && len && name[len - 1] != '/')
{
new->name[len] = '/';
new->name[len + 1] = 0;
new->name[len + 1] = '\0';
}
*tail = new;
@ -405,11 +405,7 @@ int glob(FAR const char *pat, int flags,
CODE int (*errfunc)(FAR const char *path, int err),
FAR glob_t *g)
{
struct match_s head =
{
.next = NULL
};
struct match_s head;
FAR struct match_s *tail = &head;
size_t cnt;
size_t i;
@ -417,6 +413,9 @@ int glob(FAR const char *pat, int flags,
int error = 0;
char buf[PATH_MAX];
head.next = NULL;
head.name[0] = '\0';
if (!errfunc)
{
errfunc = ignore_err;

View File

@ -90,11 +90,10 @@ struct note_startalloc_s
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
static struct note_filter_s g_note_filter =
{
.mode =
{
.flag = CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE,
CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE
#ifdef CONFIG_SMP
.cpuset = CONFIG_SCHED_INSTRUMENTATION_CPUSET,
, CONFIG_SCHED_INSTRUMENTATION_CPUSET
#endif
}
};