diff options
author | Alex Dubov <oakad@yahoo.com> | 2007-04-12 02:59:18 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-01 07:04:13 -0400 |
commit | 2428a8fe2261e901e058d9ea8b6ed7e1b4268b79 (patch) | |
tree | 8ef8c59c65ad192434abad416f53918198e6a1ec /drivers/misc/tifm_core.c | |
parent | 6113ed73e61a13db9da48831e1b35788b7f837cc (diff) |
tifm: move common device management tasks from tifm_7xx1 to tifm_core
Some details of the device management (create, add, remove) are really
belong to the tifm_core, as they are not hardware specific.
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/misc/tifm_core.c')
-rw-r--r-- | drivers/misc/tifm_core.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/misc/tifm_core.c b/drivers/misc/tifm_core.c index f0cce2a642d..1e591989835 100644 --- a/drivers/misc/tifm_core.c +++ b/drivers/misc/tifm_core.c | |||
@@ -232,25 +232,40 @@ EXPORT_SYMBOL(tifm_free_adapter); | |||
232 | 232 | ||
233 | void tifm_free_device(struct device *dev) | 233 | void tifm_free_device(struct device *dev) |
234 | { | 234 | { |
235 | struct tifm_dev *fm_dev = container_of(dev, struct tifm_dev, dev); | 235 | struct tifm_dev *sock = container_of(dev, struct tifm_dev, dev); |
236 | kfree(fm_dev); | 236 | kfree(sock); |
237 | } | 237 | } |
238 | EXPORT_SYMBOL(tifm_free_device); | 238 | EXPORT_SYMBOL(tifm_free_device); |
239 | 239 | ||
240 | struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm) | 240 | struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id, |
241 | unsigned char type) | ||
241 | { | 242 | { |
242 | struct tifm_dev *dev = kzalloc(sizeof(struct tifm_dev), GFP_KERNEL); | 243 | struct tifm_dev *sock = NULL; |
244 | |||
245 | if (!tifm_media_type_name(type, 0)) | ||
246 | return sock; | ||
243 | 247 | ||
244 | if (dev) { | 248 | sock = kzalloc(sizeof(struct tifm_dev), GFP_KERNEL); |
245 | spin_lock_init(&dev->lock); | 249 | if (sock) { |
250 | spin_lock_init(&sock->lock); | ||
251 | sock->type = type; | ||
252 | sock->socket_id = id; | ||
253 | sock->card_event = tifm_dummy_event; | ||
254 | sock->data_event = tifm_dummy_event; | ||
246 | 255 | ||
247 | dev->dev.parent = fm->cdev.dev; | 256 | sock->dev.parent = fm->cdev.dev; |
248 | dev->dev.bus = &tifm_bus_type; | 257 | sock->dev.bus = &tifm_bus_type; |
249 | dev->dev.release = tifm_free_device; | 258 | sock->dev.dma_mask = fm->cdev.dev->dma_mask; |
250 | dev->card_event = tifm_dummy_event; | 259 | sock->dev.release = tifm_free_device; |
251 | dev->data_event = tifm_dummy_event; | 260 | |
261 | snprintf(sock->dev.bus_id, BUS_ID_SIZE, | ||
262 | "tifm_%s%u:%u", tifm_media_type_name(type, 2), | ||
263 | fm->id, id); | ||
264 | printk(KERN_INFO DRIVER_NAME | ||
265 | ": %s card detected in socket %u:%u\n", | ||
266 | tifm_media_type_name(type, 0), fm->id, id); | ||
252 | } | 267 | } |
253 | return dev; | 268 | return sock; |
254 | } | 269 | } |
255 | EXPORT_SYMBOL(tifm_alloc_device); | 270 | EXPORT_SYMBOL(tifm_alloc_device); |
256 | 271 | ||