Commit 9b40ff4d authored by Ben Dooks's avatar Ben Dooks Committed by Linus Torvalds

[PATCH] spi: add spi_set_drvdata() and spi_get_drvdata()

Add wrappers for getting and setting the driver data using spi_device
instead of using dev_{get|set}_drvdata with &spi->dev, to mirror the
platform_{get|set}_drvdata.
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 69c202af
...@@ -312,7 +312,7 @@ might look like this unless you're creating a class_device: ...@@ -312,7 +312,7 @@ might look like this unless you're creating a class_device:
chip = kzalloc(sizeof *chip, GFP_KERNEL); chip = kzalloc(sizeof *chip, GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(&spi->dev, chip); spi_set_drvdata(spi, chip);
... etc ... etc
return 0; return 0;
......
...@@ -114,6 +114,17 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state) ...@@ -114,6 +114,17 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
spi->controller_state = state; spi->controller_state = state;
} }
/* device driver data */
static inline void spi_set_drvdata(struct spi_device *spi, void *data)
{
dev_set_drvdata(&spi->dev, data);
}
static inline void *spi_get_drvdata(struct spi_device *spi)
{
return dev_get_drvdata(&spi->dev);
}
struct spi_message; struct spi_message;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment