1
0
Fork 0
Commit Graph

179 Commits (7de76ee118ce013bb17c924515cb45464d8a059b)

Author SHA1 Message Date
Aaro Koskinen d51d45da3e staging: xgifb: initialize register 3cc address
Commit 56810a92c6 (staging: xgifb: use
XGIRegInit()) left 3cc uninitialized, and it may trigger a panic during
probe. Fix this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-07 13:59:25 -08:00
Peter Huewe a5e080b83e staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata
Instead of subtracting one and then assign a different name and add 1
again we simply use HDE directly. HDE wasn't used directly before, so no
change in functionality.
Same applies to VDE.

-> now we can remove the variable with the very descriptive name E ;)

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe bae31702cd staging/xgifb: rewrite XGIfb_get_cmap_len
We don't need to use this switch-case here for a simple two case
if-else.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe fd1bbbb79e staging/xgifb: Fix return of uninitialized variable
Clang warning:
drivers/staging/xgifb/XGI_main_26.c: warning: variable 'ret' is
used uninitialized whenever 'if' condition:
	if (xgifb_info->mode_idx < 0) {
evaluates to true.

drivers/staging/xgifb/XGI_main_26.c:
note: uninitialized use occurs here
	return ret;

This patch initializes the variable in this case.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe 8cedcc7022 staging/xgifb: mttr must be (signed) int
The mttr field must be declared as signed int (as in every other fb
driver) for the mttr functions to work properly.
Moreover the value should be initialized with -1.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe 44e1312c68 staging/xgifb: Remove always false comparisons
This patch removes some comparisons that always evaluate to false since
xoffset and yoffset are defined as __u32 in fb_var_screeninfo in
include/linux/fb.h and thus can never be negative.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-04 10:46:27 -08:00
Peter Huewe ecfaa00c00 staging/xgifb: Remove unused variables and dead assignments
The variables A,HBS and VBS are never read in XGIfb_mode_rate_to_ddata
and the assignment has no side effects -> so we can simply remove them.
Removing them causes VT, HT and cr_data3 to be unused -> remove them as well
and remove the assignmens to cr_data which are shadowed by a different
assignment a few lines later.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-03 19:26:13 -06:00
Aaro Koskinen 56810a92c6 staging: xgifb: use XGIRegInit()
Avoid copy-paste and use XGIRegInit() to initialize registers addresses.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 14:00:10 -08:00
Bill Pemberton 8db72ff521 staging: xgifb: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:12 -08:00
Bill Pemberton 89f6883c70 staging: xgifb: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:00 -08:00
Bill Pemberton 2c4ae9d218 staging: xgifb: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 15:05:00 -08:00
Aaro Koskinen acfe093e82 staging: xgifb: eliminate pVBInfo->VCLKData/VBVCLKData
Access XGI_VCLKData and XGI_VBVCLKData directly and make them const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen 7853bced96 staging: xgifb: eliminate pVBInfo->XGINEWUB_CRT1Table
Access XGI_CRT1Table directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen a39325d24f staging: xgifb: eliminate pVBInfo->RefIndex
Access XGI330_RefIndex directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:20 -08:00
Aaro Koskinen b397992e88 staging: xgifb: eliminate pVBInfo->EModeIDTable
Access XGI330_EModeIDTable directly and make it const.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:19 -08:00
Aaro Koskinen 98f4eade14 staging: xgifb: setup initial video RAM size for systems without BIOS
On embedded systems without a BIOS, the DRAM sizing register is 0 after
the boot, and the driver thinks we have only 1 MB video memory. On such
cases, use the PCI window size for the initial size. This information
is needed only to create the I/O mapping - the driver will later detect
and configure the memory size correctly. Limit the size to 16 MB as it
should be sufficient for all supported video modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-13 20:41:56 -07:00
Aaro Koskinen 6b2a7e0c9b staging: xgifb: prevent video RAM size exceeding PCI window size
Add a sanity check for the video RAM size. It should fit into the
PCI window.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12 09:47:09 -07:00
Aaro Koskinen a09f347c6c staging: xgifb: validate the mode against video memory size
It's possible to select video mode that exceeds the available video
memory. This is potentially dangerous, fix by adding a check.

The patch fixes system hangs seen occasionally when playing random videos
with mplayer.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-12 09:45:58 -07:00
Aaro Koskinen d3ae5762c6 staging: xgifb: use "else if"
Use "else if" when possible to reduce nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 15:48:17 -07:00
Andy Shevchenko 977310bbc3 staging: xgifb: print small buffers via %*ph
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-13 19:23:18 -07:00
Miguel Gómez f6002041af Staging: xgifb: Remove useless condition.
Remove last if branch in XGIfb_do_set_var(), as it has no action assigned.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:32 -07:00
Miguel Gómez 3bcc246016 Staging: xgifb: Fix coding style.
Fix small coding style warnings in several files.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:32 -07:00
Miguel Gómez 4362f5becd Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode().
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez 791fef1b30 Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
Simplify the code and make it more readable.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez 1cd1703081 Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
The switch performs no action so it can be removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:29 -07:00
Miguel Gómez be25aef0ca Staging: xgifb: Improve debug strings.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:28 -07:00
Miguel Gómez 469b43c0a6 Staging: xgifb: Remove LCDA detection in xgifb_probe().
The piece of code that checks for LCDA in xgifb_probe() just checks for some
register values but doesn't really do anything in response to them (the actions
that should be executed are commented).
As nothing is really being done, the code can be safely removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:28 -07:00
Miguel Gómez 949eb0aeb9 Staging: xgifb: Comment cleaning.
Remove commented code and useless comments. Leave only those with relevant
hints to the code.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-11 16:59:27 -07:00
Miguel Gómez 1918570388 Staging: xgifb: Replace pr_* with dev_* when possible.
Replace pr_* calls with dev_* ones when the device structure is available.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:21 -07:00
Miguel Gómez 448810662a Staging: xgifb: Remove printk usage.
Replace meaninful printks with pr_debug and remove useless ones.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:21 -07:00
Miguel Gómez 47cee13d1d Staging: xgifb: Remove XGIFAIL() macro and its calls.
XGIFAIL() prints a message and returns a value, but it's used only in one
place. Better remove it and replace the call with the macro content.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 96cd1f8b41 Staging: xgifb: define real dumpVGAReg() content only in DEBUG mode.
Define real content of dumpVGAReg() only in debug mode. Remove old condition.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez d56b4c3dff Staging: xgifb: remove DPRINTK() macro and replace it with pr_debug.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 67c0bf7ac7 Staging: xgifb: remove DEBUGPRN() macro and its uses.
Remove DEBUGPRN() macro which is defined as empty.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Miguel Gómez 560e8788eb Staging: xgifb: reformat module parameter descriptions.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 17:20:20 -07:00
Peter Huewe f3ca589baf staging/xgifb: Remove superfluous header includes
This patch removes all unnecessary, redundant and superfluous header
includes from xgifb.

