Skip to content

Commit

Permalink
iio:trigger: Use dev_{set,get}_drvdata for private data management
Browse files Browse the repository at this point in the history
Use dev_{set,get}_drvdata for managing private data attached to a trigger
instead of using a custom field in the iio_trigger struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Mar 25, 2013
1 parent 1e9663c commit 5034bfc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions drivers/staging/iio/Documentation/trigger.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ struct iio_trig *trig = iio_trigger_alloc("<trigger format string>", ...);
allocates a trigger structure. The key elements to then fill in within
a driver are:

trig->private_data
Device specific private data.

trig->owner
Typically set to THIS_MODULE. Used to ensure correct
ownership of core allocated resources.
Expand Down
6 changes: 2 additions & 4 deletions include/linux/iio/trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct iio_trigger_ops {
* @id: [INTERN] unique id number
* @name: [DRIVER] unique name
* @dev: [DRIVER] associated device (if relevant)
* @private_data: [DRIVER] device specific data
* @list: [INTERN] used in maintenance of global trigger list
* @alloc_list: [DRIVER] used for driver specific trigger list
* @use_count: use count for the trigger
Expand All @@ -60,7 +59,6 @@ struct iio_trigger {
const char *name;
struct device dev;

void *private_data;
struct list_head list;
struct list_head alloc_list;
int use_count;
Expand Down Expand Up @@ -101,7 +99,7 @@ static inline void iio_trigger_get(struct iio_trigger *trig)
*/
static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
{
trig->private_data = data;
dev_set_drvdata(&trig->dev, data);
}

/**
Expand All @@ -112,7 +110,7 @@ static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
*/
static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
{
return trig->private_data;
return dev_get_drvdata(&trig->dev);
}

/**
Expand Down

0 comments on commit 5034bfc

Please sign in to comment.