linux-remoteproc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arun Kumar Neelakantam <aneela@codeaurora.org>
Cc: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org,
	sricharan@codeaurora.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4 3/4] rpmsg: char: Add TIOCMGET/TIOCMSET ioctl support
Date: Tue, 19 May 2020 16:33:54 -0600	[thread overview]
Message-ID: <20200519223354.GC26832@xps15> (raw)
In-Reply-To: <1589346671-15226-4-git-send-email-aneela@codeaurora.org>

On Wed, May 13, 2020 at 10:41:10AM +0530, Arun Kumar Neelakantam wrote:
> Add TICOMGET and TIOCMSET ioctl support for rpmsg char device nodes

s/TICOMGET/TIOCMGET

> to get/set the low level transport signals.
> 
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
> ---
>  drivers/rpmsg/rpmsg_char.c | 53 +++++++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 50 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
> index 4bbbacd..e2f92f3 100644
> --- a/drivers/rpmsg/rpmsg_char.c
> +++ b/drivers/rpmsg/rpmsg_char.c
> @@ -1,5 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> + * Copyright (c) 2018, The Linux Foundation.
>   * Copyright (c) 2016, Linaro Ltd.
>   * Copyright (c) 2012, Michal Simek <monstr@monstr.eu>
>   * Copyright (c) 2012, PetaLogix
> @@ -19,6 +20,7 @@
>  #include <linux/rpmsg.h>
>  #include <linux/skbuff.h>
>  #include <linux/slab.h>
> +#include <linux/termios.h>
>  #include <linux/uaccess.h>
>  #include <uapi/linux/rpmsg.h>
>  
> @@ -269,15 +271,60 @@ static __poll_t rpmsg_eptdev_poll(struct file *filp, poll_table *wait)
>  	return mask;
>  }
>  
> +static int rpmsg_eptdev_tiocmset(struct file *fp, unsigned int cmd,
> +				 int __user *arg)
> +{
> +	struct rpmsg_eptdev *eptdev = fp->private_data;
> +	u32 set, clear, val;
> +	int ret;
> +
> +	ret = get_user(val, arg);
> +	if (ret)
> +		return ret;
> +	set = clear = 0;
> +	switch (cmd) {
> +	case TIOCMBIS:
> +		set = val;
> +		break;
> +	case TIOCMBIC:
> +		clear = val;
> +		break;
> +	case TIOCMSET:
> +		set = val;
> +		clear = ~val;
> +		break;
> +	}
> +
> +	set &= TIOCM_DTR | TIOCM_RTS | TIOCM_CD | TIOCM_RI;
> +	clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_CD | TIOCM_RI;
> +
> +	return rpmsg_set_signals(eptdev->ept, set, clear);
> +}
> +
>  static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd,
>  			       unsigned long arg)
>  {
>  	struct rpmsg_eptdev *eptdev = fp->private_data;
> +	int ret;
>  
> -	if (cmd != RPMSG_DESTROY_EPT_IOCTL)
> -		return -EINVAL;
> +	switch (cmd) {
> +	case TIOCMGET:
> +		ret = rpmsg_get_signals(eptdev->ept);
> +		if (ret >= 0)
> +			ret = put_user(ret, (int __user *)arg);
> +		break;
> +	case TIOCMSET:
> +	case TIOCMBIS:
> +	case TIOCMBIC:
> +		ret = rpmsg_eptdev_tiocmset(fp, cmd, (int __user *)arg);
> +		break;
> +	case RPMSG_DESTROY_EPT_IOCTL:
> +		ret = rpmsg_eptdev_destroy(&eptdev->dev, NULL);
> +	default:
> +		ret = -EINVAL;
> +	}
>  
> -	return rpmsg_eptdev_destroy(&eptdev->dev, NULL);
> +	return ret;
>  }
>  
>  static const struct file_operations rpmsg_eptdev_fops = {
> -- 
> 2.7.4

  parent reply	other threads:[~2020-05-19 22:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13  5:11 [RESEND PATCH V4 0/4] Add TIOCM Signals support for RPMSG char devices Arun Kumar Neelakantam
2020-05-13  5:11 ` [PATCH V4 1/4] rpmsg: core: Add signal API support Arun Kumar Neelakantam
2020-05-19 21:58   ` Mathieu Poirier
2020-05-13  5:11 ` [PATCH V4 2/4] rpmsg: glink: Add support to handle signals command Arun Kumar Neelakantam
2020-05-19 22:20   ` Mathieu Poirier
2020-05-13  5:11 ` [PATCH V4 3/4] rpmsg: char: Add TIOCMGET/TIOCMSET ioctl support Arun Kumar Neelakantam
2020-05-13 17:58   ` kbuild test robot
2020-05-19 22:33   ` Mathieu Poirier [this message]
2020-05-13  5:11 ` [PATCH V4 4/4] rpmsg: char: Add signal callback and POLLPRI support Arun Kumar Neelakantam
2020-05-19 22:49 ` [RESEND PATCH V4 0/4] Add TIOCM Signals support for RPMSG char devices Mathieu Poirier
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08  6:38 [PATCH " Arun Kumar Neelakantam
2018-10-08  6:38 ` [PATCH V4 3/4] rpmsg: char: Add TIOCMGET/TIOCMSET ioctl support Arun Kumar Neelakantam

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=20200519223354.GC26832@xps15 \
    --to=mathieu.poirier@linaro.org \
    --cc=aneela@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=clew@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=sricharan@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).