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

Configure Feed

Select the types of activity you want to include in your feed.

drm/vc4: convert to devm_drm_bridge_alloc() API

This is the new API for allocating DRM bridges.

This driver already implements refcounting of the struct vc4_dsi, which
embeds struct drm_bridge. Now this is a duplicate of the refcounting
implemented by the DRM bridge core, so convert the vc4_dsi_get/put() calls
into drm_bridge_get/put() calls and get rid of the driver-specific
refcounting implementation.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250424-drm-bridge-convert-to-alloc-api-v2-27-8f91a404d86b@bootlin.com
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>

authored by

Luca Ceresoli and committed by
Louis Chauvet
9545c91e e11532be

+5 -29
+5 -29
drivers/gpu/drm/vc4/vc4_dsi.c
··· 552 552 struct vc4_encoder encoder; 553 553 struct mipi_dsi_host dsi_host; 554 554 555 - struct kref kref; 556 - 557 555 struct platform_device *pdev; 558 556 559 557 struct drm_bridge *out_bridge; ··· 1620 1622 dsi->reg_dma_chan = NULL; 1621 1623 } 1622 1624 1623 - static void vc4_dsi_release(struct kref *kref) 1624 - { 1625 - struct vc4_dsi *dsi = 1626 - container_of(kref, struct vc4_dsi, kref); 1627 - 1628 - kfree(dsi); 1629 - } 1630 - 1631 - static void vc4_dsi_get(struct vc4_dsi *dsi) 1632 - { 1633 - kref_get(&dsi->kref); 1634 - } 1635 - 1636 - static void vc4_dsi_put(struct vc4_dsi *dsi) 1637 - { 1638 - kref_put(&dsi->kref, &vc4_dsi_release); 1639 - } 1640 - 1641 1625 static void vc4_dsi_release_action(struct drm_device *drm, void *ptr) 1642 1626 { 1643 1627 struct vc4_dsi *dsi = ptr; 1644 1628 1645 - vc4_dsi_put(dsi); 1629 + drm_bridge_put(&dsi->bridge); 1646 1630 } 1647 1631 1648 1632 static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) ··· 1635 1655 struct drm_encoder *encoder = &dsi->encoder.base; 1636 1656 int ret; 1637 1657 1638 - vc4_dsi_get(dsi); 1658 + drm_bridge_get(&dsi->bridge); 1639 1659 1640 1660 ret = drmm_add_action_or_reset(drm, vc4_dsi_release_action, dsi); 1641 1661 if (ret) ··· 1790 1810 struct device *dev = &pdev->dev; 1791 1811 struct vc4_dsi *dsi; 1792 1812 1793 - dsi = kzalloc(sizeof(*dsi), GFP_KERNEL); 1794 - if (!dsi) 1795 - return -ENOMEM; 1813 + dsi = devm_drm_bridge_alloc(&pdev->dev, struct vc4_dsi, bridge, &vc4_dsi_bridge_funcs); 1814 + if (IS_ERR(dsi)) 1815 + return PTR_ERR(dsi); 1796 1816 dev_set_drvdata(dev, dsi); 1797 1817 1798 - kref_init(&dsi->kref); 1799 - 1800 1818 dsi->pdev = pdev; 1801 - dsi->bridge.funcs = &vc4_dsi_bridge_funcs; 1802 1819 #ifdef CONFIG_OF 1803 1820 dsi->bridge.of_node = dev->of_node; 1804 1821 #endif ··· 1813 1836 struct vc4_dsi *dsi = dev_get_drvdata(dev); 1814 1837 1815 1838 mipi_dsi_host_unregister(&dsi->dsi_host); 1816 - vc4_dsi_put(dsi); 1817 1839 } 1818 1840 1819 1841 struct platform_driver vc4_dsi_driver = {