Skip to content

Commit 730df50

Browse files
ckborahjnikula
authored andcommitted
drm/i915/color: Add helper to create intel colorop
Add intel colorop create helper v2: - Make function names consistent (Jani) - Remove redundant code related to colorop state - Refactor code to separate files Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Signed-off-by: Uma Shankar <uma.shankar@intel.com> Link: https://patch.msgid.link/20251203085211.3663374-4-uma.shankar@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 3e9b065 commit 730df50

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_colorop.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,28 @@ struct intel_colorop *to_intel_colorop(struct drm_colorop *colorop)
88
{
99
return container_of(colorop, struct intel_colorop, base);
1010
}
11+
12+
struct intel_colorop *intel_colorop_alloc(void)
13+
{
14+
struct intel_colorop *colorop;
15+
16+
colorop = kzalloc(sizeof(*colorop), GFP_KERNEL);
17+
if (!colorop)
18+
return ERR_PTR(-ENOMEM);
19+
20+
return colorop;
21+
}
22+
23+
struct intel_colorop *intel_colorop_create(enum intel_color_block id)
24+
{
25+
struct intel_colorop *colorop;
26+
27+
colorop = intel_colorop_alloc();
28+
29+
if (IS_ERR(colorop))
30+
return colorop;
31+
32+
colorop->id = id;
33+
34+
return colorop;
35+
}

drivers/gpu/drm/i915/display/intel_colorop.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
#include "intel_display_types.h"
1010

1111
struct intel_colorop *to_intel_colorop(struct drm_colorop *colorop);
12+
struct intel_colorop *intel_colorop_alloc(void);
13+
struct intel_colorop *intel_colorop_create(enum intel_color_block id);
1214

1315
#endif /* __INTEL_COLOROP_H__ */

0 commit comments

Comments
 (0)