Commit 4de87f45 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: position: iqs624: remove usage of iio_priv_to_dev()

We may want to get rid of the iio_priv_to_dev() helper. That's a bit
uncertain at this point. The reason is that we will hide some of the
members of the iio_dev structure (to prevent drivers from accessing them
directly), and that will also mean hiding the implementation of the
iio_priv_to_dev() helper inside the IIO core.

Hiding the implementation of iio_priv_to_dev() implies that some fast-paths
may not be fast anymore, so a general idea is to try to get rid of the
iio_priv_to_dev() altogether.

For this driver, removing iio_priv_to_dev() also means keeping a reference
on the state struct.
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: default avatarJeff LaBundy <jeff@labundy.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6dc85564
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
struct iqs624_pos_private { struct iqs624_pos_private {
struct iqs62x_core *iqs62x; struct iqs62x_core *iqs62x;
struct iio_dev *indio_dev;
struct notifier_block notifier; struct notifier_block notifier;
struct mutex lock; struct mutex lock;
bool angle_en; bool angle_en;
...@@ -59,7 +60,7 @@ static int iqs624_pos_notifier(struct notifier_block *notifier, ...@@ -59,7 +60,7 @@ static int iqs624_pos_notifier(struct notifier_block *notifier,
iqs624_pos = container_of(notifier, struct iqs624_pos_private, iqs624_pos = container_of(notifier, struct iqs624_pos_private,
notifier); notifier);
indio_dev = iio_priv_to_dev(iqs624_pos); indio_dev = iqs624_pos->indio_dev;
timestamp = iio_get_time_ns(indio_dev); timestamp = iio_get_time_ns(indio_dev);
iqs62x = iqs624_pos->iqs62x; iqs62x = iqs624_pos->iqs62x;
...@@ -98,7 +99,7 @@ static int iqs624_pos_notifier(struct notifier_block *notifier, ...@@ -98,7 +99,7 @@ static int iqs624_pos_notifier(struct notifier_block *notifier,
static void iqs624_pos_notifier_unregister(void *context) static void iqs624_pos_notifier_unregister(void *context)
{ {
struct iqs624_pos_private *iqs624_pos = context; struct iqs624_pos_private *iqs624_pos = context;
struct iio_dev *indio_dev = iio_priv_to_dev(iqs624_pos); struct iio_dev *indio_dev = iqs624_pos->indio_dev;
int ret; int ret;
ret = blocking_notifier_chain_unregister(&iqs624_pos->iqs62x->nh, ret = blocking_notifier_chain_unregister(&iqs624_pos->iqs62x->nh,
...@@ -243,6 +244,7 @@ static int iqs624_pos_probe(struct platform_device *pdev) ...@@ -243,6 +244,7 @@ static int iqs624_pos_probe(struct platform_device *pdev)
iqs624_pos = iio_priv(indio_dev); iqs624_pos = iio_priv(indio_dev);
iqs624_pos->iqs62x = iqs62x; iqs624_pos->iqs62x = iqs62x;
iqs624_pos->indio_dev = indio_dev;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->dev.parent = &pdev->dev; indio_dev->dev.parent = &pdev->dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment