From cd419f86a583306c63a461b7e79a52e96c1e20bc Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 2 Jun 2011 20:01:34 +0000 Subject: dahdi: Allow dahdi_span_ops.[chan|span]config and startup to block. This change ensures that the dahdi_span_ops callbacks are not called with any spinlocks held, and that the module is pinned in memory, and also passes the struct file * pointer to the callbacks. Passing the file pointer to the callbacks allows the board drivers to check any flags on the file descriptor used to configure the span/channel. The intent here is to allow dahdi_config to open the /dev/dahdi/ctl file in a non-blocking mode in case there is a lengthy processes that needs to happen as part of configuration. Signed-off-by: Shaun Ruffell Acked-by: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9940 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/card_bri.c | 16 ++++++++++------ drivers/dahdi/xpp/card_pri.c | 10 ++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'drivers/dahdi/xpp') diff --git a/drivers/dahdi/xpp/card_bri.c b/drivers/dahdi/xpp/card_bri.c index 7e4ae9a..f3b5565 100644 --- a/drivers/dahdi/xpp/card_bri.c +++ b/drivers/dahdi/xpp/card_bri.c @@ -162,9 +162,11 @@ 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); +static int bri_spanconfig(struct file *file, struct dahdi_span *span, + struct dahdi_lineconfig *lc); +static int bri_chanconfig(struct file *file, struct dahdi_chan *chan, + int sigtype); +static int bri_startup(struct file *file, struct dahdi_span *span); static int bri_shutdown(struct dahdi_span *span); #define PROC_REGISTER_FNAME "slics" @@ -1165,7 +1167,8 @@ static int BRI_card_close(xpd_t *xpd, lineno_t pos) /* * Called only for 'span' keyword in /etc/dahdi/system.conf */ -static int bri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) +static int bri_spanconfig(struct file *file, struct dahdi_span *span, + struct dahdi_lineconfig *lc) { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); @@ -1210,7 +1213,8 @@ static int bri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) * Called from dahdi with spinlock held on chan. Must not call back * dahdi functions. */ -static int bri_chanconfig(struct dahdi_chan *chan, int sigtype) +static int bri_chanconfig(struct file *file, struct dahdi_chan *chan, + int sigtype) { DBG(GENERAL, "channel %d (%s) -> %s\n", chan->channo, chan->name, sig2str(sigtype)); // FIXME: sanity checks: @@ -1222,7 +1226,7 @@ static int bri_chanconfig(struct dahdi_chan *chan, int sigtype) /* * Called only for 'span' keyword in /etc/dahdi/system.conf */ -static int bri_startup(struct dahdi_span *span) +static int bri_startup(struct file *file, struct dahdi_span *span) { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c index a2f755f..8d7e76d 100644 --- a/drivers/dahdi/xpp/card_pri.c +++ b/drivers/dahdi/xpp/card_pri.c @@ -75,7 +75,7 @@ static bool is_sigtype_dchan(int sigtype) static bool pri_packet_is_valid(xpacket_t *pack); static void pri_packet_dump(const char *msg, xpacket_t *pack); -static int pri_startup(struct dahdi_span *span); +static int pri_startup(struct file *file, struct dahdi_span *span); static int pri_shutdown(struct dahdi_span *span); static int pri_rbsbits(struct dahdi_chan *chan, int bits); static int pri_lineconfig(xpd_t *xpd, int lineconfig); @@ -1033,7 +1033,8 @@ bad_lineconfig: * Called only for 'span' keyword in /etc/dahdi/system.conf */ -static int pri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) +static int pri_spanconfig(struct file *file, struct dahdi_span *span, + struct dahdi_lineconfig *lc) { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); @@ -1068,7 +1069,8 @@ static int pri_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc) * Called from dahdi with spinlock held on chan. Must not call back * dahdi functions. */ -static int pri_chanconfig(struct dahdi_chan *chan, int sigtype) +static int pri_chanconfig(struct file *file, struct dahdi_chan *chan, + int sigtype) { struct phonedev *phonedev = container_of(chan->span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); @@ -1455,7 +1457,7 @@ static int PRI_card_close(xpd_t *xpd, lineno_t pos) /* * Called only for 'span' keyword in /etc/dahdi/system.conf */ -static int pri_startup(struct dahdi_span *span) +static int pri_startup(struct file *file, struct dahdi_span *span) { struct phonedev *phonedev = container_of(span, struct phonedev, span); xpd_t *xpd = container_of(phonedev, struct xpd, phonedev); -- cgit v1.2.3