lkml.org 
[lkml]   [2014]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
Date
On Tuesday 24 June 2014 20:47:58 Suman Anna wrote:
> +static struct mbox_chan *omap_mbox_of_xlate(struct mbox_controller *controller,
> + const struct of_phandle_args *sp)
> +{
> + phandle phandle = sp->args[0];
> + struct device_node *node;
> + struct omap_mbox_device *mdev;
> + struct omap_mbox *mbox;
> +
> + node = of_find_node_by_phandle(phandle);
> + if (!node) {
> + pr_err("could not find node phandle 0x%x\n", phandle);
> + return NULL;
> + }
> +
> + mdev = container_of(controller, struct omap_mbox_device, controller);
> + if (WARN_ON(!mdev))
> + return NULL;
> +
> + mbox = omap_mbox_device_find(mdev, node->name);
> + return mbox ? mbox->chan : NULL;
>

Wouldn't it be easier to change the omap_mbox_device_find() function to
take a phandle argument directly? You shouldn't have to walk all
nodes in the system, or match it by name if you already have the
device node.

Also, the xlate function is normally the place where you read out
the other arguments and set them as members in your omap_mbox
structure.

Arnd


\
 
 \ /
  Last update: 2014-06-25 11:21    [W:0.135 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site