From 5b506aee19dd5e0e7cbfb10451c05ebf2bcb9739 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 13 Jul 2010 08:33:00 +0000 Subject: Fix building without CONFIG_PROC_FS defined This changeset should have no functional changes. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8877 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/card_bri.c | 12 ++-- drivers/dahdi/xpp/card_fxo.c | 12 ++-- drivers/dahdi/xpp/card_fxs.c | 12 ++-- drivers/dahdi/xpp/xbus-core.c | 140 ++++++++++++++++++++++-------------------- drivers/dahdi/xpp/xbus-core.h | 4 ++ drivers/dahdi/xpp/xbus-pcm.c | 2 +- drivers/dahdi/xpp/xbus-pcm.h | 2 +- drivers/dahdi/xpp/xpp_dahdi.c | 17 +++-- drivers/dahdi/xpp/xpp_usb.c | 6 ++ 9 files changed, 117 insertions(+), 90 deletions(-) (limited to 'drivers/dahdi/xpp') diff --git a/drivers/dahdi/xpp/card_bri.c b/drivers/dahdi/xpp/card_bri.c index 15a1553..75a8940 100644 --- a/drivers/dahdi/xpp/card_bri.c +++ b/drivers/dahdi/xpp/card_bri.c @@ -56,6 +56,7 @@ enum xhfc_states { ST_NT_DEACTIVTING = 4, /* G4 */ }; +#ifdef CONFIG_PROC_FS static const char *xhfc_state_name(bool is_nt, enum xhfc_states state) { const char *p; @@ -92,6 +93,7 @@ static const char *xhfc_state_name(bool is_nt, enum xhfc_states state) } return p; } +#endif /* xhfc Layer1 physical commands */ #define HFC_L1_ACTIVATE_TE 0x01 @@ -157,7 +159,9 @@ typedef union { static int write_state_register(xpd_t *xpd, byte value); static bool bri_packet_is_valid(xpacket_t *pack); static void bri_packet_dump(const char *msg, xpacket_t *pack); +#ifdef CONFIG_PROC_FS static int proc_bri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); +#endif static int bri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc); static int bri_chanconfig(struct dahdi_chan *chan, int sigtype); static int bri_startup(struct dahdi_span *span); @@ -799,14 +803,12 @@ static int bri_proc_create(xbus_t *xbus, xpd_t *xpd) priv->bri_info = create_proc_read_entry(PROC_BRI_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_bri_info_read, xpd); if(!priv->bri_info) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_BRI_INFO_FNAME); - goto err; + bri_proc_remove(xbus, xpd); + return -EINVAL; } SET_PROC_DIRENTRY_OWNER(priv->bri_info); #endif return 0; -err: - bri_proc_remove(xbus, xpd); - return -EINVAL; } static xpd_t *BRI_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, @@ -1694,6 +1696,7 @@ static void bri_packet_dump(const char *msg, xpacket_t *pack) } /*------------------------- REGISTER Handling --------------------------*/ +#ifdef CONFIG_PROC_FS static int proc_bri_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = 0; @@ -1756,6 +1759,7 @@ static int proc_bri_info_read(char *page, char **start, off_t off, int count, in len = 0; return len; } +#endif static DRIVER_ATTR_READER(dchan_hardhdlc_show, drv,buf) { diff --git a/drivers/dahdi/xpp/card_fxo.c b/drivers/dahdi/xpp/card_fxo.c index 6173603..c8b08fa 100644 --- a/drivers/dahdi/xpp/card_fxo.c +++ b/drivers/dahdi/xpp/card_fxo.c @@ -87,10 +87,12 @@ static /* 0x0F */ DECLARE_CMD(FXO, XPD_STATE, bool on); static bool fxo_packet_is_valid(xpacket_t *pack); static void fxo_packet_dump(const char *msg, xpacket_t *pack); +#ifdef CONFIG_PROC_FS static int proc_fxo_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); #ifdef WITH_METERING static int proc_xpd_metering_read(char *page, char **start, off_t off, int count, int *eof, void *data); #endif +#endif static void dahdi_report_battery(xpd_t *xpd, lineno_t chan); #define PROC_REGISTER_FNAME "slics" @@ -403,7 +405,8 @@ static int fxo_proc_create(xbus_t *xbus, xpd_t *xpd) priv->fxo_info = create_proc_read_entry(PROC_FXO_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxo_info_read, xpd); if(!priv->fxo_info) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXO_INFO_FNAME); - goto err; + fxo_proc_remove(xbus, xpd); + return -EINVAL; } SET_PROC_DIRENTRY_OWNER(priv->fxo_info); #ifdef WITH_METERING @@ -412,14 +415,13 @@ static int fxo_proc_create(xbus_t *xbus, xpd_t *xpd) proc_xpd_metering_read, xpd); if(!priv->meteringfile) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); - goto err; + fxo_proc_remove(xbus, xpd); + return -EINVAL; } SET_PROC_DIRENTRY_OWNER(priv->meteringfile); #endif #endif return 0; -err: - return -EINVAL; } static xpd_t *FXO_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, @@ -1157,6 +1159,7 @@ static void fxo_packet_dump(const char *msg, xpacket_t *pack) /*------------------------- DAA Handling --------------------------*/ +#ifdef CONFIG_PROC_FS static int proc_fxo_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = 0; @@ -1273,6 +1276,7 @@ static int proc_fxo_info_read(char *page, char **start, off_t off, int count, in len = 0; return len; } +#endif #ifdef WITH_METERING static int proc_xpd_metering_read(char *page, char **start, off_t off, int count, int *eof, void *data) diff --git a/drivers/dahdi/xpp/card_fxs.c b/drivers/dahdi/xpp/card_fxs.c index 0bc94f1..c29e320 100644 --- a/drivers/dahdi/xpp/card_fxs.c +++ b/drivers/dahdi/xpp/card_fxs.c @@ -109,10 +109,12 @@ static /* 0x0F */ DECLARE_CMD(FXS, XPD_STATE, bool on); static bool fxs_packet_is_valid(xpacket_t *pack); static void fxs_packet_dump(const char *msg, xpacket_t *pack); +#ifdef CONFIG_PROC_FS static int proc_fxs_info_read(char *page, char **start, off_t off, int count, int *eof, void *data); #ifdef WITH_METERING static int proc_xpd_metering_write(struct file *file, const char __user *buffer, unsigned long count, void *data); #endif +#endif static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos); #define PROC_REGISTER_FNAME "slics" @@ -356,7 +358,8 @@ static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) priv->fxs_info = create_proc_read_entry(PROC_FXS_INFO_FNAME, 0444, xpd->proc_xpd_dir, proc_fxs_info_read, xpd); if(!priv->fxs_info) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXS_INFO_FNAME); - goto err; + fxs_proc_remove(xbus, xpd); + return -EINVAL; } SET_PROC_DIRENTRY_OWNER(priv->fxs_info); #ifdef WITH_METERING @@ -364,7 +367,8 @@ static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) priv->meteringfile = create_proc_entry(PROC_METERING_FNAME, 0200, xpd->proc_xpd_dir); if(!priv->meteringfile) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); - goto err; + fxs_proc_remove(xbus, xpd); + return -EINVAL; } SET_PROC_DIRENTRY_OWNER(priv->meteringfile); priv->meteringfile->write_proc = proc_xpd_metering_write; @@ -373,8 +377,6 @@ static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) #endif #endif return 0; -err: - return -EINVAL; } static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_table_t *proto_table, @@ -1390,6 +1392,7 @@ static void fxs_packet_dump(const char *msg, xpacket_t *pack) /*------------------------- SLIC Handling --------------------------*/ +#ifdef CONFIG_PROC_FS static int proc_fxs_info_read(char *page, char **start, off_t off, int count, int *eof, void *data) { int len = 0; @@ -1458,6 +1461,7 @@ static int proc_fxs_info_read(char *page, char **start, off_t off, int count, in len = 0; return len; } +#endif #ifdef WITH_METERING static int proc_xpd_metering_write(struct file *file, const char __user *buffer, unsigned long count, void *data) diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index 40d127b..22f25ef 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -56,9 +56,11 @@ static const char rcsid[] = "$Id$"; #endif #ifdef PROTOCOL_DEBUG +#ifdef CONFIG_PROC_FS #define PROC_XBUS_COMMAND "command" static int proc_xbus_command_write(struct file *file, const char __user *buffer, unsigned long count, void *data); #endif +#endif /* Command line parameters */ extern int debug; @@ -66,16 +68,20 @@ static DEF_PARM(uint, command_queue_length, 800, 0444, "Maximal command queue le static DEF_PARM(uint, poll_timeout, 1000, 0644, "Timeout (in jiffies) waiting for units to reply"); 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); /* Data structures */ static spinlock_t xbuses_lock = SPIN_LOCK_UNLOCKED; +#ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_xbuses = NULL; +#endif static struct xbus_desc { xbus_t *xbus; @@ -1457,7 +1463,73 @@ void xbus_reset_counters(xbus_t *xbus) } } -#if CONFIG_PROC_FS +static bool xpds_done(xbus_t *xbus) +{ + struct xbus_workqueue *worker; + + if (XBUS_IS(xbus, FAIL)) + return 1; /* Nothing to wait for */ + if (!XBUS_IS(xbus, RECVD_DESC)) + return 1; /* We are not in the initialization phase */ + worker = xbus->worker; + if (worker->xpds_init_done) + return 1; /* All good */ + /* Keep waiting */ + return 0; +} + +int waitfor_xpds(xbus_t *xbus, char *buf) +{ + struct xbus_workqueue *worker; + unsigned long flags; + int ret; + int len = 0; + + /* + * FIXME: worker is created before ????? + * So by now it exists and initialized. + */ + xbus = get_xbus(__func__, xbus); /* until end of waitfor_xpds_show() */ + if (!xbus) + return -ENODEV; + worker = xbus->worker; + BUG_ON(!worker); + XBUS_DBG(DEVICES, xbus, + "Waiting for card initialization of %d XPD's max %d seconds\n", + worker->num_units, + INITIALIZATION_TIMEOUT/HZ); + ret = wait_event_interruptible_timeout( + worker->wait_for_xpd_initialization, + xpds_done(xbus), + INITIALIZATION_TIMEOUT); + if (ret == 0) { + XBUS_ERR(xbus, "Card Initialization Timeout\n"); + len = -ETIMEDOUT; + goto out; + } else if (ret < 0) { + XBUS_ERR(xbus, "Card Initialization Interrupted %d\n", ret); + len = ret; + goto out; + } else + XBUS_DBG(DEVICES, xbus, + "Finished initialization of %d XPD's in %d seconds.\n", + worker->num_units_initialized, + (INITIALIZATION_TIMEOUT - ret)/HZ); + if (XBUS_IS(xbus, FAIL)) { + len += sprintf(buf, "FAILED: %s\n", xbus->busname); + } else { + spin_lock_irqsave(&xbus->lock, flags); + len += sprintf(buf, "XPDS_READY: %s: %d/%d\n", + xbus->busname, + worker->num_units_initialized, worker->num_units); + spin_unlock_irqrestore(&xbus->lock, flags); + } +out: + put_xbus(__func__, xbus); /* from start of waitfor_xpds_show() */ + return len; +} + +#ifdef CONFIG_PROC_FS static int xbus_fill_proc_queue(char *p, struct xframe_queue *q) { @@ -1552,72 +1624,6 @@ out: } -static bool xpds_done(xbus_t *xbus) -{ - struct xbus_workqueue *worker; - - if(XBUS_IS(xbus, FAIL)) - return 1; /* Nothing to wait for */ - if(!XBUS_IS(xbus, RECVD_DESC)) - return 1; /* We are not in the initialization phase */ - worker = xbus->worker; - if(worker->xpds_init_done) - return 1; /* All good */ - /* Keep waiting */ - return 0; -} - -int waitfor_xpds(xbus_t *xbus, char *buf) -{ - struct xbus_workqueue *worker; - unsigned long flags; - int ret; - int len = 0; - - /* - * FIXME: worker is created before ????? - * So by now it exists and initialized. - */ - xbus = get_xbus(__FUNCTION__, xbus); /* until end of waitfor_xpds_show() */ - if(!xbus) - return -ENODEV; - worker = xbus->worker; - BUG_ON(!worker); - XBUS_DBG(DEVICES, xbus, - "Waiting for card initialization of %d XPD's max %d seconds\n", - worker->num_units, - INITIALIZATION_TIMEOUT/HZ); - ret = wait_event_interruptible_timeout( - worker->wait_for_xpd_initialization, - xpds_done(xbus), - INITIALIZATION_TIMEOUT); - if(ret == 0) { - XBUS_ERR(xbus, "Card Initialization Timeout\n"); - len = -ETIMEDOUT; - goto out; - } else if(ret < 0) { - XBUS_ERR(xbus, "Card Initialization Interrupted %d\n", ret); - len = ret; - goto out; - } else - XBUS_DBG(DEVICES, xbus, - "Finished initialization of %d XPD's in %d seconds.\n", - worker->num_units_initialized, - (INITIALIZATION_TIMEOUT - ret)/HZ); - if(XBUS_IS(xbus, FAIL)) { - len += sprintf(buf, "FAILED: %s\n", xbus->busname); - } else { - spin_lock_irqsave(&xbus->lock, flags); - len += sprintf(buf, "XPDS_READY: %s: %d/%d\n", - xbus->busname, - worker->num_units_initialized, worker->num_units); - spin_unlock_irqrestore(&xbus->lock, flags); - } -out: - put_xbus(__FUNCTION__, xbus); /* from start of waitfor_xpds_show() */ - return len; -} - #ifdef OLD_PROC static int xbus_read_waitfor_xpds(char *page, char **start, off_t off, int count, int *eof, void *data) { diff --git a/drivers/dahdi/xpp/xbus-core.h b/drivers/dahdi/xpp/xbus-core.h index 773d703..71be6bf 100644 --- a/drivers/dahdi/xpp/xbus-core.h +++ b/drivers/dahdi/xpp/xbus-core.h @@ -135,7 +135,11 @@ struct xbus_workqueue { int num_units; int num_units_initialized; wait_queue_head_t wait_for_xpd_initialization; +#ifdef CONFIG_PROC_FS +#ifdef OLD_PROC struct proc_dir_entry *proc_xbus_waitfor_xpds; +#endif +#endif spinlock_t worker_lock; }; diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c index c3e9949..283d857 100644 --- a/drivers/dahdi/xpp/xbus-pcm.c +++ b/drivers/dahdi/xpp/xbus-pcm.c @@ -1234,7 +1234,7 @@ static struct proc_dir_entry *top; #endif #endif /* OLD_PROC */ -int xbus_pcm_init(struct proc_dir_entry *toplevel) +int xbus_pcm_init(void *toplevel) { int ret = 0; diff --git a/drivers/dahdi/xpp/xbus-pcm.h b/drivers/dahdi/xpp/xbus-pcm.h index 23e701a..3b91489 100644 --- a/drivers/dahdi/xpp/xbus-pcm.h +++ b/drivers/dahdi/xpp/xbus-pcm.h @@ -99,7 +99,7 @@ static inline long usec_diff(const struct timeval *tv1, const struct timeval *tv } -int xbus_pcm_init(struct proc_dir_entry *top); +int xbus_pcm_init(void *top); void xbus_pcm_shutdown(void); int send_pcm_frame(xbus_t *xbus, xframe_t *xframe); void pcm_recompute(xpd_t *xpd, xpp_line_t tmp_pcm_mask); diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c index 19a2bc4..3e4b9b2 100644 --- a/drivers/dahdi/xpp/xpp_dahdi.c +++ b/drivers/dahdi/xpp/xpp_dahdi.c @@ -110,6 +110,7 @@ int total_registered_spans(void) return atomic_read(&num_registered_spans); } +#ifdef CONFIG_PROC_FS static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); #ifdef OLD_PROC static int proc_xpd_ztregister_read(char *page, char **start, off_t off, int count, int *eof, void *data); @@ -117,6 +118,7 @@ static int proc_xpd_ztregister_write(struct file *file, const char __user *buffe static int proc_xpd_blink_read(char *page, char **start, off_t off, int count, int *eof, void *data); static int proc_xpd_blink_write(struct file *file, const char __user *buffer, unsigned long count, void *data); #endif +#endif /*------------------------- XPD Management -------------------------*/ @@ -216,9 +218,11 @@ static int xpd_proc_create(xbus_t *xbus, xpd_t *xpd) #endif #endif return 0; +#ifdef CONFIG_PROC_FS err: xpd_proc_remove(xbus, xpd); return -EFAULT; +#endif } void xpd_free(xpd_t *xpd) @@ -831,12 +835,6 @@ static int proc_xpd_blink_write(struct file *file, const char __user *buffer, un */ int xpp_open(struct dahdi_chan *chan) { -#if 0 - xpd_t *xpd = chan->pvt; - xbus_t *xbus = xpd->xbus; - int pos = chan->chanpos - 1; - unsigned long flags; -#else xpd_t *xpd; xbus_t *xbus; int pos; @@ -863,7 +861,6 @@ int xpp_open(struct dahdi_chan *chan) put_xpd(__FUNCTION__, xpd); return -ENODEV; } -#endif spin_lock_irqsave(&xbus->lock, flags); atomic_inc(&xpd->open_counter); LINE_DBG(DEVICES, xpd, pos, "%s[%d]: open_counter=%d\n", @@ -1178,7 +1175,8 @@ static void do_cleanup(void) static int __init xpp_dahdi_init(void) { - int ret = 0; + int ret = 0; + void *top = NULL; INFO("revision %s MAX_XPDS=%d (%d*%d)\n", XPP_VERSION, MAX_XPDS, MAX_UNIT, MAX_SUBUNIT); @@ -1193,13 +1191,14 @@ static int __init xpp_dahdi_init(void) ret = -EIO; goto err; } + top = xpp_proc_toplevel; #endif ret = xbus_core_init(); if(ret) { ERR("xbus_core_init failed (%d)\n", ret); goto err; } - ret = xbus_pcm_init(xpp_proc_toplevel); + ret = xbus_pcm_init(top); if(ret) { ERR("xbus_pcm_init failed (%d)\n", ret); xbus_core_shutdown(); diff --git a/drivers/dahdi/xpp/xpp_usb.c b/drivers/dahdi/xpp/xpp_usb.c index 15507ee..40e5f9e 100644 --- a/drivers/dahdi/xpp/xpp_usb.c +++ b/drivers/dahdi/xpp/xpp_usb.c @@ -266,7 +266,9 @@ static void xpp_send_callback(USB_PASS_CB(urb)); static void xpp_receive_callback(USB_PASS_CB(urb)); static int xusb_probe (struct usb_interface *interface, const struct usb_device_id *id); static void xusb_disconnect (struct usb_interface *interface); +#ifdef CONFIG_PROC_FS static int xusb_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data); +#endif /*------------------------------------------------------------------*/ @@ -656,7 +658,9 @@ static int xusb_probe(struct usb_interface *interface, const struct usb_device_i struct usb_host_interface *iface_desc = usb_altnum_to_altsetting(interface, 0); xusb_t *xusb = NULL; struct xusb_model_info *model_info = (struct xusb_model_info*)id->driver_info; +#ifdef CONFIG_PROC_FS struct proc_dir_entry *procsummary = NULL; +#endif xbus_t *xbus = NULL; unsigned long flags; int retval = -ENOMEM; @@ -784,11 +788,13 @@ probe_failed: KZFREE(xusb); } if(xbus) { +#ifdef CONFIG_PROC_FS if(procsummary) { XBUS_DBG(PROC, xbus, "Remove proc_entry: " PROC_USBXPP_SUMMARY "\n"); remove_proc_entry(PROC_USBXPP_SUMMARY, xbus->proc_xbus_dir); procsummary = NULL; } +#endif ERR("Calling xbus_disconnect()\n"); xbus_disconnect(xbus); // Blocking until fully deactivated! } -- cgit v1.2.3