diff options
author | Ben Dooks <ben@fluff.org> | 2007-02-12 03:52:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:30 -0500 |
commit | 9b40ff4d729f4a7a9f832c67aa5de0dfa8ad45c0 (patch) | |
tree | e5ee3959e846f220a4d6a96c241a201e459b1bbb | |
parent | 69c202afa8ad6d6c1c673d8f9d47b43a0a3604e5 (diff) |
[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: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/spi/spi-summary | 2 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 72795796b13d..81b6230d3d22 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -312,7 +312,7 @@ might look like this unless you're creating a class_device: | |||
312 | chip = kzalloc(sizeof *chip, GFP_KERNEL); | 312 | chip = kzalloc(sizeof *chip, GFP_KERNEL); |
313 | if (!chip) | 313 | if (!chip) |
314 | return -ENOMEM; | 314 | return -ENOMEM; |
315 | dev_set_drvdata(&spi->dev, chip); | 315 | spi_set_drvdata(spi, chip); |
316 | 316 | ||
317 | ... etc | 317 | ... etc |
318 | return 0; | 318 | return 0; |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 176f6e36dbfa..e25fcae89d3b 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -114,6 +114,17 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state) | |||
114 | spi->controller_state = state; | 114 | spi->controller_state = state; |
115 | } | 115 | } |
116 | 116 | ||
117 | /* device driver data */ | ||
118 | |||
119 | static inline void spi_set_drvdata(struct spi_device *spi, void *data) | ||
120 | { | ||
121 | dev_set_drvdata(&spi->dev, data); | ||
122 | } | ||
123 | |||
124 | static inline void *spi_get_drvdata(struct spi_device *spi) | ||
125 | { | ||
126 | return dev_get_drvdata(&spi->dev); | ||
127 | } | ||
117 | 128 | ||
118 | struct spi_message; | 129 | struct spi_message; |
119 | 130 | ||