[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5721425.bMLltMQDlc@wuerfel>
Date: Wed, 25 Jun 2014 10:39:32 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Suman Anna <s-anna@...com>
Cc: Tony Lindgren <tony@...mide.com>,
Jassi Brar <jaswinder.singh@...aro.org>,
Dave Gerlach <d-gerlach@...com>, linux-kernel@...r.kernel.org,
linux-omap@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Jassi Brar <jassisinghbrar@...il.com>
Subject: Re: [PATCH 6/6] mailbox/omap: add a custom of_xlate function
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists