Commit d5f14f25 authored by Petr Vandrovec's avatar Petr Vandrovec

Store pointer to matroxfb specific fb information instead of universal

fb_info* pointer for secondary head. Saves some typecasts.
parent daf389a0
...@@ -1026,7 +1026,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file, ...@@ -1026,7 +1026,7 @@ static int matroxfb_ioctl(struct inode *inode, struct file *file,
struct matroxfb_dh_fb_info* crtc2; struct matroxfb_dh_fb_info* crtc2;
down_read(&ACCESS_FBINFO(crtc2.lock)); down_read(&ACCESS_FBINFO(crtc2.lock));
crtc2 = (struct matroxfb_dh_fb_info*)ACCESS_FBINFO(crtc2.info); crtc2 = ACCESS_FBINFO(crtc2.info);
if (crtc2) if (crtc2)
crtc2->fbcon.switch_con(crtc2->fbcon.currcon, &crtc2->fbcon); crtc2->fbcon.switch_con(crtc2->fbcon.currcon, &crtc2->fbcon);
up_read(&ACCESS_FBINFO(crtc2.lock)); up_read(&ACCESS_FBINFO(crtc2.lock));
......
...@@ -423,6 +423,7 @@ struct matrox_bios { ...@@ -423,6 +423,7 @@ struct matrox_bios {
struct matrox_switch; struct matrox_switch;
struct matroxfb_driver; struct matroxfb_driver;
struct matroxfb_dh_fb_info;
struct matrox_fb_info { struct matrox_fb_info {
/* fb_info must be first */ /* fb_info must be first */
...@@ -441,7 +442,7 @@ struct matrox_fb_info { ...@@ -441,7 +442,7 @@ struct matrox_fb_info {
struct pci_dev* pcidev; struct pci_dev* pcidev;
struct { struct {
struct fb_info* info; struct matroxfb_dh_fb_info* info;
struct rw_semaphore lock; struct rw_semaphore lock;
} crtc2; } crtc2;
struct { struct {
......
...@@ -796,7 +796,7 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) { ...@@ -796,7 +796,7 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
} }
down_write(&ACCESS_FBINFO(crtc2.lock)); down_write(&ACCESS_FBINFO(crtc2.lock));
oldcrtc2 = ACCESS_FBINFO(crtc2.info); oldcrtc2 = ACCESS_FBINFO(crtc2.info);
ACCESS_FBINFO(crtc2.info) = &m2info->fbcon; ACCESS_FBINFO(crtc2.info) = m2info;
up_write(&ACCESS_FBINFO(crtc2.lock)); up_write(&ACCESS_FBINFO(crtc2.lock));
if (oldcrtc2) { if (oldcrtc2) {
printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 already present: %p\n", printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 already present: %p\n",
...@@ -825,16 +825,16 @@ static void matroxfb_dh_deregisterfb(struct matroxfb_dh_fb_info* m2info) { ...@@ -825,16 +825,16 @@ static void matroxfb_dh_deregisterfb(struct matroxfb_dh_fb_info* m2info) {
#define minfo (m2info->primary_dev) #define minfo (m2info->primary_dev)
if (m2info->fbcon_registered) { if (m2info->fbcon_registered) {
int id; int id;
struct fb_info* crtc2; struct matroxfb_dh_fb_info* crtc2;
down_write(&ACCESS_FBINFO(crtc2.lock)); down_write(&ACCESS_FBINFO(crtc2.lock));
crtc2 = ACCESS_FBINFO(crtc2.info); crtc2 = ACCESS_FBINFO(crtc2.info);
if (crtc2 == &m2info->fbcon) if (crtc2 == m2info)
ACCESS_FBINFO(crtc2.info) = NULL; ACCESS_FBINFO(crtc2.info) = NULL;
up_write(&ACCESS_FBINFO(crtc2.lock)); up_write(&ACCESS_FBINFO(crtc2.lock));
if (crtc2 != &m2info->fbcon) { if (crtc2 != m2info) {
printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 mismatch at unload: %p != %p\n", printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 mismatch at unload: %p != %p\n",
crtc2, &m2info->fbcon); crtc2, m2info);
printk(KERN_ERR "matroxfb_crtc2: Expect kernel crash after module unload.\n"); printk(KERN_ERR "matroxfb_crtc2: Expect kernel crash after module unload.\n");
return; return;
} }
...@@ -872,6 +872,7 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) { ...@@ -872,6 +872,7 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
static void matroxfb_crtc2_remove(struct matrox_fb_info* minfo, void* crtc2) { static void matroxfb_crtc2_remove(struct matrox_fb_info* minfo, void* crtc2) {
matroxfb_dh_deregisterfb(crtc2); matroxfb_dh_deregisterfb(crtc2);
kfree(crtc2);
} }
static struct matroxfb_driver crtc2 = { static struct matroxfb_driver crtc2 = {
......
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