video: fbdev: pvr2fb: add COMPILE_TEST support

Add COMPILE_TEST support to pvr2fb driver for better compile
testing coverage.

While at it:

- mark pvr2fb_interrupt() and pvr2fb_common_init() with
  __maybe_unused tag (to silence build warnings when
  !SH_DREAMCAST)

- convert mmio_base in struct pvr2fb_par to 'void __iomem *'
  from 'unsigned long' (needed to silence build warnings on
  ARM).

- split pvr2_get_param() on pvr2_get_param_name() and
  pvr2_get_param_val() (needed to silence build warnings on
  x86).

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2019-06-07 14:38:07 +02:00
parent db7f2cb965
commit 0f5a5712ad
2 changed files with 36 additions and 28 deletions

View File

@ -809,7 +809,8 @@ config FB_XVR1000
config FB_PVR2
tristate "NEC PowerVR 2 display support"
depends on FB && SH_DREAMCAST
depends on FB && HAS_IOMEM
depends on SH_DREAMCAST || COMPILE_TEST
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT

View File

@ -139,7 +139,7 @@ static struct pvr2fb_par {
unsigned char is_doublescan; /* Are scanlines output twice? (doublescan) */
unsigned char is_lowres; /* Is horizontal pixel-doubling enabled? */
unsigned long mmio_base; /* MMIO base */
void __iomem *mmio_base; /* MMIO base */
u32 palette[16];
} *currentpar;
@ -325,9 +325,9 @@ static int pvr2fb_setcolreg(unsigned int regno, unsigned int red,
* anything if the cable type has been overidden (via "cable:XX").
*/
#define PCTRA 0xff80002c
#define PDTRA 0xff800030
#define VOUTC 0xa0702c00
#define PCTRA ((void __iomem *)0xff80002c)
#define PDTRA ((void __iomem *)0xff800030)
#define VOUTC ((void __iomem *)0xa0702c00)
static int pvr2_init_cable(void)
{
@ -619,7 +619,7 @@ static void pvr2_do_blank(void)
is_blanked = do_blank > 0 ? do_blank : 0;
}
static irqreturn_t pvr2fb_interrupt(int irq, void *dev_id)
static irqreturn_t __maybe_unused pvr2fb_interrupt(int irq, void *dev_id)
{
struct fb_info *info = dev_id;
@ -722,21 +722,28 @@ static struct fb_ops pvr2fb_ops = {
.fb_imageblit = cfb_imageblit,
};
static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val,
static int pvr2_get_param_val(const struct pvr2_params *p, const char *s,
int size)
{
int i;
for (i = 0; i < size; i++) {
if (!strncasecmp(p[i].name, s, strlen(s)))
return p[i].val;
}
return -1;
}
static char *pvr2_get_param_name(const struct pvr2_params *p, int val,
int size)
{
int i;
for (i = 0 ; i < size ; i++ ) {
if (s != NULL) {
if (!strncasecmp(p[i].name, s, strlen(s)))
return p[i].val;
} else {
if (p[i].val == val)
return (int)p[i].name;
}
for (i = 0; i < size; i++) {
if (p[i].val == val)
return p[i].name;
}
return -1;
return NULL;
}
/**
@ -757,7 +764,7 @@ static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val,
* in for flexibility anyways. Who knows, maybe someone has tv-out on a
* PCI-based version of these things ;-)
*/
static int pvr2fb_common_init(void)
static int __maybe_unused pvr2fb_common_init(void)
{
struct pvr2fb_par *par = currentpar;
unsigned long modememused, rev;
@ -770,8 +777,8 @@ static int pvr2fb_common_init(void)
goto out_err;
}
par->mmio_base = (unsigned long)ioremap_nocache(pvr2_fix.mmio_start,
pvr2_fix.mmio_len);
par->mmio_base = ioremap_nocache(pvr2_fix.mmio_start,
pvr2_fix.mmio_len);
if (!par->mmio_base) {
printk(KERN_ERR "pvr2fb: Failed to remap mmio space\n");
goto out_err;
@ -819,8 +826,8 @@ static int pvr2fb_common_init(void)
fb_info->var.xres, fb_info->var.yres,
fb_info->var.bits_per_pixel,
get_line_length(fb_info->var.xres, fb_info->var.bits_per_pixel),
(char *)pvr2_get_param(cables, NULL, cable_type, 3),
(char *)pvr2_get_param(outputs, NULL, video_output, 3));
pvr2_get_param_name(cables, cable_type, 3),
pvr2_get_param_name(outputs, video_output, 3));
#ifdef CONFIG_SH_STORE_QUEUES
fb_notice(fb_info, "registering with SQ API\n");
@ -838,7 +845,7 @@ out_err:
if (fb_info->screen_base)
iounmap(fb_info->screen_base);
if (par->mmio_base)
iounmap((void *)par->mmio_base);
iounmap(par->mmio_base);
return -ENXIO;
}
@ -905,8 +912,8 @@ static void __exit pvr2fb_dc_exit(void)
fb_info->screen_base = NULL;
}
if (currentpar->mmio_base) {
iounmap((void *)currentpar->mmio_base);
currentpar->mmio_base = 0;
iounmap(currentpar->mmio_base);
currentpar->mmio_base = NULL;
}
free_irq(HW_EVENT_VSYNC, fb_info);
@ -955,8 +962,8 @@ static void pvr2fb_pci_remove(struct pci_dev *pdev)
fb_info->screen_base = NULL;
}
if (currentpar->mmio_base) {
iounmap((void *)currentpar->mmio_base);
currentpar->mmio_base = 0;
iounmap(currentpar->mmio_base);
currentpar->mmio_base = NULL;
}
pci_release_regions(pdev);
@ -1027,9 +1034,9 @@ static int __init pvr2fb_setup(char *options)
}
if (*cable_arg)
cable_type = pvr2_get_param(cables, cable_arg, 0, 3);
cable_type = pvr2_get_param_val(cables, cable_arg, 3);
if (*output_arg)
video_output = pvr2_get_param(outputs, output_arg, 0, 3);
video_output = pvr2_get_param_val(outputs, output_arg, 3);
return 0;
}