aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/icom.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-03 23:16:20 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:09 -0500
commit15f2bbb28e96e20149548926e5b08551ba140b14 (patch)
tree57a669fb31fb573545ef88427f33fa24547fcdf1 /drivers/serial/icom.c
parentf7eb12c626d4375faf03039261546bd19c1325fd (diff)
kobject: convert icom to use kref, not kobject
The IBM icom serial driver is using a kobject only for reference counting, nothing else. So switch it to use a kref instead, which is all that is needed, and is much smaller. Cc: Anton Blanchard <anton@au.ibm.com> Cc: Paul Mackerras <paulus@au.ibm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Ryan S. Arnold <rsa@us.ibm.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 }