From 24c27f3657617fa49ceeea3a1e5b63cbdb9d0e89 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Mon, 16 Apr 2007 18:31:59 +0000 Subject: [PATCH] Mailbox formatting changes to sync with upstream patch Signed-off-by: Tony Lindgren --- arch/arm/mach-omap1/mailbox.c | 42 ++++++++-------- arch/arm/mach-omap2/mailbox.c | 90 +++++++++++++++++++---------------- arch/arm/plat-omap/mailbox.c | 16 ++++--- 3 files changed, 79 insertions(+), 69 deletions(-) diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c index 25e1d95063b..d3abf560990 100644 --- a/arch/arm/mach-omap1/mailbox.c +++ b/arch/arm/mach-omap1/mailbox.c @@ -110,36 +110,36 @@ omap1_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq) } static struct omap_mbox_ops omap1_mbox_ops = { - .type = OMAP_MBOX_TYPE1, - .fifo_read = omap1_mbox_fifo_read, - .fifo_write = omap1_mbox_fifo_write, - .fifo_empty = omap1_mbox_fifo_empty, - .fifo_full = omap1_mbox_fifo_full, - .enable_irq = omap1_mbox_enable_irq, - .disable_irq = omap1_mbox_disable_irq, - .is_irq = omap1_mbox_is_irq, + .type = OMAP_MBOX_TYPE1, + .fifo_read = omap1_mbox_fifo_read, + .fifo_write = omap1_mbox_fifo_write, + .fifo_empty = omap1_mbox_fifo_empty, + .fifo_full = omap1_mbox_fifo_full, + .enable_irq = omap1_mbox_enable_irq, + .disable_irq = omap1_mbox_disable_irq, + .is_irq = omap1_mbox_is_irq, }; -/* FIXME: the following struct should be created automatically by the user id */ +/* FIXME: the following struct should be created automatically by the user id */ /* DSP */ static struct omap_mbox1_priv omap1_mbox_dsp_priv = { .tx_fifo = { - .cmd = MAILBOX_ARM2DSP1b, - .data = MAILBOX_ARM2DSP1, - .flag = MAILBOX_ARM2DSP1_Flag, + .cmd = MAILBOX_ARM2DSP1b, + .data = MAILBOX_ARM2DSP1, + .flag = MAILBOX_ARM2DSP1_Flag, }, .rx_fifo = { - .cmd = MAILBOX_DSP2ARM1b, - .data = MAILBOX_DSP2ARM1, - .flag = MAILBOX_DSP2ARM1_Flag, + .cmd = MAILBOX_DSP2ARM1b, + .data = MAILBOX_DSP2ARM1, + .flag = MAILBOX_DSP2ARM1_Flag, }, }; struct omap_mbox mbox_dsp_info = { - .name = "dsp", - .ops = &omap1_mbox_ops, - .priv = &omap1_mbox_dsp_priv, + .name = "dsp", + .ops = &omap1_mbox_ops, + .priv = &omap1_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); @@ -184,9 +184,9 @@ static int omap1_mbox_remove(struct platform_device *pdev) static struct platform_driver omap1_mbox_driver = { .probe = omap1_mbox_probe, - .remove = omap1_mbox_remove, - .driver = { - .name = "mailbox", + .remove = omap1_mbox_remove, + .driver = { + .name = "mailbox", }, }; diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 824fd2128ae..b03cd06e055 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c @@ -109,30 +109,35 @@ static inline void omap2_mbox_shutdown(struct omap_mbox *mbox) /* Mailbox FIFO handle functions */ static inline mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox) { - struct omap_mbox2_fifo *fifo = &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; + struct omap_mbox2_fifo *fifo = + &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; return (mbox_msg_t) mbox_read_reg(fifo->msg); } static inline void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg) { - struct omap_mbox2_fifo *fifo = &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; + struct omap_mbox2_fifo *fifo = + &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; mbox_write_reg(msg, fifo->msg); } static inline int omap2_mbox_fifo_empty(struct omap_mbox *mbox) { - struct omap_mbox2_fifo *fifo = &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; + struct omap_mbox2_fifo *fifo = + &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo; return (mbox_read_reg(fifo->msg_stat) == 0); } static inline int omap2_mbox_fifo_full(struct omap_mbox *mbox) { - struct omap_mbox2_fifo *fifo = &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; + struct omap_mbox2_fifo *fifo = + &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo; return (mbox_read_reg(fifo->fifo_stat)); } /* Mailbox IRQ handle functions */ -static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq) +static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox, + omap_mbox_type_t irq) { struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; @@ -142,7 +147,8 @@ static inline void omap2_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_ mbox_write_reg(l, p->irqenable); } -static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq) +static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox, + omap_mbox_type_t irq) { struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; @@ -152,7 +158,8 @@ static inline void omap2_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type mbox_write_reg(l, p->irqenable); } -static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox, omap_mbox_type_t irq) +static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox, + omap_mbox_type_t irq) { struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; @@ -160,7 +167,8 @@ static inline void omap2_mbox_ack_irq(struct omap_mbox *mbox, omap_mbox_type_t i mbox_write_reg(bit, p->irqstatus); } -static inline int omap2_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq) +static inline int omap2_mbox_is_irq(struct omap_mbox *mbox, + omap_mbox_type_t irq) { struct omap_mbox2_priv *p = (struct omap_mbox2_priv *)mbox->priv; u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; @@ -171,17 +179,17 @@ static inline int omap2_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq } static struct omap_mbox_ops omap2_mbox_ops = { - .type = OMAP_MBOX_TYPE2, - .startup = omap2_mbox_startup, - .shutdown = omap2_mbox_shutdown, - .fifo_read = omap2_mbox_fifo_read, - .fifo_write = omap2_mbox_fifo_write, - .fifo_empty = omap2_mbox_fifo_empty, - .fifo_full = omap2_mbox_fifo_full, - .enable_irq = omap2_mbox_enable_irq, - .disable_irq = omap2_mbox_disable_irq, - .ack_irq = omap2_mbox_ack_irq, - .is_irq = omap2_mbox_is_irq, + .type = OMAP_MBOX_TYPE2, + .startup = omap2_mbox_startup, + .shutdown = omap2_mbox_shutdown, + .fifo_read = omap2_mbox_fifo_read, + .fifo_write = omap2_mbox_fifo_write, + .fifo_empty = omap2_mbox_fifo_empty, + .fifo_full = omap2_mbox_fifo_full, + .enable_irq = omap2_mbox_enable_irq, + .disable_irq = omap2_mbox_disable_irq, + .ack_irq = omap2_mbox_ack_irq, + .is_irq = omap2_mbox_is_irq, }; /* @@ -196,46 +204,46 @@ static struct omap_mbox_ops omap2_mbox_ops = { /* DSP */ static struct omap_mbox2_priv omap2_mbox_dsp_priv = { .tx_fifo = { - .msg = MAILBOX_MESSAGE_0, - .fifo_stat = MAILBOX_FIFOSTATUS_0, + .msg = MAILBOX_MESSAGE_0, + .fifo_stat = MAILBOX_FIFOSTATUS_0, }, .rx_fifo = { - .msg = MAILBOX_MESSAGE_1, - .msg_stat = MAILBOX_MSGSTATUS_1, + .msg = MAILBOX_MESSAGE_1, + .msg_stat = MAILBOX_MSGSTATUS_1, }, - .irqenable = MAILBOX_IRQENABLE_0, - .irqstatus = MAILBOX_IRQSTATUS_0, - .notfull_bit = MAILBOX_IRQ_NOTFULL(0), - .newmsg_bit = MAILBOX_IRQ_NEWMSG(1), + .irqenable = MAILBOX_IRQENABLE_0, + .irqstatus = MAILBOX_IRQSTATUS_0, + .notfull_bit = MAILBOX_IRQ_NOTFULL(0), + .newmsg_bit = MAILBOX_IRQ_NEWMSG(1), }; struct omap_mbox mbox_dsp_info = { - .name = "dsp", - .ops = &omap2_mbox_ops, - .priv = &omap2_mbox_dsp_priv, + .name = "dsp", + .ops = &omap2_mbox_ops, + .priv = &omap2_mbox_dsp_priv, }; EXPORT_SYMBOL(mbox_dsp_info); /* IVA */ static struct omap_mbox2_priv omap2_mbox_iva_priv = { .tx_fifo = { - .msg = MAILBOX_MESSAGE_2, - .fifo_stat = MAILBOX_FIFOSTATUS_2, + .msg = MAILBOX_MESSAGE_2, + .fifo_stat = MAILBOX_FIFOSTATUS_2, }, .rx_fifo = { - .msg = MAILBOX_MESSAGE_3, - .msg_stat = MAILBOX_MSGSTATUS_3, + .msg = MAILBOX_MESSAGE_3, + .msg_stat = MAILBOX_MSGSTATUS_3, }, - .irqenable = MAILBOX_IRQENABLE_3, - .irqstatus = MAILBOX_IRQSTATUS_3, - .notfull_bit = MAILBOX_IRQ_NOTFULL(2), - .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), + .irqenable = MAILBOX_IRQENABLE_3, + .irqstatus = MAILBOX_IRQSTATUS_3, + .notfull_bit = MAILBOX_IRQ_NOTFULL(2), + .newmsg_bit = MAILBOX_IRQ_NEWMSG(3), }; static struct omap_mbox mbox_iva_info = { - .name = "iva", - .ops = &omap2_mbox_ops, - .priv = &omap2_mbox_iva_priv, + .name = "iva", + .ops = &omap2_mbox_ops, + .priv = &omap2_mbox_iva_priv, }; static int __init omap2_mbox_probe(struct platform_device *pdev) diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index fd948c0d9ce..de7e6ef48bd 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c @@ -96,7 +96,8 @@ static void mbox_tx_work(struct work_struct *work) { int ret; struct request *rq; - struct omap_mbox_queue *mq = container_of(work, struct omap_mbox_queue, work); + struct omap_mbox_queue *mq = container_of(work, + struct omap_mbox_queue, work); struct omap_mbox *mbox = mq->queue->queuedata; struct request_queue *q = mbox->txq->queue; @@ -126,7 +127,8 @@ static void mbox_tx_work(struct work_struct *work) */ static void mbox_rx_work(struct work_struct *work) { - struct omap_mbox_queue *mq = container_of(work, struct omap_mbox_queue, work); + struct omap_mbox_queue *mq = + container_of(work, struct omap_mbox_queue, work); struct omap_mbox *mbox = mq->queue->queuedata; struct request_queue *q = mbox->rxq->queue; struct request *rq; @@ -204,7 +206,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox) /* no more messages in the fifo. clear IRQ source. */ ack_mbox_irq(mbox, IRQ_RX); enable_mbox_irq(mbox, IRQ_RX); - nomem: + nomem: schedule_work(&mbox->rxq->work); } @@ -239,7 +241,7 @@ omap_mbox_write(struct device *dev, struct device_attribute *attr, p++; } - return (size_t)((char *)p - buf); + return (size_t)((char *)p - buf); } static ssize_t @@ -346,15 +348,15 @@ static int omap_mbox_init(struct omap_mbox *mbox) ret = device_create_file(&mbox->dev, &dev_attr_mbox); if (unlikely(ret)) { printk(KERN_ERR - "device_create_file failed: %d\n", ret); + "device_create_file failed: %d\n", ret); goto fail_create_mbox; } ret = request_irq(mbox->irq, mbox_interrupt, IRQF_DISABLED, - mbox->name, mbox); + mbox->name, mbox); if (unlikely(ret)) { printk(KERN_ERR - "failed to register mailbox interrupt:%d\n", ret); + "failed to register mailbox interrupt:%d\n", ret); goto fail_request_irq; } enable_mbox_irq(mbox, IRQ_RX); -- 2.41.1