All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 4/8] staging:iio: Add ability to allocate private data space to iio_allocate_device
Date: Thu, 17 Mar 2011 23:08:08 +0100	[thread overview]
Message-ID: <201103172308.08151.arnd@arndb.de> (raw)
In-Reply-To: <1300395627-18547-5-git-send-email-jic23@cam.ac.uk>

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@arndb.de>

  reply	other threads:[~2011-03-17 22:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17 21:00 [PATCH 0/8] staging:iio:mixed bag of fixes and cleanups Jonathan Cameron
2011-03-17 21:00 ` [PATCH 1/8] staging:iio:trigger remove export of iio_trigger_find_by_name, use sysfs_streq for matching Jonathan Cameron
2011-03-17 21:00 ` [PATCH 2/8] staging:iio: iio_trigger_unregister - remove rather strange search for what we already have Jonathan Cameron
2011-03-17 21:00 ` [PATCH 3/8] staging:iio: replace rip_lots naming with read_first_n Jonathan Cameron
2011-03-17 21:00 ` [PATCH 4/8] staging:iio: Add ability to allocate private data space to iio_allocate_device Jonathan Cameron
2011-03-17 22:08   ` Arnd Bergmann [this message]
2011-03-17 21:00 ` [PATCH 5/8] staging:iio:adc:max1363 fix timestamp handling Jonathan Cameron
2011-03-17 21:00 ` [PATCH 6/8] staging:iio:adc: max1363 dev_info -> indio_dev in naming for consistency Jonathan Cameron
2011-03-17 21:00 ` [PATCH 7/8] staging:iio:max1363 take advantage of new iio_device_allocate private data Jonathan Cameron
2011-03-17 21:00 ` [PATCH 8/8] staging:iio:documentation make read_size signed to allow for errors Jonathan Cameron
2011-04-12 18:37 ` [PATCH 0/8] staging:iio:mixed bag of fixes and cleanups Jonathan Cameron
2011-04-15 17:02 ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2011-04-15 17:55 [PATCH 0/8 V2] Jonathan Cameron
2011-04-15 17:55 ` [PATCH 4/8] staging:iio: Add ability to allocate private data space to iio_allocate_device Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201103172308.08151.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.