From bbdf5918d6a6d2e0fe06af87e0570d970790f91a Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Mon, 23 May 2011 16:45:53 +0300 Subject: Revert "remove OLD_PROC code (leave only informative proc files)" This reverts commit bab264ce3cb81098ff5b450f7c94a44a10f95dec. --- drivers/dahdi/xpp/xbus-core.c | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'drivers/dahdi/xpp/xbus-core.c') diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index d23b7f2..9feaeaa 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -51,6 +51,9 @@ static const char rcsid[] = "$Id$"; #define INITIALIZATION_TIMEOUT (90*HZ) /* in jiffies */ #define PROC_XBUSES "xbuses" #define PROC_XBUS_SUMMARY "summary" +#ifdef OLD_PROC +#define PROC_XBUS_WAITFOR_XPDS "waitfor_xpds" +#endif #ifdef PROTOCOL_DEBUG #ifdef CONFIG_PROC_FS @@ -67,6 +70,9 @@ static DEF_PARM_BOOL(rx_tasklet, 0, 0644, "Use receive tasklets"); #ifdef CONFIG_PROC_FS static int xbus_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); +#ifdef OLD_PROC +static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data); +#endif #endif static void transport_init(xbus_t *xbus, struct xbus_ops *ops, ushort max_send_size, struct device *transport_device, void *priv); static void transport_destroy(xbus_t *xbus); @@ -1125,6 +1131,16 @@ static void worker_destroy(xbus_t *xbus) worker->wq = NULL; XBUS_DBG(DEVICES, xbus, "destroying workqueue -- done\n"); } +#ifdef CONFIG_PROC_FS +#ifdef OLD_PROC + if (xbus->proc_xbus_dir && worker->proc_xbus_waitfor_xpds) { + XBUS_DBG(PROC, xbus, "Removing proc '%s'\n", + PROC_XBUS_WAITFOR_XPDS); + remove_proc_entry(PROC_XBUS_WAITFOR_XPDS, xbus->proc_xbus_dir); + worker->proc_xbus_waitfor_xpds = NULL; + } +#endif +#endif XBUS_DBG(DEVICES, xbus, "detach worker\n"); put_xbus(__func__, xbus); /* got from worker_run() */ } @@ -1160,6 +1176,22 @@ static int worker_run(xbus_t *xbus) BUG_ON(worker->wq); /* Hmmm... nested workers? */ XBUS_DBG(DEVICES, xbus, "\n"); /* poll related variables */ +#ifdef CONFIG_PROC_FS +#ifdef OLD_PROC + if(xbus->proc_xbus_dir) { + worker->proc_xbus_waitfor_xpds = create_proc_read_entry( + PROC_XBUS_WAITFOR_XPDS, 0444, + xbus->proc_xbus_dir, + xbus_read_waitfor_xpds, + xbus); + if (!worker->proc_xbus_waitfor_xpds) { + XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_XBUS_WAITFOR_XPDS); + goto err; + } + SET_PROC_DIRENTRY_OWNER(worker->proc_xbus_waitfor_xpds); + } +#endif +#endif worker->wq = create_singlethread_workqueue(xbus->busname); if(!worker->wq) { XBUS_ERR(xbus, "Failed to create worker workqueue.\n"); @@ -1698,6 +1730,35 @@ out: } +#ifdef OLD_PROC +static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data) +{ + int len = 0; + int i = (int)((unsigned long)data); + xbus_t *xbus; + + xbus = get_xbus(__func__, i); + if (xbus != NULL) { + XBUS_NOTICE(xbus, "%s: DEPRECATED: %s[%d] read from /proc interface instead of /sys\n", + __func__, current->comm, current->tgid); + /* first handle special cases */ + if (count && !off) + len = waitfor_xpds(xbus, page); + put_xbus(__func__, xbus); + } + if (len <= off+count) + *eof = 1; + *start = page + off; + len -= off; + if (len > count) + len = count; + if (len < 0) + len = 0; + return len; + +} +#endif + #ifdef PROTOCOL_DEBUG static int proc_xbus_command_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { -- cgit v1.2.3