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:
Kumar Gala 2022-07-19 12:36:33 -05:00 committed by Kumar Gala
commit 8fb2210cfb
7 changed files with 12 additions and 12 deletions

View file

@ -199,9 +199,10 @@ static int espi_emul_init(const struct device *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;
const char *name = emul->target->dev->name;
sys_slist_append(&data->emuls, &emul->node);

View file

@ -118,9 +118,10 @@ static int i2c_emul_init(const struct device *dev)
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;
const char *name = emul->target->dev->name;
sys_slist_append(&data->emuls, &emul->node);

View file

@ -95,9 +95,10 @@ static int spi_emul_init(const struct device *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;
const char *name = emul->target->dev->name;
sys_slist_append(&data->emuls, &emul->node);

View file

@ -132,11 +132,10 @@ struct emul_espi_driver_api {
* Register an emulated device on the controller
*
* @param dev Device that will use the emulator
* @param name User-friendly name for this emulator
* @param emul eSPI emulator to use
* @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

View file

@ -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
*
* @param dev Device that will use the emulator
* @param name User-friendly name for this emulator
* @param emul I2C emulator to use
* @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 */
struct i2c_emul_api {

View file

@ -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
*
* @param dev Device that will use the emulator
* @param name User-friendly name for this emulator
* @param emul SPI emulator to use
* @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 */
struct spi_emul_api {

View file

@ -64,17 +64,17 @@ int emul_init_for_bus(const struct device *dev)
switch (emul->bus_type) {
#ifdef CONFIG_I2C_EMUL
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;
#endif /* CONFIG_I2C_EMUL */
#ifdef CONFIG_ESPI_EMUL
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;
#endif /* CONFIG_ESPI_EMUL */
#ifdef CONFIG_SPI_EMUL
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;
#endif /* CONFIG_SPI_EMUL */
default: