Commit b9a577a4 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/mgag200: Add struct mgag200_device_info



While currently empty, struct mgag200_device_info, will provide static,
constant information on each device model.

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Tested-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-7-tzimmermann@suse.de
parent b62d943e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -162,13 +162,15 @@ int mgag200_device_preinit(struct mga_device *mdev)
	return 0;
}

int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags)
int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags,
			const struct mgag200_device_info *info)
{
	struct drm_device *dev = &mdev->base;
	u8 crtcext3, misc;
	int ret;

	mdev->flags = flags;
	mdev->info = info;
	mdev->type = type;

	ret = drmm_mutex_init(dev, &mdev->rmmio_lock);
+11 −1
Original line number Diff line number Diff line
@@ -196,10 +196,19 @@ enum mga_type {

#define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B)

struct mgag200_device_info {
};

#define MGAG200_DEVICE_INFO_INIT() \
	{ \
	}

struct mga_device {
	struct drm_device		base;
	unsigned long			flags;

	const struct mgag200_device_info *info;

	struct resource			*rmmio_res;
	void __iomem			*rmmio;
	struct mutex			rmmio_lock; /* Protects access to rmmio */
@@ -252,7 +261,8 @@ int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2);
resource_size_t mgag200_probe_vram(void __iomem *mem, resource_size_t size);
resource_size_t mgag200_device_probe_vram(struct mga_device *mdev);
int mgag200_device_preinit(struct mga_device *mdev);
int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags);
int mgag200_device_init(struct mga_device *mdev, enum mga_type type, unsigned long flags,
			const struct mgag200_device_info *info);

				/* mgag200_<device type>.c */
struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
+4 −1
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ static int mgag200_g200_init_pci_options(struct pci_dev *pdev)
 * DRM Device
 */

static const struct mgag200_device_info mgag200_g200_device_info =
	MGAG200_DEVICE_INFO_INIT();

static void mgag200_g200_interpret_bios(struct mgag200_g200_device *g200,
					const unsigned char *bios, size_t size)
{
@@ -183,7 +186,7 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct

	mgag200_g200_init_refclk(g200);

	ret = mgag200_device_init(mdev, type, flags);
	ret = mgag200_device_init(mdev, type, flags, &mgag200_g200_device_info);
	if (ret)
		return ERR_PTR(ret);

+4 −1
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
 * DRM device
 */

static const struct mgag200_device_info mgag200_g200eh_device_info =
	MGAG200_DEVICE_INFO_INIT();

struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
						enum mga_type type, unsigned long flags)
{
@@ -33,7 +36,7 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const stru
	if (ret)
		return ERR_PTR(ret);

	ret = mgag200_device_init(mdev, type, flags);
	ret = mgag200_device_init(mdev, type, flags, &mgag200_g200eh_device_info);
	if (ret)
		return ERR_PTR(ret);

+4 −1
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
 * DRM device
 */

static const struct mgag200_device_info mgag200_g200eh3_device_info =
	MGAG200_DEVICE_INFO_INIT();

struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
						 const struct drm_driver *drv,
						 enum mga_type type, unsigned long flags)
@@ -34,7 +37,7 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
	if (ret)
		return ERR_PTR(ret);

	ret = mgag200_device_init(mdev, type, flags);
	ret = mgag200_device_init(mdev, type, flags, &mgag200_g200eh3_device_info);
	if (ret)
		return ERR_PTR(ret);

Loading