Tested on hp t5325 (XGI Z11)

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:14:49 -07:00
Peter Huewe 95649c425f staging/xgifb: Add mutext for fb_mmap locking
This adds a mutex for fb_mmap around smem_start and smem_len
so the mutex inside the fb_mmap() is actually used.  Changing of
these fields before calling the framebuffer_register() are not mutexed.

We check whether framebuffer_register has been called by reading
fbinfo->count.

See 537a1bf0 - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt
for details.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:13:22 -07:00
Peter Huewe 176f7842a8 staging/xgifb: Remove assignments without effect
This patch removes assignments to the fb_fix_screeninfo struct which are
overwritten by the memset in XGIfb_get_fix() a few lines later.
Since the name/id might be useful this was moved to XGIfb_get_fix().

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-13 17:13:21 -07:00
Miguel Gómez bf55b48371 Staging: xgifb: disable pci device on pci remove function.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:12 -07:00
Miguel Gómez 05e06036dd Staging: xgifb: disable pci device if there's an error after enabling it.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:12 -07:00
Miguel Gómez d049053ef0 Staging: xgifb: reorder the code a bit to be more module friendly
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:11 -07:00
Miguel Gómez f059077388 Staging: xgifb: Remove #ifdef MODULE
Check for MODULE is not needed. In a static compilation the parameters
definition is valid and module_exit() does nothing.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-11 17:02:11 -07:00
Aaro Koskinen f9e5de0f17 staging: xgifb: eliminate string comparison from mode search
Eliminate string comparison from the video mode search.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen f47f12d621 staging: xgifb: delete rate_idx from mode table
The default rate_idx is same for all video modes, no need to keep that
in the table.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:08 -07:00
Aaro Koskinen c38d044bf2 staging: xgifb: drop XG45 code
XG45 is not recognized/supported by the driver.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:07 -07:00
Aaro Koskinen 18408da0e8 staging: xgifb: drop XG41 code
XG_41 is not listed in xgifb_pci_table, so the code can be safely dropped.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 10:19:07 -07:00
Aaro Koskinen aca03bcc29 staging: xgifb: XGIfb_mode_rate_to_dclock: initialize ModeIdIndex properly
Initialize ModeIdIndex according to the selected video mode. Currently
index 0 is always used and wrong clock data may be used.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen e484975a23 staging: xgifb: XGIfb_mode_rate_to_dclock: delete commented-out code
Delete code that has been commented out.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen 051ff1bb3c staging: xgifb: XGIfb_mode_rate_to_ddata: initialize ModeIdIndex properly
Initialize ModeIdIndex according to the selected video mode. Currently
index 0 is always used and wrong video mode data may be used.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:09 -07:00
Aaro Koskinen 3a05de3304 staging: xgifb: XGIfb_mode_rate_to_ddata: delete commented-out code
Delete code that has been commented out.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-10 09:55:08 -07:00