From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrzej Hajda Subject: Re: [PATCH 14/15] drm/dsi: Resolve MIPI DSI device from phandle Date: Thu, 16 Oct 2014 09:03:34 +0200 Message-ID: <543F6DC6.60307@samsung.com> References: <1413195395-3355-1-git-send-email-thierry.reding@gmail.com> <1413195395-3355-14-git-send-email-thierry.reding@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailout4.w1.samsung.com (mailout4.w1.samsung.com [210.118.77.14]) by gabe.freedesktop.org (Postfix) with ESMTP id E1AE26E1E0 for ; Thu, 16 Oct 2014 00:03:40 -0700 (PDT) Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDI00HJ5ZQQAV20@mailout4.w1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 16 Oct 2014 08:06:26 +0100 (BST) In-reply-to: <1413195395-3355-14-git-send-email-thierry.reding@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Thierry Reding , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On 10/13/2014 12:16 PM, Thierry Reding wrote: > From: Thierry Reding > > Add a function, of_find_mipi_dsi_device_by_node(), that can be used to > resolve a phandle to a MIPI DSI device. > > Signed-off-by: Thierry Reding Acked-by: Andrzej Hajda -- Regards Andrzej > --- > drivers/gpu/drm/drm_mipi_dsi.c | 23 +++++++++++++++++++++++ > include/drm/drm_mipi_dsi.h | 1 + > 2 files changed, 24 insertions(+) > > diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c > index a0b9c7ea77a7..0067f914c1ea 100644 > --- a/drivers/gpu/drm/drm_mipi_dsi.c > +++ b/drivers/gpu/drm/drm_mipi_dsi.c > @@ -67,6 +67,29 @@ static struct bus_type mipi_dsi_bus_type = { > .pm = &mipi_dsi_device_pm_ops, > }; > > +static int of_device_match(struct device *dev, void *data) > +{ > + return dev->of_node == data; > +} > + > +/** > + * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a > + * device tree node > + * @np: device tree node > + * > + * Return: A pointer to the MIPI DSI device corresponding to @np or NULL if no > + * such device exists (or has not been registered yet). > + */ > +struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np) > +{ > + struct device *dev; > + > + dev = bus_find_device(&mipi_dsi_bus_type, NULL, np, of_device_match); > + > + return dev ? to_mipi_dsi_device(dev) : NULL; > +} > +EXPORT_SYMBOL(of_find_mipi_dsi_device_by_node); > + > static void mipi_dsi_dev_release(struct device *dev) > { > struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); > diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h > index 17ef2fbb09a5..8f025cc5ce99 100644 > --- a/include/drm/drm_mipi_dsi.h > +++ b/include/drm/drm_mipi_dsi.h > @@ -142,6 +142,7 @@ static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) > return container_of(dev, struct mipi_dsi_device, dev); > } > > +struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); > int mipi_dsi_attach(struct mipi_dsi_device *dsi); > int mipi_dsi_detach(struct mipi_dsi_device *dsi); > int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi,