Commit 5aa00b68 authored by Andrew Davis's avatar Andrew Davis Committed by Jassi Brar

mailbox: omap: Remove mbox_chan_to_omap_mbox()

This function only checks if mbox_chan *chan is not NULL, but that cannot
be the case and if it was returning NULL which is not later checked
doesn't save us from this. The second check for chan->con_priv is
completely redundant as if it was NULL we would return NULL just the
same. Simply dereference con_priv directly and remove this function.
Signed-off-by: default avatarAndrew Davis <afd@ti.com>
Signed-off-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
parent 34123b1a
...@@ -103,14 +103,6 @@ static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE; ...@@ -103,14 +103,6 @@ static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
module_param(mbox_kfifo_size, uint, S_IRUGO); module_param(mbox_kfifo_size, uint, S_IRUGO);
MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)"); MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)");
static struct omap_mbox *mbox_chan_to_omap_mbox(struct mbox_chan *chan)
{
if (!chan || !chan->con_priv)
return NULL;
return (struct omap_mbox *)chan->con_priv;
}
static inline static inline
unsigned int mbox_read_reg(struct omap_mbox_device *mdev, size_t ofs) unsigned int mbox_read_reg(struct omap_mbox_device *mdev, size_t ofs)
{ {
...@@ -357,7 +349,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox) ...@@ -357,7 +349,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
static int omap_mbox_chan_startup(struct mbox_chan *chan) static int omap_mbox_chan_startup(struct mbox_chan *chan)
{ {
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan); struct omap_mbox *mbox = chan->con_priv;
struct omap_mbox_device *mdev = mbox->parent; struct omap_mbox_device *mdev = mbox->parent;
int ret = 0; int ret = 0;
...@@ -372,7 +364,7 @@ static int omap_mbox_chan_startup(struct mbox_chan *chan) ...@@ -372,7 +364,7 @@ static int omap_mbox_chan_startup(struct mbox_chan *chan)
static void omap_mbox_chan_shutdown(struct mbox_chan *chan) static void omap_mbox_chan_shutdown(struct mbox_chan *chan)
{ {
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan); struct omap_mbox *mbox = chan->con_priv;
struct omap_mbox_device *mdev = mbox->parent; struct omap_mbox_device *mdev = mbox->parent;
mutex_lock(&mdev->cfg_lock); mutex_lock(&mdev->cfg_lock);
...@@ -415,7 +407,7 @@ static int omap_mbox_chan_send(struct omap_mbox *mbox, u32 msg) ...@@ -415,7 +407,7 @@ static int omap_mbox_chan_send(struct omap_mbox *mbox, u32 msg)
static int omap_mbox_chan_send_data(struct mbox_chan *chan, void *data) static int omap_mbox_chan_send_data(struct mbox_chan *chan, void *data)
{ {
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan); struct omap_mbox *mbox = chan->con_priv;
int ret; int ret;
u32 msg = (u32)(uintptr_t)(data); u32 msg = (u32)(uintptr_t)(data);
......
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