Help understanding iio_priv(..)
Hi
I have been looking at the IIO task and came across this function iio_priv(..). It is defined as-
static inline void *iio_priv(const struct iio_dev *indio_dev) {
return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
}
It returns a void pointer and used as struct dev_state = iio_priv(indio_dev). Looks like it is used to store an iio device state private to the file.
Could someone help me understand what exactly is happening inside here?
Thanks
Aishwarya
Quoted 12 lines · Aishwarya Pant
Hi
I have been looking at the IIO task and came across this function
iio_priv(..). It is defined as-static inline void *iio_priv(const struct
iio_dev*indio_dev) {
return (char *)indio_dev +ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
}
Quoted 4 lines
It returns a void pointer and used as struct
dev_state=iio_priv(indio_dev). Looks like it is used to store an iio device state private to the file.Could someone help me understand what exactly is happening inside here?
Probably it would help to look at how the priv pointer is initialized.
julia
Quoted 13 lines
Thanks
Aishwarya--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170313201511.GA12957%40aishwarya.
For more options, visit https://groups.google.com/d/optout.
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Aishwarya Pant
Hi
I have been looking at the IIO task and came across this function
iio_priv(..). It is defined as-static inline void *iio_priv(const struct
iio_dev*indio_dev) {
return (char *)indio_dev +ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
}
Quoted 6 lines
Quoted 4 lines
It returns a void pointer and used as struct
dev_state=iio_priv(indio_dev). Looks like it is used to store an iio device state private to the file.Could someone help me understand what exactly is happening inside here?
Probably it would help to look at how the priv pointer is initialized.
Looking at how iio_dev is defined helped :)
struct iio_dev indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip))
Quoted 16 lines
julia
Quoted 13 lines
Thanks
Aishwarya--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170313201511.GA12957%40aishwarya.
For more options, visit https://groups.google.com/d/optout.