From: Lars-Peter Clausen <lars@metafoo.de>
To: Daniel Baluta <daniel.baluta@intel.com>, jic23@kernel.org
Cc: jlbec@evilplan.org, knaack.h@gmx.de,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
octavian.purdila@intel.com, pebolle@tiscali.nl,
patrick.porlan@intel.com, adriana.reus@intel.com,
constantin.musca@intel.com, marten@intuitiveaerial.com
Subject: Re: [PATCH v5 2/4] iio: core: Introduce IIO configfs support
Date: Mon, 04 May 2015 21:59:06 +0200 [thread overview]
Message-ID: <5547CF8A.9060609@metafoo.de> (raw)
In-Reply-To: <1430736604-22119-3-git-send-email-daniel.baluta@intel.com>
On 05/04/2015 12:50 PM, Daniel Baluta wrote:
> This creates an IIO configfs subystem named "iio", with a default "triggers"
> group.
>
> Triggers group is used for handling software triggers. To create a new software
> trigger one must create a directory inside the trigger directory.
>
> Software trigger name MUST follow the following convention:
> * <trigger-type>-<trigger-name>
> Where:
> * <trigger_type>, specifies the interrupt source (e.g: hrtimer)
> * <trigger-name>, specifies the IIO device trigger name
>
> Failing to follow this convention will result in an directory creation error.
>
> E.g, assuming that hrtimer trigger type is registered with IIO software
> trigger core:
>
> $ mkdir /config/iio/triggers/hrtimer-instance1
>
Nice, short and clean. Looks pretty good. It's a bit of a shame that we
can't have a per type directory, but if that's how configfs works I guess
there is not much choice.
[...]
> +static struct config_group *trigger_make_group(struct config_group *group,
> + const char *name)
> +{
> + char *type_name;
> + char *trigger_name;
> + char buf[MAX_NAME_LEN];
> + struct iio_sw_trigger *t;
> +
> + snprintf(buf, MAX_NAME_LEN, "%s", name);
> +
> + /* group name should have the form <trigger-type>-<trigger-name> */
> + type_name = buf;
> + trigger_name = strchr(buf, '-');
> + if (!trigger_name) {
> + pr_err("Unable to locate '-' in %s. Use <type>-<name>.\n", buf);
Do we want to print this side channel message? Makes it pretty easy to spam
the kernel log with a rouge application.
> + return ERR_PTR(-EINVAL);
> + }
> +
> + /* replace - with \0, this nicely separates the two strings */
> + *trigger_name = '\0';
> + trigger_name++;
> +
> + t = iio_sw_trigger_create(type_name, trigger_name);
> + if (IS_ERR(t))
> + return ERR_CAST(t);
> +
> + config_item_set_name(&t->group.cg_item, name);
> +
> + return &t->group;
> +}
> +
> +static void trigger_drop_group(struct config_group *group,
> + struct config_item *item)
> +{
> + struct iio_sw_trigger *t = to_iio_sw_trigger(item);
> +
> + if (t)
t will never be NULL.
> + iio_sw_trigger_destroy(t);
> + config_item_put(item);
> +}
next prev parent reply other threads:[~2015-05-04 19:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 10:50 [PATCH v5 0/4] Add initial configfs support for IIO Daniel Baluta
2015-05-04 10:50 ` [PATCH v5 1/4] iio: core: Introduce IIO software triggers Daniel Baluta
2015-05-04 20:11 ` Lars-Peter Clausen
2015-05-06 9:24 ` Daniel Baluta
2015-05-04 10:50 ` [PATCH v5 2/4] iio: core: Introduce IIO configfs support Daniel Baluta
2015-05-04 19:59 ` Lars-Peter Clausen [this message]
2015-05-05 13:48 ` Jonathan Cameron
2015-05-06 16:15 ` Daniel Baluta
2015-05-04 10:50 ` [PATCH v5 3/4] iio: trigger: Introduce IIO hrtimer based trigger Daniel Baluta
2015-05-04 19:54 ` Lars-Peter Clausen
2015-05-05 13:51 ` Jonathan Cameron
2015-05-06 16:25 ` Daniel Baluta
2015-05-06 17:16 ` Jonathan Cameron
2015-05-06 17:37 ` Daniel Baluta
2015-05-07 9:19 ` Jonathan Cameron
2015-05-07 10:26 ` Daniel Baluta
2015-05-07 18:26 ` Lars-Peter Clausen
2015-05-04 10:50 ` [PATCH v5 4/4] iio: Documentation: Add IIO configfs documentation Daniel Baluta
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=5547CF8A.9060609@metafoo.de \
--to=lars@metafoo.de \
--cc=adriana.reus@intel.com \
--cc=constantin.musca@intel.com \
--cc=daniel.baluta@intel.com \
--cc=jic23@kernel.org \
--cc=jlbec@evilplan.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marten@intuitiveaerial.com \
--cc=octavian.purdila@intel.com \
--cc=patrick.porlan@intel.com \
--cc=pebolle@tiscali.nl \
/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.