scripts: Replace hard-coded subsystem list with __subsystem annotations.
This change removes the hardcoded subsystem list in gen_kobject_list.py favor of marking the relevant driver API structs with the _subsystem sentinel. Signed-off-by: Corey Wharton <coreyw7@fb.com>
This commit is contained in:
parent
ccd15df510
commit
86bfc489f4
25 changed files with 30 additions and 48 deletions
|
@ -24,7 +24,7 @@
|
||||||
#include "cipher_structs.h"
|
#include "cipher_structs.h"
|
||||||
|
|
||||||
/* The API a crypto driver should implement */
|
/* The API a crypto driver should implement */
|
||||||
struct crypto_driver_api {
|
__subsystem struct crypto_driver_api {
|
||||||
int (*query_hw_caps)(struct device *dev);
|
int (*query_hw_caps)(struct device *dev);
|
||||||
|
|
||||||
/* Setup a crypto session */
|
/* Setup a crypto session */
|
||||||
|
|
|
@ -353,7 +353,7 @@ typedef int (*adc_api_read_async)(struct device *dev,
|
||||||
*
|
*
|
||||||
* This is the mandatory API any ADC driver needs to expose.
|
* This is the mandatory API any ADC driver needs to expose.
|
||||||
*/
|
*/
|
||||||
struct adc_driver_api {
|
__subsystem struct adc_driver_api {
|
||||||
adc_api_channel_setup channel_setup;
|
adc_api_channel_setup channel_setup;
|
||||||
adc_api_read read;
|
adc_api_read read;
|
||||||
#ifdef CONFIG_ADC_ASYNC
|
#ifdef CONFIG_ADC_ASYNC
|
||||||
|
|
|
@ -312,7 +312,7 @@ struct zcan_work {
|
||||||
void *cb_arg;
|
void *cb_arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct can_driver_api {
|
__subsystem struct can_driver_api {
|
||||||
can_configure_t configure;
|
can_configure_t configure;
|
||||||
can_send_t send;
|
can_send_t send;
|
||||||
can_attach_isr_t attach_isr;
|
can_attach_isr_t attach_isr;
|
||||||
|
|
|
@ -184,7 +184,7 @@ typedef u32_t (*counter_api_get_guard_period)(struct device *dev, u32_t flags);
|
||||||
typedef int (*counter_api_set_guard_period)(struct device *dev, u32_t ticks,
|
typedef int (*counter_api_set_guard_period)(struct device *dev, u32_t ticks,
|
||||||
u32_t flags);
|
u32_t flags);
|
||||||
|
|
||||||
struct counter_driver_api {
|
__subsystem struct counter_driver_api {
|
||||||
counter_api_start start;
|
counter_api_start start;
|
||||||
counter_api_stop stop;
|
counter_api_stop stop;
|
||||||
counter_api_get_value get_value;
|
counter_api_get_value get_value;
|
||||||
|
|
|
@ -189,7 +189,7 @@ typedef int (*dma_api_stop)(struct device *dev, u32_t channel);
|
||||||
typedef int (*dma_api_get_status)(struct device *dev, u32_t channel,
|
typedef int (*dma_api_get_status)(struct device *dev, u32_t channel,
|
||||||
struct dma_status *status);
|
struct dma_status *status);
|
||||||
|
|
||||||
struct dma_driver_api {
|
__subsystem struct dma_driver_api {
|
||||||
dma_api_config config;
|
dma_api_config config;
|
||||||
dma_api_reload reload;
|
dma_api_reload reload;
|
||||||
dma_api_start start;
|
dma_api_start start;
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef int (*eeprom_api_write)(struct device *dev, off_t offset,
|
||||||
const void *data, size_t len);
|
const void *data, size_t len);
|
||||||
typedef size_t (*eeprom_api_size)(struct device *dev);
|
typedef size_t (*eeprom_api_size)(struct device *dev);
|
||||||
|
|
||||||
struct eeprom_driver_api {
|
__subsystem struct eeprom_driver_api {
|
||||||
eeprom_api_read read;
|
eeprom_api_read read;
|
||||||
eeprom_api_write write;
|
eeprom_api_write write;
|
||||||
eeprom_api_size size;
|
eeprom_api_size size;
|
||||||
|
|
|
@ -46,7 +46,7 @@ typedef int (*entropy_get_entropy_isr_t)(struct device *dev,
|
||||||
u8_t *buffer,
|
u8_t *buffer,
|
||||||
u16_t length,
|
u16_t length,
|
||||||
u32_t flags);
|
u32_t flags);
|
||||||
struct entropy_driver_api {
|
__subsystem struct entropy_driver_api {
|
||||||
entropy_get_entropy_t get_entropy;
|
entropy_get_entropy_t get_entropy;
|
||||||
entropy_get_entropy_isr_t get_entropy_isr;
|
entropy_get_entropy_isr_t get_entropy_isr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -357,7 +357,7 @@ typedef int (*espi_api_manage_callback)(struct device *dev,
|
||||||
struct espi_callback *callback,
|
struct espi_callback *callback,
|
||||||
bool set);
|
bool set);
|
||||||
|
|
||||||
struct espi_driver_api {
|
__subsystem struct espi_driver_api {
|
||||||
espi_api_config config;
|
espi_api_config config;
|
||||||
espi_api_get_channel_status get_channel_status;
|
espi_api_get_channel_status get_channel_status;
|
||||||
espi_api_read_request read_request;
|
espi_api_read_request read_request;
|
||||||
|
|
|
@ -70,7 +70,7 @@ typedef void (*flash_api_pages_layout)(struct device *dev,
|
||||||
size_t *layout_size);
|
size_t *layout_size);
|
||||||
#endif /* CONFIG_FLASH_PAGE_LAYOUT */
|
#endif /* CONFIG_FLASH_PAGE_LAYOUT */
|
||||||
|
|
||||||
struct flash_driver_api {
|
__subsystem struct flash_driver_api {
|
||||||
flash_api_read read;
|
flash_api_read read;
|
||||||
flash_api_write write;
|
flash_api_write write;
|
||||||
flash_api_erase erase;
|
flash_api_erase erase;
|
||||||
|
|
|
@ -545,7 +545,7 @@ enum gpio_int_trig {
|
||||||
GPIO_INT_TRIG_BOTH = GPIO_INT_LOW_0 | GPIO_INT_HIGH_1,
|
GPIO_INT_TRIG_BOTH = GPIO_INT_LOW_0 | GPIO_INT_HIGH_1,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gpio_driver_api {
|
__subsystem struct gpio_driver_api {
|
||||||
int (*pin_configure)(struct device *port, gpio_pin_t pin, gpio_flags_t flags);
|
int (*pin_configure)(struct device *port, gpio_pin_t pin, gpio_flags_t flags);
|
||||||
int (*port_get_raw)(struct device *port, gpio_port_value_t *value);
|
int (*port_get_raw)(struct device *port, gpio_port_value_t *value);
|
||||||
int (*port_set_masked_raw)(struct device *port, gpio_port_pins_t mask,
|
int (*port_set_masked_raw)(struct device *port, gpio_port_pins_t mask,
|
||||||
|
|
|
@ -174,7 +174,7 @@ typedef int (*i2c_api_slave_register_t)(struct device *dev,
|
||||||
typedef int (*i2c_api_slave_unregister_t)(struct device *dev,
|
typedef int (*i2c_api_slave_unregister_t)(struct device *dev,
|
||||||
struct i2c_slave_config *cfg);
|
struct i2c_slave_config *cfg);
|
||||||
|
|
||||||
struct i2c_driver_api {
|
__subsystem struct i2c_driver_api {
|
||||||
i2c_api_configure_t configure;
|
i2c_api_configure_t configure;
|
||||||
i2c_api_full_io_t transfer;
|
i2c_api_full_io_t transfer;
|
||||||
i2c_api_slave_register_t slave_register;
|
i2c_api_slave_register_t slave_register;
|
||||||
|
|
|
@ -313,7 +313,7 @@ struct i2s_config {
|
||||||
*
|
*
|
||||||
* For internal use only, skip these in public documentation.
|
* For internal use only, skip these in public documentation.
|
||||||
*/
|
*/
|
||||||
struct i2s_driver_api {
|
__subsystem struct i2s_driver_api {
|
||||||
int (*configure)(struct device *dev, enum i2s_dir dir,
|
int (*configure)(struct device *dev, enum i2s_dir dir,
|
||||||
struct i2s_config *cfg);
|
struct i2s_config *cfg);
|
||||||
struct i2s_config *(*config_get)(struct device *dev,
|
struct i2s_config *(*config_get)(struct device *dev,
|
||||||
|
|
|
@ -85,7 +85,7 @@ typedef void (*ipm_register_callback_t)(struct device *port, ipm_callback_t cb,
|
||||||
*/
|
*/
|
||||||
typedef int (*ipm_set_enabled_t)(struct device *ipmdev, int enable);
|
typedef int (*ipm_set_enabled_t)(struct device *ipmdev, int enable);
|
||||||
|
|
||||||
struct ipm_driver_api {
|
__subsystem struct ipm_driver_api {
|
||||||
ipm_send_t send;
|
ipm_send_t send;
|
||||||
ipm_register_callback_t register_callback;
|
ipm_register_callback_t register_callback;
|
||||||
ipm_max_data_size_get_t max_data_size_get;
|
ipm_max_data_size_get_t max_data_size_get;
|
||||||
|
|
|
@ -56,7 +56,7 @@ typedef int (*kscan_config_t)(struct device *dev,
|
||||||
typedef int (*kscan_disable_callback_t)(struct device *dev);
|
typedef int (*kscan_disable_callback_t)(struct device *dev);
|
||||||
typedef int (*kscan_enable_callback_t)(struct device *dev);
|
typedef int (*kscan_enable_callback_t)(struct device *dev);
|
||||||
|
|
||||||
struct kscan_driver_api {
|
__subsystem struct kscan_driver_api {
|
||||||
kscan_config_t config;
|
kscan_config_t config;
|
||||||
kscan_disable_callback_t disable_callback;
|
kscan_disable_callback_t disable_callback;
|
||||||
kscan_enable_callback_t enable_callback;
|
kscan_enable_callback_t enable_callback;
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef int (*led_api_off)(struct device *dev, u32_t led);
|
||||||
*
|
*
|
||||||
* This is the mandatory API any LED driver needs to expose.
|
* This is the mandatory API any LED driver needs to expose.
|
||||||
*/
|
*/
|
||||||
struct led_driver_api {
|
__subsystem struct led_driver_api {
|
||||||
led_api_blink blink;
|
led_api_blink blink;
|
||||||
led_api_set_brightness set_brightness;
|
led_api_set_brightness set_brightness;
|
||||||
led_api_on on;
|
led_api_on on;
|
||||||
|
|
|
@ -66,7 +66,7 @@ typedef int (*pmux_pullup)(struct device *dev, u32_t pin, u8_t func);
|
||||||
*/
|
*/
|
||||||
typedef int (*pmux_input)(struct device *dev, u32_t pin, u8_t func);
|
typedef int (*pmux_input)(struct device *dev, u32_t pin, u8_t func);
|
||||||
|
|
||||||
struct pinmux_driver_api {
|
__subsystem struct pinmux_driver_api {
|
||||||
pmux_set set;
|
pmux_set set;
|
||||||
pmux_get get;
|
pmux_get get;
|
||||||
pmux_pullup pullup;
|
pmux_pullup pullup;
|
||||||
|
|
|
@ -50,7 +50,7 @@ typedef int (*ps2_write_t)(struct device *dev, u8_t value);
|
||||||
typedef int (*ps2_disable_callback_t)(struct device *dev);
|
typedef int (*ps2_disable_callback_t)(struct device *dev);
|
||||||
typedef int (*ps2_enable_callback_t)(struct device *dev);
|
typedef int (*ps2_enable_callback_t)(struct device *dev);
|
||||||
|
|
||||||
struct ps2_driver_api {
|
__subsystem struct ps2_driver_api {
|
||||||
ps2_config_t config;
|
ps2_config_t config;
|
||||||
ps2_read_t read;
|
ps2_read_t read;
|
||||||
ps2_write_t write;
|
ps2_write_t write;
|
||||||
|
|
|
@ -52,7 +52,7 @@ typedef int (*pwm_get_cycles_per_sec_t)(struct device *dev, u32_t pwm,
|
||||||
u64_t *cycles);
|
u64_t *cycles);
|
||||||
|
|
||||||
/** @brief PWM driver API definition. */
|
/** @brief PWM driver API definition. */
|
||||||
struct pwm_driver_api {
|
__subsystem struct pwm_driver_api {
|
||||||
pwm_pin_set_t pin_set;
|
pwm_pin_set_t pin_set;
|
||||||
pwm_get_cycles_per_sec_t get_cycles_per_sec;
|
pwm_get_cycles_per_sec_t get_cycles_per_sec;
|
||||||
};
|
};
|
||||||
|
|
|
@ -319,7 +319,7 @@ typedef int (*sensor_channel_get_t)(struct device *dev,
|
||||||
enum sensor_channel chan,
|
enum sensor_channel chan,
|
||||||
struct sensor_value *val);
|
struct sensor_value *val);
|
||||||
|
|
||||||
struct sensor_driver_api {
|
__subsystem struct sensor_driver_api {
|
||||||
sensor_attr_set_t attr_set;
|
sensor_attr_set_t attr_set;
|
||||||
sensor_trigger_set_t trigger_set;
|
sensor_trigger_set_t trigger_set;
|
||||||
sensor_sample_fetch_t sample_fetch;
|
sensor_sample_fetch_t sample_fetch;
|
||||||
|
|
|
@ -223,7 +223,7 @@ typedef int (*spi_api_release)(struct device *dev,
|
||||||
* @brief SPI driver API
|
* @brief SPI driver API
|
||||||
* This is the mandatory API any SPI driver needs to expose.
|
* This is the mandatory API any SPI driver needs to expose.
|
||||||
*/
|
*/
|
||||||
struct spi_driver_api {
|
__subsystem struct spi_driver_api {
|
||||||
spi_api_io transceive;
|
spi_api_io transceive;
|
||||||
#ifdef CONFIG_SPI_ASYNC
|
#ifdef CONFIG_SPI_ASYNC
|
||||||
spi_api_io_async transceive_async;
|
spi_api_io_async transceive_async;
|
||||||
|
|
|
@ -342,7 +342,7 @@ struct uart_device_config {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Driver API structure. */
|
/** @brief Driver API structure. */
|
||||||
struct uart_driver_api {
|
__subsystem struct uart_driver_api {
|
||||||
|
|
||||||
#ifdef CONFIG_UART_ASYNC_API
|
#ifdef CONFIG_UART_ASYNC_API
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ typedef int (*wdt_api_install_timeout)(struct device *dev,
|
||||||
typedef int (*wdt_api_feed)(struct device *dev, int channel_id);
|
typedef int (*wdt_api_feed)(struct device *dev, int channel_id);
|
||||||
|
|
||||||
/** @cond INTERNAL_HIDDEN */
|
/** @cond INTERNAL_HIDDEN */
|
||||||
struct wdt_driver_api {
|
__subsystem struct wdt_driver_api {
|
||||||
wdt_api_setup setup;
|
wdt_api_setup setup;
|
||||||
wdt_api_disable disable;
|
wdt_api_disable disable;
|
||||||
wdt_api_install_timeout install_timeout;
|
wdt_api_install_timeout install_timeout;
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
||||||
#define PTP_CLOCK_NAME "PTP_CLOCK"
|
#define PTP_CLOCK_NAME "PTP_CLOCK"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct ptp_clock_driver_api {
|
__subsystem struct ptp_clock_driver_api {
|
||||||
int (*set)(struct device *dev, struct net_ptp_time *tm);
|
int (*set)(struct device *dev, struct net_ptp_time *tm);
|
||||||
int (*get)(struct device *dev, struct net_ptp_time *tm);
|
int (*get)(struct device *dev, struct net_ptp_time *tm);
|
||||||
int (*adjust)(struct device *dev, int increment);
|
int (*adjust)(struct device *dev, int increment);
|
||||||
|
|
|
@ -23,7 +23,7 @@ typedef int (*sample_driver_set_callback_t)(struct device *dev,
|
||||||
|
|
||||||
typedef int (*sample_driver_state_set_t)(struct device *dev, bool active);
|
typedef int (*sample_driver_state_set_t)(struct device *dev, bool active);
|
||||||
|
|
||||||
struct sample_driver_api {
|
__subsystem struct sample_driver_api {
|
||||||
sample_driver_write_t write;
|
sample_driver_write_t write;
|
||||||
sample_driver_set_callback_t set_callback;
|
sample_driver_set_callback_t set_callback;
|
||||||
sample_driver_state_set_t state_set;
|
sample_driver_state_set_t state_set;
|
||||||
|
|
|
@ -92,30 +92,12 @@ kobjects = OrderedDict([
|
||||||
])
|
])
|
||||||
|
|
||||||
subsystems = [
|
subsystems = [
|
||||||
"adc_driver_api",
|
# Editing the list is deprecated, add the __subsystem sentinal to your driver
|
||||||
"aio_cmp_driver_api",
|
# api declaration instead. e.x.
|
||||||
"counter_driver_api",
|
#
|
||||||
"crypto_driver_api",
|
# __subsystem struct my_driver_api {
|
||||||
"dma_driver_api",
|
# ....
|
||||||
"flash_driver_api",
|
#};
|
||||||
"gpio_driver_api",
|
|
||||||
"i2c_driver_api",
|
|
||||||
"i2s_driver_api",
|
|
||||||
"ipm_driver_api",
|
|
||||||
"led_driver_api",
|
|
||||||
"pinmux_driver_api",
|
|
||||||
"pwm_driver_api",
|
|
||||||
"entropy_driver_api",
|
|
||||||
"sensor_driver_api",
|
|
||||||
"spi_driver_api",
|
|
||||||
"uart_driver_api",
|
|
||||||
"can_driver_api",
|
|
||||||
"ptp_clock_driver_api",
|
|
||||||
"eeprom_driver_api",
|
|
||||||
"wdt_driver_api",
|
|
||||||
|
|
||||||
# Fake 'sample driver' subsystem, used by tests/samples
|
|
||||||
"sample_driver_api"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
header = """%compare-lengths
|
header = """%compare-lengths
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue