From patchwork Fri May 12 08:08:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 9723727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3975600CB for ; Fri, 12 May 2017 08:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C91EC287F8 for ; Fri, 12 May 2017 08:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC6F72880D; Fri, 12 May 2017 08:09:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68F43287F8 for ; Fri, 12 May 2017 08:09:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757023AbdELIIK (ORCPT ); Fri, 12 May 2017 04:08:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:42434 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755018AbdELIII (ORCPT ); Fri, 12 May 2017 04:08:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 23E95AAF2; Fri, 12 May 2017 08:08:07 +0000 (UTC) From: Jiri Slaby To: tomi.valkeinen@ti.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiri Slaby , linux-fbdev@vger.kernel.org Subject: [PATCH 2/3] mdacon: make mda_vram_base u16 * Date: Fri, 12 May 2017 10:08:03 +0200 Message-Id: <20170512080804.2508-2-jslaby@suse.cz> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170512080804.2508-1-jslaby@suse.cz> References: <20170512080804.2508-1-jslaby@suse.cz> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Tomi Valkeinen Cc: --- 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 */