mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 17:51:57 +09:00
drm/arc: Stop using drm_device->dev_private
Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210112084358.2771527-2-daniel.vetter@ffwll.ch
This commit is contained in:
@@ -17,6 +17,8 @@ struct arcpgu_drm_private {
|
||||
struct drm_plane *plane;
|
||||
};
|
||||
|
||||
#define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm)
|
||||
|
||||
#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
|
||||
|
||||
static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
|
||||
|
||||
@@ -176,7 +176,7 @@ static const struct drm_plane_funcs arc_pgu_plane_funcs = {
|
||||
|
||||
static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm)
|
||||
{
|
||||
struct arcpgu_drm_private *arcpgu = drm->dev_private;
|
||||
struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm);
|
||||
struct drm_plane *plane = NULL;
|
||||
int ret;
|
||||
|
||||
@@ -200,7 +200,7 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm)
|
||||
|
||||
int arc_pgu_setup_crtc(struct drm_device *drm)
|
||||
{
|
||||
struct arcpgu_drm_private *arcpgu = drm->dev_private;
|
||||
struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm);
|
||||
struct drm_plane *primary;
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -50,8 +50,6 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)
|
||||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
drm->dev_private = arcpgu;
|
||||
|
||||
arcpgu->clk = devm_clk_get(drm->dev, "pxlclk");
|
||||
if (IS_ERR(arcpgu->clk))
|
||||
return PTR_ERR(arcpgu->clk);
|
||||
@@ -120,7 +118,7 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
struct drm_device *drm = node->minor->dev;
|
||||
struct arcpgu_drm_private *arcpgu = drm->dev_private;
|
||||
struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm);
|
||||
unsigned long clkrate = clk_get_rate(arcpgu->clk);
|
||||
unsigned long mode_clock = arcpgu->crtc.mode.crtc_clock * 1000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user