diff options
author | Oron Peled <oron@actcom.co.il> | 2011-01-30 18:12:02 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-01-30 18:12:02 +0000 |
commit | 7f6f338b8ab432a7ad36fbf6f2b7cf3b95f24bf8 (patch) | |
tree | 19a4f85d1e424708eb99206e3939af6a33d792df | |
parent | aaca5292c564c95d527a97e4ff61763d8b3965dc (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
-rw-r--r-- | drivers/dahdi/xpp/xproto.c | 30 |
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; |