On Thursday 17 March 2011 22:00:23 Jonathan Cameron wrote: > @@ -264,10 +264,25 @@ static inline void *iio_dev_get_devdata(struct iio_dev *d) > return d->dev_data; > } > > + > +/* Can we make this smaller? */ > +#define IIO_ALIGN L1_CACHE_BYTES > /** > * iio_allocate_device() - allocate an iio_dev from a driver > + * @sizeof_priv: Space to allocate for private structure. > **/ > -struct iio_dev *iio_allocate_device(void); > +struct iio_dev *iio_allocate_device(int sizeof_priv); > + > +static inline void *iio_priv(const struct iio_dev *dev) > +{ > + return (char *)dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN); > +} > + > +static inline struct iio_dev *iio_priv_to_dev(void *priv) > +{ > + return (struct iio_dev *)((char *)priv - > + ALIGN(sizeof(struct iio_dev), IIO_ALIGN)); > +} > > /** > * iio_free_device() - free an iio_dev from a driver I was actually thinking you'd just assign iio_dev->dev_data to the private data, but this works, too. Acked-by: Arnd Bergmann <arnd@xxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html