Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: Use of_device_get_match_data()

Avoid some boilerplate by calling of_device_get_match_data() instead of
open-coding the equivalent in the driver.

While at it, shuffle around some code to avoid unnecessary local
variables.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+5 -9
+5 -9
drivers/gpu/host1x/dev.c
··· 116 116 117 117 static int host1x_probe(struct platform_device *pdev) 118 118 { 119 - const struct of_device_id *id; 120 119 struct host1x *host; 121 120 struct resource *regs; 122 121 int syncpt_irq; 123 122 int err; 124 123 125 - id = of_match_device(host1x_of_match, &pdev->dev); 126 - if (!id) 127 - return -EINVAL; 124 + host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); 125 + if (!host) 126 + return -ENOMEM; 127 + 128 + host->info = of_device_get_match_data(&pdev->dev); 128 129 129 130 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 130 131 if (!regs) { ··· 139 138 return syncpt_irq; 140 139 } 141 140 142 - host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); 143 - if (!host) 144 - return -ENOMEM; 145 - 146 141 mutex_init(&host->devices_lock); 147 142 INIT_LIST_HEAD(&host->devices); 148 143 INIT_LIST_HEAD(&host->list); 149 144 host->dev = &pdev->dev; 150 - host->info = id->data; 151 145 152 146 /* set common host1x device data */ 153 147 platform_set_drvdata(pdev, host);