aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ Freyensee <james_p_freyensee@linux.intel.com>2010-12-09 10:37:34 +0000
committerAlan Cox <alan@linux.intel.com>2010-12-09 10:37:34 +0000
commit0f39fe99d877cbabafaa2045ee9a7cac1fa7822f (patch)
tree55cda6dd40fd9cd8a847a18637ffaeb68a311643
parent2cc0000dc9be0474722fb805a6bf986004c97ce1 (diff)
downloadmrst-s0i3-test-0f39fe99d877cbabafaa2045ee9a7cac1fa7822f.tar.gz
mrst-s0i3-test-0f39fe99d877cbabafaa2045ee9a7cac1fa7822f.tar.xz
mrst-s0i3-test-0f39fe99d877cbabafaa2045ee9a7cac1fa7822f.zip
The goal of this change is to:
1. simplify the n_tracesink and n_tracerouter designs, making them more generic for general Linux tree (Alan Cox deliverable) 2. Still meet customer requirements and needs (customer deliverable for Meego) 3. Push any and all specific PTI implementation to one place, drivers/misc/pti.c This patch is for a code review and feedback and it not expected to pass first time (past experiences ;-)). Signed-off-by: J Freyensee <james_p_freyensee@linux.intel.com>
-rw-r--r--drivers/char/Kconfig17
-rw-r--r--drivers/misc/pti.c111
-rw-r--r--drivers/tty/n_tracerouter.c152
-rw-r--r--drivers/tty/n_tracesink.c23
-rw-r--r--include/linux/n_tracesink.h32
-rw-r--r--include/linux/pti.h3
6 files changed, 131 insertions, 207 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index a5ca20bf4f6..979a5941a35 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -112,23 +112,24 @@ config BFIN_JTAG_COMM_CONSOLE
config TRACE_ROUTER
tristate "Trace data router for MIPI P1149.7 cJTAG standard"
-
+ depends on TRACE_SINK
+ default Y
---help---
The trace router uses the Linux tty line discipline framework to route
- trace data coming from a HW Modem to a PTI (Parallel Trace Inferface)
- port. This is part of a solution for the MIPI P1149.7, compact JTAG,
- standard, which is for debugging mobile devices. A PTI
- driver is also needed for this solution.
+ trace data coming from a tty port (say UART for example) to
+ the trace sink line discipline driver and to another tty port (say
+ USB). This is part of a solution for the MIPI P1149.7, compact JTAG,
+ standard, which is for debugging mobile devices. The PTI
+ driver in drivers/misc/pti.c defines the majority of this MIPI solution.
You should select this driver if the target kernel is meant for
a mobile device containing a modem. Then you will need to select
"Trace data sink for MIPI P1149.7 cJTAG standard" line discipline
- driver and/or "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
- HW driver implementation.
+ driver.
config TRACE_SINK
tristate "Trace data sink for MIPI P1149.7 cJTAG standard"
-
+ default Y
---help---
The trace sink uses the Linux line discipline framework to receive
trace data coming from the trace router line discipline driver
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 71aa7835e86..8f4d9abf425 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -40,18 +40,22 @@
#include <linux/miscdevice.h>
#include <linux/pti.h>
-#define DRIVERNAME "pti"
-#define PCINAME "pciPTI"
-#define TTYNAME "ttyPTI"
-#define CHARNAME "pti"
-#define MAX_APP_IDS 128
-#define MAX_OS_IDS 128
-#define CONTROL_ID 72 /* control master ID address */
-#define CONSOLE_ID 73 /* console master ID address */
-#define OS_BASE_ID 74 /* base OS master ID address */
-#define APP_BASE_ID 80 /* base App master ID address */
-#define CONTROL_FRAME_LEN 32 /* PTI control frame maximum size */
-#define USER_COPY_SIZE 8192 /* 8Kb buffer to copy data from user space */
+#define DRIVERNAME "pti"
+#define PCINAME "pciPTI"
+#define TTYNAME "ttyPTI"
+#define CHARNAME "pti"
+#define PTITTY_MINOR_START 0
+#define PTITTY_MINOR_NUM 2
+#define MAX_APP_IDS 128
+#define MAX_OS_IDS 128
+#define MAX_MODEM_IDS 128
+#define MODEM_BASE_ID 71 /* modem master ID address */
+#define CONTROL_ID 72 /* control master ID address */
+#define CONSOLE_ID 73 /* console master ID address */
+#define OS_BASE_ID 74 /* base OS master ID address */
+#define APP_BASE_ID 80 /* base App master ID address */
+#define CONTROL_FRAME_LEN 32 /* PTI control frame maximum size */
+#define USER_COPY_SIZE 8192 /* 8Kb buffer for user space copy */
struct pti_tty {
struct masterchannel *mc;
@@ -65,6 +69,7 @@ struct pti_dev {
unsigned long pti_iolen;
u8 IA_App[MAX_APP_IDS];
u8 IA_OS[MAX_OS_IDS];
+ u8 IA_Modem[MAX_MODEM_IDS];
};
@@ -268,6 +273,8 @@ static struct masterchannel *getID(u8 *IDarray, int max_IDS, int baseID)
* PTI HW.
* @type: 0- request Application master, channel aperture ID write address.
* 1- request OS master, channel aperture ID write address.
+ * 2- request Modem master, channel aperture ID write
+ * address.
* Other values, error.
* @return: masterchannel struct or 0 for error.
*
@@ -288,6 +295,8 @@ struct masterchannel *mipi_request_masterchannel(u8 type)
mc = getID(drv_data->IA_OS, MAX_OS_IDS, OS_BASE_ID);
break;
+ case 2:
+ mc = getID(drv_data->IA_Modem, MAX_MODEM_IDS, MODEM_BASE_ID);
default:
mutex_unlock(&alloclock);
return 0;
@@ -296,7 +305,7 @@ struct masterchannel *mipi_request_masterchannel(u8 type)
mutex_unlock(&alloclock);
return mc;
}
-EXPORT_SYMBOL(mipi_request_masterchannel);
+EXPORT_SYMBOL_GPL(mipi_request_masterchannel);
/**
* mipi_release_masterchannel() - Kernel API function used to release
@@ -315,21 +324,25 @@ void mipi_release_masterchannel(struct masterchannel *mc)
master = mc->master;
channel = mc->channel;
- if (master >= 80) {
- i = ((master-80) << 4) + (channel>>3);
+ if (master == APP_BASE_ID) {
+ i = channel >> 3;
drv_data->IA_App[i] &= ~(0x80>>(channel & 0x7));
}
- if (master >= 72) {
- i = ((master-72) << 4) + (channel>>3);
+ else if (master == OS_BASE_ID) {
+ i = channel >> 3;
drv_data->IA_OS[i] &= ~(0x80>>(channel & 0x7));
}
+ else {
+ i = channel >> 3;
+ drv_data->IA_Modem[i] &= ~(0x80>>(channel & 0x7));
+ }
kfree(mc);
}
mutex_unlock(&alloclock);
}
-EXPORT_SYMBOL(mipi_release_masterchannel);
+EXPORT_SYMBOL_GPL(mipi_release_masterchannel);
/**
* mipi_pti_writedata() - Kernel API function used to write trace
@@ -356,7 +369,7 @@ void mipi_pti_writedata(struct masterchannel *mc, u8 *buf, int count)
}
return;
}
-EXPORT_SYMBOL(mipi_pti_writedata);
+EXPORT_SYMBOL_GPL(mipi_pti_writedata);
static void __devexit pti_pci_remove(struct pci_dev *pdev)
{
@@ -386,9 +399,14 @@ static void __devexit pti_pci_remove(struct pci_dev *pdev)
*
* @return int : Success = 0, otherwise fail.
*
- * The main purpose of using the tty device interface is to route
- * syslog daemon messages to the PTI HW and out of the handheld platform
- * and to the Fido/Lauterbach device.
+ * The main purpose of using the tty device interface is for
+ * each tty port to have a unique PTI write aperture. In an
+ * example use case, ttyPTI0 gets syslogd and an APP aperture
+ * ID and ttyPTI1 is where the n_tracesink ldisc hooks to route
+ * modem messages into PTI. Modem trace data does not have to
+ * go to ttyPTI1, but ttyPTI0 and ttyPTI1 do need to be distinct
+ * master IDs. These messages go through the PTI HW and out of
+ * the handheld platform and to the Fido/Lauterbach device.
*/
static int pti_tty_driver_open(struct tty_struct *tty, struct file *filp)
{
@@ -396,6 +414,9 @@ static int pti_tty_driver_open(struct tty_struct *tty, struct file *filp)
struct masterchannel *mc;
int ret = 0;
+ pr_debug("%s: tty->name is: %s\n", __func__, tty->name);
+ pr_debug("%s: tty->index is: %d\n", __func__, tty->index);
+
/*
we actually want to allocate a new channel per open, per
system arch. HW gives more than plenty channels for a single
@@ -405,7 +426,11 @@ static int pti_tty_driver_open(struct tty_struct *tty, struct file *filp)
*/
ret = tty_port_open(&drv_data->port, tty, filp);
pti_tty_data = tty->driver_data;
- mc = mipi_request_masterchannel(0);
+
+ if (tty->index == PTITTY_MINOR_START)
+ mc = mipi_request_masterchannel(0);
+ else
+ mc = mipi_request_masterchannel(2);
if (mc == 0)
return -EBUSY;
pti_tty_data->mc = mc;
@@ -435,8 +460,8 @@ static void pti_tty_driver_close(struct tty_struct *tty, struct file *filp)
if (pti_tty_data != NULL) {
mc = pti_tty_data->mc;
mipi_release_masterchannel(mc);
+ pti_tty_data->mc = NULL;
}
-
tty_port_close(&drv_data->port, tty, filp);
return;
@@ -558,7 +583,7 @@ int pti_char_release(struct inode *inode, struct file *filp)
* @return int : # of bytes written, or error.
*/
ssize_t pti_char_write(struct file *filp, const char *data, size_t len,
- loff_t *ppose)
+ loff_t *ppose)
{
struct masterchannel *mc;
void *kbuf;
@@ -667,19 +692,21 @@ static struct console pti_console = {
* pti_port_activate(): Used to start/initialize any items upon
* first opening of tty_port().
*
- * @param port
- * @param tty
+ * @param port- The tty port number of the PTI device.
+ * @param tty- The tty struct associated with this device.
*
* @return int - Always returns 0.
*
- * Notes: The primary purpose of the PTI tty port is to hook the
- * syslog daemon to it; thus this port will be open for a very
- * long time.
+ * Notes: The primary purpose of the PTI tty port 0 is to hook
+ * the syslog daemon to it; thus this port will be open for a
+ * very long time.
*/
int pti_port_activate(struct tty_port *port, struct tty_struct *tty)
{
pr_debug("%s(%d): Called.\n", __func__, __LINE__);
- console_start(&pti_console);
+ pr_debug("%s(%d): index is: %d\n", __func__, __LINE__, port->tty->index);
+ if (port->tty->index == PTITTY_MINOR_START)
+ console_start(&pti_console);
return 0;
}
@@ -687,16 +714,18 @@ int pti_port_activate(struct tty_port *port, struct tty_struct *tty)
* pti_port_shutdown(): Used to stop/shutdown any items upon the
* last tty port close.
*
- * @param port
+ * @param port- The tty port number of the PTI device.
*
- * Notes: The primary purpose of the PTI tty port is to hook the
- * syslog daemon to it; thus this port will be open for a very
- * long time.
+ * Notes: The primary purpose of the PTI tty port 0 is to hook
+ * the syslog daemon to it; thus this port will be open for a
+ * very long time.
*/
void pti_port_shutdown(struct tty_port *port)
{
pr_debug("%s(%d): Called.\n", __func__, __LINE__);
- console_stop(&pti_console);
+ pr_debug("%s(%d): index is: %d\n", __func__, __LINE__, port->tty->index);
+ if (port->tty->index == PTITTY_MINOR_START)
+ console_stop(&pti_console);
}
static const struct tty_port_operations tty_port_ops = {
@@ -762,7 +791,8 @@ static int __devinit pti_pci_probe(struct pci_dev *pdev,
tty_port_init(&drv_data->port);
drv_data->port.ops = &tty_port_ops;
- tty_register_device(pti_tty_driver, 0, NULL);
+ tty_register_device(pti_tty_driver, 0, &pdev->dev);
+ tty_register_device(pti_tty_driver, 1, &pdev->dev);
register_console(&pti_console);
@@ -810,9 +840,9 @@ static int __init pti_init(void)
pti_tty_driver->driver_name = DRIVERNAME;
pti_tty_driver->name = TTYNAME;
pti_tty_driver->major = 0;
- pti_tty_driver->minor_start = 0;
- pti_tty_driver->minor_num = 1;
- pti_tty_driver->num = 1;
+ pti_tty_driver->minor_start = PTITTY_MINOR_START;
+ pti_tty_driver->minor_num = PTITTY_MINOR_NUM;
+ pti_tty_driver->num = PTITTY_MINOR_NUM;
pti_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
pti_tty_driver->subtype = SYSTEM_TYPE_SYSCONS;
pti_tty_driver->flags = TTY_DRIVER_REAL_RAW |
@@ -866,6 +896,7 @@ static void __exit pti_exit(void)
}
tty_unregister_device(pti_tty_driver, 0);
+ tty_unregister_device(pti_tty_driver, 1);
retval = tty_unregister_driver(pti_tty_driver);
if (retval) {
diff --git a/drivers/tty/n_tracerouter.c b/drivers/tty/n_tracerouter.c
index 8b2e43258f5..ec85ccd5b41 100644
--- a/drivers/tty/n_tracerouter.c
+++ b/drivers/tty/n_tracerouter.c
@@ -1,5 +1,5 @@
/*
- * n_tracerouter.c - PTI data router for JTAG data extration
+ * n_tracerouter.c - Trace data router through tty space
*
* Copyright (C) Intel 2010
*
@@ -41,7 +41,7 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <asm-generic/bug.h>
-#include <linux/pti.h>
+#include <linux/n_tracesink.h>
/* Other ldisc drivers use 65536 which basically means,
* 'I can always accept 64k' and flow control is off.
@@ -51,23 +51,11 @@
#define RECEIVE_ROOM 65536
#define DRIVERNAME "n_tracerouter"
-/* FIXME: ioctl stuff to specifically set PTI HW; it's being assumed
- * the default and more common extraction case is to route
- * data to an output port like USB. This feature is needed
- * now to meet requests; however, once a second tty is added
- * to the PTI driver and the right write aperture is assigned to
- * that tty then this can be removed.
- */
-#define PTIHW_SETCONF _IOW('J', 0, int)
-
/* struct to hold private configuration data for this ldisc.
- * routedata() used to hold the function to call to route the data.
- * routedata_ptihw is used as switch a user app tells the ldisc where
- * to route.
+ * opencalled is used to hold if this ldisc has been opened.
+ * kref_tty holds the tty reference the ldisc sits on top of.
*/
struct tracerouter_data {
- void (*routedata)(struct masterchannel *mc, u8 *cp, int count);
- u8 routedata_ptihw;
u8 opencalled;
struct tty_struct *kref_tty;
};
@@ -77,22 +65,6 @@ static struct tracerouter_data *tr_data;
static DEFINE_MUTEX(routelock);
/**
- * tracerouter_reset
- *
- * Provides an initial state to route data.
- *
- * @param ptr expects an existing ptr to be passed in
- * to set the parameters involved in actually routing
- * the data (routedata, routedata_ptihw, opencalled).
- */
-static void tracerouter_resetroute(struct tracerouter_data *ptr)
-{
- ptr->routedata = mipi_pti_sinkdata;
- ptr->routedata_ptihw = 0;
- ptr->opencalled = 0;
-}
-
-/**
* tracerouter_alloc
*
* Allocates the structure needed for this ldisc.
@@ -104,13 +76,7 @@ static struct tracerouter_data *tracerouter_alloc(void)
GFP_KERNEL);
if (tptr == NULL)
return NULL;
-
- /* default to shifting data out to the USB and specifically configure
- * it to shift out to PTI. This is because it will probably be possible
- * in the field to shift out data to USB, but the PTI HW may not be
- * available 'in the field'.
- */
- tracerouter_resetroute(tptr);
+ tptr->opencalled = 0;
return tptr;
}
@@ -164,7 +130,7 @@ static void n_tracerouter_close(struct tty_struct *tty)
mutex_lock(&routelock);
tty_kref_put(tr_data->kref_tty);
tr_data->kref_tty = NULL;
- tracerouter_resetroute(tr_data);
+ tr_data->opencalled = 0;
tty->disc_data = NULL;
mutex_unlock(&routelock);
@@ -219,99 +185,6 @@ static ssize_t n_tracerouter_write(struct tty_struct *tty, struct file *file,
}
/**
- * FIXME: This whole routine is part of the FIXME ioctl() at the
- * begining and can be removed when the PTI driver gets a 2nd
- * tty port and is validated both ports can handle continuous
- * simultaneous constant writes. n_tracerouter will then
- * always route to n_tracesink and whatever tty n_tracesink sits
- * on top of is where trace data winds up going. The
- * combination n_tracerouter and n_tracesink will then make up a
- * generic solution of being able to route any data (not just
- * for capturing modem debug data) to any tty port a user-app
- * configures.
- *
- * n_tracerouter_ioctl()
- * - Defined for custom behavior for the PTI trace router.
- *
- * @tty: the tty device the ldisc sits on top of.
- * @file: File descriptor
- * @cmd: The defined ioctl. The custom ioctl defined is
- * PTIHW_SETCONF, which sets if trace data should go
- * to the PTI HW that is on the system.
- * @arg: A pointer to the thing in userspace. If it's 0, the
- * router will route tot he n_ptisink driver. Otherwise, it
- * will send the data to the PTI modem.
- *
- * Return:
- * 0 for success, anything else error
- *
- * Caveats:
- * This function winds up being a NOP when the PTI device
- * driver, misc/pti.c is not compiled with the kernel.
- */
-static int n_tracerouter_ioctl(struct tty_struct *tty, struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- u8 copy_tmp = 0;
- int retval = 0;
- struct tracerouter_data *tptr = tty->disc_data;
-
- pr_debug("%s(%s): called\n", __FILE__, __func__);
-
- switch (cmd) {
- case PTIHW_SETCONF:
-
- mutex_lock(&routelock);
-
- /* with the #ifdef below, this ioctl() basically is
- * (and should be a harmless) NOP in the case a
- * target system has not configured
- * the PTI driver. alloc() makes sure routing to n_tracesink
- * is default case, and this if() makes sure that in
- * the event PTI driver is configured into a Linux
- * solution that trace data can be routed to the
- * n_tracesink if the PTI driver is first selected.
- */
- if (access_ok(VERIFY_READ, (void *) arg, sizeof(int))) {
- if (get_user(copy_tmp, (int __user *) arg))
- retval = -EFAULT;
- }
- pr_debug("%s(%s): after access_ok() ioctl. Return value %d\n",
- __FILE__, __func__, retval);
- pr_debug("%s(%s): after access_ok() ioctl. copy_tmp %d\n",
- __FILE__, __func__, copy_tmp);
- tptr->routedata_ptihw = copy_tmp;
- if (tptr->routedata_ptihw == 0)
- tptr->routedata = mipi_pti_sinkdata;
-
- /* in case someone does not configure misc/pti.c
- * into the kernel build (like the build is
- * targeted for a HW solution without PTI HW),
- * this will prevent an
- * 'undefined reference' warning. For this
- * system, it is perfectly acceptable for a kernel
- * user to not configure the PTI HW into the
- * kernel because it may not be on the HW platform, but
- * to use this trace router and the trace sink
- * for a given system's trace route needs.
- */
-#ifdef CONFIG_INTEL_MID_PTI
- else {
- tptr->routedata = mipi_pti_writedata;
- pr_debug("%s(%s): writedata set. Return value %d\n",
- __FILE__, __func__, retval);
- }
-#endif
- mutex_unlock(&routelock);
- return retval;
-
- default:
- retval = n_tty_ioctl_helper(tty, file, cmd, arg);
- return retval;
- }
-}
-
-/**
* n_tracerouter_receivebuf() - Routing function for driver.
* @tty: terminal device passed into the ldisc. It's assumed
* tty will never be NULL.
@@ -327,15 +200,9 @@ static void n_tracerouter_receivebuf(struct tty_struct *tty,
const unsigned char *cp,
char *fp, int count)
{
- struct tracerouter_data *tptr = tty->disc_data;
-
- /* 71 is the master ID for modem messages */
- /* Only channel 0 for now */
- static struct masterchannel mc = {.master = 71, .channel = 0 };
-
- pr_debug("%s(%s): calling routedata()\n", __FILE__, __func__);
+ pr_debug("%s(%s): calling n_tracesink_datadrain()\n", __FILE__, __func__);
mutex_lock(&routelock);
- tptr->routedata((void *) &mc, (u8 *)cp, count);
+ n_tracesink_datadrain((u8 *) cp, count);
mutex_unlock(&routelock);
}
@@ -351,7 +218,6 @@ static struct tty_ldisc_ops tty_ptirouter_ldisc = {
.close = n_tracerouter_close,
.read = n_tracerouter_read,
.write = n_tracerouter_write,
- .ioctl = n_tracerouter_ioctl,
.receive_buf = n_tracerouter_receivebuf
};
@@ -403,4 +269,4 @@ module_exit(n_tracerouter_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jay Freyensee");
MODULE_ALIAS_LDISC(N_TRACEROUTER);
-MODULE_DESCRIPTION("PTI Router ldisc driver");
+MODULE_DESCRIPTION("Trace router ldisc driver");
diff --git a/drivers/tty/n_tracesink.c b/drivers/tty/n_tracesink.c
index 1815c52f492..c5a48e6a173 100644
--- a/drivers/tty/n_tracesink.c
+++ b/drivers/tty/n_tracesink.c
@@ -1,5 +1,5 @@
/*
- * n_tracesink.c - PTI data router for JTAG data extration
+ * n_tracesink.c - Trace data router and sink path through tty space.
*
* Copyright (C) Intel 2010
*
@@ -41,7 +41,7 @@
#include <linux/errno.h>
#include <linux/string.h>
#include <asm-generic/bug.h>
-#include <linux/pti.h>
+#include <linux/n_tracesink.h>
/* Other ldisc drivers use 65536 which basically means,
* 'I can always accept 64k' and flow control is off.
@@ -51,11 +51,10 @@
#define DRIVERNAME "n_tracesink"
/* there is a quirk with this ldisc is he can write data
- * to a tty from anyone calling his kernel API, to keep
- * it along the same theme with drivers/misc/pti.c
- * whose requirements were defined by customers. So he
- * needs to know when he can and cannot write when the
- * API is called. In theory, the API can be called
+ * to a tty from anyone calling his kernel API, which
+ * meets customer requirements in the drivers/misc/pti.c
+ * project. So he needs to know when he can and cannot write when
+ * the API is called. In theory, the API can be called
* after an init() but before a successful open() which
* would crash the system if tty is not checked.
*/
@@ -173,10 +172,8 @@ static ssize_t n_tracesink_write(struct tty_struct *tty, struct file *file,
* trace debugging data to user-defined
* port like USB.
*
- * @mc: Not used. Null can be passed. Needed to keep
- * conformance with mipi_pti_writedata().
- * @buf: Trace debuging data to write to the PTI HW.
- * Null value will return with no write occurring.
+ * @buf: Trace debuging data buffer to write to tty target
+ * port. Null value will return with no write occurring.
* @count: Size of buf. Value of 0 or a negative number will
* return with no write occuring.
*
@@ -186,7 +183,7 @@ static ssize_t n_tracesink_write(struct tty_struct *tty, struct file *file,
* to call the write().
*/
-void mipi_pti_sinkdata(struct masterchannel *mc, u8 *cp, int count)
+void n_tracesink_datadrain(u8 *cp, int count)
{
pr_debug("%s(%s): called\n", __FILE__, __func__);
@@ -197,7 +194,7 @@ void mipi_pti_sinkdata(struct masterchannel *mc, u8 *cp, int count)
mutex_unlock(&writelock);
}
-EXPORT_SYMBOL_GPL(mipi_pti_sinkdata);
+EXPORT_SYMBOL_GPL(n_tracesink_datadrain);
/* 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.
diff --git a/include/linux/n_tracesink.h b/include/linux/n_tracesink.h
new file mode 100644
index 00000000000..b1a3ad88762
--- /dev/null
+++ b/include/linux/n_tracesink.h
@@ -0,0 +1,32 @@
+/*
+ * n_tracesink.h - Kernel driver API to route trace data in kernel space.
+ *
+ * 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 implementation of the function seen in this file can be found in
+ * char/n_tracesink.c
+ */
+
+#ifndef N_TRACESINK_H_
+#define N_TRACESINK_H_
+
+void n_tracesink_datadrain(u8 *cp, int count);
+
+#endif
diff --git a/include/linux/pti.h b/include/linux/pti.h
index 5ca3fa94c26..c7727b2db08 100644
--- a/include/linux/pti.h
+++ b/include/linux/pti.h
@@ -32,9 +32,6 @@ void mipi_pti_writedata(struct masterchannel *mc, u8 *cp, int count);
struct masterchannel *mipi_request_masterchannel(u8 kerneluser);
void mipi_release_masterchannel(struct masterchannel *mc);
-/* the following function is defined in char/n_tracesink.c */
-void mipi_pti_sinkdata(struct masterchannel *mc, u8 *cp, int count);
-
#define APERTURE_14 0x3800000
#define APERTURE_LEN 0x400000