aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-09-12 11:00:10 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 13:37:11 -0500
commit873733188a019acdb7fa253011cbdc0a8afd97f3 (patch)
tree99828bd5db2f183e1b2d2204dc2c94bd1f8fdbbb /drivers/pcmcia/cs.c
parent31b9025aa0f89b392077db3f87458fd46bcc4f58 (diff)
Driver core: convert pcmcia code to use struct device
Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Cc: <linux-pcmcia@lists.infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c34
1 files changed, 17 insertions, 17 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);