From: Peter Huewe <peterhuewe@gmx.de>
To: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Peter Huewe" <peterhuewe@gmx.de>,
"Aaro Koskinen" <aaro.koskinen@iki.fi>,
"Miguel Gómez" <magomez@igalia.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] staging/xgifb: Remove unnecessary cases in XGINew_SenseLCD
Date: Mon, 13 May 2013 23:41:46 +0200 [thread overview]
Message-ID: <1368481309-4883-2-git-send-email-peterhuewe@gmx.de> (raw)
In-Reply-To: <1368481309-4883-1-git-send-email-peterhuewe@gmx.de>
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>
---
drivers/staging/xgifb/vb_init.c | 51 ++++++++++++-----------------------------
1 file changed, 15 insertions(+), 36 deletions(-)
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 9caf12a..ab1706b 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1077,44 +1077,23 @@ static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info
*HwDeviceExtension,
struct vb_device_info *pVBInfo)
{
- unsigned short temp;
-
- /* add lcd sense */
- if (HwDeviceExtension->ulCRT2LCDType == LCD_UNKNOWN) {
+ unsigned short temp = HwDeviceExtension->ulCRT2LCDType;
+
+ switch (HwDeviceExtension->ulCRT2LCDType) {
+ case LCD_640x480:
+ case LCD_1024x600:
+ case LCD_1152x864:
+ case LCD_1280x960:
+ case LCD_1152x768:
+ case LCD_1920x1440:
+ case LCD_2048x1536:
+ temp = 0; /* overwrite used ulCRT2LCDType */
+ break;
+ case LCD_UNKNOWN: /* unknown lcd, do nothing */
return 0;
- } else {
- temp = (unsigned short) HwDeviceExtension->ulCRT2LCDType;
- switch (HwDeviceExtension->ulCRT2LCDType) {
- case LCD_INVALID:
- case LCD_800x600:
- case LCD_1024x768:
- case LCD_1280x1024:
- break;
-
- case LCD_640x480:
- case LCD_1024x600:
- case LCD_1152x864:
- case LCD_1280x960:
- case LCD_1152x768:
- temp = 0;
- break;
-
- case LCD_1400x1050:
- case LCD_1280x768:
- case LCD_1600x1200:
- break;
-
- case LCD_1920x1440:
- case LCD_2048x1536:
- temp = 0;
- break;
-
- default:
- break;
- }
- xgifb_reg_and_or(pVBInfo->P3d4, 0x36, 0xF0, temp);
- return 1;
}
+ xgifb_reg_and_or(pVBInfo->P3d4, 0x36, 0xF0, temp);
+ return 1;
}
static void XGINew_GetXG21Sense(struct pci_dev *pdev,
--
1.8.1.5
next prev parent reply other threads:[~2013-05-13 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 21:41 [PATCH 1/5] staging/xgifb: Remove uneccessary/simply if in XGINew_GetXG20DRAMType Peter Huewe
2013-05-13 21:41 ` Peter Huewe [this message]
2013-05-13 21:41 ` [PATCH 3/5] staging/xgifb: Consolidate function almost identical calls in XGINew_GetXG21Sense Peter Huewe
2013-05-13 21:41 ` [PATCH 4/5] staging/xgifb: Remove unnecessary binary calculation in GetXG27FPBits Peter Huewe
2013-05-13 21:41 ` [PATCH 5/5] staging/xgifb: Fix always false condition in vb_setmode.c (smatch) Peter Huewe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1368481309-4883-2-git-send-email-peterhuewe@gmx.de \
--to=peterhuewe@gmx.de \
--cc=aaro.koskinen@iki.fi \
--cc=arnaud.patard@rtp-net.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magomez@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®