linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@snapgear.com>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [2/3]
Date: Mon, 19 Jan 2004 09:23:27 +1000	[thread overview]
Message-ID: <400B156F.3050508@snapgear.com> (raw)
In-Reply-To: <20040118154223.F19593@flint.arm.linux.org.uk>

Hi Russel,

Russell King wrote:
> On Sun, Jan 18, 2004 at 10:43:01PM +1000, Greg Ungerer wrote:
>>Looks good for mcfserial.c. The only additional change I would
>>make is to remove the "rts", "dtr", and "val" variables from the
>>ioctl function - removing the TIOCM* cases means these variables
>>are no longer used.
> 
> 
> I agree for "rts" and "dtr", however "val" is still used - in
> TIOC[SG]ET422.  Here's a new patch for mcfserial.c

Oops, your right. This new patch looks good.

Regards
Greg



> ===== drivers/serial/mcfserial.c 1.17 vs edited =====
> --- 1.17/drivers/serial/mcfserial.c	Thu Jul  3 02:18:07 2003
> +++ edited/drivers/serial/mcfserial.c	Sun Jan 18 15:40:39 2004
> @@ -985,13 +985,49 @@
>  	local_irq_restore(flags);
>  }
>  
> +static int mcfrs_tiocmget(struct tty_struct *tty, struct file *file)
> +{
> +	struct mcf_serial * info = (struct mcf_serial *)tty->driver_data;
> +
> +	if (serial_paranoia_check(info, tty->name, __FUNCTION__))
> +		return -ENODEV;
> +	if (tty->flags & (1 << TTY_IO_ERROR))
> +		return -EIO;
> +
> +	return mcfrs_getsignals(info);
> +}
> +
> +static int mcfrs_tiocmset(struct tty_struct *tty, struct file *file,
> +			  unsigned int set, unsigned int clear)
> +{
> +	struct mcf_serial * info = (struct mcf_serial *)tty->driver_data;
> +	int rts = -1, dtr = -1;
> +
> +	if (serial_paranoia_check(info, tty->name, __FUNCTION__))
> +		return -ENODEV;
> +	if (tty->flags & (1 << TTY_IO_ERROR))
> +		return -EIO;
> +
> +	if (set & TIOCM_RTS)
> +		rts = 1;
> +	if (set & TIOCM_DTR)
> +		dtr = 1;
> +	if (clear & TIOCM_RTS)
> +		rts = 0;
> +	if (clear & TIOCM_DTR)
> +		dtr = 0;
> +
> +	mcfrs_setsignals(info, dtr, rts);
> +
> +	return 0;
> +}
> +
>  static int mcfrs_ioctl(struct tty_struct *tty, struct file * file,
>  		    unsigned int cmd, unsigned long arg)
>  {
>  	struct mcf_serial * info = (struct mcf_serial *)tty->driver_data;
>  	unsigned int val;
>  	int retval, error;
> -	int dtr, rts;
>  
>  	if (serial_paranoia_check(info, tty->name, "mcfrs_ioctl"))
>  		return -ENODEV;
> @@ -1059,45 +1095,6 @@
>  				    info, sizeof(struct mcf_serial));
>  			return 0;
>  			
> -		case TIOCMGET:
> -			if ((error = verify_area(VERIFY_WRITE, (void *) arg,
> -                            sizeof(unsigned int))))
> -                                return(error);
> -			val = mcfrs_getsignals(info);
> -			put_user(val, (unsigned int *) arg);
> -			break;
> -
> -                case TIOCMBIS:
> -			if ((error = verify_area(VERIFY_WRITE, (void *) arg,
> -                            sizeof(unsigned int))))
> -				return(error);
> -
> -			get_user(val, (unsigned int *) arg);
> -			rts = (val & TIOCM_RTS) ? 1 : -1;
> -			dtr = (val & TIOCM_DTR) ? 1 : -1;
> -			mcfrs_setsignals(info, dtr, rts);
> -			break;
> -
> -                case TIOCMBIC:
> -			if ((error = verify_area(VERIFY_WRITE, (void *) arg,
> -                            sizeof(unsigned int))))
> -				return(error);
> -			get_user(val, (unsigned int *) arg);
> -			rts = (val & TIOCM_RTS) ? 0 : -1;
> -			dtr = (val & TIOCM_DTR) ? 0 : -1;
> -			mcfrs_setsignals(info, dtr, rts);
> -			break;
> -
> -                case TIOCMSET:
> -			if ((error = verify_area(VERIFY_WRITE, (void *) arg,
> -                            sizeof(unsigned int))))
> -				return(error);
> -			get_user(val, (unsigned int *) arg);
> -			rts = (val & TIOCM_RTS) ? 1 : 0;
> -			dtr = (val & TIOCM_DTR) ? 1 : 0;
> -			mcfrs_setsignals(info, dtr, rts);
> -			break;
> -
>  #ifdef TIOCSET422
>  		case TIOCSET422:
>  			get_user(val, (unsigned int *) arg);
> @@ -1563,6 +1560,8 @@
>  	.start = mcfrs_start,
>  	.hangup = mcfrs_hangup,
>  	.read_proc = mcfrs_readproc,
> +	.tiocmget = mcfrs_tiocmget,
> +	.tiocmset = mcfrs_tiocmset,
>  };
>  
>  /* mcfrs_init inits the driver */
> 
> 

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg@snapgear.com
SnapGear -- a CyberGuard Company            PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com


  reply	other threads:[~2004-01-18 23:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-13 11:00 [PROBLEM] ircomm ioctls Jozef Vesely
2004-01-13 11:36 ` Russell King
2004-01-13 11:49   ` Outstanding fixups (was: Re: [PROBLEM] ircomm ioctls) Russell King
2004-01-13 17:15     ` Russell King
2004-01-13 17:24       ` [1/3] Serial fixups (mostly tested) Russell King
2004-01-24  6:16         ` [lkml] pseudo tty / kernel compile question Karl Tatgenhorst
2004-01-25 21:53           ` David Woodhouse
2004-01-13 17:33       ` [2/3] Russell King
2004-01-13 17:55         ` [2/3] Henrique Oliveira
2004-01-13 18:53           ` [2/3] John Stoffel
2004-01-13 22:15         ` [2/3] Paul Mackerras
2004-01-14  7:01           ` [2/3] Benjamin Herrenschmidt
2004-01-16 11:34             ` [2/3] Matthias Urlichs
2004-01-16  0:54         ` [2/3] Greg KH
2004-01-18 12:43         ` [2/3] Greg Ungerer
2004-01-18 15:42           ` [2/3] Russell King
2004-01-18 23:23             ` Greg Ungerer [this message]
2004-01-13 17:42       ` [3/3] 2.6 broken serial drivers Russell King
2004-01-13 20:21         ` Andrew Morton
2004-01-13 21:10           ` Russell King
2004-01-18 16:16             ` Russell King
2004-01-14 12:42         ` Maciej W. Rozycki

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=400B156F.3050508@snapgear.com \
    --to=gerg@snapgear.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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).