mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
Rework mgag200_regs_init() and mgag200_mm_init() into device preinit and init functions. The preinit function, mgag200_device_preinit(), requests and maps a device's I/O and video memory. The init function, mgag200_device_init() initializes the state of struct mga_device. Splitting the initialization between the two functions is necessary to perform per-model operations between the two calls, such as reading the unique revision ID on G200SEs. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Tested-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220601112522.5774-6-tzimmermann@suse.de
47 lines
941 B
C
47 lines
941 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <drm/drm_drv.h>
|
|
|
|
#include "mgag200_drv.h"
|
|
|
|
/*
|
|
* DRM device
|
|
*/
|
|
|
|
struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
|
|
enum mga_type type, unsigned long flags)
|
|
{
|
|
struct mga_device *mdev;
|
|
struct drm_device *dev;
|
|
resource_size_t vram_available;
|
|
int ret;
|
|
|
|
mdev = devm_drm_dev_alloc(&pdev->dev, drv, struct mga_device, base);
|
|
if (IS_ERR(mdev))
|
|
return mdev;
|
|
dev = &mdev->base;
|
|
|
|
pci_set_drvdata(pdev, dev);
|
|
|
|
ret = mgag200_init_pci_options(pdev, 0x00000120, 0x0000b000);
|
|
if (ret)
|
|
return ERR_PTR(ret);
|
|
|
|
ret = mgag200_device_preinit(mdev);
|
|
if (ret)
|
|
return ERR_PTR(ret);
|
|
|
|
ret = mgag200_device_init(mdev, type, flags);
|
|
if (ret)
|
|
return ERR_PTR(ret);
|
|
|
|
vram_available = mgag200_device_probe_vram(mdev);
|
|
|
|
ret = mgag200_modeset_init(mdev, vram_available);
|
|
if (ret)
|
|
return ERR_PTR(ret);
|
|
|
|
return mdev;
|
|
}
|