diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-12-16 00:17:40 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2021-01-06 15:15:39 +0100 |
commit | bf722fdd3bc4d0285a131248b8254b30f1f8474a (patch) | |
tree | f9ac364242637376e8cbd64d2a76632fdfc65d6d /drivers/net/can/m_can | |
parent | 0c05345210fc265d24f7b800516d2a4eac0c56c1 (diff) |
can: tcan4x5x: tcan4x5x_regmap_init(): use spi as context pointer
This patch replaces the context pointer of the regmap callback functions by a
pointer to the spi_device. This saves one level of indirection in the
callbacks.
Reviewed-by: Dan Murphy <dmurphy@ti.com>
Tested-by: Sean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20201215231746.1132907-11-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/m_can')
-rw-r--r-- | drivers/net/can/m_can/tcan4x5x-regmap.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c index 6345bcb7704f..4d43c145fdec 100644 --- a/drivers/net/can/m_can/tcan4x5x-regmap.c +++ b/drivers/net/can/m_can/tcan4x5x-regmap.c @@ -18,8 +18,7 @@ static int tcan4x5x_regmap_gather_write(void *context, const void *reg, size_t reg_len, const void *val, size_t val_len) { - struct device *dev = context; - struct spi_device *spi = to_spi_device(dev); + struct spi_device *spi = context; struct spi_message m; u32 addr; struct spi_transfer t[2] = { @@ -47,8 +46,7 @@ static int tcan4x5x_regmap_read(void *context, const void *reg, size_t reg_size, void *val, size_t val_size) { - struct device *dev = context; - struct spi_device *spi = to_spi_device(dev); + struct spi_device *spi = context; u32 addr = TCAN4X5X_READ_CMD | (*((u16 *)reg) << 8) | val_size >> 2; @@ -73,6 +71,6 @@ static const struct regmap_bus tcan4x5x_bus = { int tcan4x5x_regmap_init(struct tcan4x5x_priv *priv) { priv->regmap = devm_regmap_init(&priv->spi->dev, &tcan4x5x_bus, - &priv->spi->dev, &tcan4x5x_regmap); + priv->spi, &tcan4x5x_regmap); return PTR_ERR_OR_ZERO(priv->regmap); } |