From patchwork Wed Apr 15 07:40:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11490099 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0572A174A for ; Wed, 15 Apr 2020 07:42:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D89F7206D9 for ; Wed, 15 Apr 2020 07:42:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="hlBUuEnw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D89F7206D9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2899289617; Wed, 15 Apr 2020 07:41:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5ABCF89048 for ; Wed, 15 Apr 2020 07:41:20 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id h26so6469586wrb.7 for ; Wed, 15 Apr 2020 00:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XedkJmxjsSw5iGyEbJMrjH+8XvxXV8jZNQZcH9D7ls4=; b=hlBUuEnw0cvcyM55N5GFKDKVz+iuS4rDb0JUNP5hF7k0Y7wzt5kiTqJQGXl9/dbUwV PmsBpzrAslauDltt9RncT+iL42zTVBDvLhgh7r1WWFBc1cCdUta5QUTXfhXhHmsLA8Cy LQFR2QK8dg0UrplcwHpX77mK6U++eM8/+KWSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XedkJmxjsSw5iGyEbJMrjH+8XvxXV8jZNQZcH9D7ls4=; b=pt0qM4PLcZ5DpCU5oJZFxZLu5P+qJmnVjWbL4JgMJRkOfGcImCLojmOswSrdDSY51n jQF8jAut7JjoAuPmD2RgPn41e/rcg4LCajHsylaYHx63ZxA/Oc9kCVZ2O9VxjjxfPFUp oMnj9QYV3oGUBymzRbzO1v0HDCHLU+YSQSpBZY+y6ak4/dcE4+2uQCEc0T4Iyap5h2/w JGmcPBM9yY9poxDqsxx8ryeNitZYyVTMFEuE9C8/YmyvTXL8lfCnBMQJqNuqFvjgMqLW Z4YutTXsXhA14PX0J6r9/72AnXiS4dt1T92Of9rVzXMDPRCQPHtkStFhT75jUMLaU3AM c0dA== X-Gm-Message-State: AGi0PuYINjtgMMbzBSEcqmQo9rT6JCFIkIubgO9h9btuC1GIEmon5nPU gT6QSb2FU0krLVP6mfrDUeK+X1b5qwE= X-Google-Smtp-Source: APiQypImEFWjI/mCGsxrHaTlwwEuBcDEHWeOGY/Vgwm1Ce7LQXsW12usA7t3oLVS57so3p0UqpfgCg== X-Received: by 2002:a5d:404a:: with SMTP id w10mr1080324wrp.397.1586936478721; Wed, 15 Apr 2020 00:41:18 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id u30sm1878552wru.13.2020.04.15.00.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2020 00:41:18 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 15 Apr 2020 09:40:11 +0200 Message-Id: <20200415074034.175360-37-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200415074034.175360-1-daniel.vetter@ffwll.ch> References: <20200415074034.175360-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 36/59] drm/cirrus: Don't use drm_device->dev_private X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , DRI Development , virtualization@lists.linux-foundation.org, Eric Anholt , =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Gerd Hoffmann , Thomas Zimmermann , Dave Airlie , Daniel Vetter , Sam Ravnborg Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. Acked-by: Eric Anholt Acked-by: Sam Ravnborg Signed-off-by: Daniel Vetter Cc: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: "Noralf Trønnes" Cc: Sam Ravnborg Cc: Eric Anholt Cc: Thomas Zimmermann Cc: virtualization@lists.linux-foundation.org --- drivers/gpu/drm/cirrus/cirrus.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index 4b65637147ba..744a8e337e41 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -59,6 +59,8 @@ struct cirrus_device { void __iomem *mmio; }; +#define to_cirrus(_dev) container_of(_dev, struct cirrus_device, dev) + /* ------------------------------------------------------------------ */ /* * The meat of this driver. The core passes us a mode and we have to program @@ -311,7 +313,7 @@ static int cirrus_mode_set(struct cirrus_device *cirrus, static int cirrus_fb_blit_rect(struct drm_framebuffer *fb, struct drm_rect *rect) { - struct cirrus_device *cirrus = fb->dev->dev_private; + struct cirrus_device *cirrus = to_cirrus(fb->dev); void *vmap; int idx, ret; @@ -436,7 +438,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe, struct drm_crtc_state *crtc_state, struct drm_plane_state *plane_state) { - struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; + struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev); cirrus_mode_set(cirrus, &crtc_state->mode, plane_state->fb); cirrus_fb_blit_fullscreen(plane_state->fb); @@ -445,7 +447,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe, static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe, struct drm_plane_state *old_state) { - struct cirrus_device *cirrus = pipe->crtc.dev->dev_private; + struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev); struct drm_plane_state *state = pipe->plane.state; struct drm_crtc *crtc = &pipe->crtc; struct drm_rect rect; @@ -573,7 +575,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev, return PTR_ERR(cirrus); dev = &cirrus->dev; - dev->dev_private = cirrus; cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));