emul: remove name param from bus register APIs
Rework the <BUS>_emul_register calls to not pass the name param. The name param is only used for logging and we can get it from the struct <BUS>_emul instead. Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
parent
20177daa0f
commit
8fb2210cfb
7 changed files with 12 additions and 12 deletions
|
@ -199,9 +199,10 @@ static int espi_emul_init(const struct device *dev)
|
||||||
return emul_init_for_bus(dev);
|
return emul_init_for_bus(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int espi_emul_register(const struct device *dev, const char *name, struct espi_emul *emul)
|
int espi_emul_register(const struct device *dev, struct espi_emul *emul)
|
||||||
{
|
{
|
||||||
struct espi_emul_data *data = dev->data;
|
struct espi_emul_data *data = dev->data;
|
||||||
|
const char *name = emul->target->dev->name;
|
||||||
|
|
||||||
sys_slist_append(&data->emuls, &emul->node);
|
sys_slist_append(&data->emuls, &emul->node);
|
||||||
|
|
||||||
|
|
|
@ -118,9 +118,10 @@ static int i2c_emul_init(const struct device *dev)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i2c_emul_register(const struct device *dev, const char *name, struct i2c_emul *emul)
|
int i2c_emul_register(const struct device *dev, struct i2c_emul *emul)
|
||||||
{
|
{
|
||||||
struct i2c_emul_data *data = dev->data;
|
struct i2c_emul_data *data = dev->data;
|
||||||
|
const char *name = emul->target->dev->name;
|
||||||
|
|
||||||
sys_slist_append(&data->emuls, &emul->node);
|
sys_slist_append(&data->emuls, &emul->node);
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,10 @@ static int spi_emul_init(const struct device *dev)
|
||||||
return emul_init_for_bus(dev);
|
return emul_init_for_bus(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int spi_emul_register(const struct device *dev, const char *name, struct spi_emul *emul)
|
int spi_emul_register(const struct device *dev, struct spi_emul *emul)
|
||||||
{
|
{
|
||||||
struct spi_emul_data *data = dev->data;
|
struct spi_emul_data *data = dev->data;
|
||||||
|
const char *name = emul->target->dev->name;
|
||||||
|
|
||||||
sys_slist_append(&data->emuls, &emul->node);
|
sys_slist_append(&data->emuls, &emul->node);
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,10 @@ struct emul_espi_driver_api {
|
||||||
* Register an emulated device on the controller
|
* Register an emulated device on the controller
|
||||||
*
|
*
|
||||||
* @param dev Device that will use the emulator
|
* @param dev Device that will use the emulator
|
||||||
* @param name User-friendly name for this emulator
|
|
||||||
* @param emul eSPI emulator to use
|
* @param emul eSPI emulator to use
|
||||||
* @return 0 indicating success (always)
|
* @return 0 indicating success (always)
|
||||||
*/
|
*/
|
||||||
int espi_emul_register(const struct device *dev, const char *name, struct espi_emul *emul);
|
int espi_emul_register(const struct device *dev, struct espi_emul *emul);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the eSPI virtual wire on the host side, which will
|
* Sets the eSPI virtual wire on the host side, which will
|
||||||
|
|
|
@ -65,11 +65,10 @@ typedef int (*i2c_emul_transfer_t)(const struct emul *target, struct i2c_msg *ms
|
||||||
* Register an emulated device on the controller
|
* Register an emulated device on the controller
|
||||||
*
|
*
|
||||||
* @param dev Device that will use the emulator
|
* @param dev Device that will use the emulator
|
||||||
* @param name User-friendly name for this emulator
|
|
||||||
* @param emul I2C emulator to use
|
* @param emul I2C emulator to use
|
||||||
* @return 0 indicating success (always)
|
* @return 0 indicating success (always)
|
||||||
*/
|
*/
|
||||||
int i2c_emul_register(const struct device *dev, const char *name, struct i2c_emul *emul);
|
int i2c_emul_register(const struct device *dev, struct i2c_emul *emul);
|
||||||
|
|
||||||
/** Definition of the emulator API */
|
/** Definition of the emulator API */
|
||||||
struct i2c_emul_api {
|
struct i2c_emul_api {
|
||||||
|
|
|
@ -69,11 +69,10 @@ typedef int (*spi_emul_io_t)(const struct emul *target, const struct spi_config
|
||||||
* Register an emulated device on the controller
|
* Register an emulated device on the controller
|
||||||
*
|
*
|
||||||
* @param dev Device that will use the emulator
|
* @param dev Device that will use the emulator
|
||||||
* @param name User-friendly name for this emulator
|
|
||||||
* @param emul SPI emulator to use
|
* @param emul SPI emulator to use
|
||||||
* @return 0 indicating success (always)
|
* @return 0 indicating success (always)
|
||||||
*/
|
*/
|
||||||
int spi_emul_register(const struct device *dev, const char *name, struct spi_emul *emul);
|
int spi_emul_register(const struct device *dev, struct spi_emul *emul);
|
||||||
|
|
||||||
/** Definition of the emulator API */
|
/** Definition of the emulator API */
|
||||||
struct spi_emul_api {
|
struct spi_emul_api {
|
||||||
|
|
|
@ -64,17 +64,17 @@ int emul_init_for_bus(const struct device *dev)
|
||||||
switch (emul->bus_type) {
|
switch (emul->bus_type) {
|
||||||
#ifdef CONFIG_I2C_EMUL
|
#ifdef CONFIG_I2C_EMUL
|
||||||
case EMUL_BUS_TYPE_I2C:
|
case EMUL_BUS_TYPE_I2C:
|
||||||
rc = i2c_emul_register(dev, emul->dev->name, emul->bus.i2c);
|
rc = i2c_emul_register(dev, emul->bus.i2c);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_I2C_EMUL */
|
#endif /* CONFIG_I2C_EMUL */
|
||||||
#ifdef CONFIG_ESPI_EMUL
|
#ifdef CONFIG_ESPI_EMUL
|
||||||
case EMUL_BUS_TYPE_ESPI:
|
case EMUL_BUS_TYPE_ESPI:
|
||||||
rc = espi_emul_register(dev, emul->dev->name, emul->bus.espi);
|
rc = espi_emul_register(dev, emul->bus.espi);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_ESPI_EMUL */
|
#endif /* CONFIG_ESPI_EMUL */
|
||||||
#ifdef CONFIG_SPI_EMUL
|
#ifdef CONFIG_SPI_EMUL
|
||||||
case EMUL_BUS_TYPE_SPI:
|
case EMUL_BUS_TYPE_SPI:
|
||||||
rc = spi_emul_register(dev, emul->dev->name, emul->bus.spi);
|
rc = spi_emul_register(dev, emul->bus.spi);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_SPI_EMUL */
|
#endif /* CONFIG_SPI_EMUL */
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue