Hi Dmitry, 

於 六,2011-03-12 於 22:31 -0800,Dmitry Torokhov 提到:
> >  
> >  static int dmi_check_cb(const struct dmi_system_id *id)
> >  {
> > -   printk(KERN_INFO "msi-laptop: Identified laptop model '%s'.\n",
> > -          id->ident);
> > +   pr_info("msi-laptop: Identified laptop model '%s'.\n", id->ident);
> 
> No, you need to add:
> 
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> 
> at the very beginning of your driver (before includes) and then just do
> 
>       pr_info("Identified laptop model '%s'.\n", id->ident);
> 
> and pr_fmt() will ensure that alll your messages use consistent prefix.
> 
> Thanks.
> 

Thank's for your teach, it works fine to me. Follow your suggestion, I
fixed my patch like the following, please kindly review it again:


>From 31123fcc91b073b329a970b075041eaec523b106 Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <[email protected]>
Date: Wed, 16 Mar 2011 15:44:40 +0800
Subject: [PATCH] msi-laptop: use pr_<level> for messages

msi-laptop: use pr_<level> for messages

Cc: Carlos Corbacho <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Corentin Chary <[email protected]>
Signed-off-by: Lee, Chun-Yi <[email protected]>
---
 drivers/platform/x86/msi-laptop.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/msi-laptop.c 
b/drivers/platform/x86/msi-laptop.c
index 028d2c6..0de6d43 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -51,6 +51,8 @@
  * laptop as MSI S270. YMMV.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -445,8 +447,7 @@ static struct platform_device *msipf_device;
 
 static int dmi_check_cb(const struct dmi_system_id *id)
 {
-       printk(KERN_INFO "msi-laptop: Identified laptop model '%s'.\n",
-              id->ident);
+       pr_info("Identified laptop model '%s'.\n", id->ident);
        return 1;
 }
 
@@ -834,8 +835,7 @@ static int load_scm_model_init(struct platform_device *sdev)
 
        result = i8042_install_filter(msi_laptop_i8042_filter);
        if (result) {
-               printk(KERN_ERR
-                       "msi-laptop: Unable to install key filter\n");
+               pr_err("Unable to install key filter\n");
                goto fail_filter;
        }
 
@@ -875,7 +875,7 @@ static int __init msi_init(void)
        /* Register backlight stuff */
 
        if (acpi_video_backlight_support()) {
-               printk(KERN_INFO "MSI: Brightness ignored, must be controlled "
+               pr_info("Brightness ignored, must be controlled "
                       "by ACPI video driver\n");
        } else {
                struct backlight_properties props;
@@ -929,7 +929,7 @@ static int __init msi_init(void)
        if (auto_brightness != 2)
                set_auto_brightness(auto_brightness);
 
-       printk(KERN_INFO "msi-laptop: driver "MSI_DRIVER_VERSION" successfully 
loaded.\n");
+       pr_info("driver "MSI_DRIVER_VERSION" successfully loaded.\n");
 
        return 0;
 
@@ -977,7 +977,7 @@ static void __exit msi_cleanup(void)
        if (auto_brightness != 2)
                set_auto_brightness(1);
 
-       printk(KERN_INFO "msi-laptop: driver unloaded.\n");
+       pr_info("driver unloaded.\n");
 }
 
 module_init(msi_init);
-- 
1.6.0.2




--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" 
in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to