Skip to content

Commit 5aa00b6

Browse files
glneoJassi Brar
authored andcommitted
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: Andrew Davis <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent 34123b1 commit 5aa00b6

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/mailbox/omap-mailbox.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@ static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
103103
module_param(mbox_kfifo_size, uint, S_IRUGO);
104104
MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)");
105105

106-
static struct omap_mbox *mbox_chan_to_omap_mbox(struct mbox_chan *chan)
107-
{
108-
if (!chan || !chan->con_priv)
109-
return NULL;
110-
111-
return (struct omap_mbox *)chan->con_priv;
112-
}
113-
114106
static inline
115107
unsigned int mbox_read_reg(struct omap_mbox_device *mdev, size_t ofs)
116108
{
@@ -357,7 +349,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
357349

358350
static int omap_mbox_chan_startup(struct mbox_chan *chan)
359351
{
360-
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan);
352+
struct omap_mbox *mbox = chan->con_priv;
361353
struct omap_mbox_device *mdev = mbox->parent;
362354
int ret = 0;
363355

@@ -372,7 +364,7 @@ static int omap_mbox_chan_startup(struct mbox_chan *chan)
372364

373365
static void omap_mbox_chan_shutdown(struct mbox_chan *chan)
374366
{
375-
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan);
367+
struct omap_mbox *mbox = chan->con_priv;
376368
struct omap_mbox_device *mdev = mbox->parent;
377369

378370
mutex_lock(&mdev->cfg_lock);
@@ -415,7 +407,7 @@ static int omap_mbox_chan_send(struct omap_mbox *mbox, u32 msg)
415407

416408
static int omap_mbox_chan_send_data(struct mbox_chan *chan, void *data)
417409
{
418-
struct omap_mbox *mbox = mbox_chan_to_omap_mbox(chan);
410+
struct omap_mbox *mbox = chan->con_priv;
419411
int ret;
420412
u32 msg = (u32)(uintptr_t)(data);
421413

0 commit comments

Comments
 (0)