From 1a5c5df3dd49acdda584802aa1b7e0cc32476066 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Wed, 27 May 2009 13:02:44 +0000 Subject: xpp: 'owner' property of procfs was dropped in 2.6.30. This adds a compatibility macro for older versions that is a noop for kernels >= 2.6.30. From dahdi-linux r6642, r6659 , regarding issue #14964 . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4648 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- kernel/xpp/card_bri.c | 2 +- kernel/xpp/card_fxo.c | 4 ++-- kernel/xpp/card_fxs.c | 4 ++-- kernel/xpp/card_global.c | 2 +- kernel/xpp/card_pri.c | 2 +- kernel/xpp/xbus-core.c | 8 ++++---- kernel/xpp/xdefs.h | 5 +++++ kernel/xpp/xpp_usb.c | 2 +- kernel/xpp/xpp_zap.c | 6 +++--- 9 files changed, 20 insertions(+), 15 deletions(-) diff --git a/kernel/xpp/card_bri.c b/kernel/xpp/card_bri.c index 7c344af..d4698d9 100644 --- a/kernel/xpp/card_bri.c +++ b/kernel/xpp/card_bri.c @@ -799,7 +799,7 @@ static int bri_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_BRI_INFO_FNAME); goto err; } - priv->bri_info->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->bri_info); #endif return 0; err: diff --git a/kernel/xpp/card_fxo.c b/kernel/xpp/card_fxo.c index 3ad8b7a..bc6b61d 100644 --- a/kernel/xpp/card_fxo.c +++ b/kernel/xpp/card_fxo.c @@ -411,7 +411,7 @@ static int fxo_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXO_INFO_FNAME); goto err; } - priv->fxo_info->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->fxo_info); #ifdef WITH_METERING XPD_DBG(PROC, xpd, "Creating Metering tone file\n"); priv->meteringfile = create_proc_read_entry(PROC_METERING_FNAME, 0444, xpd->proc_xpd_dir, @@ -420,7 +420,7 @@ static int fxo_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); goto err; } - priv->meteringfile->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->meteringfile); #endif #endif return 0; diff --git a/kernel/xpp/card_fxs.c b/kernel/xpp/card_fxs.c index b7bcdd2..450539a 100644 --- a/kernel/xpp/card_fxs.c +++ b/kernel/xpp/card_fxs.c @@ -358,7 +358,7 @@ static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_FXS_INFO_FNAME); goto err; } - priv->fxs_info->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->fxs_info); #ifdef WITH_METERING XPD_DBG(PROC, xpd, "Creating Metering tone file\n"); priv->meteringfile = create_proc_entry(PROC_METERING_FNAME, 0200, xpd->proc_xpd_dir); @@ -366,7 +366,7 @@ static int fxs_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_METERING_FNAME); goto err; } - priv->meteringfile->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->meteringfile); priv->meteringfile->write_proc = proc_xpd_metering_write; priv->meteringfile->read_proc = NULL; priv->meteringfile->data = xpd; diff --git a/kernel/xpp/card_global.c b/kernel/xpp/card_global.c index 14cf02c..ce3e4f6 100644 --- a/kernel/xpp/card_global.c +++ b/kernel/xpp/card_global.c @@ -402,7 +402,7 @@ int chip_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", CHIP_REGISTERS); goto err; } - xpd->proc_xpd_chipregs->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->proc_xpd_chipregs); xpd->proc_xpd_chipregs->write_proc = proc_xpd_register_write; xpd->proc_xpd_chipregs->read_proc = proc_xpd_register_read; xpd->proc_xpd_chipregs->data = xpd; diff --git a/kernel/xpp/card_pri.c b/kernel/xpp/card_pri.c index 8760cf8..c018bcf 100644 --- a/kernel/xpp/card_pri.c +++ b/kernel/xpp/card_pri.c @@ -421,7 +421,7 @@ static int pri_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc '%s'\n", PROC_PRI_INFO_FNAME); goto err; } - priv->pri_info->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(priv->pri_info); priv->pri_info->write_proc = proc_pri_info_write; priv->pri_info->read_proc = proc_pri_info_read; priv->pri_info->data = xpd; diff --git a/kernel/xpp/xbus-core.c b/kernel/xpp/xbus-core.c index 68fc617..89ac287 100644 --- a/kernel/xpp/xbus-core.c +++ b/kernel/xpp/xbus-core.c @@ -1087,7 +1087,7 @@ static struct xbus_workqueue *worker_new(int xbusno) XBUS_ERR(xbus, "Failed to create proc file '%s'\n", PROC_XBUS_WAITFOR_XPDS); goto err; } - worker->proc_xbus_waitfor_xpds->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(worker->proc_xbus_waitfor_xpds); } #endif #endif @@ -1398,7 +1398,7 @@ xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, struct device *tran err = -EIO; goto nobus; } - xbus->proc_xbus_summary->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(xbus->proc_xbus_summary); #ifdef PROTOCOL_DEBUG xbus->proc_xbus_command = create_proc_entry(PROC_XBUS_COMMAND, 0200, xbus->proc_xbus_dir); if (!xbus->proc_xbus_command) { @@ -1408,7 +1408,7 @@ xbus_t *xbus_new(struct xbus_ops *ops, ushort max_send_size, struct device *tran } xbus->proc_xbus_command->write_proc = proc_xbus_command_write; xbus->proc_xbus_command->data = xbus; - xbus->proc_xbus_command->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(xbus->proc_xbus_command); #endif #endif #ifdef XPP_DEBUGFS @@ -1857,7 +1857,7 @@ int __init xbus_core_init(void) ret = -EFAULT; goto err; } - proc_xbuses->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(proc_xbuses); #endif #ifdef XPP_DEBUGFS DBG(GENERAL, "Creating debugfs xpp root\n"); diff --git a/kernel/xpp/xdefs.h b/kernel/xpp/xdefs.h index 9fe821d..1aadbe5 100644 --- a/kernel/xpp/xdefs.h +++ b/kernel/xpp/xdefs.h @@ -123,6 +123,11 @@ typedef unsigned char byte; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) #define OLD_HOTPLUG_SUPPORT_269// for way older kernels #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) +#define SET_PROC_DIRENTRY_OWNER(p) do { (p)->owner = THIS_MODULE; } while(0); +#else +#define SET_PROC_DIRENTRY_OWNER(p) do { } while(0); +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) #define DEVICE_ATTR_READER(name,dev,buf) \ diff --git a/kernel/xpp/xpp_usb.c b/kernel/xpp/xpp_usb.c index 0d6d16a..525f777 100644 --- a/kernel/xpp/xpp_usb.c +++ b/kernel/xpp/xpp_usb.c @@ -755,7 +755,7 @@ static int xusb_probe(struct usb_interface *interface, const struct usb_device_i retval = -EIO; goto probe_failed; } - procsummary->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(procsummary); #endif bus_count++; xusb->xbus_num = xbus->num; diff --git a/kernel/xpp/xpp_zap.c b/kernel/xpp/xpp_zap.c index b324cfa..f99c4fe 100644 --- a/kernel/xpp/xpp_zap.c +++ b/kernel/xpp/xpp_zap.c @@ -190,14 +190,14 @@ static int xpd_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_SUMMARY); goto err; } - xpd->proc_xpd_summary->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(xpd->proc_xpd_summary); #ifdef OLD_PROC xpd->proc_xpd_ztregister = create_proc_entry(PROC_XPD_ZTREGISTER, 0644, xpd->proc_xpd_dir); if (!xpd->proc_xpd_ztregister) { XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_ZTREGISTER); goto err; } - xpd->proc_xpd_ztregister->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(xpd->proc_xpd_ztregister); xpd->proc_xpd_ztregister->data = xpd; xpd->proc_xpd_ztregister->read_proc = proc_xpd_ztregister_read; xpd->proc_xpd_ztregister->write_proc = proc_xpd_ztregister_write; @@ -206,7 +206,7 @@ static int xpd_proc_create(xbus_t *xbus, xpd_t *xpd) XPD_ERR(xpd, "Failed to create proc file '%s'\n", PROC_XPD_BLINK); goto err; } - xpd->proc_xpd_blink->owner = THIS_MODULE; + SET_PROC_DIRENTRY_OWNER(xpd->proc_xpd_blink); xpd->proc_xpd_blink->data = xpd; xpd->proc_xpd_blink->read_proc = proc_xpd_blink_read; xpd->proc_xpd_blink->write_proc = proc_xpd_blink_write; -- cgit v1.2.3