* [PATCH 1/3] mdacon: align code in mda_detect properly
@ 2016-07-25 15:24 Jiri Slaby
0 siblings, 0 replies; 7+ messages in thread
From: Jiri Slaby @ 2016-07-25 15:24 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: plagnioj, linux-fbdev, akpm, linux-kernel, Jiri Slaby
This is just a whitespace cleanup. The code was a mess having multiple
commands on one line like:
scr_writew(0xAA55, p); if (scr_readw(p) = 0xAA55) count++;
Indent that properly and make it nicer for reading.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/video/console/mdacon.c | 60 ++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index bacbb044d77c..64c2c5e8d00b 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -208,10 +208,17 @@ static int mda_detect(void)
p = (u16 *) mda_vram_base;
q = (u16 *) (mda_vram_base + 0x01000);
- p_save = scr_readw(p); q_save = scr_readw(q);
+ p_save = scr_readw(p);
+ q_save = scr_readw(q);
+
+ scr_writew(0xAA55, p);
+ if (scr_readw(p) = 0xAA55)
+ count++;
+
+ scr_writew(0x55AA, p);
+ if (scr_readw(p) = 0x55AA)
+ count++;
- scr_writew(0xAA55, p); if (scr_readw(p) = 0xAA55) count++;
- scr_writew(0x55AA, p); if (scr_readw(p) = 0x55AA) count++;
scr_writew(p_save, p);
if (count != 2) {
@@ -220,13 +227,18 @@ static int mda_detect(void)
/* check if we have 4K or 8K */
- scr_writew(0xA55A, q); scr_writew(0x0000, p);
- if (scr_readw(q) = 0xA55A) count++;
+ scr_writew(0xA55A, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) = 0xA55A)
+ count++;
- scr_writew(0x5AA5, q); scr_writew(0x0000, p);
- if (scr_readw(q) = 0x5AA5) count++;
+ scr_writew(0x5AA5, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) = 0x5AA5)
+ count++;
- scr_writew(p_save, p); scr_writew(q_save, q);
+ scr_writew(p_save, p);
+ scr_writew(q_save, q);
if (count = 4) {
mda_vram_len = 0x02000;
@@ -240,14 +252,12 @@ static int mda_detect(void)
/* Edward: These two mess `tests' mess up my cursor on bootup */
/* cursor low register */
- if (! test_mda_b(0x66, 0x0f)) {
+ if (!test_mda_b(0x66, 0x0f))
return 0;
- }
/* cursor low register */
- if (! test_mda_b(0x99, 0x0f)) {
+ if (!test_mda_b(0x99, 0x0f))
return 0;
- }
#endif
/* See if the card is a Hercules, by checking whether the vsync
@@ -257,25 +267,25 @@ static int mda_detect(void)
p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;
- for (count=0; count < 50000 && p_save = q_save; count++) {
+ for (count = 0; count < 50000 && p_save = q_save; count++) {
q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
udelay(2);
}
if (p_save != q_save) {
switch (inb_p(mda_status_port) & 0x70) {
- case 0x10:
- mda_type = TYPE_HERCPLUS;
- mda_type_name = "HerculesPlus";
- break;
- case 0x50:
- mda_type = TYPE_HERCCOLOR;
- mda_type_name = "HerculesColor";
- break;
- default:
- mda_type = TYPE_HERC;
- mda_type_name = "Hercules";
- break;
+ case 0x10:
+ mda_type = TYPE_HERCPLUS;
+ mda_type_name = "HerculesPlus";
+ break;
+ case 0x50:
+ mda_type = TYPE_HERCCOLOR;
+ mda_type_name = "HerculesColor";
+ break;
+ default:
+ mda_type = TYPE_HERC;
+ mda_type_name = "Hercules";
+ break;
}
}
--
2.9.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/3] mdacon: align code in mda_detect properly
@ 2017-05-12 8:08 Jiri Slaby
2017-05-12 8:08 ` [PATCH 2/3] mdacon: make mda_vram_base u16 * Jiri Slaby
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jiri Slaby @ 2017-05-12 8:08 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: linux-fbdev, Jiri Slaby, linux-kernel, dri-devel
This is just a whitespace cleanup. The code was a mess having multiple
commands on one line like:
scr_writew(0xAA55, p); if (scr_readw(p) = 0xAA55) count++;
Indent that properly and make it nicer for reading.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 60 ++++++++++++++++++++++++------------------
1 file changed, 35 insertions(+), 25 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index ec192a1bf297..424af6bdb408 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -208,10 +208,17 @@ static int mda_detect(void)
p = (u16 *) mda_vram_base;
q = (u16 *) (mda_vram_base + 0x01000);
- p_save = scr_readw(p); q_save = scr_readw(q);
+ p_save = scr_readw(p);
+ q_save = scr_readw(q);
+
+ scr_writew(0xAA55, p);
+ if (scr_readw(p) = 0xAA55)
+ count++;
+
+ scr_writew(0x55AA, p);
+ if (scr_readw(p) = 0x55AA)
+ count++;
- scr_writew(0xAA55, p); if (scr_readw(p) = 0xAA55) count++;
- scr_writew(0x55AA, p); if (scr_readw(p) = 0x55AA) count++;
scr_writew(p_save, p);
if (count != 2) {
@@ -220,13 +227,18 @@ static int mda_detect(void)
/* check if we have 4K or 8K */
- scr_writew(0xA55A, q); scr_writew(0x0000, p);
- if (scr_readw(q) = 0xA55A) count++;
+ scr_writew(0xA55A, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) = 0xA55A)
+ count++;
- scr_writew(0x5AA5, q); scr_writew(0x0000, p);
- if (scr_readw(q) = 0x5AA5) count++;
+ scr_writew(0x5AA5, q);
+ scr_writew(0x0000, p);
+ if (scr_readw(q) = 0x5AA5)
+ count++;
- scr_writew(p_save, p); scr_writew(q_save, q);
+ scr_writew(p_save, p);
+ scr_writew(q_save, q);
if (count = 4) {
mda_vram_len = 0x02000;
@@ -240,14 +252,12 @@ static int mda_detect(void)
/* Edward: These two mess `tests' mess up my cursor on bootup */
/* cursor low register */
- if (! test_mda_b(0x66, 0x0f)) {
+ if (!test_mda_b(0x66, 0x0f))
return 0;
- }
/* cursor low register */
- if (! test_mda_b(0x99, 0x0f)) {
+ if (!test_mda_b(0x99, 0x0f))
return 0;
- }
#endif
/* See if the card is a Hercules, by checking whether the vsync
@@ -257,25 +267,25 @@ static int mda_detect(void)
p_save = q_save = inb_p(mda_status_port) & MDA_STATUS_VSYNC;
- for (count=0; count < 50000 && p_save = q_save; count++) {
+ for (count = 0; count < 50000 && p_save = q_save; count++) {
q_save = inb(mda_status_port) & MDA_STATUS_VSYNC;
udelay(2);
}
if (p_save != q_save) {
switch (inb_p(mda_status_port) & 0x70) {
- case 0x10:
- mda_type = TYPE_HERCPLUS;
- mda_type_name = "HerculesPlus";
- break;
- case 0x50:
- mda_type = TYPE_HERCCOLOR;
- mda_type_name = "HerculesColor";
- break;
- default:
- mda_type = TYPE_HERC;
- mda_type_name = "Hercules";
- break;
+ case 0x10:
+ mda_type = TYPE_HERCPLUS;
+ mda_type_name = "HerculesPlus";
+ break;
+ case 0x50:
+ mda_type = TYPE_HERCCOLOR;
+ mda_type_name = "HerculesColor";
+ break;
+ default:
+ mda_type = TYPE_HERC;
+ mda_type_name = "Hercules";
+ break;
}
}
--
2.13.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] mdacon: make mda_vram_base u16 *
2017-05-12 8:08 [PATCH 1/3] mdacon: align code in mda_detect properly Jiri Slaby
@ 2017-05-12 8:08 ` Jiri Slaby
[not found] ` <CGME20170614132859epcas1p3f3db84642709f6ae79e4ca495a4c8ebe@epcas1p3.samsung.com>
2017-05-12 8:08 ` [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function Jiri Slaby
[not found] ` <CGME20170614132820epcas1p32f19f6899a8ec80379799506133005f0@epcas1p3.samsung.com>
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Slaby @ 2017-05-12 8:08 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: linux-fbdev, Jiri Slaby, linux-kernel, dri-devel
Given every user of mda_vram_base expects a pointer, let
mda_vram_base be a pointer to u16.
The offset calculation in mda_detect had to be adjusted by / 2 (due to
different pointer arithmetic now).
We introduce a cast to a value returned from VGA_MAP_MEM. But I will
change VGA_MAP_MEM to return a pointer later too. But vgacon needs a
similar change first.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 424af6bdb408..3ec2b178bb88 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -48,7 +48,7 @@ static DEFINE_SPINLOCK(mda_lock);
/* description of the hardware layout */
-static unsigned long mda_vram_base; /* Base of video memory */
+static u16 *mda_vram_base; /* Base of video memory */
static unsigned long mda_vram_len; /* Size of video memory */
static unsigned int mda_num_columns; /* Number of text columns */
static unsigned int mda_num_lines; /* Number of text lines */
@@ -205,8 +205,8 @@ static int mda_detect(void)
/* do a memory check */
- p = (u16 *) mda_vram_base;
- q = (u16 *) (mda_vram_base + 0x01000);
+ p = mda_vram_base;
+ q = mda_vram_base + 0x01000 / 2;
p_save = scr_readw(p);
q_save = scr_readw(q);
@@ -323,7 +323,7 @@ static const char *mdacon_startup(void)
mda_num_lines = 25;
mda_vram_len = 0x01000;
- mda_vram_base = VGA_MAP_MEM(0xb0000, mda_vram_len);
+ mda_vram_base = (u16 *)VGA_MAP_MEM(0xb0000, mda_vram_len);
mda_index_port = 0x3b4;
mda_value_port = 0x3b5;
@@ -420,7 +420,7 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
}
}
-#define MDA_ADDR(x,y) ((u16 *) mda_vram_base + (y)*mda_num_columns + (x))
+#define MDA_ADDR(x, y) (mda_vram_base + (y)*mda_num_columns + (x))
static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
{
@@ -463,7 +463,7 @@ static int mdacon_blank(struct vc_data *c, int blank, int mode_switch)
{
if (mda_type = TYPE_MDA) {
if (blank)
- scr_memsetw((void *)mda_vram_base,
+ scr_memsetw(mda_vram_base,
mda_convert_attr(c->vc_video_erase_char),
c->vc_screenbuf_size);
/* Tell console.c that it has to restore the screen itself */
--
2.13.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function
2017-05-12 8:08 [PATCH 1/3] mdacon: align code in mda_detect properly Jiri Slaby
2017-05-12 8:08 ` [PATCH 2/3] mdacon: make mda_vram_base u16 * Jiri Slaby
@ 2017-05-12 8:08 ` Jiri Slaby
[not found] ` <CGME20170614132927epcas1p311aa2291f0d36ce0691955287c9af3a2@epcas1p3.samsung.com>
[not found] ` <CGME20170614132820epcas1p32f19f6899a8ec80379799506133005f0@epcas1p3.samsung.com>
2 siblings, 1 reply; 7+ messages in thread
From: Jiri Slaby @ 2017-05-12 8:08 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: linux-fbdev, Jiri Slaby, linux-kernel, dri-devel
MDA_ADDR is one of those macros which could be an inline function. So
convert MDA_ADDR to mda_addr.
Note that we take x and y as unsigned now. But they are absolute
coordinates, so this is no problem.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: <linux-fbdev@vger.kernel.org>
---
drivers/video/console/mdacon.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 3ec2b178bb88..d0d427a2f1a3 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -420,17 +420,20 @@ static void mdacon_invert_region(struct vc_data *c, u16 *p, int count)
}
}
-#define MDA_ADDR(x, y) (mda_vram_base + (y)*mda_num_columns + (x))
+static inline u16 *mda_addr(unsigned int x, unsigned int y)
+{
+ return mda_vram_base + y * mda_num_columns + x;
+}
static void mdacon_putc(struct vc_data *c, int ch, int y, int x)
{
- scr_writew(mda_convert_attr(ch), MDA_ADDR(x, y));
+ scr_writew(mda_convert_attr(ch), mda_addr(x, y));
}
static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
int count, int y, int x)
{
- u16 *dest = MDA_ADDR(x, y);
+ u16 *dest = mda_addr(x, y);
for (; count > 0; count--) {
scr_writew(mda_convert_attr(scr_readw(s++)), dest++);
@@ -440,7 +443,7 @@ static void mdacon_putcs(struct vc_data *c, const unsigned short *s,
static void mdacon_clear(struct vc_data *c, int y, int x,
int height, int width)
{
- u16 *dest = MDA_ADDR(x, y);
+ u16 *dest = mda_addr(x, y);
u16 eattr = mda_convert_attr(c->vc_video_erase_char);
if (width <= 0 || height <= 0)
@@ -512,16 +515,16 @@ static bool mdacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,
switch (dir) {
case SM_UP:
- scr_memmovew(MDA_ADDR(0,t), MDA_ADDR(0,t+lines),
+ scr_memmovew(mda_addr(0, t), mda_addr(0, t + lines),
(b-t-lines)*mda_num_columns*2);
- scr_memsetw(MDA_ADDR(0,b-lines), eattr,
+ scr_memsetw(mda_addr(0, b - lines), eattr,
lines*mda_num_columns*2);
break;
case SM_DOWN:
- scr_memmovew(MDA_ADDR(0,t+lines), MDA_ADDR(0,t),
+ scr_memmovew(mda_addr(0, t + lines), mda_addr(0, t),
(b-t-lines)*mda_num_columns*2);
- scr_memsetw(MDA_ADDR(0,t), eattr, lines*mda_num_columns*2);
+ scr_memsetw(mda_addr(0, t), eattr, lines*mda_num_columns*2);
break;
}
--
2.13.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] mdacon: align code in mda_detect properly
[not found] ` <CGME20170614132820epcas1p32f19f6899a8ec80379799506133005f0@epcas1p3.samsung.com>
@ 2017-06-14 13:28 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-06-14 13:28 UTC (permalink / raw)
To: Jiri Slaby; +Cc: dri-devel, tomi.valkeinen, linux-fbdev, linux-kernel
On Friday, May 12, 2017 10:08:02 AM Jiri Slaby wrote:
> This is just a whitespace cleanup. The code was a mess having multiple
> commands on one line like:
> scr_writew(0xAA55, p); if (scr_readw(p) = 0xAA55) count++;
>
> Indent that properly and make it nicer for reading.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: <linux-fbdev@vger.kernel.org>
Patch queued for 4.13, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] mdacon: make mda_vram_base u16 *
[not found] ` <CGME20170614132859epcas1p3f3db84642709f6ae79e4ca495a4c8ebe@epcas1p3.samsung.com>
@ 2017-06-14 13:28 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-06-14 13:28 UTC (permalink / raw)
To: Jiri Slaby; +Cc: dri-devel, tomi.valkeinen, linux-fbdev, linux-kernel
On Friday, May 12, 2017 10:08:03 AM Jiri Slaby wrote:
> Given every user of mda_vram_base expects a pointer, let
> mda_vram_base be a pointer to u16.
>
> The offset calculation in mda_detect had to be adjusted by / 2 (due to
> different pointer arithmetic now).
>
> We introduce a cast to a value returned from VGA_MAP_MEM. But I will
> change VGA_MAP_MEM to return a pointer later too. But vgacon needs a
> similar change first.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: <linux-fbdev@vger.kernel.org>
Patch queued for 4.13, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function
[not found] ` <CGME20170614132927epcas1p311aa2291f0d36ce0691955287c9af3a2@epcas1p3.samsung.com>
@ 2017-06-14 13:29 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-06-14 13:29 UTC (permalink / raw)
To: Jiri Slaby; +Cc: tomi.valkeinen, dri-devel, linux-kernel, linux-fbdev
On Friday, May 12, 2017 10:08:04 AM Jiri Slaby wrote:
> MDA_ADDR is one of those macros which could be an inline function. So
> convert MDA_ADDR to mda_addr.
>
> Note that we take x and y as unsigned now. But they are absolute
> coordinates, so this is no problem.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: <linux-fbdev@vger.kernel.org>
Patch queued for 4.13, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-06-14 13:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 8:08 [PATCH 1/3] mdacon: align code in mda_detect properly Jiri Slaby
2017-05-12 8:08 ` [PATCH 2/3] mdacon: make mda_vram_base u16 * Jiri Slaby
[not found] ` <CGME20170614132859epcas1p3f3db84642709f6ae79e4ca495a4c8ebe@epcas1p3.samsung.com>
2017-06-14 13:28 ` Bartlomiej Zolnierkiewicz
2017-05-12 8:08 ` [PATCH 3/3] mdacon: replace MDA_ADDR macro by inline function Jiri Slaby
[not found] ` <CGME20170614132927epcas1p311aa2291f0d36ce0691955287c9af3a2@epcas1p3.samsung.com>
2017-06-14 13:29 ` Bartlomiej Zolnierkiewicz
[not found] ` <CGME20170614132820epcas1p32f19f6899a8ec80379799506133005f0@epcas1p3.samsung.com>
2017-06-14 13:28 ` [PATCH 1/3] mdacon: align code in mda_detect properly Bartlomiej Zolnierkiewicz
-- strict thread matches above, loose matches on Subject: below --
2016-07-25 15:24 Jiri Slaby
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).