Commit d4a3e50f authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/mgag200: Remove type field from struct mga_device

Each model's specific code is located in a separate file. The type
field in struct mga_device is no unused. Remove it.
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>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220728124103.30159-15-tzimmermann@suse.de
parent 828369f2
...@@ -161,7 +161,7 @@ int mgag200_device_preinit(struct mga_device *mdev) ...@@ -161,7 +161,7 @@ int mgag200_device_preinit(struct mga_device *mdev)
return 0; return 0;
} }
int mgag200_device_init(struct mga_device *mdev, enum mga_type type, int mgag200_device_init(struct mga_device *mdev,
const struct mgag200_device_info *info, const struct mgag200_device_info *info,
const struct mgag200_device_funcs *funcs) const struct mgag200_device_funcs *funcs)
{ {
...@@ -171,7 +171,6 @@ int mgag200_device_init(struct mga_device *mdev, enum mga_type type, ...@@ -171,7 +171,6 @@ int mgag200_device_init(struct mga_device *mdev, enum mga_type type,
mdev->info = info; mdev->info = info;
mdev->funcs = funcs; mdev->funcs = funcs;
mdev->type = type;
ret = drmm_mutex_init(dev, &mdev->rmmio_lock); ret = drmm_mutex_init(dev, &mdev->rmmio_lock);
if (ret) if (ret)
...@@ -234,29 +233,29 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -234,29 +233,29 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
switch (type) { switch (type) {
case G200_PCI: case G200_PCI:
case G200_AGP: case G200_AGP:
mdev = mgag200_g200_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200_device_create(pdev, &mgag200_driver);
break; break;
case G200_SE_A: case G200_SE_A:
case G200_SE_B: case G200_SE_B:
mdev = mgag200_g200se_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200se_device_create(pdev, &mgag200_driver, type);
break; break;
case G200_WB: case G200_WB:
mdev = mgag200_g200wb_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200wb_device_create(pdev, &mgag200_driver);
break; break;
case G200_EV: case G200_EV:
mdev = mgag200_g200ev_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200ev_device_create(pdev, &mgag200_driver);
break; break;
case G200_EH: case G200_EH:
mdev = mgag200_g200eh_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200eh_device_create(pdev, &mgag200_driver);
break; break;
case G200_EH3: case G200_EH3:
mdev = mgag200_g200eh3_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200eh3_device_create(pdev, &mgag200_driver);
break; break;
case G200_ER: case G200_ER:
mdev = mgag200_g200er_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200er_device_create(pdev, &mgag200_driver);
break; break;
case G200_EW3: case G200_EW3:
mdev = mgag200_g200ew3_device_create(pdev, &mgag200_driver, type); mdev = mgag200_g200ew3_device_create(pdev, &mgag200_driver);
break; break;
default: default:
dev_err(&pdev->dev, "Device type %d is unsupported\n", type); dev_err(&pdev->dev, "Device type %d is unsupported\n", type);
......
...@@ -292,8 +292,6 @@ struct mga_device { ...@@ -292,8 +292,6 @@ struct mga_device {
void __iomem *vram; void __iomem *vram;
resource_size_t vram_available; resource_size_t vram_available;
enum mga_type type;
struct drm_plane primary_plane; struct drm_plane primary_plane;
struct drm_crtc crtc; struct drm_crtc crtc;
struct drm_encoder encoder; struct drm_encoder encoder;
...@@ -337,31 +335,28 @@ int mgag200_init_pci_options(struct pci_dev *pdev, u32 option, u32 option2); ...@@ -337,31 +335,28 @@ 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_probe_vram(void __iomem *mem, resource_size_t size);
resource_size_t mgag200_device_probe_vram(struct mga_device *mdev); resource_size_t mgag200_device_probe_vram(struct mga_device *mdev);
int mgag200_device_preinit(struct mga_device *mdev); int mgag200_device_preinit(struct mga_device *mdev);
int mgag200_device_init(struct mga_device *mdev, enum mga_type type, int mgag200_device_init(struct mga_device *mdev,
const struct mgag200_device_info *info, const struct mgag200_device_info *info,
const struct mgag200_device_funcs *funcs); const struct mgag200_device_funcs *funcs);
/* mgag200_<device type>.c */ /* mgag200_<device type>.c */
struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv);
enum mga_type type);
struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type); enum mga_type type);
void mgag200_g200wb_init_registers(struct mga_device *mdev); void mgag200_g200wb_init_registers(struct mga_device *mdev);
void mgag200_g200wb_pixpllc_atomic_update(struct drm_crtc *crtc, struct drm_atomic_state *old_state); void mgag200_g200wb_pixpllc_atomic_update(struct drm_crtc *crtc, struct drm_atomic_state *old_state);
struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv);
enum mga_type type); struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv);
struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv,
enum mga_type type);
void mgag200_g200eh_init_registers(struct mga_device *mdev); void mgag200_g200eh_init_registers(struct mga_device *mdev);
void mgag200_g200eh_pixpllc_atomic_update(struct drm_crtc *crtc, struct drm_atomic_state *old_state); void mgag200_g200eh_pixpllc_atomic_update(struct drm_crtc *crtc, struct drm_atomic_state *old_state);
struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev,
enum mga_type type); const struct drm_driver *drv);
struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
enum mga_type type); const struct drm_driver *drv);
struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev,
enum mga_type type); const struct drm_driver *drv);
struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev,
enum mga_type type); const struct drm_driver *drv);
/* /*
* mgag200_mode.c * mgag200_mode.c
......
...@@ -398,8 +398,7 @@ static const struct mgag200_device_funcs mgag200_g200_device_funcs = { ...@@ -398,8 +398,7 @@ static const struct mgag200_device_funcs mgag200_g200_device_funcs = {
.pixpllc_atomic_update = mgag200_g200_pixpllc_atomic_update, .pixpllc_atomic_update = mgag200_g200_pixpllc_atomic_update,
}; };
struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mgag200_g200_device *g200; struct mgag200_g200_device *g200;
struct mga_device *mdev; struct mga_device *mdev;
...@@ -425,7 +424,7 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct ...@@ -425,7 +424,7 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct
mgag200_g200_init_refclk(g200); mgag200_g200_init_refclk(g200);
ret = mgag200_device_init(mdev, type, &mgag200_g200_device_info, ret = mgag200_device_init(mdev, &mgag200_g200_device_info,
&mgag200_g200_device_funcs); &mgag200_g200_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -274,8 +274,7 @@ static const struct mgag200_device_funcs mgag200_g200eh_device_funcs = { ...@@ -274,8 +274,7 @@ static const struct mgag200_device_funcs mgag200_g200eh_device_funcs = {
.pixpllc_atomic_update = mgag200_g200eh_pixpllc_atomic_update, .pixpllc_atomic_update = mgag200_g200eh_pixpllc_atomic_update,
}; };
struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -297,7 +296,7 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const stru ...@@ -297,7 +296,7 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const stru
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200eh_device_info, ret = mgag200_device_init(mdev, &mgag200_g200eh_device_info,
&mgag200_g200eh_device_funcs); &mgag200_g200eh_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -179,8 +179,7 @@ static const struct mgag200_device_funcs mgag200_g200eh3_device_funcs = { ...@@ -179,8 +179,7 @@ static const struct mgag200_device_funcs mgag200_g200eh3_device_funcs = {
}; };
struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
const struct drm_driver *drv, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -202,7 +201,7 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, ...@@ -202,7 +201,7 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200eh3_device_info, ret = mgag200_device_init(mdev, &mgag200_g200eh3_device_info,
&mgag200_g200eh3_device_funcs); &mgag200_g200eh3_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -312,8 +312,7 @@ static const struct mgag200_device_funcs mgag200_g200er_device_funcs = { ...@@ -312,8 +312,7 @@ static const struct mgag200_device_funcs mgag200_g200er_device_funcs = {
.pixpllc_atomic_update = mgag200_g200er_pixpllc_atomic_update, .pixpllc_atomic_update = mgag200_g200er_pixpllc_atomic_update,
}; };
struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -331,7 +330,7 @@ struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const stru ...@@ -331,7 +330,7 @@ struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const stru
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200er_device_info, ret = mgag200_device_init(mdev, &mgag200_g200er_device_info,
&mgag200_g200er_device_funcs); &mgag200_g200er_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -313,8 +313,7 @@ static const struct mgag200_device_funcs mgag200_g200ev_device_funcs = { ...@@ -313,8 +313,7 @@ static const struct mgag200_device_funcs mgag200_g200ev_device_funcs = {
.pixpllc_atomic_update = mgag200_g200ev_pixpllc_atomic_update, .pixpllc_atomic_update = mgag200_g200ev_pixpllc_atomic_update,
}; };
struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -336,7 +335,7 @@ struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const stru ...@@ -336,7 +335,7 @@ struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const stru
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200ev_device_info, ret = mgag200_device_init(mdev, &mgag200_g200ev_device_info,
&mgag200_g200ev_device_funcs); &mgag200_g200ev_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -199,8 +199,7 @@ static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev ...@@ -199,8 +199,7 @@ static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev
} }
struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev,
const struct drm_driver *drv, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -222,7 +221,7 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, ...@@ -222,7 +221,7 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev,
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200ew3_device_info, ret = mgag200_device_init(mdev, &mgag200_g200ew3_device_info,
&mgag200_g200ew3_device_funcs); &mgag200_g200ew3_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -535,7 +535,7 @@ struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const stru ...@@ -535,7 +535,7 @@ struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const stru
else else
funcs = &mgag200_g200se_00_device_funcs; funcs = &mgag200_g200se_00_device_funcs;
ret = mgag200_device_init(mdev, type, info, funcs); ret = mgag200_device_init(mdev, info, funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -323,8 +323,7 @@ static const struct mgag200_device_funcs mgag200_g200wb_device_funcs = { ...@@ -323,8 +323,7 @@ static const struct mgag200_device_funcs mgag200_g200wb_device_funcs = {
.pixpllc_atomic_update = mgag200_g200wb_pixpllc_atomic_update, .pixpllc_atomic_update = mgag200_g200wb_pixpllc_atomic_update,
}; };
struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv)
enum mga_type type)
{ {
struct mga_device *mdev; struct mga_device *mdev;
struct drm_device *dev; struct drm_device *dev;
...@@ -346,7 +345,7 @@ struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const stru ...@@ -346,7 +345,7 @@ struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const stru
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
ret = mgag200_device_init(mdev, type, &mgag200_g200wb_device_info, ret = mgag200_device_init(mdev, &mgag200_g200wb_device_info,
&mgag200_g200wb_device_funcs); &mgag200_g200wb_device_funcs);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment