lkml.org 
[lkml]   [2003]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: Kill unneccessary debug printk [PATCH]
Date
    > 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 */
===============================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.027 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site