[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140731150753.3f12fc2f@alan.etchedpixels.co.uk>
Date: Thu, 31 Jul 2014 15:07:53 +0100
From: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>, Alan Cox <alan@...ux.intel.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Murali Karicheri <m-karicheri2@...com>,
Jingoo Han <jg1.han@...sung.com>,
Michael Welling <mwelling@...e.org>,
Peter Hurley <peter@...leysoftware.com>,
Joe Schultz <jschultz@...-inc.com>,
Ingo Molnar <mingo@...e.hu>,
Doug Anderson <dianders@...omium.org>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] serial/8250: Add support for RS485 IOCTLs
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists