aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2007-09-24 20:03:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:06 -0500
commit7dd817d083b6fc103b9ea4f2b4f4a1c6a09e29a0 (patch)
tree2e9e782982555e99cb4e40cde469699696470e15
parent6013c12be8313b3205b41912d965b03f3b06147d (diff)
tifm: Convert from class_device to device for TI flash media
Signed-off-by: Tony Jones <tonyj@suse.de> Cc: Alex Dubov <oakad@yahoo.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/misc/tifm_7xx1.c4
-rw-r--r--drivers/misc/tifm_core.c24
-rw-r--r--include/linux/tifm.h2
3 files changed, 15 insertions, 15 deletions
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 2d1b3df95c5b..54380da343a5 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -149,7 +149,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
149 socket_change_set = fm->socket_change_set; 149 socket_change_set = fm->socket_change_set;
150 fm->socket_change_set = 0; 150 fm->socket_change_set = 0;
151 151
152 dev_dbg(fm->cdev.dev, "checking media set %x\n", 152 dev_dbg(fm->dev.parent, "checking media set %x\n",
153 socket_change_set); 153 socket_change_set);
154 154
155 if (!socket_change_set) { 155 if (!socket_change_set) {
@@ -164,7 +164,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
164 if (sock) { 164 if (sock) {
165 printk(KERN_INFO 165 printk(KERN_INFO
166 "%s : demand removing card from socket %u:%u\n", 166 "%s : demand removing card from socket %u:%u\n",
167 fm->cdev.class_id, fm->id, cnt); 167 fm->dev.bus_id, fm->id, cnt);
168 fm->sockets[cnt] = NULL; 168 fm->sockets[cnt] = NULL;
169 sock_addr = sock->addr; 169 sock_addr = sock->addr;
170 spin_unlock_irqrestore(&fm->lock, flags); 170 spin_unlock_irqrestore(&fm->lock, flags);
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c
index 8f77949f93dd..97544052e768 100644
--- a/drivers/misc/tifm_core.c
+++ b/drivers/misc/tifm_core.c
@@ -160,16 +160,16 @@ static struct bus_type tifm_bus_type = {
160 .resume = tifm_device_resume 160 .resume = tifm_device_resume
161}; 161};
162 162
163static void tifm_free(struct class_device *cdev) 163static void tifm_free(struct device *dev)
164{ 164{
165 struct tifm_adapter *fm = container_of(cdev, struct tifm_adapter, cdev); 165 struct tifm_adapter *fm = container_of(dev, struct tifm_adapter, dev);
166 166
167 kfree(fm); 167 kfree(fm);
168} 168}
169 169
170static struct class tifm_adapter_class = { 170static struct class tifm_adapter_class = {
171 .name = "tifm_adapter", 171 .name = "tifm_adapter",
172 .release = tifm_free 172 .dev_release = tifm_free
173}; 173};
174 174
175struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets, 175struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
@@ -180,9 +180,9 @@ struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
180 fm = kzalloc(sizeof(struct tifm_adapter) 180 fm = kzalloc(sizeof(struct tifm_adapter)
181 + sizeof(struct tifm_dev*) * num_sockets, GFP_KERNEL); 181 + sizeof(struct tifm_dev*) * num_sockets, GFP_KERNEL);
182 if (fm) { 182 if (fm) {
183 fm->cdev.class = &tifm_adapter_class; 183 fm->dev.class = &tifm_adapter_class;
184 fm->cdev.dev = dev; 184 fm->dev.parent = dev;
185 class_device_initialize(&fm->cdev); 185 device_initialize(&fm->dev);
186 spin_lock_init(&fm->lock); 186 spin_lock_init(&fm->lock);
187 fm->num_sockets = num_sockets; 187 fm->num_sockets = num_sockets;
188 } 188 }
@@ -203,8 +203,8 @@ int tifm_add_adapter(struct tifm_adapter *fm)
203 if (rc) 203 if (rc)
204 return rc; 204 return rc;
205 205
206 snprintf(fm->cdev.class_id, BUS_ID_SIZE, "tifm%u", fm->id); 206 snprintf(fm->dev.bus_id, BUS_ID_SIZE, "tifm%u", fm->id);
207 rc = class_device_add(&fm->cdev); 207 rc = device_add(&fm->dev);
208 if (rc) { 208 if (rc) {
209 spin_lock(&tifm_adapter_lock); 209 spin_lock(&tifm_adapter_lock);
210 idr_remove(&tifm_adapter_idr, fm->id); 210 idr_remove(&tifm_adapter_idr, fm->id);
@@ -228,13 +228,13 @@ void tifm_remove_adapter(struct tifm_adapter *fm)
228 spin_lock(&tifm_adapter_lock); 228 spin_lock(&tifm_adapter_lock);
229 idr_remove(&tifm_adapter_idr, fm->id); 229 idr_remove(&tifm_adapter_idr, fm->id);
230 spin_unlock(&tifm_adapter_lock); 230 spin_unlock(&tifm_adapter_lock);
231 class_device_del(&fm->cdev); 231 device_del(&fm->dev);
232} 232}
233EXPORT_SYMBOL(tifm_remove_adapter); 233EXPORT_SYMBOL(tifm_remove_adapter);
234 234
235void tifm_free_adapter(struct tifm_adapter *fm) 235void tifm_free_adapter(struct tifm_adapter *fm)
236{ 236{
237 class_device_put(&fm->cdev); 237 put_device(&fm->dev);
238} 238}
239EXPORT_SYMBOL(tifm_free_adapter); 239EXPORT_SYMBOL(tifm_free_adapter);
240 240
@@ -261,9 +261,9 @@ struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
261 sock->card_event = tifm_dummy_event; 261 sock->card_event = tifm_dummy_event;
262 sock->data_event = tifm_dummy_event; 262 sock->data_event = tifm_dummy_event;
263 263
264 sock->dev.parent = fm->cdev.dev; 264 sock->dev.parent = fm->dev.parent;
265 sock->dev.bus = &tifm_bus_type; 265 sock->dev.bus = &tifm_bus_type;
266 sock->dev.dma_mask = fm->cdev.dev->dma_mask; 266 sock->dev.dma_mask = fm->dev.parent->dma_mask;
267 sock->dev.release = tifm_free_device; 267 sock->dev.release = tifm_free_device;
268 268
269 snprintf(sock->dev.bus_id, BUS_ID_SIZE, 269 snprintf(sock->dev.bus_id, BUS_ID_SIZE,
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 6b3a31805c72..2096b76d0cee 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -120,7 +120,7 @@ struct tifm_adapter {
120 struct completion *finish_me; 120 struct completion *finish_me;
121 121
122 struct work_struct media_switcher; 122 struct work_struct media_switcher;
123 struct class_device cdev; 123 struct device dev;
124 124
125 void (*eject)(struct tifm_adapter *fm, 125 void (*eject)(struct tifm_adapter *fm,
126 struct tifm_dev *sock); 126 struct tifm_dev *sock);