Commit Graph

128 Commits

Author SHA1 Message Date
Clifton Barnes 56e18f8cdf staging: xgifb: fix block comments
fix checkpatch.pl warning about 'Block comments use a trailing */ on a
separate line' and 'Block comments use * on subsequent lines'

Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-30 21:34:55 -07:00
Clifton Barnes d3d62d1d6c staging: xgifb: fix 'line over 80 characters'
fix checkpatch.pl warning about 'line over 80 characters'

Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-29 12:40:20 -07:00
Janani Ravichandran 288f152cad staging: xgifb: Fix comment style
Fix comments to use trailing */ on separate lines.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 17:01:26 -08:00
Navya Sri Nizamkari c3a56f750d Staging: xgifb: Remove space after cast
This patch fixes the checkpatch check:

CHECK: No space is necessary after a cast

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:11:30 -07:00
Navya Sri Nizamkari 076e235856 Staging: xgifb: Fix comparison to NULL warning
Change comparison to NULL to a ! operation.
Found using checkpatch.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:11:30 -07:00
Navya Sri Nizamkari 0d46afbce6 Staging: xgifb: Remove extra blank lines.
This patch fixes the checkpatch.pl check:

CHECK: Please don't use multiple blank lines

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:11:30 -07:00
Navya Sri Nizamkari 3fc27711de Staging: xgifb: Remove blank line before } and after {
Remove blank line after { and before }.
Problem found using checkpatch.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:11:30 -07:00
Navya Sri Nizamkari d8acac9421 Staging: xgifb: Replace udelay, mdelay functions with usleep_range
This patch fixes the checkpatch.pl check:

CHECK: usleep_range is preferred over udelay.

Replace mdelay with usleep_range function too.
Add 1 millisecond to the delay time to get a
reasonable upper limit which saves one wakeup call.
Do same throughout the file.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:11:30 -07:00
Thomas Gummerer 9c8c831514 staging: xgifb: remove unnecessary else
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-06 21:48:19 -07:00
Vitor Braga 694683f631 staging: xgifb coding style cleanup
This fixes "missing a blank line after declaration" warnings from
checkpatch.pl for driver xgifb. The driver has no remaining errors or
warnings from checkpatch.pl

Signed-off-by: Vitor Braga <vitorpybraga@gmail.com>
Reviewed-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-25 16:20:02 -07:00
Aaro Koskinen 334ab0728d staging: xgifb: delete unused "pVBInfo" parameters
Delete unused "pVBInfo" parameters from internal functions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23 15:01:09 -07:00
Aaro Koskinen b053af1688 staging: xgifb: delete unused "HwDeviceExtension" parameters
Delete unused "HwDeviceExtension" parameters from internal functions.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-23 15:01:09 -07:00
Aaro Koskinen ce76de5abe staging: xgifb: call XGI_GetVBType from InitTo330Pointer
Move XGI_GetVBType call inside InitTo330Pointer to avoid code duplication.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 20:55:47 +09:00
Aaro Koskinen c976c7819b staging: xgifb: refactor XGI_BridgeIsOn()
Refactor XGI_BridgeIsOn(). IF_DEF_LVDS bit is not valid for < XG20 chips.
Also we can make the function static by moving it to vb_init.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-30 20:55:47 +09:00
Peter Huewe 7580d7feb4 staging/xgifb: Remove dead assignments/increments
The code now contains several dead assignments which are shadowed by
another assignment a few lines later.

-> This patch removes them (and possibly associated code).

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-17 15:47:18 -07:00
Peter Huewe 986eb9fad5 staging/xgifb: Remove unnecessary binary calculation in GetXG27FPBits
If temp <= 2 no other bits than the lowest two (0x03) can be set anyway
-> this operation can be removed.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 16:02:34 -07:00
Peter Huewe 9195ba095d staging/xgifb: Consolidate function almost identical calls in XGINew_GetXG21Sense
Instead of calling xgifb_reg_and_or with almost identical parameters in
a simple if/else scenario, we assign the changing parameter to a temp
variable and call xgifb_reg_and_or only from one location.

-> Easier to read, easier to understand (especially wrt the line breaks)

(For the if condition we don't need the Temp variable, so we can use the
value directly).

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 16:02:34 -07:00
Peter Huewe bcd1f16573 staging/xgifb: Remove unnecessary cases in XGINew_SenseLCD
The switch statement sets the temp value to zero for certain cases and
leaves it untouched for other cases -> all these other cases can be
combined in the default case.

Since an empty case containing only a break, it can be removed.

The patch also removes the if statement, as it uses the same value as the switch
for comparison, and includes the code into the switch.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 16:02:34 -07:00
Peter Huewe fb70b191ee staging/xgifb: Remove uneccessary/simply if in XGINew_GetXG20DRAMType
Instead of storing the value in a temp variable, anding it with 1 and
assign data conditionally we can assign the value directly.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 16:02:33 -07:00
Aaro Koskinen 597d96b63b staging: xgifb: rename SR15/SR13 arrays to SR18
Since we are programming SR register 18, better name structs/arrays
accordingly to avoid confusion.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 16:10:16 -07:00
Aaro Koskinen d8e7567e53 staging: xgifb: make SR15/SR13 arrays single dimensional
Since we only access the third row, we can delete the others.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 16:10:16 -07:00
Aaro Koskinen d7ab4a4f5b staging: xgifb: XGINew_SetDRAMDefaultRegister340: inline the value of SR1B
SR1B register value is always 3 regardless of video card or RAM type.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 16:10:15 -07:00
Aaro Koskinen c0d60da8f2 staging: xgifb: eliminate IF_DEF_LVDS checks from vb_init
Inside vb_init, IF_DEF_LVDS tells only if the vbios was succesfully read
on XG21. Rearrange the code so that we don't need to set or care about
this flag.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 16:10:15 -07:00
Aaro Koskinen 6bc542779f staging: xgifb: delete redundant IF_DEF_LVDS check
IF_DEF_LVDS can be set only on XG21.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-28 16:10:14 -07:00
Peter Huewe 9388ad9c6a staging/xgifb: Remove unnecessary casts
Both functions xgifb_reg_get and inb return an u8 value, so we don't
need to cast their return value to unsigned char.

-> remove the cast

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-15 15:12:40 -08:00
Peter Huewe 4b488afbc4 staging/xgifb: Remove always false if statement
MCLKData does not contain any 0x1C value for its field SR28 nor does
XGI340_ECLKData contain any 0x1C or 0x22 value for its field SR2E.

-> the statement always evaluates to false.
-> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 13:45:10 -08:00
Peter Huewe 6a7fd2db79 staging/xgifb: Remove unneeded conditional assignment
pVBInfo->ram_type is assigned the return value of
XGINew_GetXG20DRAMType which can only be 0, 1 or 2

-> The conditional assignment is not needed here as it always evaluates
to true.
-> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 13:45:10 -08:00
Peter Huewe fc008afff8 staging/xgifb: Remove unused variable
After the patch
'staging/xgifb: Don't write the same values x times'
the local variable i is unused, which leads to the following warning:

driverrs/staging/xgifb/vb_init.c: In function
‘XGINew_SetDRAMDefaultRegister340’:
drivers/staging/xgifb/vb_init.c:433:43: warning: unused variable ‘i’
[-Wunused-variable]

This patch fixes this

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 11:55:08 -08:00
Peter Huewe 1504ecbeec staging/xgifb: Don't write the same values x times
With the previous patch 'Move duplicated code for dram to helper
function' it becomes evident that the code is performing the same
thing 4 or 8 times in a row without changing arguments to the function
and thus writing the same values over and over again.

It was tested that these repeats are unnecessary.

-> we can safely remove them.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 11:16:21 -08:00
Peter Huewe 0141bb2ed9 staging/xgifb: Move duplicated code for dram to helper function
XGINew_SetDRAMDefaultRegister340 uses the same code fragment 4 times
with only a slight variation each time.
-> Move this code to a helper function - this saves some lines and
~450bytes in the .o / .ko

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 11:16:21 -08:00
Peter Huewe 227dc1156c staging/xgifb: Replace XGI340_CR6B table with simple if/else
The XGI340_CR6B lookup table consists of the entries
{0xaa, 0xaa, 0xaa, 0xaa} for an index <= 2 and
{0x00, 0x00, 0x00, 0x00} for all other indices.

The only user XGINew_SetDRAMDefaultRegister340 loops over these 4 values
of a line with a for loop and since all entries are the same for each line
we can simply replace the whole lookup table with a simple if/else assignment.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05 11:16:21 -08:00
Aaro Koskinen cdbbc618f8 staging: xgifb: delete pVBInfo->BaseAddr
Delete redundant field.

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
Aaro Koskinen b8e1cc5c8d staging: xgifb: do not use pVBInfo->BaseAddr
Use pre-calculated register addresses instead of pVBInfo->BaseAddr.

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
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
Aaro Koskinen ea12b4e077 staging: xgifb: eliminate pVBInfo->AGPReg
Access XGI340_AGPReg 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:30 -08:00
Aaro Koskinen 0904f7f315 staging: xgifb: eliminate pVBInfo->SR16
Inline constant values that are used only once.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:30 -08:00
Aaro Koskinen 5ce24760f6 staging: xgifb: eliminate pVBInfo->CR6B
Access XGI340_CR6B 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:30 -08:00
Aaro Koskinen 38c09652a0 staging: xgifb: eliminate pVBInfo->SR21/22/25
In-line constants that are used only once.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 12:54:29 -08:00
Aaro Koskinen 9b04745816 staging: xgifb: eliminate pVBInfo->ECLKData
Access XGI340_ECLKData 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 7e29d632f3 staging: xgifb: eliminate pVBInfo->CR6E/6F/89
Eliminate dummy zero read-only global data.

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 d42bb0fbd9 staging: xgifb: delete bogus video RAM configuration
The driver reconfigures DRAM size register to 8M (regardless what the
actual size was) once the init has been completed, overwriting the
correct value written during the early init. As a result if the driver
is unloaded and reloaded, the user will be limited to 8M video memory
and may lose some of the available 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:57 -07:00
Aaro Koskinen 8951dadc97 staging: xgifb: delete ISXPDOS
Delete unneeded flag.

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
Dan Carpenter 2f123cbcf0 Staging: xgifb: fix bitwise vs logical bug
This is a static checker fix and not something I can test.  The intent
of the code here is to set some bit flags.  For a logical OR the ">> 1"
shift wouldn't make a difference.  So it should be using a bitwise OR.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-14 16:46:33 -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 8afb7d3528 Staging: xgifb: Remove useless always true condition.
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 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 e054102b9f Staging: xgifb: Fix sparse warnings.
Add include files with function definitions to avoid sparse warnings.

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