Skip to contentSkip to conversation

RS485 on Cris: use global value of TIOCSRS485

PATCH NAK Claudio Scordino 2 participants 3 messages Jan 6, 2011 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RS485 on Cris: use global value of TIOCSRS485

Hi Jesper, Hi Mikael,

the following patch sets the value of TIOCSRS485 on Cris
equal to the value of all other architectures (as currently is for TIOCGRS485).

With this patch, TIOCSRS485 gets the same value across all architectures, making maintenance and portability of user-level code easier.

Best regards,

Claudio

RS485: use global value of TIOCSRS485 (i.e. 0x546F) on Cris.

---
 arch/cris/include/asm/ioctls.h |    2 +-
 drivers/serial/crisv10.c       |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)
arch/cris/include/asm/ioctls.h +1 -1
index 488fbb3..2c15ff8 100644
@@ -4,7 +4,7 @@
 #define TIOCSERGSTRUCT	0x5458 /* For debugging only */
 #define TIOCSERSETRS485	0x5461  /* enable rs-485 (deprecated) */
 #define TIOCSERWRRS485	0x5462  /* write rs-485 */
-#define TIOCSRS485	0x5463  /* enable rs-485 */
+#define TIOCSRS485DEPR	0x5463  /* enable rs-485 (deprecated) */
 
 #include <asm-generic/ioctls.h>
 
drivers/serial/crisv10.c +5 -0
index bcc31f2..29bd418 100644
@@ -3717,6 +3717,11 @@ rs_ioctl(struct tty_struct *tty, struct file * file,
 		return e100_enable_rs485(tty, &rs485data);
 	}
 
+	case TIOCSRS485DEPR:
+	{
+		printk(KERN_DEBUG "The use of this ioctl is deprecated. Use TIOCSRS485 instead\n");
+		/* Fall through */
+	}
 	case TIOCSRS485:
 	{
 		/* This is the new version of TIOCSRS485, with new
Signature · 1 line
1.7.1
#1 lore raw
Quoted 3 lines

With this patch, TIOCSRS485 gets the same value across all architectures, making maintenance and portability of user-level code easier.

I don't see why this is worth doing - no application code should ever hardcode the value.

drivers/serial/crisv10.c rs_ioctl(struct tty_struct *tty, struct file * file, · line 3724

Quoted 5 lines
drivers/serial/crisv10.c +5 -0
+	case TIOCSRS485DEPR:
+	{
+		printk(KERN_DEBUG "The use of this ioctl is deprecated. Use TIOCSRS485 instead\n");
+		/* Fall through */
+	}

and letting everyone spew printks is not a good thing.

NAK

#2 lore raw

Il 06/01/2011 14:34, Alan Cox ha scritto:

Quoted 6 lines
Quoted 3 lines

With this patch, TIOCSRS485 gets the same value across all architectures, making maintenance and portability of user-level code easier.

I don't see why this is worth doing - no application code should ever hardcode the value.

I'm afraid this is true only in a theoretical world. But I hope I'm wrong.

Actually, I can't see any reason to keep different values of TIOCSRS485 in the kernel code when we can have a single value across all architectures.

But I trust your judgment: if you say it's not worth doing, let's avoid it.

Many thanks,

Claudio