mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Mock <kd6pag@qsl.net>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kill unneccessary debug printk [PATCH]
Date: Sat, 25 Oct 2003 00:07:31 -0700	[thread overview]
Message-ID: <E1ADIWJ-00012u-00@penngrove.fdns.net> (raw)

    > Better yet, let's take this opportunity to do this more cleanly.  How 
    > about having something like /sys/power/vmode (or /proc/...) contain that 
    > inforemation instead?  With luck, it might even be few kernel bytes than
    > the original printk (or at least not much more).  (I know nothing about
    > either /proc or /sys, so it would take me awhile to suggest a patch).

    Well, you probably know about as much as I do. I'm afraid I'm just
    going to take the easy way out.
								    Pavel

OK, then, here's a quick fix (perhaps someone else can refine it) which 
reads back saved video mode via '/sys/power/gmode'.  Maybe someone else
who understand mechanism better than i do can come up with some cleaner
code to do the same thing (or at least find a better place to put this).
Hopefully, i've at least picked the right CONFIG variable...

				-- JM

Attachment: Patch to 2.6.0-test8-bk2
-------------------------------------------------------------------------------
--- ./kernel/power/disk.c.orig	2003-10-17 14:42:53.000000000 -0700
+++ ./kernel/power/disk.c	2003-10-25 00:02:10.000000000 -0700
@@ -326,10 +326,55 @@
 	.attrs = g,
 };
 
-
 static int __init pm_disk_init(void)
 {
 	return sysfs_create_group(&power_subsys.kset.kobj,&attr_group);
 }
 
 core_initcall(pm_disk_init);
+
+#ifdef CONFIG_VIDEO_SELECT
+/*
+ *	gmode - report graphics mode
+ *
+ * In order for software suspend to succeed, the video mode must match that
+ * supplied via the console or from the kernel command line.  This provides
+ * an orderly means of retrieving that information (rather than grep'ing
+ * 'dmesg' at an appropriate time, as was the previous means of obtaining
+ * this datum).
+ *
+ * TO DO:  Make sure framebuffer code updates 'saved_videomode' if it is
+ *	   capable of changing the video mode ('vesafb' apparently cannot).
+ */
+extern unsigned long saved_videomode;
+
+static ssize_t gmode_show(struct subsystem * subsys, char * buf)
+{
+	return sprintf(buf,"0x%lx\n",saved_videomode);
+}
+
+static ssize_t gmode_store(struct subsystem * s, const char * buf, size_t n) {
+	return -EINVAL;
+}
+
+/* Probably should use some macro which makes 'gmode' read-only, since the
+   above code didn't report an error when storing into /sys/prog/gmode */
+power_attr(gmode);
+
+static struct attribute * g2[] = {
+	&gmode_attr.attr,
+	NULL,
+};
+
+static struct attribute_group attr_group2 = {
+	.attrs = g2,
+};
+
+static int __init pm_gmode_init(void)
+{
+	return sysfs_create_group(&power_subsys.kset.kobj,&attr_group2);
+}
+
+core_initcall(pm_gmode_init);
+
+#endif /* CONFIG_VIDEO_SELECT */

===============================================================================

             reply	other threads:[~2003-10-25  7:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-25  7:07 John Mock [this message]
2003-10-25 13:43 ` Pavel Machek

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=E1ADIWJ-00012u-00@penngrove.fdns.net \
    --to=kd6pag@qsl.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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

all inboxes | Powered by JetHome®