Commit e9eceec6 authored by Andrew Davis's avatar Andrew Davis Committed by Jassi Brar

mailbox: omap: Move fifo size check to point of use

The mbox_kfifo_size can be changed at runtime, the sanity
check on it's value should be done when it is used, not
only once at init time.
Signed-off-by: default avatarAndrew Davis <afd@ti.com>
Signed-off-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
parent 6979e8be
...@@ -310,6 +310,7 @@ static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, ...@@ -310,6 +310,7 @@ static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
void (*work)(struct work_struct *)) void (*work)(struct work_struct *))
{ {
struct omap_mbox_queue *mq; struct omap_mbox_queue *mq;
unsigned int size;
if (!work) if (!work)
return NULL; return NULL;
...@@ -320,7 +321,10 @@ static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, ...@@ -320,7 +321,10 @@ static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
spin_lock_init(&mq->lock); spin_lock_init(&mq->lock);
if (kfifo_alloc(&mq->fifo, mbox_kfifo_size, GFP_KERNEL)) /* kfifo size sanity check: alignment and minimal size */
size = ALIGN(mbox_kfifo_size, sizeof(u32));
size = max_t(unsigned int, size, sizeof(u32));
if (kfifo_alloc(&mq->fifo, size, GFP_KERNEL))
goto error; goto error;
INIT_WORK(&mq->work, work); INIT_WORK(&mq->work, work);
...@@ -838,10 +842,6 @@ static int __init omap_mbox_init(void) ...@@ -838,10 +842,6 @@ static int __init omap_mbox_init(void)
if (err) if (err)
return err; return err;
/* kfifo size sanity check: alignment and minimal size */
mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(u32));
mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size, sizeof(u32));
err = platform_driver_register(&omap_mbox_driver); err = platform_driver_register(&omap_mbox_driver);
if (err) if (err)
class_unregister(&omap_mbox_class); class_unregister(&omap_mbox_class);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment