Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259625
b: refs/heads/master
c: 3e77258
h: refs/heads/master
i:
  259623: 0c7b537
v: v3
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Jun 28, 2011
1 parent 73fc301 commit 2c2eac8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb565f132bd43924c053abb8b15e8d6e57606c0c
refs/heads/master: 3e772581c282cd5e0685b4179602067404953537
36 changes: 13 additions & 23 deletions trunk/drivers/staging/iio/dds/ad9951.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ struct ad9951_config {

struct ad9951_state {
struct mutex lock;
struct iio_dev *idev;
struct spi_device *sdev;
};

Expand All @@ -65,7 +64,7 @@ static ssize_t ad9951_set_parameter(struct device *dev,
int ret;
struct ad9951_config *config = (struct ad9951_config *)buf;
struct iio_dev *idev = dev_get_drvdata(dev);
struct ad9951_state *st = idev->dev_data;
struct ad9951_state *st = iio_priv(idev);

xfer.len = 3;
xfer.tx_buf = &config->asf[0];
Expand Down Expand Up @@ -174,30 +173,25 @@ static const struct iio_info ad9951_info = {
static int __devinit ad9951_probe(struct spi_device *spi)
{
struct ad9951_state *st;
struct iio_dev *idev;
int ret = 0;

st = kzalloc(sizeof(*st), GFP_KERNEL);
if (st == NULL) {
idev = iio_allocate_device(sizeof(*st));
if (idev == NULL) {
ret = -ENOMEM;
goto error_ret;
}
spi_set_drvdata(spi, st);

spi_set_drvdata(spi, idev);
st = iio_priv(idev);
mutex_init(&st->lock);
st->sdev = spi;

st->idev = iio_allocate_device(0);
if (st->idev == NULL) {
ret = -ENOMEM;
goto error_free_st;
}
st->idev->dev.parent = &spi->dev;
idev->dev.parent = &spi->dev;

st->idev->info = &ad9951_info;
st->idev->dev_data = (void *)(st);
st->idev->modes = INDIO_DIRECT_MODE;
idev->info = &ad9951_info;
idev->modes = INDIO_DIRECT_MODE;

ret = iio_device_register(st->idev);
ret = iio_device_register(idev);
if (ret)
goto error_free_dev;
spi->max_speed_hz = 2000000;
Expand All @@ -208,19 +202,15 @@ static int __devinit ad9951_probe(struct spi_device *spi)
return 0;

error_free_dev:
iio_free_device(st->idev);
error_free_st:
kfree(st);
iio_free_device(idev);

error_ret:
return ret;
}

static int __devexit ad9951_remove(struct spi_device *spi)
{
struct ad9951_state *st = spi_get_drvdata(spi);

iio_device_unregister(st->idev);
kfree(st);
iio_device_unregister(spi_get_drvdata(spi));

return 0;
}
Expand Down

0 comments on commit 2c2eac8

Please sign in to comment.