From: Dan Carpenter <dan.carpenter@oracle.com>
To: Peter Huewe <peterhuewe@gmx.de>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>,
devel@driverdev.osuosl.org, Aaro Koskinen <aaro.koskinen@iki.fi>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 08/10] staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs
Date: Mon, 4 Feb 2013 15:59:01 +0300 [thread overview]
Message-ID: <20130204125901.GH4937@mwanda> (raw)
In-Reply-To: <1359928479-8484-8-git-send-email-peterhuewe@gmx.de>
On Sun, Feb 03, 2013 at 10:54:37PM +0100, Peter Huewe wrote:
> Since data can only be 0x0000, 0x0035 or 0x0048 we can simply skip the
> bit shifting and masking as data & 0xFF is always equal to data and
> data & 0xFF00 is always 0.
> So we simply use data and 0 directly and save the assignment.
>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
> ---
> drivers/staging/xgifb/vb_setmode.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> index 6f366f4..1ff1178 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -1083,10 +1083,8 @@ static void XGI_SetCRT1ModeRegs(struct xgi_hw_device_info *HwDeviceExtension,
> data = 0x0048;
> }
>
> - data2 = data & 0x00FF;
> - xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFF, data2);
> - data2 = (data & 0xFF00) >> 8;
> - xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFC, data2);
> + xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFF, data);
> + xgifb_reg_and_or(pVBInfo->P3d4, 0x19, 0xFC, 0);
This patch is fine.
This is a fairly common pattern where people do:
write_a_char(data & 0xff);
write_a_char((data >> 8) & 0xff);
It feels there should be a macro to do the shift and mask but I'm
not sure what it would look like.
regards,
dan carpenter
next prev parent reply other threads:[~2013-02-04 12:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-03 21:54 [PATCH 01/10] staging/xgifb: Simplify XGI_GetRatePtrCRT2 Peter Huewe
2013-02-03 21:54 ` [PATCH 02/10] staging/xgifb: Remove always false comparisons Peter Huewe
2013-02-03 21:54 ` [PATCH 03/10] staging/xgifb: mttr must be (signed) int Peter Huewe
2013-02-03 21:54 ` [PATCH 04/10] staging/xgifb: Fix return of uninitialized variable Peter Huewe
2013-02-03 21:54 ` [PATCH 05/10] staging/xgifb: Simplify XGI_SetSeqRegs Peter Huewe
2013-02-03 21:54 ` [PATCH 06/10] staging/xgifb: rewrite XGIfb_get_cmap_len Peter Huewe
2013-02-03 21:54 ` [PATCH 07/10] staging/xgifb: remove unnecessary temp variable in XGIfb_mode_rate_to_ddata Peter Huewe
2013-02-03 21:54 ` [PATCH 08/10] staging/xgifb: Remove unnecessary bitshifts in XGI_SetCRT1ModeRegs Peter Huewe
2013-02-04 12:59 ` Dan Carpenter [this message]
2013-02-04 18:25 ` H Hartley Sweeten
2013-02-03 21:54 ` [PATCH 09/10] staging/xgifb: Consolidate XGI_EnableChISLCD and XGI_DisableChISLCD Peter Huewe
2013-02-03 21:54 ` [PATCH 10/10] staging/xgifb: Simplify XGISetModeNew Peter Huewe
2013-02-04 19:37 ` [PATCH 01/10] staging/xgifb: Simplify XGI_GetRatePtrCRT2 Aaro Koskinen
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=20130204125901.GH4937@mwanda \
--to=dan.carpenter@oracle.com \
--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=peterhuewe@gmx.de \
/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;
as well as URLs for NNTP newsgroup(s).