Skip to content

Commit a1a1ca7

Browse files
committed
Merge tag 'drm-misc-next-fixes-2021-04-22' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
A few fixes for the next merge window, with some build fixes for anx7625 and lt8912b bridges, incorrect error handling for lt8912b and TTM, and one fix for TTM page limit accounting. Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20210422163329.dvbuwre3akwdmzjt@gilmour
2 parents af8352f + a4394b6 commit a1a1ca7

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

drivers/gpu/drm/bridge/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ config DRM_LONTIUM_LT8912B
6666
depends on OF
6767
select DRM_PANEL_BRIDGE
6868
select DRM_KMS_HELPER
69+
select DRM_MIPI_DSI
6970
select REGMAP_I2C
7071
help
7172
Driver for Lontium LT8912B DSI to HDMI bridge
@@ -81,6 +82,7 @@ config DRM_LONTIUM_LT9611
8182
depends on OF
8283
select DRM_PANEL_BRIDGE
8384
select DRM_KMS_HELPER
85+
select DRM_MIPI_DSI
8486
select REGMAP_I2C
8587
help
8688
Driver for Lontium LT9611 DSI to HDMI bridge
@@ -94,6 +96,7 @@ config DRM_LONTIUM_LT9611UXC
9496
depends on OF
9597
select DRM_PANEL_BRIDGE
9698
select DRM_KMS_HELPER
99+
select DRM_MIPI_DSI
97100
select REGMAP_I2C
98101
help
99102
Driver for Lontium LT9611UXC DSI to HDMI bridge

drivers/gpu/drm/bridge/analogix/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ config DRM_ANALOGIX_ANX7625
3030
tristate "Analogix Anx7625 MIPI to DP interface support"
3131
depends on DRM
3232
depends on OF
33+
select DRM_MIPI_DSI
3334
help
3435
ANX7625 is an ultra-low power 4K mobile HD transmitter
3536
designed for portable devices. It converts MIPI/DPI to

drivers/gpu/drm/bridge/lontium-lt8912b.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
622622
{
623623
struct gpio_desc *gp_reset;
624624
struct device *dev = lt->dev;
625-
int ret = 0;
625+
int ret;
626+
int data_lanes;
626627
struct device_node *port_node;
627628
struct device_node *endpoint;
628629

@@ -636,19 +637,21 @@ static int lt8912_parse_dt(struct lt8912 *lt)
636637
lt->gp_reset = gp_reset;
637638

638639
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
639-
if (IS_ERR(endpoint)) {
640-
ret = PTR_ERR(endpoint);
641-
goto end;
642-
}
640+
if (!endpoint)
641+
return -ENODEV;
643642

644-
lt->data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
643+
data_lanes = of_property_count_u32_elems(endpoint, "data-lanes");
645644
of_node_put(endpoint);
645+
if (data_lanes < 0) {
646+
dev_err(lt->dev, "%s: Bad data-lanes property\n", __func__);
647+
return data_lanes;
648+
}
649+
lt->data_lanes = data_lanes;
646650

647651
lt->host_node = of_graph_get_remote_node(dev->of_node, 0, -1);
648652
if (!lt->host_node) {
649653
dev_err(lt->dev, "%s: Failed to get remote port\n", __func__);
650-
ret = -ENODEV;
651-
goto end;
654+
return -ENODEV;
652655
}
653656

654657
port_node = of_graph_get_remote_node(dev->of_node, 1, -1);
@@ -659,24 +662,23 @@ static int lt8912_parse_dt(struct lt8912 *lt)
659662
}
660663

661664
lt->hdmi_port = of_drm_find_bridge(port_node);
662-
if (IS_ERR(lt->hdmi_port)) {
665+
if (!lt->hdmi_port) {
663666
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
664-
ret = PTR_ERR(lt->hdmi_port);
665-
of_node_put(lt->host_node);
666-
goto end;
667+
ret = -ENODEV;
668+
goto err_free_host_node;
667669
}
668670

669671
if (!of_device_is_compatible(port_node, "hdmi-connector")) {
670672
dev_err(lt->dev, "%s: Failed to get hdmi port\n", __func__);
671673
ret = -EINVAL;
674+
goto err_free_host_node;
672675
}
673676

674677
of_node_put(port_node);
675-
676-
end:
677-
return ret;
678+
return 0;
678679

679680
err_free_host_node:
681+
of_node_put(port_node);
680682
of_node_put(lt->host_node);
681683
return ret;
682684
}

drivers/gpu/drm/ttm/ttm_tt.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,19 @@ int ttm_tt_populate(struct ttm_device *bdev,
317317
if (ttm_tt_is_populated(ttm))
318318
return 0;
319319

320-
atomic_long_add(ttm->num_pages, &ttm_pages_allocated);
321-
if (bdev->pool.use_dma32)
322-
atomic_long_add(ttm->num_pages, &ttm_dma32_pages_allocated);
320+
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
321+
atomic_long_add(ttm->num_pages, &ttm_pages_allocated);
322+
if (bdev->pool.use_dma32)
323+
atomic_long_add(ttm->num_pages,
324+
&ttm_dma32_pages_allocated);
325+
}
323326

324327
while (atomic_long_read(&ttm_pages_allocated) > ttm_pages_limit ||
325328
atomic_long_read(&ttm_dma32_pages_allocated) >
326329
ttm_dma32_pages_limit) {
327330

328331
ret = ttm_global_swapout(ctx, GFP_KERNEL);
329-
if (ret)
332+
if (ret < 0)
330333
goto error;
331334
}
332335

@@ -350,9 +353,12 @@ int ttm_tt_populate(struct ttm_device *bdev,
350353
return 0;
351354

352355
error:
353-
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
354-
if (bdev->pool.use_dma32)
355-
atomic_long_sub(ttm->num_pages, &ttm_dma32_pages_allocated);
356+
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
357+
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
358+
if (bdev->pool.use_dma32)
359+
atomic_long_sub(ttm->num_pages,
360+
&ttm_dma32_pages_allocated);
361+
}
356362
return ret;
357363
}
358364
EXPORT_SYMBOL(ttm_tt_populate);
@@ -382,9 +388,12 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm)
382388
else
383389
ttm_pool_free(&bdev->pool, ttm);
384390

385-
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
386-
if (bdev->pool.use_dma32)
387-
atomic_long_sub(ttm->num_pages, &ttm_dma32_pages_allocated);
391+
if (!(ttm->page_flags & TTM_PAGE_FLAG_SG)) {
392+
atomic_long_sub(ttm->num_pages, &ttm_pages_allocated);
393+
if (bdev->pool.use_dma32)
394+
atomic_long_sub(ttm->num_pages,
395+
&ttm_dma32_pages_allocated);
396+
}
388397

389398
ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
390399
}

0 commit comments

Comments
 (0)