Commit b8901b09 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds

[PATCH] fbdev: savagefb: Driver cleanup

- remove redundant casts
- remove symbol_get/symbol_put
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c439e345
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
static void savage4_gpio_setscl(void *data, int val) static void savage4_gpio_setscl(void *data, int val)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
unsigned int r; unsigned int r;
r = readl(chan->ioaddr + chan->reg); r = readl(chan->ioaddr + chan->reg);
...@@ -63,7 +63,7 @@ static void savage4_gpio_setscl(void *data, int val) ...@@ -63,7 +63,7 @@ static void savage4_gpio_setscl(void *data, int val)
static void savage4_gpio_setsda(void *data, int val) static void savage4_gpio_setsda(void *data, int val)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
unsigned int r; unsigned int r;
r = readl(chan->ioaddr + chan->reg); r = readl(chan->ioaddr + chan->reg);
...@@ -77,21 +77,21 @@ static void savage4_gpio_setsda(void *data, int val) ...@@ -77,21 +77,21 @@ static void savage4_gpio_setsda(void *data, int val)
static int savage4_gpio_getscl(void *data) static int savage4_gpio_getscl(void *data)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN));
} }
static int savage4_gpio_getsda(void *data) static int savage4_gpio_getsda(void *data)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN));
} }
static void prosavage_gpio_setscl(void* data, int val) static void prosavage_gpio_setscl(void* data, int val)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
u32 r; u32 r;
SET_CR_IX(chan->ioaddr, chan->reg); SET_CR_IX(chan->ioaddr, chan->reg);
...@@ -107,7 +107,7 @@ static void prosavage_gpio_setscl(void* data, int val) ...@@ -107,7 +107,7 @@ static void prosavage_gpio_setscl(void* data, int val)
static void prosavage_gpio_setsda(void* data, int val) static void prosavage_gpio_setsda(void* data, int val)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
unsigned int r; unsigned int r;
SET_CR_IX(chan->ioaddr, chan->reg); SET_CR_IX(chan->ioaddr, chan->reg);
...@@ -123,7 +123,7 @@ static void prosavage_gpio_setsda(void* data, int val) ...@@ -123,7 +123,7 @@ static void prosavage_gpio_setsda(void* data, int val)
static int prosavage_gpio_getscl(void* data) static int prosavage_gpio_getscl(void* data)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
SET_CR_IX(chan->ioaddr, chan->reg); SET_CR_IX(chan->ioaddr, chan->reg);
return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN));
...@@ -131,7 +131,7 @@ static int prosavage_gpio_getscl(void* data) ...@@ -131,7 +131,7 @@ static int prosavage_gpio_getscl(void* data)
static int prosavage_gpio_getsda(void* data) static int prosavage_gpio_getsda(void* data)
{ {
struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; struct savagefb_i2c_chan *chan = data;
SET_CR_IX(chan->ioaddr, chan->reg); SET_CR_IX(chan->ioaddr, chan->reg);
return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN));
...@@ -140,10 +140,9 @@ static int prosavage_gpio_getsda(void* data) ...@@ -140,10 +140,9 @@ static int prosavage_gpio_getsda(void* data)
static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
const char *name) const char *name)
{ {
int (*add_bus)(struct i2c_adapter *) = symbol_get(i2c_bit_add_bus);
int rc = 0; int rc = 0;
if (add_bus && chan->par) { if (chan->par) {
strcpy(chan->adapter.name, name); strcpy(chan->adapter.name, name);
chan->adapter.owner = THIS_MODULE; chan->adapter.owner = THIS_MODULE;
chan->adapter.id = I2C_HW_B_SAVAGE; chan->adapter.id = I2C_HW_B_SAVAGE;
...@@ -161,7 +160,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, ...@@ -161,7 +160,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
chan->algo.setscl(chan, 1); chan->algo.setscl(chan, 1);
udelay(20); udelay(20);
rc = add_bus(&chan->adapter); rc = i2c_bit_add_bus(&chan->adapter);
if (rc == 0) if (rc == 0)
dev_dbg(&chan->par->pcidev->dev, dev_dbg(&chan->par->pcidev->dev,
...@@ -169,8 +168,6 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, ...@@ -169,8 +168,6 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
else else
dev_warn(&chan->par->pcidev->dev, dev_warn(&chan->par->pcidev->dev,
"Failed to register I2C bus %s.\n", name); "Failed to register I2C bus %s.\n", name);
symbol_put(i2c_bit_add_bus);
} else } else
chan->par = NULL; chan->par = NULL;
...@@ -179,7 +176,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, ...@@ -179,7 +176,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,
void savagefb_create_i2c_busses(struct fb_info *info) void savagefb_create_i2c_busses(struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
par->chan.par = par; par->chan.par = par;
switch(info->fix.accel) { switch(info->fix.accel) {
...@@ -210,14 +207,10 @@ void savagefb_create_i2c_busses(struct fb_info *info) ...@@ -210,14 +207,10 @@ void savagefb_create_i2c_busses(struct fb_info *info)
void savagefb_delete_i2c_busses(struct fb_info *info) void savagefb_delete_i2c_busses(struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int (*del_bus)(struct i2c_adapter *) =
symbol_get(i2c_bit_del_bus);
if (del_bus && par->chan.par) { if (par->chan.par)
del_bus(&par->chan.adapter); i2c_bit_del_bus(&par->chan.adapter);
symbol_put(i2c_bit_del_bus);
}
par->chan.par = NULL; par->chan.par = NULL;
} }
...@@ -225,8 +218,6 @@ void savagefb_delete_i2c_busses(struct fb_info *info) ...@@ -225,8 +218,6 @@ void savagefb_delete_i2c_busses(struct fb_info *info)
static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
{ {
u8 start = 0x0; u8 start = 0x0;
int (*transfer)(struct i2c_adapter *, struct i2c_msg *, int) =
symbol_get(i2c_transfer);
struct i2c_msg msgs[] = { struct i2c_msg msgs[] = {
{ {
.addr = SAVAGE_DDC, .addr = SAVAGE_DDC,
...@@ -240,21 +231,19 @@ static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) ...@@ -240,21 +231,19 @@ static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan)
}; };
u8 *buf = NULL; u8 *buf = NULL;
if (transfer && chan->par) { if (chan->par) {
buf = kmalloc(EDID_LENGTH, GFP_KERNEL); buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (buf) { if (buf) {
msgs[1].buf = buf; msgs[1].buf = buf;
if (transfer(&chan->adapter, msgs, 2) != 2) { if (i2c_transfer(&chan->adapter, msgs, 2) != 2) {
dev_dbg(&chan->par->pcidev->dev, dev_dbg(&chan->par->pcidev->dev,
"Unable to read EDID block.\n"); "Unable to read EDID block.\n");
kfree(buf); kfree(buf);
buf = NULL; buf = NULL;
} }
} }
symbol_put(i2c_transfer);
} }
return buf; return buf;
......
...@@ -21,7 +21,7 @@ static u32 savagefb_rop[] = { ...@@ -21,7 +21,7 @@ static u32 savagefb_rop[] = {
int savagefb_sync(struct fb_info *info) int savagefb_sync(struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
par->SavageWaitIdle(par); par->SavageWaitIdle(par);
return 0; return 0;
...@@ -29,7 +29,7 @@ int savagefb_sync(struct fb_info *info) ...@@ -29,7 +29,7 @@ int savagefb_sync(struct fb_info *info)
void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int sx = region->sx, dx = region->dx; int sx = region->sx, dx = region->dx;
int sy = region->sy, dy = region->dy; int sy = region->sy, dy = region->dy;
int cmd; int cmd;
...@@ -63,7 +63,7 @@ void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) ...@@ -63,7 +63,7 @@ void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int cmd, color; int cmd, color;
if (!rect->width || !rect->height) if (!rect->width || !rect->height)
...@@ -90,7 +90,7 @@ void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) ...@@ -90,7 +90,7 @@ void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) void savagefb_imageblit(struct fb_info *info, const struct fb_image *image)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int fg, bg, size, i, width; int fg, bg, size, i, width;
int cmd; int cmd;
u32 *src = (u32 *) image->data; u32 *src = (u32 *) image->data;
......
...@@ -686,7 +686,7 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode ...@@ -686,7 +686,7 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode
static int savagefb_check_var (struct fb_var_screeninfo *var, static int savagefb_check_var (struct fb_var_screeninfo *var,
struct fb_info *info) struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int memlen, vramlen, mode_valid = 0; int memlen, vramlen, mode_valid = 0;
DBG("savagefb_check_var"); DBG("savagefb_check_var");
...@@ -1025,7 +1025,7 @@ static int savagefb_setcolreg(unsigned regno, ...@@ -1025,7 +1025,7 @@ static int savagefb_setcolreg(unsigned regno,
unsigned transp, unsigned transp,
struct fb_info *info) struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
if (regno >= NR_PALETTE) if (regno >= NR_PALETTE)
return -EINVAL; return -EINVAL;
...@@ -1328,7 +1328,7 @@ static void savagefb_set_fix(struct fb_info *info) ...@@ -1328,7 +1328,7 @@ static void savagefb_set_fix(struct fb_info *info)
#if defined(CONFIG_FB_SAVAGE_ACCEL) #if defined(CONFIG_FB_SAVAGE_ACCEL)
static void savagefb_set_clip(struct fb_info *info) static void savagefb_set_clip(struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int cmd; int cmd;
cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW;
...@@ -1342,7 +1342,7 @@ static void savagefb_set_clip(struct fb_info *info) ...@@ -1342,7 +1342,7 @@ static void savagefb_set_clip(struct fb_info *info)
static int savagefb_set_par (struct fb_info *info) static int savagefb_set_par (struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
struct fb_var_screeninfo *var = &info->var; struct fb_var_screeninfo *var = &info->var;
int err; int err;
...@@ -1381,7 +1381,7 @@ static int savagefb_set_par (struct fb_info *info) ...@@ -1381,7 +1381,7 @@ static int savagefb_set_par (struct fb_info *info)
static int savagefb_pan_display (struct fb_var_screeninfo *var, static int savagefb_pan_display (struct fb_var_screeninfo *var,
struct fb_info *info) struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
u_int y_bottom; u_int y_bottom;
y_bottom = var->yoffset; y_bottom = var->yoffset;
...@@ -1534,7 +1534,7 @@ static void savage_disable_mmio (struct savagefb_par *par) ...@@ -1534,7 +1534,7 @@ static void savage_disable_mmio (struct savagefb_par *par)
static int __devinit savage_map_mmio (struct fb_info *info) static int __devinit savage_map_mmio (struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
DBG ("savage_map_mmio"); DBG ("savage_map_mmio");
if (S3_SAVAGE3D_SERIES (par->chip)) if (S3_SAVAGE3D_SERIES (par->chip))
...@@ -1567,7 +1567,7 @@ static int __devinit savage_map_mmio (struct fb_info *info) ...@@ -1567,7 +1567,7 @@ static int __devinit savage_map_mmio (struct fb_info *info)
static void __devinit savage_unmap_mmio (struct fb_info *info) static void __devinit savage_unmap_mmio (struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
DBG ("savage_unmap_mmio"); DBG ("savage_unmap_mmio");
savage_disable_mmio(par); savage_disable_mmio(par);
...@@ -1581,7 +1581,7 @@ static void __devinit savage_unmap_mmio (struct fb_info *info) ...@@ -1581,7 +1581,7 @@ static void __devinit savage_unmap_mmio (struct fb_info *info)
static int __devinit savage_map_video (struct fb_info *info, static int __devinit savage_map_video (struct fb_info *info,
int video_len) int video_len)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int resource; int resource;
DBG("savage_map_video"); DBG("savage_map_video");
...@@ -1619,7 +1619,7 @@ static int __devinit savage_map_video (struct fb_info *info, ...@@ -1619,7 +1619,7 @@ static int __devinit savage_map_video (struct fb_info *info,
static void __devinit savage_unmap_video (struct fb_info *info) static void __devinit savage_unmap_video (struct fb_info *info)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
DBG("savage_unmap_video"); DBG("savage_unmap_video");
...@@ -1869,7 +1869,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info, ...@@ -1869,7 +1869,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info,
struct pci_dev *dev, struct pci_dev *dev,
const struct pci_device_id *id) const struct pci_device_id *id)
{ {
struct savagefb_par *par = (struct savagefb_par *)info->par; struct savagefb_par *par = info->par;
int err = 0; int err = 0;
par->pcidev = dev; par->pcidev = dev;
...@@ -2139,8 +2139,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev, ...@@ -2139,8 +2139,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev,
static void __devexit savagefb_remove (struct pci_dev *dev) static void __devexit savagefb_remove (struct pci_dev *dev)
{ {
struct fb_info *info = struct fb_info *info = pci_get_drvdata(dev);
(struct fb_info *)pci_get_drvdata(dev);
DBG("savagefb_remove"); DBG("savagefb_remove");
...@@ -2174,9 +2173,8 @@ static void __devexit savagefb_remove (struct pci_dev *dev) ...@@ -2174,9 +2173,8 @@ static void __devexit savagefb_remove (struct pci_dev *dev)
static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
{ {
struct fb_info *info = struct fb_info *info = pci_get_drvdata(dev);
(struct fb_info *)pci_get_drvdata(dev); struct savagefb_par *par = info->par;
struct savagefb_par *par = (struct savagefb_par *)info->par;
DBG("savagefb_suspend"); DBG("savagefb_suspend");
...@@ -2210,9 +2208,8 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) ...@@ -2210,9 +2208,8 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state)
static int savagefb_resume (struct pci_dev* dev) static int savagefb_resume (struct pci_dev* dev)
{ {
struct fb_info *info = struct fb_info *info = pci_get_drvdata(dev);
(struct fb_info *)pci_get_drvdata(dev); struct savagefb_par *par = info->par;
struct savagefb_par *par = (struct savagefb_par *)info->par;
int cur_state = par->pm_state; int cur_state = par->pm_state;
DBG("savage_resume"); DBG("savage_resume");
......
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