Skip to content

Commit 982b145

Browse files
glneoJassi Brar
authored andcommitted
mailbox: omap: Remove device class
The driver currently creates a new device class "mbox". Then for each mailbox adds a device to that class. This class provides no file operations provided for any userspace users of this device class. It may have been extended to be functional in our vendor tree at some point, but that is not the case anymore, nor does it matter for the upstream tree. Remove this device class and related functions and variables. This also allows us to switch to module_platform_driver() as there is nothing left to do in module_init(). Signed-off-by: Andrew Davis <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 8aa4a34 commit 982b145

File tree

1 file changed

+2
-87
lines changed

1 file changed

+2
-87
lines changed

drivers/mailbox/omap-mailbox.c

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct omap_mbox_device {
8787
u32 intr_type;
8888
struct omap_mbox **mboxes;
8989
struct mbox_controller controller;
90-
struct list_head elem;
9190
};
9291

9392
struct omap_mbox_fifo_info {
@@ -107,7 +106,6 @@ struct omap_mbox {
107106
const char *name;
108107
int irq;
109108
struct omap_mbox_queue *rxq;
110-
struct device *dev;
111109
struct omap_mbox_device *parent;
112110
struct omap_mbox_fifo tx_fifo;
113111
struct omap_mbox_fifo rx_fifo;
@@ -116,10 +114,6 @@ struct omap_mbox {
116114
bool send_no_irq;
117115
};
118116

119-
/* global variables for the mailbox devices */
120-
static DEFINE_MUTEX(omap_mbox_devices_lock);
121-
static LIST_HEAD(omap_mbox_devices);
122-
123117
static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
124118
module_param(mbox_kfifo_size, uint, S_IRUGO);
125119
MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)");
@@ -395,61 +389,6 @@ static struct omap_mbox *omap_mbox_device_find(struct omap_mbox_device *mdev,
395389
return mbox;
396390
}
397391

398-
static struct class omap_mbox_class = { .name = "mbox", };
399-
400-
static int omap_mbox_register(struct omap_mbox_device *mdev)
401-
{
402-
int ret;
403-
int i;
404-
struct omap_mbox **mboxes;
405-
406-
if (!mdev || !mdev->mboxes)
407-
return -EINVAL;
408-
409-
mboxes = mdev->mboxes;
410-
for (i = 0; mboxes[i]; i++) {
411-
struct omap_mbox *mbox = mboxes[i];
412-
413-
mbox->dev = device_create(&omap_mbox_class, mdev->dev,
414-
0, mbox, "%s", mbox->name);
415-
if (IS_ERR(mbox->dev)) {
416-
ret = PTR_ERR(mbox->dev);
417-
goto err_out;
418-
}
419-
}
420-
421-
mutex_lock(&omap_mbox_devices_lock);
422-
list_add(&mdev->elem, &omap_mbox_devices);
423-
mutex_unlock(&omap_mbox_devices_lock);
424-
425-
ret = devm_mbox_controller_register(mdev->dev, &mdev->controller);
426-
427-
err_out:
428-
if (ret) {
429-
while (i--)
430-
device_unregister(mboxes[i]->dev);
431-
}
432-
return ret;
433-
}
434-
435-
static int omap_mbox_unregister(struct omap_mbox_device *mdev)
436-
{
437-
int i;
438-
struct omap_mbox **mboxes;
439-
440-
if (!mdev || !mdev->mboxes)
441-
return -EINVAL;
442-
443-
mutex_lock(&omap_mbox_devices_lock);
444-
list_del(&mdev->elem);
445-
mutex_unlock(&omap_mbox_devices_lock);
446-
447-
mboxes = mdev->mboxes;
448-
for (i = 0; mboxes[i]; i++)
449-
device_unregister(mboxes[i]->dev);
450-
return 0;
451-
}
452-
453392
static int omap_mbox_chan_startup(struct mbox_chan *chan)
454393
{
455394
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan);
@@ -782,7 +721,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
782721
mdev->controller.chans = chnls;
783722
mdev->controller.num_chans = info_count;
784723
mdev->controller.of_xlate = omap_mbox_of_xlate;
785-
ret = omap_mbox_register(mdev);
724+
ret = devm_mbox_controller_register(mdev->dev, &mdev->controller);
786725
if (ret)
787726
return ret;
788727

@@ -809,7 +748,6 @@ static int omap_mbox_probe(struct platform_device *pdev)
809748

810749
unregister:
811750
pm_runtime_disable(mdev->dev);
812-
omap_mbox_unregister(mdev);
813751
return ret;
814752
}
815753

@@ -818,7 +756,6 @@ static void omap_mbox_remove(struct platform_device *pdev)
818756
struct omap_mbox_device *mdev = platform_get_drvdata(pdev);
819757

820758
pm_runtime_disable(mdev->dev);
821-
omap_mbox_unregister(mdev);
822759
}
823760

824761
static struct platform_driver omap_mbox_driver = {
@@ -830,29 +767,7 @@ static struct platform_driver omap_mbox_driver = {
830767
.of_match_table = of_match_ptr(omap_mailbox_of_match),
831768
},
832769
};
833-
834-
static int __init omap_mbox_init(void)
835-
{
836-
int err;
837-
838-
err = class_register(&omap_mbox_class);
839-
if (err)
840-
return err;
841-
842-
err = platform_driver_register(&omap_mbox_driver);
843-
if (err)
844-
class_unregister(&omap_mbox_class);
845-
846-
return err;
847-
}
848-
subsys_initcall(omap_mbox_init);
849-
850-
static void __exit omap_mbox_exit(void)
851-
{
852-
platform_driver_unregister(&omap_mbox_driver);
853-
class_unregister(&omap_mbox_class);
854-
}
855-
module_exit(omap_mbox_exit);
770+
module_platform_driver(omap_mbox_driver);
856771

857772
MODULE_LICENSE("GPL v2");
858773
MODULE_DESCRIPTION("omap mailbox: interrupt driven messaging");

0 commit comments

Comments
 (0)