Skip to content

Commit 5034bfc

Browse files
larsclausenjic23
authored andcommitted
iio:trigger: Use dev_{set,get}_drvdata for private data management
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>
1 parent 1e9663c commit 5034bfc

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

‎drivers/staging/iio/Documentation/trigger.txt‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ struct iio_trig *trig = iio_trigger_alloc("<trigger format string>", ...);
1010
allocates a trigger structure. The key elements to then fill in within
1111
a driver are:
1212

13-
trig->private_data
14-
Device specific private data.
15-
1613
trig->owner
1714
Typically set to THIS_MODULE. Used to ensure correct
1815
ownership of core allocated resources.

‎include/linux/iio/trigger.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ struct iio_trigger_ops {
4444
* @id: [INTERN] unique id number
4545
* @name: [DRIVER] unique name
4646
* @dev: [DRIVER] associated device (if relevant)
47-
* @private_data: [DRIVER] device specific data
4847
* @list: [INTERN] used in maintenance of global trigger list
4948
* @alloc_list: [DRIVER] used for driver specific trigger list
5049
* @use_count: use count for the trigger
@@ -60,7 +59,6 @@ struct iio_trigger {
6059
const char *name;
6160
struct device dev;
6261

63-
void *private_data;
6462
struct list_head list;
6563
struct list_head alloc_list;
6664
int use_count;
@@ -101,7 +99,7 @@ static inline void iio_trigger_get(struct iio_trigger *trig)
10199
*/
102100
static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
103101
{
104-
trig->private_data = data;
102+
dev_set_drvdata(&trig->dev, data);
105103
}
106104

107105
/**
@@ -112,7 +110,7 @@ static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data)
112110
*/
113111
static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig)
114112
{
115-
return trig->private_data;
113+
return dev_get_drvdata(&trig->dev);
116114
}
117115

118116
/**

0 commit comments

Comments
 (0)