Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2284347ybl; Thu, 19 Dec 2019 11:00:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzQC7O+3yNoan/nbt/QvUvLMAFsVnjcGAFWRLazeTn6p/cL0lmQ/gWO/Pdb503a5caxDRWl X-Received: by 2002:a05:6830:4d9:: with SMTP id s25mr10375352otd.171.1576782041071; Thu, 19 Dec 2019 11:00:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576782041; cv=none; d=google.com; s=arc-20160816; b=dHixf4RWra6gcDyJcF8JgVKh2jRIGQeQHJ2eqaCFvG82i6jQwHP10Bdy1CDCe/nroT YaJiiPtetnY4HgsKUyypm1cWqV8+KE9LNFDfYKGdYnQ3nI8e4/XGSAUtrWXIOsDiXB/A 5GVBRk1ErhFYejV90/4O4oc5muZ0EyNvDbx9hWPxllvbbEaYv6fMp//22P1iZukeqW9X N70vTUsQ62BneXs2Yze4XE0pZgUCc4BIhxj/kmRIFFVgRiBMy0lCoOrn28Rv8OLgv3V+ esgkdMdGKxP7ybDj9s1dz2z2vFlcP/RcntYTdLmHl5kS8eZgBuDtYBl3ulAUe1Oea58u OZew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yqi1zQ48ZHfcKYmwLYX0RbeZlV8Nr5PFyWIFRWUHhUk=; b=FtsPaCTP0uAaB+jFdbrkJ+eYQjvi8XZ+9dYzRkr6vViwXMOYMKd86XxzoTsf7b6TcD fA0fWHEL7N2oWJeQcX4chnJqzI0Qt/ndJudQ1t5eseh6Tl8yedLT0xZ0o4JN/PBzq8dq NcipIfXXTeoX6JUXlyfD8UyJ79+jYBejyvT39U/bdogkHXX3DTG0F58NNHTXxDTdeL+K +766MJkPFUrpzWjxTc/VVo/42so4jbPCHb33fAV9wWDSUDzkHEibbcCxJGLNqWhAQmA6 Fyg0opsjkKSr4gW6B1OWCa5MoC+gC+qXVghr6T1rF/XeiOJ3Wqr7dUtNf8kEXmnd1Dgk xOTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M04HltVi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g200si3454708oib.273.2019.12.19.11.00.28; Thu, 19 Dec 2019 11:00:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M04HltVi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730610AbfLSSzE (ORCPT + 99 others); Thu, 19 Dec 2019 13:55:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:50716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729849AbfLSSzD (ORCPT ); Thu, 19 Dec 2019 13:55:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC2B1222C2; Thu, 19 Dec 2019 18:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781702; bh=lxiLAwc3bq7yRsFDpS8Y/vXlzk3A1s79z7n/XxmpgZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M04HltVi8w1WzySTFYCLneYGnfUjHaeOgfGU4jXb075J3ZmGFIkKipVVZuMFlMeqS Shpd4BYLSo5gvTwCaJ1xSE008COi+3g+5EUt9+1KojMB0RTCADeWWJyr+YgLuzkRlv BpEX40ap6iWS1dfdblQ4NdEdxvqHHpI7YjVhc6GA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Daniel Vetter , John Donnelly , Gerd Hoffmann , Dave Airlie , Maarten Lankhorst , Maxime Ripard , David Airlie , Sam Ravnborg , Emil Velikov , "Y.C. Chen" , Laurent Pinchart , =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= , Andrzej Pietrasiewicz , dri-devel@lists.freedesktop.org Subject: [PATCH 5.4 46/80] drm/mgag200: Extract device type from flags Date: Thu, 19 Dec 2019 19:34:38 +0100 Message-Id: <20191219183113.297293802@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Zimmermann commit 3a8a5aba142a44eaeba0cb0ec1b4a8f177b5e59a upstream. Adds a conversion function that extracts the device type from the PCI id-table flags. Allows for storing additional information in the other flag bits. Signed-off-by: Thomas Zimmermann Fixes: 81da87f63a1e ("drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin") Reviewed-by: Daniel Vetter Cc: John Donnelly Cc: Gerd Hoffmann Cc: Dave Airlie Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Sam Ravnborg Cc: Emil Velikov Cc: "Y.C. Chen" Cc: Laurent Pinchart Cc: "José Roberto de Souza" Cc: Andrzej Pietrasiewicz Cc: dri-devel@lists.freedesktop.org Cc: # v5.3+ Link: https://patchwork.freedesktop.org/patch/msgid/20191126101529.20356-2-tzimmermann@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/mgag200/mgag200_drv.h | 7 +++++++ drivers/gpu/drm/mgag200/mgag200_main.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -159,6 +159,8 @@ enum mga_type { G200_EW3, }; +#define MGAG200_TYPE_MASK (0x000000ff) + #define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B) struct mga_device { @@ -188,6 +190,11 @@ struct mga_device { u32 unique_rev_id; }; +static inline enum mga_type +mgag200_type_from_driver_data(kernel_ulong_t driver_data) +{ + return (enum mga_type)(driver_data & MGAG200_TYPE_MASK); +} /* mgag200_mode.c */ int mgag200_modeset_init(struct mga_device *mdev); void mgag200_modeset_fini(struct mga_device *mdev); --- a/drivers/gpu/drm/mgag200/mgag200_main.c +++ b/drivers/gpu/drm/mgag200/mgag200_main.c @@ -94,7 +94,7 @@ static int mgag200_device_init(struct dr struct mga_device *mdev = dev->dev_private; int ret, option; - mdev->type = flags; + mdev->type = mgag200_type_from_driver_data(flags); /* Hardcode the number of CRTCs to 1 */ mdev->num_crtc = 1;