diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 23:26:34 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-25 23:26:34 -0700 |
commit | 138051659902da7e6a09d379fee5dade2a80fcfd (patch) | |
tree | e0a90e27451b1fcd812675092d30c1059369cb87 /drivers/staging/iio/gyro/adis16080_core.c | |
parent | d5ef642355bdd9b383ff5c18cbc6102a06eecbaf (diff) | |
parent | e1703b329f7c7ea82ea181dc4c50020f25061a2c (diff) |
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (741 commits)
staging:iio:meter:ade7753 should be 16 bit read not 8 bit for mode register.
staging:iio:kfifo_buf fix double initialization of the ring device structure.
staging:iio:accel:lis3l02dq: fix incorrect pointer passed to spi_set_drvdata.
staging:iio:imu fix missing register table index for some channels
spectra: enable device before poking it
staging: rts_pstor: Fix a miswriting
staging/lirc_bt829: Return -ENODEV when no hardware is found.
staging/lirc_parallel: remove pointless prototypes.
staging/lirc_parallel: fix panic on rmmod
staging:iio:adc:ad7476: Incorrect pointer into spi_set_drvdata.
Staging: zram: Fix kunmapping order
Revert "gma500: Fix dependencies"
gma500: Add medfield header
gma500: wire up the mrst i2c bus from chip_info
gma500: Fix DPU build
gma500: Clean up the DPU config and make it runtime
gma500: resync with Medfield progress
gma500: Use the mrst helpers and power control for mode commit
gma500@ Fix backlight range error
gma500: More Moorestown muddle meddling means MM maybe might modeset
...
Fix up fairly trivial conflicts all over, mostly due to header file
cleanup conflicts, but some deleted files and some just context changes:
- Documentation/feature-removal-schedule.txt
- drivers/staging/bcm/headers.h
- drivers/staging/brcm80211/brcmfmac/dhd_linux.c
- drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
- drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
- drivers/staging/brcm80211/brcmfmac/wl_iw.c
- drivers/staging/et131x/et131x_netdev.c
- drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
- drivers/staging/rtl8192e/r8192E.h
- drivers/staging/usbip/userspace/src/utils.h
Diffstat (limited to 'drivers/staging/iio/gyro/adis16080_core.c')
-rw-r--r-- | drivers/staging/iio/gyro/adis16080_core.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c index d42690bea066..ad2db4d723df 100644 --- a/drivers/staging/iio/gyro/adis16080_core.c +++ b/drivers/staging/iio/gyro/adis16080_core.c @@ -34,13 +34,11 @@ /** * struct adis16080_state - device instance specific data * @us: actual spi_device to write data - * @indio_dev: industrial I/O device structure * @buf: transmit or receive buffer * @buf_lock: mutex to protect tx and rx **/ struct adis16080_state { struct spi_device *us; - struct iio_dev *indio_dev; struct mutex buf_lock; u8 buf[2] ____cacheline_aligned; @@ -51,7 +49,7 @@ static int adis16080_spi_write(struct device *dev, { int ret; struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct adis16080_state *st = iio_dev_get_devdata(indio_dev); + struct adis16080_state *st = iio_priv(indio_dev); mutex_lock(&st->buf_lock); st->buf[0] = val >> 8; @@ -68,7 +66,7 @@ static int adis16080_spi_read(struct device *dev, { int ret; struct iio_dev *indio_dev = dev_get_drvdata(dev); - struct adis16080_state *st = iio_dev_get_devdata(indio_dev); + struct adis16080_state *st = iio_priv(indio_dev); mutex_lock(&st->buf_lock); @@ -131,31 +129,29 @@ static const struct iio_info adis16080_info = { static int __devinit adis16080_probe(struct spi_device *spi) { int ret, regdone = 0; - struct adis16080_state *st = kzalloc(sizeof *st, GFP_KERNEL); - if (!st) { - ret = -ENOMEM; + struct adis16080_state *st; + struct iio_dev *indio_dev; + + /* setup the industrialio driver allocated elements */ + indio_dev = iio_allocate_device(sizeof(*st)); + if (indio_dev == NULL) { + ret = -ENOMEM; goto error_ret; } + st = iio_priv(indio_dev); /* this is only used for removal purposes */ - spi_set_drvdata(spi, st); + spi_set_drvdata(spi, indio_dev); /* Allocate the comms buffers */ st->us = spi; mutex_init(&st->buf_lock); - /* setup the industrialio driver allocated elements */ - st->indio_dev = iio_allocate_device(0); - if (st->indio_dev == NULL) { - ret = -ENOMEM; - goto error_free_st; - } - st->indio_dev->name = spi->dev.driver->name; - st->indio_dev->dev.parent = &spi->dev; - st->indio_dev->info = &adis16080_info; - st->indio_dev->dev_data = (void *)(st); - st->indio_dev->modes = INDIO_DIRECT_MODE; + indio_dev->name = spi->dev.driver->name; + indio_dev->dev.parent = &spi->dev; + indio_dev->info = &adis16080_info; + indio_dev->modes = INDIO_DIRECT_MODE; - ret = iio_device_register(st->indio_dev); + ret = iio_device_register(indio_dev); if (ret) goto error_free_dev; regdone = 1; @@ -164,11 +160,9 @@ static int __devinit adis16080_probe(struct spi_device *spi) error_free_dev: if (regdone) - iio_device_unregister(st->indio_dev); + iio_device_unregister(indio_dev); else - iio_free_device(st->indio_dev); -error_free_st: - kfree(st); + iio_free_device(indio_dev); error_ret: return ret; } @@ -176,11 +170,7 @@ error_ret: /* fixme, confirm ordering in this function */ static int adis16080_remove(struct spi_device *spi) { - struct adis16080_state *st = spi_get_drvdata(spi); - struct iio_dev *indio_dev = st->indio_dev; - - iio_device_unregister(indio_dev); - kfree(st); + iio_device_unregister(spi_get_drvdata(spi)); return 0; } |