Thu Feb 20 02:09:28 2014 UTC ()
Call memset in a loop, not loop around doing nothing and calling memset
once.


(joerg)
diff -r1.31 -r1.32 src/sys/dev/sun/bwtwo.c

cvs diff -r1.31 -r1.32 src/sys/dev/sun/bwtwo.c (expand / switch to unified diff)

--- src/sys/dev/sun/bwtwo.c 2013/12/02 15:54:06 1.31
+++ src/sys/dev/sun/bwtwo.c 2014/02/20 02:09:28 1.32
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bwtwo.c,v 1.31 2013/12/02 15:54:06 jdc Exp $ */ 1/* $NetBSD: bwtwo.c,v 1.32 2014/02/20 02:09:28 joerg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe. 8 * by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -69,27 +69,27 @@ @@ -69,27 +69,27 @@
69 * @(#)bwtwo.c 8.1 (Berkeley) 6/11/93 69 * @(#)bwtwo.c 8.1 (Berkeley) 6/11/93
70 */ 70 */
71 71
72/* 72/*
73 * black & white display (bwtwo) driver. 73 * black & white display (bwtwo) driver.
74 * 74 *
75 * Does not handle interrupts, even though they can occur. 75 * Does not handle interrupts, even though they can occur.
76 * 76 *
77 * P4 and overlay plane support by Jason R. Thorpe <thorpej@NetBSD.org>. 77 * P4 and overlay plane support by Jason R. Thorpe <thorpej@NetBSD.org>.
78 * Overlay plane handling hints and ideas provided by Brad Spencer. 78 * Overlay plane handling hints and ideas provided by Brad Spencer.
79 */ 79 */
80 80
81#include <sys/cdefs.h> 81#include <sys/cdefs.h>
82__KERNEL_RCSID(0, "$NetBSD: bwtwo.c,v 1.31 2013/12/02 15:54:06 jdc Exp $"); 82__KERNEL_RCSID(0, "$NetBSD: bwtwo.c,v 1.32 2014/02/20 02:09:28 joerg Exp $");
83 83
84#include <sys/param.h> 84#include <sys/param.h>
85#include <sys/systm.h> 85#include <sys/systm.h>
86#include <sys/device.h> 86#include <sys/device.h>
87#include <sys/ioctl.h> 87#include <sys/ioctl.h>
88#include <sys/malloc.h> 88#include <sys/malloc.h>
89#include <sys/mman.h> 89#include <sys/mman.h>
90#include <sys/tty.h> 90#include <sys/tty.h>
91#include <sys/conf.h> 91#include <sys/conf.h>
92 92
93#include <machine/autoconf.h> 93#include <machine/autoconf.h>
94#include <machine/eeprom.h> 94#include <machine/eeprom.h>
95 95
@@ -448,24 +448,24 @@ bwtwo_init_screen(void *cookie, struct v @@ -448,24 +448,24 @@ bwtwo_init_screen(void *cookie, struct v
448 ri->ri_width = sc->sc_width; 448 ri->ri_width = sc->sc_width;
449 ri->ri_height = sc->sc_height; 449 ri->ri_height = sc->sc_height;
450 ri->ri_stride = sc->sc_stride; 450 ri->ri_stride = sc->sc_stride;
451 ri->ri_flg = RI_CENTER; 451 ri->ri_flg = RI_CENTER;
452 452
453 ri->ri_bits = sc->sc_fb.fb_pixels; 453 ri->ri_bits = sc->sc_fb.fb_pixels;
454 454
455 /* 455 /*
456 * Make sure that we set a maximum of 32 bits at a time, 456 * Make sure that we set a maximum of 32 bits at a time,
457 * otherwise we'll see VME write errors if this is a P4 BW2. 457 * otherwise we'll see VME write errors if this is a P4 BW2.
458 */ 458 */
459 for (bits = (char *) ri->ri_bits; 459 for (bits = (char *) ri->ri_bits;
460 bits < (char *) ri->ri_bits + ri->ri_stride * ri->ri_height; 460 bits < (char *) ri->ri_bits + ri->ri_stride * ri->ri_height;
461 bits += 4); 461 bits += 4)
462 memset(bits, (*defattr >> 16) & 0xff, 4); 462 memset(bits, (*defattr >> 16) & 0xff, 4);
463 rasops_init(ri, 0, 0); 463 rasops_init(ri, 0, 0);
464 ri->ri_caps = 0; 464 ri->ri_caps = 0;
465 rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight, 465 rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
466 sc->sc_width / ri->ri_font->fontwidth); 466 sc->sc_width / ri->ri_font->fontwidth);
467 467
468 ri->ri_hw = scr; 468 ri->ri_hw = scr;
469} 469}
470 470
471#endif /* NWSDISPLAY > 0 */ 471#endif /* NWSDISPLAY > 0 */