All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aishwarya Pant <aishpant@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [IIO] Help understanding iio_priv(..)
Date: Tue, 14 Mar 2017 03:39:49 +0530	[thread overview]
Message-ID: <20170313220949.GA30622@aishwarya> (raw)
In-Reply-To: <alpine.DEB.2.20.1703141342300.3174@hadrien>

On Tue, Mar 14, 2017 at 01:43:08PM +0100, Julia Lawall wrote:
> 
> 
> On Tue, 14 Mar 2017, Aishwarya Pant wrote:
> 
> > Hi
> >
> > I have been looking at the IIO task and came across this function
> > iio_priv(..). It is defined as-
> >
> >
> > static inline void *iio_priv(const struct iio_dev *indio_dev)
> > {
> >         return (char *)indio_dev + ALIGN(sizeof(struct iio_dev),
> > 	IIO_ALIGN);
> > }
> >
> > It returns a void pointer and used as struct dev_state = iio_priv(indio_dev).
> > Looks like it is used to store an iio device state private to the file.
> >
> > Could someone help me understand what exactly is happening inside here?
> 
> Probably it would help to look at how the priv pointer is initialized.

Looking at how iio_dev is defined helped :)

struct iio_dev indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip))

> 
> julia
> 
> >
> > Thanks
> > Aishwarya
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170313201511.GA12957%40aishwarya.
> > For more options, visit https://groups.google.com/d/optout.
> >


      reply	other threads:[~2017-03-14 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 20:15 [IIO] Help understanding iio_priv(..) Aishwarya Pant
2017-03-14 12:43 ` [Outreachy kernel] " Julia Lawall
2017-03-13 22:09   ` Aishwarya Pant [this message]

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=20170313220949.GA30622@aishwarya \
    --to=aishpant@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=outreachy-kernel@googlegroups.com \
    /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.