Skip to content

Commit

Permalink
[PATCH] spi: add spi_set_drvdata() and spi_get_drvdata()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Dooks authored and Linus Torvalds committed Feb 12, 2007
1 parent 69c202a commit 9b40ff4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/spi/spi-summary
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ might look like this unless you're creating a class_device:
chip = kzalloc(sizeof *chip, GFP_KERNEL);
if (!chip)
return -ENOMEM;
dev_set_drvdata(&spi->dev, chip);
spi_set_drvdata(spi, chip);

... etc
return 0;
Expand Down
11 changes: 11 additions & 0 deletions include/linux/spi/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *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;

Expand Down

0 comments on commit 9b40ff4

Please sign in to comment.