Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic avoid allocating almost 5k struct ibm561data on s...



details:   https://anonhg.NetBSD.org/src/rev/4ebc0a5bcb06
branches:  trunk
changeset: 935106:4ebc0a5bcb06
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Jun 24 19:55:25 2020 +0000

description:
avoid allocating almost 5k struct ibm561data on stack in ibm561_cninit();
it's too early for kmem_alloc(), so use static variable in BSS

diffstat:

 sys/dev/ic/ibm561.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r bdb77e146814 -r 4ebc0a5bcb06 sys/dev/ic/ibm561.c
--- a/sys/dev/ic/ibm561.c       Wed Jun 24 19:24:44 2020 +0000
+++ b/sys/dev/ic/ibm561.c       Wed Jun 24 19:55:25 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibm561.c,v 1.11 2012/02/12 16:34:11 matt Exp $ */
+/* $NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.11 2012/02/12 16:34:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.12 2020/06/24 19:55:25 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -155,7 +155,7 @@
  * initializing the console early on.
  */
 
-struct ibm561data *saved_console_data;
+static struct ibm561data saved_console_data;
 
 void
 ibm561_cninit(
@@ -172,9 +172,7 @@
        data->ramdac_wr = wr;
        data->ramdac_rd = rd;
        ibm561_set_dotclock((struct ramdac_cookie *)data, dotclock);
-       saved_console_data = data;
        ibm561_init((struct ramdac_cookie *)data);
-       saved_console_data = NULL;
 }
 
 void
@@ -394,7 +392,7 @@
 
        /* XXX see comment above ibm561_cninit() */
        if (!data)
-               data = saved_console_data;
+               data = &saved_console_data;
 
        if (data->changed & CHANGED_WTYPE) {
                ibm561_regbegin(data, IBM561_FB_WINTYPE);



Home | Main Index | Thread Index | Old Index