Skip to content

Commit 2a0fca3

Browse files
glneoJassi Brar
authored andcommitted
mailbox: omap: Use function local struct mbox_controller
The mbox_controller struct is only needed in the probe function. Make it a local variable instead of storing a copy in omap_mbox_device to simplify that struct. Signed-off-by: Andrew Davis <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 7077ac4 commit 2a0fca3

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/mailbox/omap-mailbox.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ struct omap_mbox_device {
8686
u32 num_fifos;
8787
u32 intr_type;
8888
struct omap_mbox **mboxes;
89-
struct mbox_controller controller;
9089
};
9190

9291
struct omap_mbox {
@@ -541,7 +540,7 @@ static struct mbox_chan *omap_mbox_of_xlate(struct mbox_controller *controller,
541540
struct omap_mbox_device *mdev;
542541
struct omap_mbox *mbox;
543542

544-
mdev = container_of(controller, struct omap_mbox_device, controller);
543+
mdev = dev_get_drvdata(controller->dev);
545544
if (WARN_ON(!mdev))
546545
return ERR_PTR(-EINVAL);
547546

@@ -567,6 +566,7 @@ static int omap_mbox_probe(struct platform_device *pdev)
567566
struct device_node *node = pdev->dev.of_node;
568567
struct device_node *child;
569568
const struct omap_mbox_match_data *match_data;
569+
struct mbox_controller *controller;
570570
u32 intr_type, info_count;
571571
u32 num_users, num_fifos;
572572
u32 tmp[3];
@@ -685,17 +685,20 @@ static int omap_mbox_probe(struct platform_device *pdev)
685685
mdev->intr_type = intr_type;
686686
mdev->mboxes = list;
687687

688+
controller = devm_kzalloc(&pdev->dev, sizeof(*controller), GFP_KERNEL);
689+
if (!controller)
690+
return -ENOMEM;
688691
/*
689692
* OMAP/K3 Mailbox IP does not have a Tx-Done IRQ, but rather a Tx-Ready
690693
* IRQ and is needed to run the Tx state machine
691694
*/
692-
mdev->controller.txdone_irq = true;
693-
mdev->controller.dev = mdev->dev;
694-
mdev->controller.ops = &omap_mbox_chan_ops;
695-
mdev->controller.chans = chnls;
696-
mdev->controller.num_chans = info_count;
697-
mdev->controller.of_xlate = omap_mbox_of_xlate;
698-
ret = devm_mbox_controller_register(mdev->dev, &mdev->controller);
695+
controller->txdone_irq = true;
696+
controller->dev = mdev->dev;
697+
controller->ops = &omap_mbox_chan_ops;
698+
controller->chans = chnls;
699+
controller->num_chans = info_count;
700+
controller->of_xlate = omap_mbox_of_xlate;
701+
ret = devm_mbox_controller_register(mdev->dev, controller);
699702
if (ret)
700703
return ret;
701704

0 commit comments

Comments
 (0)