Commit 3dba81ba authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:max1363 take advantage of new iio_device_allocate private data.

The only fiddly bit in here was ensuring the regulator was available until after
the free had occured.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b6b7068c
......@@ -174,7 +174,6 @@ struct max1363_chip_info {
/**
* struct max1363_state - driver instance specific data
* @indio_dev: the industrial I/O device
* @client: i2c_client
* @setupbyte: cache of current device setup byte
* @configbyte: cache of current device config byte
......@@ -194,7 +193,6 @@ struct max1363_chip_info {
* @thresh_work: bh work structure for event handling
*/
struct max1363_state {
struct iio_dev *indio_dev;
struct i2c_client *client;
u8 setupbyte;
u8 configbyte;
......
This diff is collapsed.
......@@ -27,10 +27,9 @@
#include "max1363.h"
/* Todo: test this */
int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
{
struct iio_ring_buffer *ring = st->indio_dev->ring;
struct iio_ring_buffer *ring = iio_priv_to_dev(st)->ring;
int count = 0, ret;
u8 *ring_data;
if (!(st->current_mode->modemask & mask)) {
......@@ -74,7 +73,7 @@ int max1363_single_channel_from_ring(long mask, struct max1363_state *st)
**/
static int max1363_ring_preenable(struct iio_dev *indio_dev)
{
struct max1363_state *st = indio_dev->dev_data;
struct max1363_state *st = iio_priv(indio_dev);
struct iio_ring_buffer *ring = indio_dev->ring;
size_t d_size = 0;
unsigned long numvals;
......@@ -116,7 +115,7 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev)
**/
static void max1363_poll_func_th(struct iio_dev *indio_dev, s64 time)
{
struct max1363_state *st = indio_dev->dev_data;
struct max1363_state *st = iio_priv(indio_dev);
schedule_work(&st->poll_work);
......@@ -135,7 +134,7 @@ static void max1363_poll_bh_to_ring(struct work_struct *work_s)
{
struct max1363_state *st = container_of(work_s, struct max1363_state,
poll_work);
struct iio_dev *indio_dev = st->indio_dev;
struct iio_dev *indio_dev = iio_priv_to_dev(st);
struct iio_sw_ring_buffer *sw_ring = iio_to_sw_ring(indio_dev->ring);
s64 time_ns;
__u8 *rxbuf;
......@@ -185,7 +184,7 @@ static void max1363_poll_bh_to_ring(struct work_struct *work_s)
int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
{
struct max1363_state *st = indio_dev->dev_data;
struct max1363_state *st = iio_priv(indio_dev);
int ret = 0;
indio_dev->ring = iio_sw_rb_allocate(indio_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