aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/spi/spi-summary2
-rw-r--r--include/linux/spi/spi.h11
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
119static inline void spi_set_drvdata(struct spi_device *spi, void *data)
120{
121 dev_set_drvdata(&spi->dev, data);
122}
123
124static inline void *spi_get_drvdata(struct spi_device *spi)
125{
126 return dev_get_drvdata(&spi->dev);
127}
117 128
118struct spi_message; 129struct spi_message;
119 130