aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pcmcia/cs.c34
-rw-r--r--drivers/pcmcia/cs_internal.h4
-rw-r--r--drivers/pcmcia/ds.c14
-rw-r--r--drivers/pcmcia/i82092.c2
-rw-r--r--drivers/pcmcia/i82365.c2
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c1
-rw-r--r--drivers/pcmcia/pcmcia_resource.c1
-rw-r--r--drivers/pcmcia/pd6729.c2
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c56
-rw-r--r--drivers/pcmcia/soc_common.c6
-rw-r--r--drivers/pcmcia/socket_sysfs.c104
-rw-r--r--drivers/pcmcia/tcic.c2
-rw-r--r--drivers/pcmcia/yenta_socket.c2
-rw-r--r--include/pcmcia/ss.h2
14 files changed, 127 insertions, 105 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 606a46740338..ac004248324a 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -110,7 +110,7 @@ int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state)
110 110
111 down_read(&pcmcia_socket_list_rwsem); 111 down_read(&pcmcia_socket_list_rwsem);
112 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { 112 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
113 if (socket->dev.dev != dev) 113 if (socket->dev.parent != dev)
114 continue; 114 continue;
115 mutex_lock(&socket->skt_mutex); 115 mutex_lock(&socket->skt_mutex);
116 socket_suspend(socket); 116 socket_suspend(socket);
@@ -128,7 +128,7 @@ int pcmcia_socket_dev_resume(struct device *dev)
128 128
129 down_read(&pcmcia_socket_list_rwsem); 129 down_read(&pcmcia_socket_list_rwsem);
130 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) { 130 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
131 if (socket->dev.dev != dev) 131 if (socket->dev.parent != dev)
132 continue; 132 continue;
133 mutex_lock(&socket->skt_mutex); 133 mutex_lock(&socket->skt_mutex);
134 socket_resume(socket); 134 socket_resume(socket);
@@ -143,12 +143,12 @@ EXPORT_SYMBOL(pcmcia_socket_dev_resume);
143 143
144struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt) 144struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt)
145{ 145{
146 struct class_device *cl_dev = class_device_get(&skt->dev); 146 struct device *dev = get_device(&skt->dev);
147 if (!cl_dev) 147 if (!dev)
148 return NULL; 148 return NULL;
149 skt = class_get_devdata(cl_dev); 149 skt = dev_get_drvdata(dev);
150 if (!try_module_get(skt->owner)) { 150 if (!try_module_get(skt->owner)) {
151 class_device_put(&skt->dev); 151 put_device(&skt->dev);
152 return NULL; 152 return NULL;
153 } 153 }
154 return (skt); 154 return (skt);
@@ -159,14 +159,14 @@ EXPORT_SYMBOL(pcmcia_get_socket);
159void pcmcia_put_socket(struct pcmcia_socket *skt) 159void pcmcia_put_socket(struct pcmcia_socket *skt)
160{ 160{
161 module_put(skt->owner); 161 module_put(skt->owner);
162 class_device_put(&skt->dev); 162 put_device(&skt->dev);
163} 163}
164EXPORT_SYMBOL(pcmcia_put_socket); 164EXPORT_SYMBOL(pcmcia_put_socket);
165 165
166 166
167static void pcmcia_release_socket(struct class_device *class_dev) 167static void pcmcia_release_socket(struct device *dev)
168{ 168{
169 struct pcmcia_socket *socket = class_get_devdata(class_dev); 169 struct pcmcia_socket *socket = dev_get_drvdata(dev);
170 170
171 complete(&socket->socket_released); 171 complete(&socket->socket_released);
172} 172}
@@ -181,7 +181,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
181 struct task_struct *tsk; 181 struct task_struct *tsk;
182 int ret; 182 int ret;
183 183
184 if (!socket || !socket->ops || !socket->dev.dev || !socket->resource_ops) 184 if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops)
185 return -EINVAL; 185 return -EINVAL;
186 186
187 cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); 187 cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops);
@@ -226,9 +226,9 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
226#endif 226#endif
227 227
228 /* set proper values in socket->dev */ 228 /* set proper values in socket->dev */
229 socket->dev.class_data = socket; 229 dev_set_drvdata(&socket->dev, socket);
230 socket->dev.class = &pcmcia_socket_class; 230 socket->dev.class = &pcmcia_socket_class;
231 snprintf(socket->dev.class_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock); 231 snprintf(socket->dev.bus_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock);
232 232
233 /* base address = 0, map = 0 */ 233 /* base address = 0, map = 0 */
234 socket->cis_mem.flags = 0; 234 socket->cis_mem.flags = 0;
@@ -640,7 +640,7 @@ static int pccardd(void *__skt)
640 skt->ops->set_socket(skt, &skt->socket); 640 skt->ops->set_socket(skt, &skt->socket);
641 641
642 /* register with the device core */ 642 /* register with the device core */
643 ret = class_device_register(&skt->dev); 643 ret = device_register(&skt->dev);
644 if (ret) { 644 if (ret) {
645 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", 645 printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n",
646 skt); 646 skt);
@@ -689,7 +689,7 @@ static int pccardd(void *__skt)
689 remove_wait_queue(&skt->thread_wait, &wait); 689 remove_wait_queue(&skt->thread_wait, &wait);
690 690
691 /* remove from the device core */ 691 /* remove from the device core */
692 class_device_unregister(&skt->dev); 692 device_unregister(&skt->dev);
693 693
694 return 0; 694 return 0;
695} 695}
@@ -904,7 +904,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt)
904EXPORT_SYMBOL(pcmcia_insert_card); 904EXPORT_SYMBOL(pcmcia_insert_card);
905 905
906 906
907static int pcmcia_socket_uevent(struct class_device *dev, char **envp, 907static int pcmcia_socket_uevent(struct device *dev, char **envp,
908 int num_envp, char *buffer, int buffer_size) 908 int num_envp, char *buffer, int buffer_size)
909{ 909{
910 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev); 910 struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev);
@@ -930,8 +930,8 @@ static void pcmcia_release_socket_class(struct class *data)
930 930
931struct class pcmcia_socket_class = { 931struct class pcmcia_socket_class = {
932 .name = "pcmcia_socket", 932 .name = "pcmcia_socket",
933 .uevent = pcmcia_socket_uevent, 933 .dev_uevent = pcmcia_socket_uevent,
934 .release = pcmcia_release_socket, 934 .dev_release = pcmcia_release_socket,
935 .class_release = pcmcia_release_socket_class, 935 .class_release = pcmcia_release_socket_class,
936}; 936};
937EXPORT_SYMBOL(pcmcia_socket_class); 937EXPORT_SYMBOL(pcmcia_socket_class);
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index f573ea04db6f..9fa207e3c7b3 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -142,7 +142,7 @@ struct pcmcia_callback{
142 142
143int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 143int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
144 144
145#define cs_socket_name(skt) ((skt)->dev.class_id) 145#define cs_socket_name(skt) ((skt)->dev.bus_id)
146 146
147#ifdef DEBUG 147#ifdef DEBUG
148extern int cs_debug_level(int); 148extern int cs_debug_level(int);
@@ -158,6 +158,6 @@ extern int cs_debug_level(int);
158#endif 158#endif
159 159
160#define cs_err(skt, fmt, arg...) \ 160#define cs_err(skt, fmt, arg...) \
161 printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.class_id , ## arg) 161 printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.bus_id , ## arg)
162 162
163#endif /* _LINUX_CS_INTERNAL_H */ 163#endif /* _LINUX_CS_INTERNAL_H */
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 7355eb455a88..18e111e12339 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -572,7 +572,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
572 p_dev->func = function; 572 p_dev->func = function;
573 573
574 p_dev->dev.bus = &pcmcia_bus_type; 574 p_dev->dev.bus = &pcmcia_bus_type;
575 p_dev->dev.parent = s->dev.dev; 575 p_dev->dev.parent = s->dev.parent;
576 p_dev->dev.release = pcmcia_release_dev; 576 p_dev->dev.release = pcmcia_release_dev;
577 bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no); 577 bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no);
578 578
@@ -1328,10 +1328,10 @@ static struct pcmcia_callback pcmcia_bus_callback = {
1328 .resume = pcmcia_bus_resume, 1328 .resume = pcmcia_bus_resume,
1329}; 1329};
1330 1330
1331static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev, 1331static int __devinit pcmcia_bus_add_socket(struct device *dev,
1332 struct class_interface *class_intf) 1332 struct class_interface *class_intf)
1333{ 1333{
1334 struct pcmcia_socket *socket = class_get_devdata(class_dev); 1334 struct pcmcia_socket *socket = dev_get_drvdata(dev);
1335 int ret; 1335 int ret;
1336 1336
1337 socket = pcmcia_get_socket(socket); 1337 socket = pcmcia_get_socket(socket);
@@ -1364,10 +1364,10 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev,
1364 return 0; 1364 return 0;
1365} 1365}
1366 1366
1367static void pcmcia_bus_remove_socket(struct class_device *class_dev, 1367static void pcmcia_bus_remove_socket(struct device *dev,
1368 struct class_interface *class_intf) 1368 struct class_interface *class_intf)
1369{ 1369{
1370 struct pcmcia_socket *socket = class_get_devdata(class_dev); 1370 struct pcmcia_socket *socket = dev_get_drvdata(dev);
1371 1371
1372 if (!socket) 1372 if (!socket)
1373 return; 1373 return;
@@ -1389,8 +1389,8 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev,
1389/* the pcmcia_bus_interface is used to handle pcmcia socket devices */ 1389/* the pcmcia_bus_interface is used to handle pcmcia socket devices */
1390static struct class_interface pcmcia_bus_interface = { 1390static struct class_interface pcmcia_bus_interface = {
1391 .class = &pcmcia_socket_class, 1391 .class = &pcmcia_socket_class,
1392 .add = &pcmcia_bus_add_socket, 1392 .add_dev = &pcmcia_bus_add_socket,
1393 .remove = &pcmcia_bus_remove_socket, 1393 .remove_dev = &pcmcia_bus_remove_socket,
1394}; 1394};
1395 1395
1396 1396
diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
index c2ea07aa7a12..df21e2d16f87 100644
--- a/drivers/pcmcia/i82092.c
+++ b/drivers/pcmcia/i82092.c
@@ -161,7 +161,7 @@ static int __devinit i82092aa_pci_probe(struct pci_dev *dev, const struct pci_de
161 pci_set_drvdata(dev, &sockets[i].socket); 161 pci_set_drvdata(dev, &sockets[i].socket);
162 162
163 for (i = 0; i<socket_count; i++) { 163 for (i = 0; i<socket_count; i++) {
164 sockets[i].socket.dev.dev = &dev->dev; 164 sockets[i].socket.dev.parent = &dev->dev;
165 sockets[i].socket.ops = &i82092aa_operations; 165 sockets[i].socket.ops = &i82092aa_operations;
166 sockets[i].socket.resource_ops = &pccard_nonstatic_ops; 166 sockets[i].socket.resource_ops = &pccard_nonstatic_ops;
167 ret = pcmcia_register_socket(&sockets[i].socket); 167 ret = pcmcia_register_socket(&sockets[i].socket);
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index ea74f98a7350..72ff2f615b33 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -1298,7 +1298,7 @@ static int __init init_i82365(void)
1298 1298
1299 /* register sockets with the pcmcia core */ 1299 /* register sockets with the pcmcia core */
1300 for (i = 0; i < sockets; i++) { 1300 for (i = 0; i < sockets; i++) {
1301 socket[i].socket.dev.dev = &i82365_device->dev; 1301 socket[i].socket.dev.parent = &i82365_device->dev;
1302 socket[i].socket.ops = &pcic_operations; 1302 socket[i].socket.ops = &pcic_operations;
1303 socket[i].socket.resource_ops = &pccard_nonstatic_ops; 1303 socket[i].socket.resource_ops = &pccard_nonstatic_ops;
1304 socket[i].socket.owner = THIS_MODULE; 1304 socket[i].socket.owner = THIS_MODULE;
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 327372b7a54e..88494149e910 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -59,7 +59,6 @@ typedef struct user_info_t {
59 59
60#ifdef DEBUG 60#ifdef DEBUG
61extern int ds_pc_debug; 61extern int ds_pc_debug;
62#define cs_socket_name(skt) ((skt)->dev.class_id)
63 62
64#define ds_dbg(lvl, fmt, arg...) do { \ 63#define ds_dbg(lvl, fmt, arg...) do { \
65 if (ds_pc_debug >= lvl) \ 64 if (ds_pc_debug >= lvl) \
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index b9201c2ec38b..0ce39de834c4 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -48,7 +48,6 @@ static u8 pcmcia_used_irq[NR_IRQS];
48 48
49#ifdef DEBUG 49#ifdef DEBUG
50extern int ds_pc_debug; 50extern int ds_pc_debug;
51#define cs_socket_name(skt) ((skt)->dev.class_id)
52 51
53#define ds_dbg(skt, lvl, fmt, arg...) do { \ 52#define ds_dbg(skt, lvl, fmt, arg...) do { \
54 if (ds_pc_debug >= lvl) \ 53 if (ds_pc_debug >= lvl) \
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 360c24896548..dd0ddf19ee57 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -682,7 +682,7 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
682 682
683 socket[i].socket.ops = &pd6729_operations; 683 socket[i].socket.ops = &pd6729_operations;
684 socket[i].socket.resource_ops = &pccard_nonstatic_ops; 684 socket[i].socket.resource_ops = &pccard_nonstatic_ops;
685 socket[i].socket.dev.dev = &dev->dev; 685 socket[i].socket.dev.parent = &dev->dev;
686 socket[i].socket.driver_data = &socket[i]; 686 socket[i].socket.driver_data = &socket[i];
687 } 687 }
688 688
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index c3176b16b7be..bfcaad6021cf 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -616,7 +616,7 @@ static int nonstatic_adjust_io_region(struct resource *res, unsigned long r_star
616static struct resource *nonstatic_find_io_region(unsigned long base, int num, 616static struct resource *nonstatic_find_io_region(unsigned long base, int num,
617 unsigned long align, struct pcmcia_socket *s) 617 unsigned long align, struct pcmcia_socket *s)
618{ 618{
619 struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.class_id); 619 struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.bus_id);
620 struct socket_data *s_data = s->resource_data; 620 struct socket_data *s_data = s->resource_data;
621 struct pcmcia_align_data data; 621 struct pcmcia_align_data data;
622 unsigned long min = base; 622 unsigned long min = base;
@@ -650,7 +650,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num,
650static struct resource * nonstatic_find_mem_region(u_long base, u_long num, 650static struct resource * nonstatic_find_mem_region(u_long base, u_long num,
651 u_long align, int low, struct pcmcia_socket *s) 651 u_long align, int low, struct pcmcia_socket *s)
652{ 652{
653 struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.class_id); 653 struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.bus_id);
654 struct socket_data *s_data = s->resource_data; 654 struct socket_data *s_data = s->resource_data;
655 struct pcmcia_align_data data; 655 struct pcmcia_align_data data;
656 unsigned long min, max; 656 unsigned long min, max;
@@ -897,9 +897,10 @@ EXPORT_SYMBOL(pccard_nonstatic_ops);
897 897
898/* sysfs interface to the resource database */ 898/* sysfs interface to the resource database */
899 899
900static ssize_t show_io_db(struct class_device *class_dev, char *buf) 900static ssize_t show_io_db(struct device *dev,
901 struct device_attribute *attr, char *buf)
901{ 902{
902 struct pcmcia_socket *s = class_get_devdata(class_dev); 903 struct pcmcia_socket *s = dev_get_drvdata(dev);
903 struct socket_data *data; 904 struct socket_data *data;
904 struct resource_map *p; 905 struct resource_map *p;
905 ssize_t ret = 0; 906 ssize_t ret = 0;
@@ -920,9 +921,11 @@ static ssize_t show_io_db(struct class_device *class_dev, char *buf)
920 return (ret); 921 return (ret);
921} 922}
922 923
923static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size_t count) 924static ssize_t store_io_db(struct device *dev,
925 struct device_attribute *attr,
926 const char *buf, size_t count)
924{ 927{
925 struct pcmcia_socket *s = class_get_devdata(class_dev); 928 struct pcmcia_socket *s = dev_get_drvdata(dev);
926 unsigned long start_addr, end_addr; 929 unsigned long start_addr, end_addr;
927 unsigned int add = ADD_MANAGED_RESOURCE; 930 unsigned int add = ADD_MANAGED_RESOURCE;
928 ssize_t ret = 0; 931 ssize_t ret = 0;
@@ -947,11 +950,12 @@ static ssize_t store_io_db(struct class_device *class_dev, const char *buf, size
947 950
948 return ret ? ret : count; 951 return ret ? ret : count;
949} 952}
950static CLASS_DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db); 953static DEVICE_ATTR(available_resources_io, 0600, show_io_db, store_io_db);
951 954
952static ssize_t show_mem_db(struct class_device *class_dev, char *buf) 955static ssize_t show_mem_db(struct device *dev,
956 struct device_attribute *attr, char *buf)
953{ 957{
954 struct pcmcia_socket *s = class_get_devdata(class_dev); 958 struct pcmcia_socket *s = dev_get_drvdata(dev);
955 struct socket_data *data; 959 struct socket_data *data;
956 struct resource_map *p; 960 struct resource_map *p;
957 ssize_t ret = 0; 961 ssize_t ret = 0;
@@ -972,9 +976,11 @@ static ssize_t show_mem_db(struct class_device *class_dev, char *buf)
972 return (ret); 976 return (ret);
973} 977}
974 978
975static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, size_t count) 979static ssize_t store_mem_db(struct device *dev,
980 struct device_attribute *attr,
981 const char *buf, size_t count)
976{ 982{
977 struct pcmcia_socket *s = class_get_devdata(class_dev); 983 struct pcmcia_socket *s = dev_get_drvdata(dev);
978 unsigned long start_addr, end_addr; 984 unsigned long start_addr, end_addr;
979 unsigned int add = ADD_MANAGED_RESOURCE; 985 unsigned int add = ADD_MANAGED_RESOURCE;
980 ssize_t ret = 0; 986 ssize_t ret = 0;
@@ -999,25 +1005,25 @@ static ssize_t store_mem_db(struct class_device *class_dev, const char *buf, siz
999 1005
1000 return ret ? ret : count; 1006 return ret ? ret : count;
1001} 1007}
1002static CLASS_DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db); 1008static DEVICE_ATTR(available_resources_mem, 0600, show_mem_db, store_mem_db);
1003 1009
1004static struct class_device_attribute *pccard_rsrc_attributes[] = { 1010static struct device_attribute *pccard_rsrc_attributes[] = {
1005 &class_device_attr_available_resources_io, 1011 &dev_attr_available_resources_io,
1006 &class_device_attr_available_resources_mem, 1012 &dev_attr_available_resources_mem,
1007 NULL, 1013 NULL,
1008}; 1014};
1009 1015
1010static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev, 1016static int __devinit pccard_sysfs_add_rsrc(struct device *dev,
1011 struct class_interface *class_intf) 1017 struct class_interface *class_intf)
1012{ 1018{
1013 struct pcmcia_socket *s = class_get_devdata(class_dev); 1019 struct pcmcia_socket *s = dev_get_drvdata(dev);
1014 struct class_device_attribute **attr; 1020 struct device_attribute **attr;
1015 int ret = 0; 1021 int ret = 0;
1016 if (s->resource_ops != &pccard_nonstatic_ops) 1022 if (s->resource_ops != &pccard_nonstatic_ops)
1017 return 0; 1023 return 0;
1018 1024
1019 for (attr = pccard_rsrc_attributes; *attr; attr++) { 1025 for (attr = pccard_rsrc_attributes; *attr; attr++) {
1020 ret = class_device_create_file(class_dev, *attr); 1026 ret = device_create_file(dev, *attr);
1021 if (ret) 1027 if (ret)
1022 break; 1028 break;
1023 } 1029 }
@@ -1025,23 +1031,23 @@ static int __devinit pccard_sysfs_add_rsrc(struct class_device *class_dev,
1025 return ret; 1031 return ret;
1026} 1032}
1027 1033
1028static void __devexit pccard_sysfs_remove_rsrc(struct class_device *class_dev, 1034static void __devexit pccard_sysfs_remove_rsrc(struct device *dev,
1029 struct class_interface *class_intf) 1035 struct class_interface *class_intf)
1030{ 1036{
1031 struct pcmcia_socket *s = class_get_devdata(class_dev); 1037 struct pcmcia_socket *s = dev_get_drvdata(dev);
1032 struct class_device_attribute **attr; 1038 struct device_attribute **attr;
1033 1039
1034 if (s->resource_ops != &pccard_nonstatic_ops) 1040 if (s->resource_ops != &pccard_nonstatic_ops)
1035 return; 1041 return;
1036 1042
1037 for (attr = pccard_rsrc_attributes; *attr; attr++) 1043 for (attr = pccard_rsrc_attributes; *attr; attr++)
1038 class_device_remove_file(class_dev, *attr); 1044 device_remove_file(dev, *attr);
1039} 1045}
1040 1046
1041static struct class_interface pccard_rsrc_interface = { 1047static struct class_interface pccard_rsrc_interface = {
1042 .class = &pcmcia_socket_class, 1048 .class = &pcmcia_socket_class,
1043 .add = &pccard_sysfs_add_rsrc, 1049 .add_dev = &pccard_sysfs_add_rsrc,
1044 .remove = __devexit_p(&pccard_sysfs_remove_rsrc), 1050 .remove_dev = __devexit_p(&pccard_sysfs_remove_rsrc),
1045}; 1051};
1046 1052
1047static int __init nonstatic_sysfs_init(void) 1053static int __init nonstatic_sysfs_init(void)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index e433704e026a..d2a3bea55de2 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -478,10 +478,10 @@ dump_bits(char **p, const char *prefix, unsigned int val, struct bittbl *bits, i
478 * 478 *
479 * Returns: the number of characters added to the buffer 479 * Returns: the number of characters added to the buffer
480 */ 480 */
481static ssize_t show_status(struct class_device *class_dev, char *buf) 481static ssize_t show_status(struct device *dev, char *buf)
482{ 482{
483 struct soc_pcmcia_socket *skt = 483 struct soc_pcmcia_socket *skt =
484 container_of(class_dev, struct soc_pcmcia_socket, socket.dev); 484 container_of(dev, struct soc_pcmcia_socket, socket.dev);
485 char *p = buf; 485 char *p = buf;
486 486
487 p+=sprintf(p, "slot : %d\n", skt->nr); 487 p+=sprintf(p, "slot : %d\n", skt->nr);
@@ -747,7 +747,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
747 747
748 add_timer(&skt->poll_timer); 748 add_timer(&skt->poll_timer);
749 749
750 class_device_create_file(&skt->socket.dev, &class_device_attr_status); 750 device_create_file(&skt->socket.dev, &device_attr_status);
751 } 751 }
752 752
753 dev_set_drvdata(dev, sinfo); 753 dev_set_drvdata(dev, sinfo);
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index b005602d6b53..ea5765c3bdc0 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -40,7 +40,8 @@
40 40
41#define to_socket(_dev) container_of(_dev, struct pcmcia_socket, dev) 41#define to_socket(_dev) container_of(_dev, struct pcmcia_socket, dev)
42 42
43static ssize_t pccard_show_type(struct class_device *dev, char *buf) 43static ssize_t pccard_show_type(struct device *dev, struct device_attribute *attr,
44 char *buf)
44{ 45{
45 struct pcmcia_socket *s = to_socket(dev); 46 struct pcmcia_socket *s = to_socket(dev);
46 47
@@ -50,9 +51,10 @@ static ssize_t pccard_show_type(struct class_device *dev, char *buf)
50 return sprintf(buf, "32-bit\n"); 51 return sprintf(buf, "32-bit\n");
51 return sprintf(buf, "16-bit\n"); 52 return sprintf(buf, "16-bit\n");
52} 53}
53static CLASS_DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL); 54static DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL);
54 55
55static ssize_t pccard_show_voltage(struct class_device *dev, char *buf) 56static ssize_t pccard_show_voltage(struct device *dev, struct device_attribute *attr,
57 char *buf)
56{ 58{
57 struct pcmcia_socket *s = to_socket(dev); 59 struct pcmcia_socket *s = to_socket(dev);
58 60
@@ -63,28 +65,31 @@ static ssize_t pccard_show_voltage(struct class_device *dev, char *buf)
63 s->socket.Vcc % 10); 65 s->socket.Vcc % 10);
64 return sprintf(buf, "X.XV\n"); 66 return sprintf(buf, "X.XV\n");
65} 67}
66static CLASS_DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL); 68static DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL);
67 69
68static ssize_t pccard_show_vpp(struct class_device *dev, char *buf) 70static ssize_t pccard_show_vpp(struct device *dev, struct device_attribute *attr,
71 char *buf)
69{ 72{
70 struct pcmcia_socket *s = to_socket(dev); 73 struct pcmcia_socket *s = to_socket(dev);
71 if (!(s->state & SOCKET_PRESENT)) 74 if (!(s->state & SOCKET_PRESENT))
72 return -ENODEV; 75 return -ENODEV;
73 return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10); 76 return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10);
74} 77}
75static CLASS_DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL); 78static DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL);
76 79
77static ssize_t pccard_show_vcc(struct class_device *dev, char *buf) 80static ssize_t pccard_show_vcc(struct device *dev, struct device_attribute *attr,
81 char *buf)
78{ 82{
79 struct pcmcia_socket *s = to_socket(dev); 83 struct pcmcia_socket *s = to_socket(dev);
80 if (!(s->state & SOCKET_PRESENT)) 84 if (!(s->state & SOCKET_PRESENT))
81 return -ENODEV; 85 return -ENODEV;
82 return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10); 86 return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10);
83} 87}
84static CLASS_DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL); 88static DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL);
85 89
86 90
87static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count) 91static ssize_t pccard_store_insert(struct device *dev, struct device_attribute *attr,
92 const char *buf, size_t count)
88{ 93{
89 ssize_t ret; 94 ssize_t ret;
90 struct pcmcia_socket *s = to_socket(dev); 95 struct pcmcia_socket *s = to_socket(dev);
@@ -96,16 +101,20 @@ static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, si
96 101
97 return ret ? ret : count; 102 return ret ? ret : count;
98} 103}
99static CLASS_DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert); 104static DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert);
100 105
101 106
102static ssize_t pccard_show_card_pm_state(struct class_device *dev, char *buf) 107static ssize_t pccard_show_card_pm_state(struct device *dev,
108 struct device_attribute *attr,
109 char *buf)
103{ 110{
104 struct pcmcia_socket *s = to_socket(dev); 111 struct pcmcia_socket *s = to_socket(dev);
105 return sprintf(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on"); 112 return sprintf(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on");
106} 113}
107 114
108static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char *buf, size_t count) 115static ssize_t pccard_store_card_pm_state(struct device *dev,
116 struct device_attribute *attr,
117 const char *buf, size_t count)
109{ 118{
110 ssize_t ret = -EINVAL; 119 ssize_t ret = -EINVAL;
111 struct pcmcia_socket *s = to_socket(dev); 120 struct pcmcia_socket *s = to_socket(dev);
@@ -120,9 +129,11 @@ static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char *
120 129
121 return ret ? -ENODEV : count; 130 return ret ? -ENODEV : count;
122} 131}
123static CLASS_DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state); 132static DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state);
124 133
125static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, size_t count) 134static ssize_t pccard_store_eject(struct device *dev,
135 struct device_attribute *attr,
136 const char *buf, size_t count)
126{ 137{
127 ssize_t ret; 138 ssize_t ret;
128 struct pcmcia_socket *s = to_socket(dev); 139 struct pcmcia_socket *s = to_socket(dev);
@@ -134,16 +145,20 @@ static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, siz
134 145
135 return ret ? ret : count; 146 return ret ? ret : count;
136} 147}
137static CLASS_DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject); 148static DEVICE_ATTR(card_eject, 0200, NULL, pccard_store_eject);
138 149
139 150
140static ssize_t pccard_show_irq_mask(struct class_device *dev, char *buf) 151static ssize_t pccard_show_irq_mask(struct device *dev,
152 struct device_attribute *attr,
153 char *buf)
141{ 154{
142 struct pcmcia_socket *s = to_socket(dev); 155 struct pcmcia_socket *s = to_socket(dev);
143 return sprintf(buf, "0x%04x\n", s->irq_mask); 156 return sprintf(buf, "0x%04x\n", s->irq_mask);
144} 157}
145 158
146static ssize_t pccard_store_irq_mask(struct class_device *dev, const char *buf, size_t count) 159static ssize_t pccard_store_irq_mask(struct device *dev,
160 struct device_attribute *attr,
161 const char *buf, size_t count)
147{ 162{
148 ssize_t ret; 163 ssize_t ret;
149 struct pcmcia_socket *s = to_socket(dev); 164 struct pcmcia_socket *s = to_socket(dev);
@@ -161,16 +176,19 @@ static ssize_t pccard_store_irq_mask(struct class_device *dev, const char *buf,
161 176
162 return ret ? ret : count; 177 return ret ? ret : count;
163} 178}
164static CLASS_DEVICE_ATTR(card_irq_mask, 0600, pccard_show_irq_mask, pccard_store_irq_mask); 179static DEVICE_ATTR(card_irq_mask, 0600, pccard_show_irq_mask, pccard_store_irq_mask);
165 180
166 181
167static ssize_t pccard_show_resource(struct class_device *dev, char *buf) 182static ssize_t pccard_show_resource(struct device *dev,
183 struct device_attribute *attr, char *buf)
168{ 184{
169 struct pcmcia_socket *s = to_socket(dev); 185 struct pcmcia_socket *s = to_socket(dev);
170 return sprintf(buf, "%s\n", s->resource_setup_done ? "yes" : "no"); 186 return sprintf(buf, "%s\n", s->resource_setup_done ? "yes" : "no");
171} 187}
172 188
173static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, size_t count) 189static ssize_t pccard_store_resource(struct device *dev,
190 struct device_attribute *attr,
191 const char *buf, size_t count)
174{ 192{
175 unsigned long flags; 193 unsigned long flags;
176 struct pcmcia_socket *s = to_socket(dev); 194 struct pcmcia_socket *s = to_socket(dev);
@@ -196,7 +214,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf,
196 214
197 return count; 215 return count;
198} 216}
199static CLASS_DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource); 217static DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource);
200 218
201 219
202static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count) 220static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count)
@@ -279,7 +297,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size
279 if (off + count > size) 297 if (off + count > size)
280 count = size - off; 298 count = size - off;
281 299
282 s = to_socket(container_of(kobj, struct class_device, kobj)); 300 s = to_socket(container_of(kobj, struct device, kobj));
283 301
284 if (!(s->state & SOCKET_PRESENT)) 302 if (!(s->state & SOCKET_PRESENT))
285 return -ENODEV; 303 return -ENODEV;
@@ -296,7 +314,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size
296 314
297static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) 315static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count)
298{ 316{
299 struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj)); 317 struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj));
300 cisdump_t *cis; 318 cisdump_t *cis;
301 int error; 319 int error;
302 320
@@ -335,16 +353,16 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz
335} 353}
336 354
337 355
338static struct class_device_attribute *pccard_socket_attributes[] = { 356static struct device_attribute *pccard_socket_attributes[] = {
339 &class_device_attr_card_type, 357 &dev_attr_card_type,
340 &class_device_attr_card_voltage, 358 &dev_attr_card_voltage,
341 &class_device_attr_card_vpp, 359 &dev_attr_card_vpp,
342 &class_device_attr_card_vcc, 360 &dev_attr_card_vcc,
343 &class_device_attr_card_insert, 361 &dev_attr_card_insert,
344 &class_device_attr_card_pm_state, 362 &dev_attr_card_pm_state,
345 &class_device_attr_card_eject, 363 &dev_attr_card_eject,
346 &class_device_attr_card_irq_mask, 364 &dev_attr_card_irq_mask,
347 &class_device_attr_available_resources_setup_done, 365 &dev_attr_available_resources_setup_done,
348 NULL, 366 NULL,
349}; 367};
350 368
@@ -355,35 +373,35 @@ static struct bin_attribute pccard_cis_attr = {
355 .write = pccard_store_cis, 373 .write = pccard_store_cis,
356}; 374};
357 375
358static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev, 376static int __devinit pccard_sysfs_add_socket(struct device *dev,
359 struct class_interface *class_intf) 377 struct class_interface *class_intf)
360{ 378{
361 struct class_device_attribute **attr; 379 struct device_attribute **attr;
362 int ret = 0; 380 int ret = 0;
363 381
364 for (attr = pccard_socket_attributes; *attr; attr++) { 382 for (attr = pccard_socket_attributes; *attr; attr++) {
365 ret = class_device_create_file(class_dev, *attr); 383 ret = device_create_file(dev, *attr);
366 if (ret) 384 if (ret)
367 break; 385 break;
368 } 386 }
369 if (!ret) 387 if (!ret)
370 ret = sysfs_create_bin_file(&class_dev->kobj, &pccard_cis_attr); 388 ret = sysfs_create_bin_file(&dev->kobj, &pccard_cis_attr);
371 389
372 return ret; 390 return ret;
373} 391}
374 392
375static void __devexit pccard_sysfs_remove_socket(struct class_device *class_dev, 393static void __devexit pccard_sysfs_remove_socket(struct device *dev,
376 struct class_interface *class_intf) 394 struct class_interface *class_intf)
377{ 395{
378 struct class_device_attribute **attr; 396 struct device_attribute **attr;
379 397
380 sysfs_remove_bin_file(&class_dev->kobj, &pccard_cis_attr); 398 sysfs_remove_bin_file(&dev->kobj, &pccard_cis_attr);
381 for (attr = pccard_socket_attributes; *attr; attr++) 399 for (attr = pccard_socket_attributes; *attr; attr++)
382 class_device_remove_file(class_dev, *attr); 400 device_remove_file(dev, *attr);
383} 401}
384 402
385struct class_interface pccard_sysfs_interface = { 403struct class_interface pccard_sysfs_interface = {
386 .class = &pcmcia_socket_class, 404 .class = &pcmcia_socket_class,
387 .add = &pccard_sysfs_add_socket, 405 .add_dev = &pccard_sysfs_add_socket,
388 .remove = __devexit_p(&pccard_sysfs_remove_socket), 406 .remove_dev = __devexit_p(&pccard_sysfs_remove_socket),
389}; 407};
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
index 2d2f415f80a8..c158cf38b9dd 100644
--- a/drivers/pcmcia/tcic.c
+++ b/drivers/pcmcia/tcic.c
@@ -512,7 +512,7 @@ static int __init init_tcic(void)
512 for (i = 0; i < sockets; i++) { 512 for (i = 0; i < sockets; i++) {
513 socket_table[i].socket.ops = &tcic_operations; 513 socket_table[i].socket.ops = &tcic_operations;
514 socket_table[i].socket.resource_ops = &pccard_nonstatic_ops; 514 socket_table[i].socket.resource_ops = &pccard_nonstatic_ops;
515 socket_table[i].socket.dev.dev = &tcic_device.dev; 515 socket_table[i].socket.dev.parent = &tcic_device.dev;
516 ret = pcmcia_register_socket(&socket_table[i].socket); 516 ret = pcmcia_register_socket(&socket_table[i].socket);
517 if (ret && i) 517 if (ret && i)
518 pcmcia_unregister_socket(&socket_table[0].socket); 518 pcmcia_unregister_socket(&socket_table[0].socket);
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index da471bddc972..a61d768f6e0e 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -1104,7 +1104,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
1104 /* prepare pcmcia_socket */ 1104 /* prepare pcmcia_socket */
1105 socket->socket.ops = &yenta_socket_operations; 1105 socket->socket.ops = &yenta_socket_operations;
1106 socket->socket.resource_ops = &pccard_nonstatic_ops; 1106 socket->socket.resource_ops = &pccard_nonstatic_ops;
1107 socket->socket.dev.dev = &dev->dev; 1107 socket->socket.dev.parent = &dev->dev;
1108 socket->socket.driver_data = socket; 1108 socket->socket.driver_data = socket;
1109 socket->socket.owner = THIS_MODULE; 1109 socket->socket.owner = THIS_MODULE;
1110 socket->socket.features = SS_CAP_PAGE_REGS | SS_CAP_PCCARD; 1110 socket->socket.features = SS_CAP_PAGE_REGS | SS_CAP_PCCARD;
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index 623a0fc0dae1..6e84258b94de 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -284,7 +284,7 @@ struct pcmcia_socket {
284#endif 284#endif
285 285
286 /* socket device */ 286 /* socket device */
287 struct class_device dev; 287 struct device dev;
288 void *driver_data; /* data internal to the socket driver */ 288 void *driver_data; /* data internal to the socket driver */
289 289
290}; 290};