aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/icom.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 08:34:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 08:35:13 -0800
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/serial/icom.c
parentslab: fix bootstrap on memoryless node (diff)
parentDriver core: coding style fixes (diff)
downloadlinux-dev-df8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e.tar.xz
linux-dev-df8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'drivers/serial/icom.c')
-rw-r--r--drivers/serial/icom.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index 9d3105b64a7a..9c2df5c857cf 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -48,7 +48,7 @@
#include <linux/vmalloc.h>
#include <linux/smp.h>
#include <linux/spinlock.h>
-#include <linux/kobject.h>
+#include <linux/kref.h>
#include <linux/firmware.h>
#include <linux/bitops.h>
@@ -65,7 +65,7 @@
#define ICOM_VERSION_STR "1.3.1"
#define NR_PORTS 128
#define ICOM_PORT ((struct icom_port *)port)
-#define to_icom_adapter(d) container_of(d, struct icom_adapter, kobj)
+#define to_icom_adapter(d) container_of(d, struct icom_adapter, kref)
static const struct pci_device_id icom_pci_table[] = {
{
@@ -141,6 +141,7 @@ static inline void trace(struct icom_port *, char *, unsigned long) {};
#else
static inline void trace(struct icom_port *icom_port, char *trace_pt, unsigned long trace_data) {};
#endif
+static void icom_kref_release(struct kref *kref);
static void free_port_memory(struct icom_port *icom_port)
{
@@ -1063,11 +1064,11 @@ static int icom_open(struct uart_port *port)
{
int retval;
- kobject_get(&ICOM_PORT->adapter->kobj);
+ kref_get(&ICOM_PORT->adapter->kref);
retval = startup(ICOM_PORT);
if (retval) {
- kobject_put(&ICOM_PORT->adapter->kobj);
+ kref_put(&ICOM_PORT->adapter->kref, icom_kref_release);
trace(ICOM_PORT, "STARTUP_ERROR", 0);
return retval;
}
@@ -1088,7 +1089,7 @@ static void icom_close(struct uart_port *port)
shutdown(ICOM_PORT);
- kobject_put(&ICOM_PORT->adapter->kobj);
+ kref_put(&ICOM_PORT->adapter->kref, icom_kref_release);
}
static void icom_set_termios(struct uart_port *port,
@@ -1485,18 +1486,14 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter)
pci_release_regions(icom_adapter->pci_dev);
}
-static void icom_kobj_release(struct kobject *kobj)
+static void icom_kref_release(struct kref *kref)
{
struct icom_adapter *icom_adapter;
- icom_adapter = to_icom_adapter(kobj);
+ icom_adapter = to_icom_adapter(kref);
icom_remove_adapter(icom_adapter);
}
-static struct kobj_type icom_kobj_type = {
- .release = icom_kobj_release,
-};
-
static int __devinit icom_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
@@ -1592,8 +1589,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
}
}
- kobject_init(&icom_adapter->kobj);
- icom_adapter->kobj.ktype = &icom_kobj_type;
+ kref_init(&icom_adapter->kref);
return 0;
probe_exit2:
@@ -1619,7 +1615,7 @@ static void __devexit icom_remove(struct pci_dev *dev)
icom_adapter = list_entry(tmp, struct icom_adapter,
icom_adapter_entry);
if (icom_adapter->pci_dev == dev) {
- kobject_put(&icom_adapter->kobj);
+ kref_put(&icom_adapter->kref, icom_kref_release);
return;
}
}