summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xproto.c
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-30 18:12:02 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-01-30 18:12:02 +0000
commit210720d9e0efb8db37a5171a8e755997d07eda73 (patch)
tree19a4f85d1e424708eb99206e3939af6a33d792df /drivers/dahdi/xpp/xproto.c
parenta08ef925e7fd28fd18d48313bcfb048851600b57 (diff)
xpp: Add fixed runtime checks for the PHONEDEV code
Signed-off-by: Oron Peled <oron@actcom.co.il> Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9710 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xproto.c')
-rw-r--r--drivers/dahdi/xpp/xproto.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/dahdi/xpp/xproto.c b/drivers/dahdi/xpp/xproto.c
index afc6be5..570fd85 100644
--- a/drivers/dahdi/xpp/xproto.c
+++ b/drivers/dahdi/xpp/xproto.c
@@ -420,11 +420,18 @@ const char *xproto_name(xpd_type_t xpd_type)
return -EINVAL; \
}
+#define CHECK_PHONEOP(phoneops, f) \
+ if(!(phoneops)->f) { \
+ ERR("%s: missing phone method %s [%s (%d)]\n", __FUNCTION__, #f, name, type); \
+ return -EINVAL; \
+ }
+
int xproto_register(const xproto_table_t *proto_table)
{
int type;
const char *name;
const struct xops *xops;
+ const struct phoneops *phoneops;
BUG_ON(!proto_table);
type = proto_table->type;
@@ -441,17 +448,18 @@ int xproto_register(const xproto_table_t *proto_table)
CHECK_XOP(xops, card_init);
CHECK_XOP(xops, card_remove);
CHECK_XOP(xops, card_tick);
-#if 0
- /* FIXME: check PHONE_METHOD() */
- CHECK_XOP(card_pcm_recompute);
- CHECK_XOP(card_pcm_fromspan);
- CHECK_XOP(card_pcm_tospan);
- CHECK_XOP(card_dahdi_preregistration);
- CHECK_XOP(card_dahdi_postregistration);
- // CHECK_XOP(card_ioctl); // optional method -- call after testing
- CHECK_XOP(card_register_reply);
- CHECK_XOP(XPD_STATE);
-#endif
+ CHECK_XOP(xops, card_register_reply);
+
+ phoneops = proto_table->phoneops;
+ if (phoneops) {
+ CHECK_PHONEOP(phoneops, card_pcm_recompute);
+ CHECK_PHONEOP(phoneops, card_pcm_fromspan);
+ CHECK_PHONEOP(phoneops, card_pcm_tospan);
+ CHECK_PHONEOP(phoneops, card_dahdi_preregistration);
+ CHECK_PHONEOP(phoneops, card_dahdi_postregistration);
+ /* optional method -- call after testing: */
+ /*CHECK_PHONEOP(phoneops, card_ioctl);*/
+ }
xprotocol_tables[type] = proto_table;
return 0;