diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-05-10 14:10:14 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-05-10 14:10:14 +1000 |
commit | 2f03c554a1682a4d6268ef9cd63da592fe6f21b9 (patch) | |
tree | 11adc3f7fd144488fccc1f228ea02b9a27ccb99f /drivers/staging/iio/industrialio-core.c | |
parent | 78b22b0fa73a440375f71d2717b60f2e943ef3c9 (diff) | |
parent | dc762c4f8514f23094927e0a62ef305d90651535 (diff) |
Merge remote-tracking branch 'staging/staging-next'
Conflicts:
drivers/staging/rt2860/common/cmm_data_pci.c
drivers/staging/rt2860/common/cmm_data_usb.c
Diffstat (limited to 'drivers/staging/iio/industrialio-core.c')
-rw-r--r-- | drivers/staging/iio/industrialio-core.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/staging/iio/industrialio-core.c b/drivers/staging/iio/industrialio-core.c index 1795ee1e8207..3a824146455e 100644 --- a/drivers/staging/iio/industrialio-core.c +++ b/drivers/staging/iio/industrialio-core.c @@ -720,9 +720,20 @@ static struct device_type iio_dev_type = { .release = iio_dev_release, }; -struct iio_dev *iio_allocate_device(void) +struct iio_dev *iio_allocate_device(int sizeof_priv) { - struct iio_dev *dev = kzalloc(sizeof *dev, GFP_KERNEL); + struct iio_dev *dev; + size_t alloc_size; + + alloc_size = sizeof(struct iio_dev); + if (sizeof_priv) { + alloc_size = ALIGN(alloc_size, IIO_ALIGN); + alloc_size += sizeof_priv; + } + /* ensure 32-byte alignment of whole construct ? */ + alloc_size += IIO_ALIGN - 1; + + dev = kzalloc(alloc_size, GFP_KERNEL); if (dev) { dev->dev.type = &iio_dev_type; |