All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Baluta <daniel.baluta@gmail.com>
To: Robert Dolca <robert.dolca@intel.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Denis CIOCCA <denis.ciocca@st.com>
Subject: Re: [PATCH RFC 2/3] iio: Improve iio_trigger_register_with_dev to register trigger after device
Date: Tue, 12 May 2015 16:46:54 +0300	[thread overview]
Message-ID: <CAEnQRZD4g=qoP8sGzW1ZA3nP4M_2wKu=CCDVTZ6vh-2p=fvk3w@mail.gmail.com> (raw)
In-Reply-To: <1429174868-11953-3-git-send-email-robert.dolca@intel.com>

On Thu, Apr 16, 2015 at 12:01 PM, Robert Dolca <robert.dolca@intel.com> wrote:
> Until now calling iio_trigger_register_with_dev after registering the IIO device
> added the trigger to the device's trigger list and saved a reference to the
> device in the trigger's struct but it did not create the symlink.
>
> In order to know if the device was registered or not this patch adds a flag
> in the dev_iio struct and checks it when iio_trigger_register_with_dev is
> called.

I don't think we should care about this. In order for the symlink to be created
the driver should call the right sequence of functions.

>
> Signed-off-by: Robert Dolca <robert.dolca@intel.com>
> ---
>  drivers/iio/industrialio-core.c    | 4 ++++
>  drivers/iio/industrialio-trigger.c | 6 ++++++
>  include/linux/iio/iio.h            | 1 +
>  3 files changed, 11 insertions(+)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 94bcd54..04862a4 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1233,6 +1233,8 @@ int iio_device_register(struct iio_dev *indio_dev)
>                         goto error_cdev_del;
>         }
>
> +       indio_dev->registered = true;
> +
>         return 0;
>  error_cdev_del:
>         cdev_del(&indio_dev->chrdev);
> @@ -1281,6 +1283,8 @@ void iio_device_unregister(struct iio_dev *indio_dev)
>         mutex_unlock(&indio_dev->info_exist_lock);
>
>         iio_buffer_free_sysfs_and_mask(indio_dev);
> +
> +       indio_dev->registered = false;
>  }
>  EXPORT_SYMBOL(iio_device_unregister);
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index cebdd10..d4118fe 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -69,6 +69,12 @@ int iio_trigger_register_with_dev(struct iio_dev *indio_dev,
>         trig_info->indio_dev = indio_dev;
>         list_add(&trig_info->indio_dev_list, &indio_dev->triggers);
>
> +       if (indio_dev->registered) {
> +               ret = iio_trigger_link(trig_info);
> +               if (ret < 0)
> +                       goto error;
> +       }
> +
>         return 0;
>  error:
>         return ret;
> diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> index 9ff54ef..3f704ae 100644
> --- a/include/linux/iio/iio.h
> +++ b/include/linux/iio/iio.h
> @@ -496,6 +496,7 @@ struct iio_dev {
>         unsigned                        cached_reg_addr;
>  #endif
>         struct list_head                triggers;
> +       bool                            registered;
>  };
>
>  const struct iio_chan_spec
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-05-12 13:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16  9:01 [PATCH RFC 0/3] Add IIO trigger symlink in iio:device0/trigger/ Robert Dolca
2015-04-16  9:01 ` [PATCH RFC 1/3] iio: Add symlink to triggers in the device's trigger folder Robert Dolca
2015-05-08 15:11   ` Jonathan Cameron
2015-05-12 16:56     ` Lars-Peter Clausen
2015-05-12 19:06       ` Jonathan Cameron
2015-05-13  7:28         ` Lars-Peter Clausen
2015-05-13 17:42           ` Jonathan Cameron
2015-05-13 18:00             ` Robert Dolca
2015-05-13 18:03             ` Robert Dolca
2015-05-13 18:05               ` Lars-Peter Clausen
2015-05-13 18:09                 ` Lars-Peter Clausen
2015-05-12 13:44   ` Daniel Baluta
2015-04-16  9:01 ` [PATCH RFC 2/3] iio: Improve iio_trigger_register_with_dev to register trigger after device Robert Dolca
2015-05-12 13:46   ` Daniel Baluta [this message]
2015-04-16  9:01 ` [PATCH RFC 3/3] iio: Use with iio_trigger_register_with_dev to register trigger Robert Dolca

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='CAEnQRZD4g=qoP8sGzW1ZA3nP4M_2wKu=CCDVTZ6vh-2p=fvk3w@mail.gmail.com' \
    --to=daniel.baluta@gmail.com \
    --cc=denis.ciocca@st.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robert.dolca@intel.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.