|
6 | 6 | #include <drm/drm_crtc.h> |
7 | 7 | #include <drm/drm_of.h> |
8 | 8 |
|
| 9 | +static void drm_release_of(struct device *dev, void *data) |
| 10 | +{ |
| 11 | + of_node_put(data); |
| 12 | +} |
| 13 | + |
9 | 14 | /** |
10 | 15 | * drm_crtc_port_mask - find the mask of a registered CRTC by port OF node |
11 | 16 | * @dev: DRM device |
@@ -63,6 +68,24 @@ uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, |
63 | 68 | } |
64 | 69 | EXPORT_SYMBOL(drm_of_find_possible_crtcs); |
65 | 70 |
|
| 71 | +/** |
| 72 | + * drm_of_component_match_add - Add a component helper OF node match rule |
| 73 | + * @master: master device |
| 74 | + * @matchptr: component match pointer |
| 75 | + * @compare: compare function used for matching component |
| 76 | + * @node: of_node |
| 77 | + */ |
| 78 | +void drm_of_component_match_add(struct device *master, |
| 79 | + struct component_match **matchptr, |
| 80 | + int (*compare)(struct device *, void *), |
| 81 | + struct device_node *node) |
| 82 | +{ |
| 83 | + of_node_get(node); |
| 84 | + component_match_add_release(master, matchptr, drm_release_of, |
| 85 | + compare, node); |
| 86 | +} |
| 87 | +EXPORT_SYMBOL_GPL(drm_of_component_match_add); |
| 88 | + |
66 | 89 | /** |
67 | 90 | * drm_of_component_probe - Generic probe function for a component based master |
68 | 91 | * @dev: master device containing the OF node |
@@ -101,7 +124,7 @@ int drm_of_component_probe(struct device *dev, |
101 | 124 | continue; |
102 | 125 | } |
103 | 126 |
|
104 | | - component_match_add(dev, &match, compare_of, port); |
| 127 | + drm_of_component_match_add(dev, &match, compare_of, port); |
105 | 128 | of_node_put(port); |
106 | 129 | } |
107 | 130 |
|
@@ -140,7 +163,8 @@ int drm_of_component_probe(struct device *dev, |
140 | 163 | continue; |
141 | 164 | } |
142 | 165 |
|
143 | | - component_match_add(dev, &match, compare_of, remote); |
| 166 | + drm_of_component_match_add(dev, &match, compare_of, |
| 167 | + remote); |
144 | 168 | of_node_put(remote); |
145 | 169 | } |
146 | 170 | of_node_put(port); |
|
0 commit comments