mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>, Alan Cox <alan@linux.intel.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Murali Karicheri <m-karicheri2@ti.com>,
	Jingoo Han <jg1.han@samsung.com>,
	Michael Welling <mwelling@ieee.org>,
	Peter Hurley <peter@hurleysoftware.com>,
	Joe Schultz <jschultz@xes-inc.com>, Ingo Molnar <mingo@elte.hu>,
	Doug Anderson <dianders@chromium.org>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] serial/8250: Add support for RS485 IOCTLs
Date: Thu, 31 Jul 2014 15:07:53 +0100	[thread overview]
Message-ID: <20140731150753.3f12fc2f@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1406651242-20689-1-git-send-email-ricardo.ribalda@gmail.com>

> This patch allow the users of the 8250 infrastructure to define a
> handler for RS485 configration.

This feels to me like the right code in the wrong place.
 
> If no handler is defined the 8250 driver will work as usual.

Is there any reasons we can't have uart_ops.rs485_config and the RS485
ioctl logic in the serial_core, or even push rs485_get/put into the tty
ioctl handler and tty ops so it's not duplicated everywhere ?
 
> +	switch (cmd) {
> +	case TIOCSRS485:
> +		if (copy_from_user(&rs485_config, (void __user *)arg,
> +				   sizeof(rs485_config)))
> +			return -EFAULT;
> +
> +		ret = up->rs485_config(up, &rs485_config);
> +		if (ret)
> +			return ret;
> +
> +		memcpy(&up->rs485, &rs485_config, sizeof(rs485_config));
> +
> +		return 0;
> +	case TIOCGRS485:
> +		if (copy_to_user((void __user *)arg, &up->rs485,
> +				 sizeof(up->rs485)))
> +			return -EFAULT;
> +		return 0;

Possibly your mutex needs to cover parallel get an set, but then again
anyone doing that may well deserve what they get 8)

Alan

  parent reply	other threads:[~2014-07-31 14:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29 16:27 Ricardo Ribalda Delgado
2014-07-29 16:27 ` [PATCH 2/2] serial: Add support for Fintek F81216A LPC to 4 UART Ricardo Ribalda Delgado
2014-07-31 14:19   ` One Thousand Gnomes
2014-07-31 16:07     ` Ricardo Ribalda Delgado
2014-07-31 19:22       ` [PATCH 2/2 v2] " Ricardo Ribalda Delgado
2014-08-01 12:23         ` One Thousand Gnomes
2014-08-01 12:28           ` Ricardo Ribalda Delgado
2014-08-05  9:34             ` One Thousand Gnomes
2014-08-05  9:47               ` Ricardo Ribalda Delgado
2014-07-31 14:07 ` One Thousand Gnomes [this message]
2014-07-31 16:13   ` [PATCH 1/2] serial/8250: Add support for RS485 IOCTLs Ricardo Ribalda Delgado

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=20140731150753.3f12fc2f@alan.etchedpixels.co.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=alan@linux.intel.com \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jg1.han@samsung.com \
    --cc=jschultz@xes-inc.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=mingo@elte.hu \
    --cc=mwelling@ieee.org \
    --cc=peter@hurleysoftware.com \
    --cc=ricardo.ribalda@gmail.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®