Skip to content

Commit f12784e

Browse files
tdzgregkh
authored andcommitted
drm/ast: Separate DRM driver from PCI code
[ Upstream commit d50ace1 ] Putting the DRM driver to the top of the file and the PCI code to the bottom makes ast_drv.c more readable. While at it, the patch prefixes file-scope variables with ast_. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200730135206.30239-3-tzimmermann@suse.de Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ad9d55d commit f12784e

1 file changed

Lines changed: 31 additions & 28 deletions

File tree

drivers/gpu/drm/ast/ast_drv.c

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,33 @@ int ast_modeset = -1;
4343
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
4444
module_param_named(modeset, ast_modeset, int, 0400);
4545

46-
#define PCI_VENDOR_ASPEED 0x1a03
46+
/*
47+
* DRM driver
48+
*/
49+
50+
DEFINE_DRM_GEM_FOPS(ast_fops);
51+
52+
static struct drm_driver ast_driver = {
53+
.driver_features = DRIVER_ATOMIC |
54+
DRIVER_GEM |
55+
DRIVER_MODESET,
56+
57+
.fops = &ast_fops,
58+
.name = DRIVER_NAME,
59+
.desc = DRIVER_DESC,
60+
.date = DRIVER_DATE,
61+
.major = DRIVER_MAJOR,
62+
.minor = DRIVER_MINOR,
63+
.patchlevel = DRIVER_PATCHLEVEL,
4764

48-
static struct drm_driver driver;
65+
DRM_GEM_VRAM_DRIVER
66+
};
67+
68+
/*
69+
* PCI driver
70+
*/
71+
72+
#define PCI_VENDOR_ASPEED 0x1a03
4973

5074
#define AST_VGA_DEVICE(id, info) { \
5175
.class = PCI_BASE_CLASS_DISPLAY << 16, \
@@ -56,13 +80,13 @@ static struct drm_driver driver;
5680
.subdevice = PCI_ANY_ID, \
5781
.driver_data = (unsigned long) info }
5882

59-
static const struct pci_device_id pciidlist[] = {
83+
static const struct pci_device_id ast_pciidlist[] = {
6084
AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL),
6185
AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL),
6286
{0, 0, 0},
6387
};
6488

65-
MODULE_DEVICE_TABLE(pci, pciidlist);
89+
MODULE_DEVICE_TABLE(pci, ast_pciidlist);
6690

6791
static void ast_kick_out_firmware_fb(struct pci_dev *pdev)
6892
{
@@ -94,7 +118,7 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
94118
if (ret)
95119
return ret;
96120

97-
dev = drm_dev_alloc(&driver, &pdev->dev);
121+
dev = drm_dev_alloc(&ast_driver, &pdev->dev);
98122
if (IS_ERR(dev))
99123
return PTR_ERR(dev);
100124

@@ -118,11 +142,9 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
118142
err_drm_dev_put:
119143
drm_dev_put(dev);
120144
return ret;
121-
122145
}
123146

124-
static void
125-
ast_pci_remove(struct pci_dev *pdev)
147+
static void ast_pci_remove(struct pci_dev *pdev)
126148
{
127149
struct drm_device *dev = pci_get_drvdata(pdev);
128150

@@ -217,30 +239,12 @@ static const struct dev_pm_ops ast_pm_ops = {
217239

218240
static struct pci_driver ast_pci_driver = {
219241
.name = DRIVER_NAME,
220-
.id_table = pciidlist,
242+
.id_table = ast_pciidlist,
221243
.probe = ast_pci_probe,
222244
.remove = ast_pci_remove,
223245
.driver.pm = &ast_pm_ops,
224246
};
225247

226-
DEFINE_DRM_GEM_FOPS(ast_fops);
227-
228-
static struct drm_driver driver = {
229-
.driver_features = DRIVER_ATOMIC |
230-
DRIVER_GEM |
231-
DRIVER_MODESET,
232-
233-
.fops = &ast_fops,
234-
.name = DRIVER_NAME,
235-
.desc = DRIVER_DESC,
236-
.date = DRIVER_DATE,
237-
.major = DRIVER_MAJOR,
238-
.minor = DRIVER_MINOR,
239-
.patchlevel = DRIVER_PATCHLEVEL,
240-
241-
DRM_GEM_VRAM_DRIVER
242-
};
243-
244248
static int __init ast_init(void)
245249
{
246250
if (vgacon_text_force() && ast_modeset == -1)
@@ -261,4 +265,3 @@ module_exit(ast_exit);
261265
MODULE_AUTHOR(DRIVER_AUTHOR);
262266
MODULE_DESCRIPTION(DRIVER_DESC);
263267
MODULE_LICENSE("GPL and additional rights");
264-

0 commit comments

Comments
 (0)