[Meego-kernel] [PATCH] ptirouter_ldisc to n_tracerouter rename.
james_p_freyensee at linux.intel.com
james_p_freyensee at linux.intel.com
Thu Nov 4 14:12:41 PDT 2010
From: J Freyensee <james_p_freyensee at linux.intel.com>
This patch renames ptirouter_ldisc to n_tracerouter to a more
linux kernel naming convention. NO added functionality or
bug fixes are in this patch; it's just a rename.
Signed-off-by: J Freyensee <james_p_freyensee at linux.intel.com>
---
drivers/char/Kconfig | 2 +-
drivers/char/Makefile | 2 +-
drivers/char/n_tracerouter.c | 202 ++++++++++++++++++++++++++++++++++++++++
drivers/char/ptirouter_ldisc.c | 202 ----------------------------------------
include/linux/tty.h | 2 +-
5 files changed, 205 insertions(+), 205 deletions(-)
create mode 100644 drivers/char/n_tracerouter.c
delete mode 100644 drivers/char/ptirouter_ldisc.c
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index f7a9e3b..d561b8c 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -110,7 +110,7 @@ config BFIN_JTAG_COMM_CONSOLE
bool "Console on Blackfin JTAG"
depends on BFIN_JTAG_COMM=y
-config PTI_ROUTER
+config TRACE_ROUTER
tristate "Trace data router for MIPI P1149.7 cJTAG standard"
depends on INTEL_MID_PTI
---help---
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index c228d43..734eddb 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -14,7 +14,7 @@ obj-$(CONFIG_UNIX98_PTYS) += pty.o
obj-y += misc.o
obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o selection.o keyboard.o
obj-$(CONFIG_BFIN_JTAG_COMM) += bfin_jtag_comm.o
-obj-$(CONFIG_PTI_ROUTER) += ptirouter_ldisc.o
+obj-$(CONFIG_TRACE_ROUTER) += n_tracerouter.o
obj-$(CONFIG_CONSOLE_TRANSLATIONS) += consolemap.o consolemap_deftbl.o
obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
obj-$(CONFIG_AUDIT) += tty_audit.o
diff --git a/drivers/char/n_tracerouter.c b/drivers/char/n_tracerouter.c
new file mode 100644
index 0000000..9b1cfb0
--- /dev/null
+++ b/drivers/char/n_tracerouter.c
@@ -0,0 +1,202 @@
+/*
+ * n_tracerouter.c - PTI data router for JTAG data extration
+ *
+ * Copyright (C) Intel 2010
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * The PTI router uses the Linux line discipline framework to route
+ * trace data coming from a HW Modem to a PTI (Parallel Trace Module) port.
+ * This is part of a solution for the P1149.7, compact JTAG, standard.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#include <linux/tty.h>
+#include <linux/tty_ldisc.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/signal.h>
+#include <linux/slab.h>
+#include <asm-generic/bug.h>
+#include <linux/pti.h>
+
+/* Other ldisc drivers use 65536 which basically means,
+ * 'I can always accept 64k' and flow control is off.
+ * This number is deemed appropriate for this driver.
+ */
+
+#define RECEIVE_ROOM 65536
+#define DRIVERNAME "n_tracerouter"
+
+/**
+ * n_tracerouter_open() - Called when a tty is opened by a SW entity.
+ * @tty: terminal device to the ldisc.
+ *
+ * Return:
+ * 0 for success.
+ */
+
+static int n_tracerouter_open(struct tty_struct *tty)
+{
+ tty->receive_room = RECEIVE_ROOM;
+ tty_driver_flush_buffer(tty);
+ return 0;
+}
+
+/**
+ * n_tracerouter_close() - close connection
+ * @tty: terminal device to the ldisc.
+ *
+ * Called when a software entity wants to close a connection.
+ */
+static void n_tracerouter_close(struct tty_struct *tty)
+{
+ tty_driver_flush_buffer(tty);
+}
+
+/**
+ * n_tracerouter_read() - read request from user space
+ * @tty: terminal device passed into the ldisc.
+ * @file: pointer to open file object.
+ * @buf: pointer to the data buffer that gets eventually returned.
+ * @nr: number of bytes of the data buffer that is returned.
+ *
+ * function that allows read() functionality in userspace. By default if this
+ * is not implemented it returns -EIO. This module is functioning like a
+ * router via n_tracerouter_receivebuf(), and there is no real requirement
+ * to implement this function. However, an error return value other than
+ * -EIO should be used just to show that there was an intent not to have
+ * this function implemented. Return value based on read() man pages.
+ *
+ * Return:
+ * -EINVAL
+ */
+ssize_t n_tracerouter_read(struct tty_struct *tty, struct file *file,
+ unsigned char *buf, size_t nr) {
+ return -EINVAL;
+}
+
+/**
+ * n_tracerouter_write() - Function that allows write() in userspace.
+ * @tty: terminal device passed into the ldisc.
+ * @file: pointer to open file object.
+ * @buf: pointer to the data buffer that gets eventually returned.
+ * @nr: number of bytes of the data buffer that is returned.
+ *
+ * By default if this is not implemented, it returns -EIO.
+ * This should not be implemented, ever, because
+ * 1. this driver is functioning like a router via
+ * n_tracerouter_receivebuf()
+ * 2. No writes to HW will ever go through this line discpline driver.
+ * However, an error return value other than -EIO should be used
+ * just to show that there was an intent not to have this function
+ * implemented. Return value based on write() man pages.
+ *
+ * Return:
+ * -EINVAL
+ */
+ssize_t n_tracerouter_write(struct tty_struct *tty, struct file *file,
+ const unsigned char *buf, size_t nr) {
+ return -EINVAL;
+}
+
+/**
+ * n_tracerouter_receivebuf() - Routing function for driver.
+ * @tty: terminal device passed into the ldisc. It's assumed
+ * tty will never be NULL.
+ * @cp: buffer, block of characters to be eventually read by
+ * someone, somewhere (user read() call or some kernel function).
+ * @fp: flag buffer.
+ * @count: number of characters (aka, bytes) in cp.
+ *
+ * This function takes the input buffer, cp, and passes it to
+ * an external API function for processing.
+ */
+static void n_tracerouter_receivebuf(struct tty_struct *tty,
+ const unsigned char *cp,
+ char *fp, int count)
+{
+ /* 71 is the master ID for modem messages */
+ /* Only channel 0 for now */
+ static struct masterchannel mc = {.master = 71, .channel = 0 };
+ mipi_pti_writedata((void *) &mc, (u8 *)cp, count);
+}
+
+/* Flush buffer is not impelemented as the ldisc has no internal buffering
+ * so the tty_driver_flush_buffer() is sufficient for this driver's needs.
+ */
+
+static struct tty_ldisc_ops tty_n_tracerouter = {
+ .owner = THIS_MODULE,
+ .magic = TTY_LDISC_MAGIC,
+ .name = DRIVERNAME,
+ .open = n_tracerouter_open,
+ .close = n_tracerouter_close,
+ .read = n_tracerouter_read,
+ .write = n_tracerouter_write,
+ .receive_buf = n_tracerouter_receivebuf
+};
+
+/**
+ * n_tracerouter_init - module initialisation
+ *
+ * Registers this module as a line discipline driver.
+ *
+ * Return:
+ * 0 for success, any other value error.
+ */
+static int __init n_tracerouter_init(void)
+{
+ int retval;
+
+ /* Note N_PTIR is defined in linux/tty.h */
+ retval = tty_register_ldisc(N_TRACEROUTER, &tty_n_tracerouter);
+ if (retval < 0)
+ pr_err("%s: Registration failed: %d\n",
+ __func__, retval);
+ return retval;
+}
+
+/**
+ * n_tracerouter_exit - - module unload
+ *
+ * Removes this module as a line discipline driver.
+ */
+static void __exit n_tracerouter_exit(void)
+{
+ int retval;
+
+ retval = tty_unregister_ldisc(N_TRACEROUTER);
+ if (retval < 0)
+ pr_err("%s: Unregistration failed: %d\n",
+ __func__, retval);
+}
+
+module_init(n_tracerouter_init);
+module_exit(n_tracerouter_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jay Freyensee");
+MODULE_ALIAS_LDISC(N_TRACEROUTER);
+MODULE_DESCRIPTION("Trace router ldisc driver");
diff --git a/drivers/char/ptirouter_ldisc.c b/drivers/char/ptirouter_ldisc.c
deleted file mode 100644
index 7e72d41..0000000
--- a/drivers/char/ptirouter_ldisc.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * ptirouter_ldisc.c - PTI data router for JTAG data extration
- *
- * Copyright (C) Intel 2010
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * The PTI router uses the Linux line discipline framework to route
- * trace data coming from a HW Modem to a PTI (Parallel Trace Module) port.
- * This is part of a solution for the P1149.7, compact JTAG, standard.
- *
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <linux/tty.h>
-#include <linux/tty_ldisc.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/signal.h>
-#include <linux/slab.h>
-#include <asm-generic/bug.h>
-#include <linux/pti.h>
-
-/* Other ldisc drivers use 65536 which basically means,
- * 'I can always accept 64k' and flow control is off.
- * This number is deemed appropriate for this driver.
- */
-
-#define RECEIVE_ROOM 65536
-#define DRIVERNAME "ptirouter_ldisc"
-
-/**
- * ptirouter_ldisc_open() - Called when a tty is opened by a SW entity.
- * @tty: terminal device to the ldisc.
- *
- * Return:
- * 0 for success.
- */
-
-static int ptirouter_ldisc_open(struct tty_struct *tty)
-{
- tty->receive_room = RECEIVE_ROOM;
- tty_driver_flush_buffer(tty);
- return 0;
-}
-
-/**
- * ptirouter_ldisc_close() - close connection
- * @tty: terminal device to the ldisc.
- *
- * Called when a software entity wants to close a connection.
- */
-static void ptirouter_ldisc_close(struct tty_struct *tty)
-{
- tty_driver_flush_buffer(tty);
-}
-
-/**
- * ptirouter_ldisc_read() - read request from user space
- * @tty: terminal device passed into the ldisc.
- * @file: pointer to open file object.
- * @buf: pointer to the data buffer that gets eventually returned.
- * @nr: number of bytes of the data buffer that is returned.
- *
- * function that allows read() functionality in userspace. By default if this
- * is not implemented it returns -EIO. This module is functioning like a
- * router via ptirouter_ldisc_receivebuf(), and there is no real requirement
- * to implement this function. However, an error return value other than
- * -EIO should be used just to show that there was an intent not to have
- * this function implemented. Return value based on read() man pages.
- *
- * Return:
- * -EINVAL
- */
-ssize_t ptirouter_ldisc_read(struct tty_struct *tty, struct file *file,
- unsigned char *buf, size_t nr) {
- return -EINVAL;
-}
-
-/**
- * ptirouter_ldisc_write() - Function that allows write() in userspace.
- * @tty: terminal device passed into the ldisc.
- * @file: pointer to open file object.
- * @buf: pointer to the data buffer that gets eventually returned.
- * @nr: number of bytes of the data buffer that is returned.
- *
- * By default if this is not implemented, it returns -EIO.
- * This should not be implemented, ever, because
- * 1. this driver is functioning like a router via
- * ptirouter_ldisc_receivebuf()
- * 2. No writes to HW will ever go through this line discpline driver.
- * However, an error return value other than -EIO should be used
- * just to show that there was an intent not to have this function
- * implemented. Return value based on write() man pages.
- *
- * Return:
- * -EINVAL
- */
-ssize_t ptirouter_ldisc_write(struct tty_struct *tty, struct file *file,
- const unsigned char *buf, size_t nr) {
- return -EINVAL;
-}
-
-/**
- * ptirouter_ldisc_receivebuf() - Routing function for driver.
- * @tty: terminal device passed into the ldisc. It's assumed
- * tty will never be NULL.
- * @cp: buffer, block of characters to be eventually read by
- * someone, somewhere (user read() call or some kernel function).
- * @fp: flag buffer.
- * @count: number of characters (aka, bytes) in cp.
- *
- * This function takes the input buffer, cp, and passes it to
- * an external API function for processing.
- */
-static void ptirouter_ldisc_receivebuf(struct tty_struct *tty,
- const unsigned char *cp,
- char *fp, int count)
-{
- /* 71 is the master ID for modem messages */
- /* Only channel 0 for now */
- static struct masterchannel mc = {.master = 71, .channel = 0 };
- mipi_pti_writedata((void *) &mc, (u8 *)cp, count);
-}
-
-/* Flush buffer is not impelemented as the ldisc has no internal buffering
- * so the tty_driver_flush_buffer() is sufficient for this driver's needs.
- */
-
-static struct tty_ldisc_ops tty_ptirouter_ldisc = {
- .owner = THIS_MODULE,
- .magic = TTY_LDISC_MAGIC,
- .name = DRIVERNAME,
- .open = ptirouter_ldisc_open,
- .close = ptirouter_ldisc_close,
- .read = ptirouter_ldisc_read,
- .write = ptirouter_ldisc_write,
- .receive_buf = ptirouter_ldisc_receivebuf
-};
-
-/**
- * ptirouter_ldisc_init - module initialisation
- *
- * Registers this module as a line discipline driver.
- *
- * Return:
- * 0 for success, any other value error.
- */
-static int __init ptirouter_ldisc_init(void)
-{
- int retval;
-
- /* Note N_PTIR is defined in linux/tty.h */
- retval = tty_register_ldisc(N_PTIR, &tty_ptirouter_ldisc);
- if (retval < 0)
- pr_err("%s: Registration failed: %d\n",
- __func__, retval);
- return retval;
-}
-
-/**
- * ptirouter_ldisc_exit - - module unload
- *
- * Removes this module as a line discipline driver.
- */
-static void __exit ptirouter_ldisc_exit(void)
-{
- int retval;
-
- retval = tty_unregister_ldisc(N_PTIR);
- if (retval < 0)
- pr_err("%s: Unregistration failed: %d\n",
- __func__, retval);
-}
-
-module_init(ptirouter_ldisc_init);
-module_exit(ptirouter_ldisc_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Jay Freyensee");
-MODULE_ALIAS_LDISC(N_PTIR);
-MODULE_DESCRIPTION("PTI Router ldisc driver");
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 587fe31..cc35b24 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -49,7 +49,7 @@
#define N_V253 19 /* Codec control over voice modem */
#define N_CAIF 20 /* CAIF protocol for talking to modems */
#define N_GSM0710 21 /* GSM 0710 Mux */
-#define N_PTIR 22 /* PTI cJTAG data routing for MIPI P1149.7 */
+#define N_TRACEROUTER 22 /* Trace data routing for MIPI P1149.7 */
#define N_IFX_SPI 29 /* Mux mode for Infineon modems */
--
1.6.6.1
More information about the MeeGo-kernel
mailing list