aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/icom.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/serial/icom.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
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 @@
48#include <linux/vmalloc.h> 48#include <linux/vmalloc.h>
49#include <linux/smp.h> 49#include <linux/smp.h>
50#include <linux/spinlock.h> 50#include <linux/spinlock.h>
51#include <linux/kobject.h> 51#include <linux/kref.h>
52#include <linux/firmware.h> 52#include <linux/firmware.h>
53#include <linux/bitops.h> 53#include <linux/bitops.h>
54 54
@@ -65,7 +65,7 @@
65#define ICOM_VERSION_STR "1.3.1" 65#define ICOM_VERSION_STR "1.3.1"
66#define NR_PORTS 128 66#define NR_PORTS 128
67#define ICOM_PORT ((struct icom_port *)port) 67#define ICOM_PORT ((struct icom_port *)port)
68#define to_icom_adapter(d) container_of(d, struct icom_adapter, kobj) 68#define to_icom_adapter(d) container_of(d, struct icom_adapter, kref)
69 69
70static const struct pci_device_id icom_pci_table[] = { 70static const struct pci_device_id icom_pci_table[] = {
71 { 71 {
@@ -141,6 +141,7 @@ static inline void trace(struct icom_port *, char *, unsigned long) {};
141#else 141#else
142static inline void trace(struct icom_port *icom_port, char *trace_pt, unsigned long trace_data) {}; 142static inline void trace(struct icom_port *icom_port, char *trace_pt, unsigned long trace_data) {};
143#endif 143#endif
144static void icom_kref_release(struct kref *kref);
144 145
145static void free_port_memory(struct icom_port *icom_port) 146static void free_port_memory(struct icom_port *icom_port)
146{ 147{
@@ -1063,11 +1064,11 @@ static int icom_open(struct uart_port *port)
1063{ 1064{
1064 int retval; 1065 int retval;
1065 1066
1066 kobject_get(&ICOM_PORT->adapter->kobj); 1067 kref_get(&ICOM_PORT->adapter->kref);
1067 retval = startup(ICOM_PORT); 1068 retval = startup(ICOM_PORT);
1068 1069
1069 if (retval) { 1070 if (retval) {
1070 kobject_put(&ICOM_PORT->adapter->kobj); 1071 kref_put(&ICOM_PORT->adapter->kref, icom_kref_release);
1071 trace(ICOM_PORT, "STARTUP_ERROR", 0); 1072 trace(ICOM_PORT, "STARTUP_ERROR", 0);
1072 return retval; 1073 return retval;
1073 } 1074 }
@@ -1088,7 +1089,7 @@ static void icom_close(struct uart_port *port)
1088 1089
1089 shutdown(ICOM_PORT); 1090 shutdown(ICOM_PORT);
1090 1091
1091 kobject_put(&ICOM_PORT->adapter->kobj); 1092 kref_put(&ICOM_PORT->adapter->kref, icom_kref_release);
1092} 1093}
1093 1094
1094static void icom_set_termios(struct uart_port *port, 1095static void icom_set_termios(struct uart_port *port,
@@ -1485,18 +1486,14 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter)
1485 pci_release_regions(icom_adapter->pci_dev); 1486 pci_release_regions(icom_adapter->pci_dev);
1486} 1487}
1487 1488
1488static void icom_kobj_release(struct kobject *kobj) 1489static void icom_kref_release(struct kref *kref)
1489{ 1490{
1490 struct icom_adapter *icom_adapter; 1491 struct icom_adapter *icom_adapter;
1491 1492
1492 icom_adapter = to_icom_adapter(kobj); 1493 icom_adapter = to_icom_adapter(kref);
1493 icom_remove_adapter(icom_adapter); 1494 icom_remove_adapter(icom_adapter);
1494} 1495}
1495 1496
1496static struct kobj_type icom_kobj_type = {
1497 .release = icom_kobj_release,
1498};
1499
1500static int __devinit icom_probe(struct pci_dev *dev, 1497static int __devinit icom_probe(struct pci_dev *dev,
1501 const struct pci_device_id *ent) 1498 const struct pci_device_id *ent)
1502{ 1499{
@@ -1592,8 +1589,7 @@ static int __devinit icom_probe(struct pci_dev *dev,
1592 } 1589 }
1593 } 1590 }
1594 1591
1595 kobject_init(&icom_adapter->kobj); 1592 kref_init(&icom_adapter->kref);
1596 icom_adapter->kobj.ktype = &icom_kobj_type;
1597 return 0; 1593 return 0;
1598 1594
1599probe_exit2: 1595probe_exit2:
@@ -1619,7 +1615,7 @@ static void __devexit icom_remove(struct pci_dev *dev)
1619 icom_adapter = list_entry(tmp, struct icom_adapter, 1615 icom_adapter = list_entry(tmp, struct icom_adapter,
1620 icom_adapter_entry); 1616 icom_adapter_entry);
1621 if (icom_adapter->pci_dev == dev) { 1617 if (icom_adapter->pci_dev == dev) {
1622 kobject_put(&icom_adapter->kobj); 1618 kref_put(&icom_adapter->kref, icom_kref_release);
1623 return; 1619 return;
1624 } 1620 }
1625 } 1621 }