On 05/03/2016 06:12 PM, Rob Herring wrote: > On Tue, May 3, 2016 at 5:57 AM, Archit Taneja <architt at codeaurora.org> > wrote: >> The driver currently identifies the GPU components it needs by parsing >> a phandle list from the 'gpus' DT property. >> >> This isn't the right binding to go with. So, for now, just search all >> device nodes and find the gpu node we need by parsing a list of >> compatible strings. >> >> Once we know how to link the kms and gpu drivers, we'll drop this method >> and use the correct binding. >> >> Signed-off-by: Archit Taneja <architt at codeaurora.org> >> --- >> drivers/gpu/drm/msm/msm_drv.c | 26 +++++++++++++++++++------- >> 1 file changed, 19 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c >> index 30b8f3b..f717a69 100644 >> --- a/drivers/gpu/drm/msm/msm_drv.c >> +++ b/drivers/gpu/drm/msm/msm_drv.c >> @@ -1068,20 +1068,32 @@ static int compare_of(struct device *dev, void *data) >> return dev->of_node == data; >> } >> >> -static int add_components(struct device *dev, struct component_match >> **matchptr, >> - const char *name) >> +static const char * const msm_compatible_gpus[] = { >> + "qcom,adreno-3xx", >> + "qcom,kgsl-3d0", >> +}; >> + >> +/* >> + * We don't know what's the best binding to link the gpu with the drm >> device. >> + * Fow now, we just hunt for all the possible gpus that we support, and add >> them >> + * as components. >> + */ >> +static int add_gpu_components(struct device *dev, >> + struct component_match **matchptr) >> { >> - struct device_node *np = dev->of_node; >> unsigned i; >> >> - for (i = 0; ; i++) { >> + for (i = 0; i < ARRAY_SIZE(msm_compatible_gpus); i++) { > > You can use of_find_matching_node() here instead of a loop.
I'll switch to that. Thanks, Archit -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation