From: Christian Riesch <christian.riesch@omicron.at>
To: Richard Cochran <richardcochran@gmail.com>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Ben Hutchings" <bhutchings@solarflare.com>,
"David Miller" <davem@davemloft.net>,
"Stefan Sørensen" <stefan.sorensen@spectralink.com>
Subject: Re: [PATCH RFC net-next v1 1/9] ptp: introduce programmable pins.
Date: Tue, 11 Mar 2014 08:58:45 +0100 [thread overview]
Message-ID: <F85F72BA1EE25F8F7FB77295@[172.22.2.41]> (raw)
In-Reply-To: <d9cb37a7d6e57d7f103dab78f98044697d3c4433.1394307304.git.richardcochran@gmail.com>
Hi Richard,
--On March 08, 2014 20:42 +0100 Richard Cochran <richardcochran@gmail.com>
wrote:
> This patch adds a pair of new ioctls to the PTP Hardware Clock device
> interface. Using the ioctls, user space programs can query each pin to
> find out its current function and also reprogram a different function
> if desired.
>
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
> ---
> drivers/ptp/ptp_chardev.c | 133
> +++++++++++++++++++++++++++++++++++++- drivers/ptp/ptp_clock.c
> | 23 +++++++
> drivers/ptp/ptp_private.h | 4 ++
> include/linux/ptp_clock_kernel.h | 33 ++++++++++
> include/uapi/linux/ptp_clock.h | 39 ++++++++++-
> 5 files changed, 230 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 34a0c60..dc13d1e 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
[...]
> +int ptp_setpin(struct ptp_clock *ptp, unsigned int pin,
> + enum ptp_pin_function func, unsigned int chan)
> +{
> + struct ptp_clock_info *info = ptp->info;
> + struct ptp_pin_desc *pin1 = NULL, *pin2 = &info->pin_config[pin];
> + unsigned int i;
> +
> + /* Check to see if any other pin previously had this function. */
> + if (mutex_lock_interruptible(&ptp->pincfg_mux))
> + return -ERESTARTSYS;
> + for (i = 0; i < info->n_pins; i++) {
> + if (info->pin_config[i].func == func &&
> + info->pin_config[i].chan == chan) {
> + pin1 = &info->pin_config[i];
> + break;
> + }
> + }
> + mutex_unlock(&ptp->pincfg_mux);
> + if (pin1 && i == pin)
> + return 0;
> +
> + /* Check the desired function and channel. */
> + switch (func) {
> + case PTP_PF_NONE:
> + break;
> + case PTP_PF_EXTTS:
> + if (chan >= info->n_ext_ts)
> + return -EINVAL;
> + break;
> + case PTP_PF_PEROUT:
> + if (chan >= info->n_per_out)
> + return -EINVAL;
> + break;
> + case PTP_PF_PHYSYNC:
> + pr_err("sorry, cannot reassign the calibration pin\n");
> + return -EINVAL;
> + default:
> + return -EINVAL;
> + }
> +
> + if (pin1 && pin1->func == PTP_PF_PHYSYNC) {
> + pr_err("sorry, cannot reprogram the calibration pin\n");
> + return -EINVAL;
^^^^
Will this ever happen? pin1 && pin1->func == PTP_PF_PHYSYNC means that func
== PTP_PF_PHYSYNC, but in this case you already return -EINVAL a few lines
above.
Christian
next prev parent reply other threads:[~2014-03-11 7:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-08 19:42 [PATCH RFC net-next v1 0/9] ptp: dynamic pin control Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 1/9] ptp: introduce programmable pins Richard Cochran
2014-03-10 12:53 ` Sørensen, Stefan
2014-03-10 13:32 ` Richard Cochran
2014-03-11 7:58 ` Christian Riesch [this message]
2014-03-11 10:08 ` Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 2/9] ptp: add the pin GET/SETFUNC ioctls to the testptp program Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 3/9] ptp: expose the programmable pins via sysfs Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 4/9] ptp: drivers: set the number of programmable pins Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 5/9] dp83640: trivial fixes Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 6/9] dp83640: correct the periodic output frequency Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 7/9] dp83640: implement programmable pin functions Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 8/9] dp83640: let external input pins from the module parameters be defaults Richard Cochran
2014-03-08 19:42 ` [PATCH RFC net-next v1 9/9] dp83640: let the periodic pin from the module parameter be a default Richard Cochran
2014-03-10 12:52 ` [PATCH RFC net-next v1 0/9] ptp: dynamic pin control Sørensen, Stefan
2014-03-10 13:42 ` Richard Cochran
2014-03-12 6:58 ` Christian Riesch
2014-03-12 14:22 ` Richard Cochran
2014-03-10 14:05 ` Richard Cochran
2014-03-12 8:21 ` Christian Riesch
2014-03-12 14:46 ` Richard Cochran
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='F85F72BA1EE25F8F7FB77295@[172.22.2.41]' \
--to=christian.riesch@omicron.at \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=stefan.sorensen@spectralink.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®