diff options
author | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2009-11-22 13:11:19 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-11-22 13:24:33 -0500 |
commit | c7c158e57bce6220644f2bcd65d82e1468aa40ec (patch) | |
tree | 67fc558126d4db3494397e833ce21119fa458b78 /arch | |
parent | bfe1f6acb0df957e513b7c71c3f1a7ac56b32e4d (diff) |
omap: mailbox: remove class interface
It's not used at present.
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-omap/include/plat/mailbox.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/mailbox.c | 115 |
2 files changed, 9 insertions, 107 deletions
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h index b7a6991814ec..319306a8f44a 100644 --- a/arch/arm/plat-omap/include/plat/mailbox.h +++ b/arch/arm/plat-omap/include/plat/mailbox.h | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/blkdev.h> | 8 | #include <linux/blkdev.h> |
9 | 9 | ||
10 | typedef u32 mbox_msg_t; | 10 | typedef u32 mbox_msg_t; |
11 | typedef void (mbox_receiver_t)(mbox_msg_t msg); | ||
12 | struct omap_mbox; | 11 | struct omap_mbox; |
13 | 12 | ||
14 | typedef int __bitwise omap_mbox_irq_t; | 13 | typedef int __bitwise omap_mbox_irq_t; |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index f82810eeb3f4..13ca2365f279 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -71,7 +71,7 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | |||
71 | /* | 71 | /* |
72 | * message sender | 72 | * message sender |
73 | */ | 73 | */ |
74 | static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg) | 74 | static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg) |
75 | { | 75 | { |
76 | int ret = 0, i = 1000; | 76 | int ret = 0, i = 1000; |
77 | 77 | ||
@@ -82,15 +82,7 @@ static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg) | |||
82 | return -1; | 82 | return -1; |
83 | udelay(1); | 83 | udelay(1); |
84 | } | 84 | } |
85 | |||
86 | if (arg && mbox->txq->callback) { | ||
87 | ret = mbox->txq->callback(arg); | ||
88 | if (ret) | ||
89 | goto out; | ||
90 | } | ||
91 | |||
92 | mbox_fifo_write(mbox, msg); | 85 | mbox_fifo_write(mbox, msg); |
93 | out: | ||
94 | return ret; | 86 | return ret; |
95 | } | 87 | } |
96 | 88 | ||
@@ -152,7 +144,7 @@ static void mbox_tx_work(struct work_struct *work) | |||
152 | 144 | ||
153 | tx_data = rq->special; | 145 | tx_data = rq->special; |
154 | 146 | ||
155 | ret = __mbox_msg_send(mbox, tx_data->msg, tx_data->arg); | 147 | ret = __mbox_msg_send(mbox, tx_data->msg); |
156 | if (ret) { | 148 | if (ret) { |
157 | enable_mbox_irq(mbox, IRQ_TX); | 149 | enable_mbox_irq(mbox, IRQ_TX); |
158 | spin_lock(q->queue_lock); | 150 | spin_lock(q->queue_lock); |
@@ -180,11 +172,6 @@ static void mbox_rx_work(struct work_struct *work) | |||
180 | mbox_msg_t msg; | 172 | mbox_msg_t msg; |
181 | unsigned long flags; | 173 | unsigned long flags; |
182 | 174 | ||
183 | if (mbox->rxq->callback == NULL) { | ||
184 | sysfs_notify(&mbox->dev->kobj, NULL, "mbox"); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | while (1) { | 175 | while (1) { |
189 | spin_lock_irqsave(q->queue_lock, flags); | 176 | spin_lock_irqsave(q->queue_lock, flags); |
190 | rq = blk_fetch_request(q); | 177 | rq = blk_fetch_request(q); |
@@ -257,69 +244,6 @@ static irqreturn_t mbox_interrupt(int irq, void *p) | |||
257 | return IRQ_HANDLED; | 244 | return IRQ_HANDLED; |
258 | } | 245 | } |
259 | 246 | ||
260 | /* | ||
261 | * sysfs files | ||
262 | */ | ||
263 | static ssize_t | ||
264 | omap_mbox_write(struct device *dev, struct device_attribute *attr, | ||
265 | const char *buf, size_t count) | ||
266 | { | ||
267 | int ret; | ||
268 | mbox_msg_t *p = (mbox_msg_t *)buf; | ||
269 | struct omap_mbox *mbox = dev_get_drvdata(dev); | ||
270 | |||
271 | for (; count >= sizeof(mbox_msg_t); count -= sizeof(mbox_msg_t)) { | ||
272 | ret = omap_mbox_msg_send(mbox, be32_to_cpu(*p), NULL); | ||
273 | if (ret) | ||
274 | return -EAGAIN; | ||
275 | p++; | ||
276 | } | ||
277 | |||
278 | return (size_t)((char *)p - buf); | ||
279 | } | ||
280 | |||
281 | static ssize_t | ||
282 | omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf) | ||
283 | { | ||
284 | unsigned long flags; | ||
285 | struct request *rq; | ||
286 | mbox_msg_t *p = (mbox_msg_t *) buf; | ||
287 | struct omap_mbox *mbox = dev_get_drvdata(dev); | ||
288 | struct request_queue *q = mbox->rxq->queue; | ||
289 | |||
290 | while (1) { | ||
291 | spin_lock_irqsave(q->queue_lock, flags); | ||
292 | rq = blk_fetch_request(q); | ||
293 | spin_unlock_irqrestore(q->queue_lock, flags); | ||
294 | |||
295 | if (!rq) | ||
296 | break; | ||
297 | |||
298 | *p = (mbox_msg_t)rq->special; | ||
299 | |||
300 | blk_end_request_all(rq, 0); | ||
301 | |||
302 | p++; | ||
303 | } | ||
304 | |||
305 | pr_debug("%02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]); | ||
306 | |||
307 | return (size_t) ((char *)p - buf); | ||
308 | } | ||
309 | |||
310 | static DEVICE_ATTR(mbox, S_IRUGO | S_IWUSR, omap_mbox_read, omap_mbox_write); | ||
311 | |||
312 | static ssize_t mbox_show(struct class *class, char *buf) | ||
313 | { | ||
314 | return sprintf(buf, "mbox"); | ||
315 | } | ||
316 | |||
317 | static CLASS_ATTR(mbox, S_IRUGO, mbox_show, NULL); | ||
318 | |||
319 | static struct class omap_mbox_class = { | ||
320 | .name = "omap-mailbox", | ||
321 | }; | ||
322 | |||
323 | static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, | 247 | static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, |
324 | request_fn_proc *proc, | 248 | request_fn_proc *proc, |
325 | void (*work) (struct work_struct *)) | 249 | void (*work) (struct work_struct *)) |
@@ -353,7 +277,7 @@ static void mbox_queue_free(struct omap_mbox_queue *q) | |||
353 | kfree(q); | 277 | kfree(q); |
354 | } | 278 | } |
355 | 279 | ||
356 | static int omap_mbox_init(struct omap_mbox *mbox) | 280 | static int omap_mbox_startup(struct omap_mbox *mbox) |
357 | { | 281 | { |
358 | int ret; | 282 | int ret; |
359 | struct omap_mbox_queue *mq; | 283 | struct omap_mbox_queue *mq; |
@@ -436,7 +360,7 @@ struct omap_mbox *omap_mbox_get(const char *name) | |||
436 | 360 | ||
437 | read_unlock(&mboxes_lock); | 361 | read_unlock(&mboxes_lock); |
438 | 362 | ||
439 | ret = omap_mbox_init(mbox); | 363 | ret = omap_mbox_startup(mbox); |
440 | if (ret) | 364 | if (ret) |
441 | return ERR_PTR(-ENODEV); | 365 | return ERR_PTR(-ENODEV); |
442 | 366 | ||
@@ -460,15 +384,6 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox) | |||
460 | if (mbox->next) | 384 | if (mbox->next) |
461 | return -EBUSY; | 385 | return -EBUSY; |
462 | 386 | ||
463 | mbox->dev = device_create(&omap_mbox_class, | ||
464 | parent, 0, mbox, "%s", mbox->name); | ||
465 | if (IS_ERR(mbox->dev)) | ||
466 | return PTR_ERR(mbox->dev); | ||
467 | |||
468 | ret = device_create_file(mbox->dev, &dev_attr_mbox); | ||
469 | if (ret) | ||
470 | goto err_sysfs; | ||
471 | |||
472 | write_lock(&mboxes_lock); | 387 | write_lock(&mboxes_lock); |
473 | tmp = find_mboxes(mbox->name); | 388 | tmp = find_mboxes(mbox->name); |
474 | if (*tmp) { | 389 | if (*tmp) { |
@@ -482,9 +397,6 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox) | |||
482 | return 0; | 397 | return 0; |
483 | 398 | ||
484 | err_find: | 399 | err_find: |
485 | device_remove_file(mbox->dev, &dev_attr_mbox); | ||
486 | err_sysfs: | ||
487 | device_unregister(mbox->dev); | ||
488 | return ret; | 400 | return ret; |
489 | } | 401 | } |
490 | EXPORT_SYMBOL(omap_mbox_register); | 402 | EXPORT_SYMBOL(omap_mbox_register); |
@@ -500,8 +412,6 @@ int omap_mbox_unregister(struct omap_mbox *mbox) | |||
500 | *tmp = mbox->next; | 412 | *tmp = mbox->next; |
501 | mbox->next = NULL; | 413 | mbox->next = NULL; |
502 | write_unlock(&mboxes_lock); | 414 | write_unlock(&mboxes_lock); |
503 | device_remove_file(mbox->dev, &dev_attr_mbox); | ||
504 | device_unregister(mbox->dev); | ||
505 | return 0; | 415 | return 0; |
506 | } | 416 | } |
507 | tmp = &(*tmp)->next; | 417 | tmp = &(*tmp)->next; |
@@ -512,23 +422,16 @@ int omap_mbox_unregister(struct omap_mbox *mbox) | |||
512 | } | 422 | } |
513 | EXPORT_SYMBOL(omap_mbox_unregister); | 423 | EXPORT_SYMBOL(omap_mbox_unregister); |
514 | 424 | ||
515 | static int __init omap_mbox_class_init(void) | 425 | static int __init omap_mbox_init(void) |
516 | { | 426 | { |
517 | int ret = class_register(&omap_mbox_class); | 427 | return 0; |
518 | if (!ret) | ||
519 | ret = class_create_file(&omap_mbox_class, &class_attr_mbox); | ||
520 | |||
521 | return ret; | ||
522 | } | 428 | } |
429 | module_init(omap_mbox_init); | ||
523 | 430 | ||
524 | static void __exit omap_mbox_class_exit(void) | 431 | static void __exit omap_mbox_exit(void) |
525 | { | 432 | { |
526 | class_remove_file(&omap_mbox_class, &class_attr_mbox); | ||
527 | class_unregister(&omap_mbox_class); | ||
528 | } | 433 | } |
529 | 434 | module_exit(omap_mbox_exit); | |
530 | subsys_initcall(omap_mbox_class_init); | ||
531 | module_exit(omap_mbox_class_exit); | ||
532 | 435 | ||
533 | MODULE_LICENSE("GPL v2"); | 436 | MODULE_LICENSE("GPL v2"); |
534 | MODULE_DESCRIPTION("omap mailbox: interrupt driven messaging"); | 437 | MODULE_DESCRIPTION("omap mailbox: interrupt driven messaging"); |