[dahdi-commits] tzafrir: linux/trunk r6637 - /linux/trunk/drivers/dahdi/xpp/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue May 19 09:12:20 CDT 2009
Author: tzafrir
Date: Tue May 19 09:12:15 2009
New Revision: 6637
URL: http://svn.asterisk.org/svn-view/dahdi?view=rev&rev=6637
Log:
Replaece member bus_id with dev_name() and set_dev_name()
As of 2.6.26 the macros dev_name() and set_dev_name() are used to read
and set (respectively) the bus_id member in sysfs. As of 2.6.30 bus_id
is gone. This patch provides comaptiobility macros for older kernel
versions and removes direct usage of bus_id.
(closes issue #14965)
Patches:
xpp_2630_dev_name.diff uploaded by tzafrir (license 46)
Modified:
linux/trunk/drivers/dahdi/xpp/Kbuild
linux/trunk/drivers/dahdi/xpp/card_bri.c
linux/trunk/drivers/dahdi/xpp/card_fxo.c
linux/trunk/drivers/dahdi/xpp/card_fxs.c
linux/trunk/drivers/dahdi/xpp/card_pri.c
linux/trunk/drivers/dahdi/xpp/mmapbus.c
linux/trunk/drivers/dahdi/xpp/mmapdrv.c
linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
linux/trunk/drivers/dahdi/xpp/xdefs.h
Modified: linux/trunk/drivers/dahdi/xpp/Kbuild
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/Kbuild?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/Kbuild (original)
+++ linux/trunk/drivers/dahdi/xpp/Kbuild Tue May 19 09:12:15 2009
@@ -5,6 +5,8 @@
-DPROTOCOL_DEBUG \
-g # -DOLD_PROC
#
+
+WITH_BRISTUFF := $(shell grep -c '^[[:space:]]*\#[[:space:]]*define[[:space:]]\+CONFIG_DAHDI_BRI_DCHANS\>' $(src)/../../../include/dahdi/dahdi_config.h)
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPP) += xpp.o
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_XPD_FXS) += xpd_fxs.o
Modified: linux/trunk/drivers/dahdi/xpp/card_bri.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/card_bri.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_bri.c Tue May 19 09:12:15 2009
@@ -1761,7 +1761,7 @@
/* Is it our device? */
if(xpd->type != XPD_TYPE_BRI) {
XPD_ERR(xpd, "drop suggestion for %s (%d)\n",
- dev->bus_id, xpd->type);
+ dev_name(dev), xpd->type);
return -EINVAL;
}
XPD_DBG(DEVICES, xpd, "SYSFS\n");
Modified: linux/trunk/drivers/dahdi/xpp/card_fxo.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxo.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxo.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxo.c Tue May 19 09:12:15 2009
@@ -1351,7 +1351,7 @@
/* Is it our device? */
if(xpd->type != XPD_TYPE_FXO) {
XPD_ERR(xpd, "drop suggestion for %s (%d)\n",
- dev->bus_id, xpd->type);
+ dev_name(dev), xpd->type);
return -EINVAL;
}
XPD_DBG(DEVICES, xpd, "SYSFS\n");
Modified: linux/trunk/drivers/dahdi/xpp/card_fxs.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/card_fxs.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_fxs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_fxs.c Tue May 19 09:12:15 2009
@@ -1502,7 +1502,7 @@
/* Is it our device? */
if(xpd->type != XPD_TYPE_FXS) {
XPD_ERR(xpd, "drop suggestion for %s (%d)\n",
- dev->bus_id, xpd->type);
+ dev_name(dev), xpd->type);
return -EINVAL;
}
XPD_DBG(DEVICES, xpd, "SYSFS\n");
Modified: linux/trunk/drivers/dahdi/xpp/card_pri.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/card_pri.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_pri.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_pri.c Tue May 19 09:12:15 2009
@@ -2085,7 +2085,7 @@
/* Is it our device? */
if(xpd->type != XPD_TYPE_PRI) {
XPD_ERR(xpd, "drop suggestion for %s (%d)\n",
- dev->bus_id, xpd->type);
+ dev_name(dev), xpd->type);
return -EINVAL;
}
XPD_DBG(DEVICES, xpd, "SYSFS\n");
Modified: linux/trunk/drivers/dahdi/xpp/mmapbus.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/mmapbus.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/mmapbus.c (original)
+++ linux/trunk/drivers/dahdi/xpp/mmapbus.c Tue May 19 09:12:15 2009
@@ -5,7 +5,7 @@
static int mmap_match(struct device *dev, struct device_driver *driver)
{
- return !strncmp(dev->bus_id, driver->name, strlen(driver->name));
+ return !strncmp(dev_name(dev), driver->name, strlen(driver->name));
}
static int mmap_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
{
Modified: linux/trunk/drivers/dahdi/xpp/mmapdrv.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/mmapdrv.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/mmapdrv.c (original)
+++ linux/trunk/drivers/dahdi/xpp/mmapdrv.c Tue May 19 09:12:15 2009
@@ -10,7 +10,7 @@
#include <asm/dma.h>
#include <asm/cacheflush.h>
#include <asm/uaccess.h>
-#include <dahdi.h>
+#include <dahdi/kernel.h>
#include "mmapbus.h"
#include "xbus-core.h"
#include "dahdi_debug.h"
Modified: linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-sysfs.c Tue May 19 09:12:15 2009
@@ -279,7 +279,7 @@
static int astribank_match(struct device *dev, struct device_driver *driver)
{
DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
- dev->bus_id, driver->name);
+ dev_name(dev), driver->name);
return 1;
}
@@ -326,7 +326,7 @@
if(!dev)
return -ENODEV;
xbus = dev_to_xbus(dev);
- DBG(GENERAL, "SYFS bus_id=%s xbus=%s\n", dev->bus_id, xbus->busname);
+ DBG(GENERAL, "SYFS bus_id=%s xbus=%s\n", dev_name(dev), xbus->busname);
XBUS_VAR_BLOCK;
envp[i] = NULL;
return 0;
@@ -348,7 +348,7 @@
if(!dev)
return -ENODEV;
xbus = dev_to_xbus(dev);
- DBG(GENERAL, "SYFS bus_id=%s xbus=%s\n", dev->bus_id, xbus->busname);
+ DBG(GENERAL, "SYFS bus_id=%s xbus=%s\n", dev_name(dev), xbus->busname);
XBUS_VAR_BLOCK;
return 0;
}
@@ -363,7 +363,7 @@
kobj = &xbus->astribank.kobj;
XBUS_DBG(DEVICES, xbus, "SYFS bus_id=%s action=%d\n",
- xbus->astribank.bus_id, act);
+ dev_name(&xbus->astribank), act);
#if defined(OLD_HOTPLUG_SUPPORT_269)
{
@@ -645,7 +645,7 @@
return 0;
}
XPD_DBG(DEVICES, xpd, "SYSFS MATCH: type=%d dev->bus_id = %s, driver->name = %s\n",
- xpd->type, dev->bus_id, driver->name);
+ xpd->type, dev_name(dev), driver->name);
return 1;
}
@@ -701,8 +701,8 @@
XPD_DBG(DEVICES, xpd, "SYSFS\n");
dev->bus = &xpd_type;
dev->parent = &xbus->astribank;
- snprintf(dev->bus_id, BUS_ID_SIZE, "%02d:%1x:%1x",
- xbus->num, xpd->addr.unit, xpd->addr.subunit);
+ dev_set_name(dev, "%02d:%1x:%1x", xbus->num, xpd->addr.unit,
+ xpd->addr.subunit);
dev->driver_data = xpd;
dev->release = xpd_release;
ret = device_register(dev);
@@ -759,7 +759,7 @@
XBUS_DBG(DEVICES, xbus, "\n");
astribank->bus = &toplevel_bus_type;
astribank->parent = xbus->transport.transport_device;
- snprintf(astribank->bus_id, BUS_ID_SIZE, "xbus-%02d", xbus->num);
+ dev_set_name(astribank, "xbus-%02d", xbus->num);
astribank->driver_data = xbus;
astribank->release = astribank_release;
ret = device_register(astribank);
Modified: linux/trunk/drivers/dahdi/xpp/xdefs.h
URL: http://svn.asterisk.org/svn-view/dahdi/linux/trunk/drivers/dahdi/xpp/xdefs.h?view=diff&rev=6637&r1=6636&r2=6637
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xdefs.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xdefs.h Tue May 19 09:12:15 2009
@@ -136,6 +136,12 @@
ssize_t name(struct device *dev, const char *buf, size_t count)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
+#define dev_name(dev) (dev)->bus_id
+#define dev_set_name(dev, format, ...) \
+ snprintf((dev)->bus_id, BUS_ID_SIZE, format, ## __VA_ARGS__);
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
/* Also don't define this for later RHEL >= 5.2 . hex_asc is from the
* same linux-2.6-net-infrastructure-updates-to-mac80211-iwl4965.patch
More information about the dahdi-commits
mailing list