From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mauro Carvalho Chehab Subject: Re: [PATCH EDAC 13/13] ghes_edac: Improve driver's printk messages Date: Fri, 15 Feb 2013 15:33:54 -0200 Message-ID: <20130215153354.2779cf4b@redhat.com> References: <30bb26a76d98f876648020517cd38a4884626f44.1360931635.git.mchehab@redhat.com> <1360946297.2089.6.camel@joe-AO722> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1360946297.2089.6.camel@joe-AO722> Sender: linux-kernel-owner@vger.kernel.org To: Joe Perches Cc: linux-acpi@vger.kernel.org, Huang Ying , Tony Luck , Linux Edac Mailing List , Linux Kernel Mailing List List-Id: linux-acpi@vger.kernel.org Em Fri, 15 Feb 2013 08:38:17 -0800 Joe Perches escreveu: > On Fri, 2013-02-15 at 10:45 -0200, Mauro Carvalho Chehab wrote: > > Provide a better infrastructure for printk's inside the driver: > > - use edac_dbg() for debug messages; > > - standardize the usage of pr_info(); > > - provide warning about the risk of relying on this > > driver. > [] > > diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c > [] > > @@ -80,7 +80,8 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) > > dimm_fill->count, 0, 0); > > > > if (entry->size == 0xffff) { > > - pr_info(GHES_PFX "Can't get dimm size\n"); > > + pr_info(GHES_PFX "Can't get DIMM%i size\n", > > + dimm_fill->count); > > Perhaps these should use > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > and remove GHEX_PFX from all the pr_()'s? Yeah, sure. Regards, Mauro - [PATCH] ghes_edac: remove GHES_PFX macro As suggested by Joe: On Fri, 15 Feb 2013 08:38:17 -0800 Joe Perches wrote: Perhaps these should use #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt and remove GHES_PFX from all the pr_()'s? Suggested-by: Joe Perches Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index 782ed74..9fe787b 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -1,14 +1,16 @@ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include #include "edac_core.h" -#define GHES_PFX "ghes_edac: " #define GHES_EDAC_REVISION " Ver: 1.0.0" static DEFINE_MUTEX(ghes_edac_lock); static int ghes_edac_mc_num; + /* Memory Device - Type 17 of SMBIOS spec */ struct memdev_dmi_entry { u8 type; @@ -80,7 +82,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) dimm_fill->count, 0, 0); if (entry->size == 0xffff) { - pr_info(GHES_PFX "Can't get DIMM%i size\n", + pr_info("Can't get DIMM%i size\n", dimm_fill->count); dimm->nr_pages = MiB_TO_PAGES(32);/* Unknown */ } else if (entry->size == 0x7fff) { @@ -232,7 +234,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) mutex_lock(&ghes_edac_lock); mci = edac_mc_alloc(ghes_edac_mc_num, ARRAY_SIZE(layers), layers, 0); if (!mci) { - pr_info(GHES_PFX "Can't allocate memory for EDAC data\n"); + pr_info("Can't allocate memory for EDAC data\n"); mutex_unlock(&ghes_edac_lock); return -ENOMEM; } @@ -250,17 +252,17 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) if (!ghes_edac_mc_num) { if (!fake) { - pr_info(GHES_PFX "This EDAC driver relies on BIOS to enumerate memory and get error reports.\n"); - pr_info(GHES_PFX "Unfortunately, not all BIOSes reflect the memory layout correctly.\n"); - pr_info(GHES_PFX "So, the end result of using this driver varies from vendor to vendor.\n"); - pr_info(GHES_PFX "If you find incorrect reports, please contact your hardware vendor\n"); - pr_info(GHES_PFX "to correct its BIOS.\n"); - pr_info(GHES_PFX "This system has %d DIMM sockets.\n", + pr_info("This EDAC driver relies on BIOS to enumerate memory and get error reports.\n"); + pr_info("Unfortunately, not all BIOSes reflect the memory layout correctly.\n"); + pr_info("So, the end result of using this driver varies from vendor to vendor.\n"); + pr_info("If you find incorrect reports, please contact your hardware vendor\n"); + pr_info("to correct its BIOS.\n"); + pr_info("This system has %d DIMM sockets.\n", num_dimm); } else { - pr_info(GHES_PFX "This system has a very crappy BIOS: It doesn't even list the DIMMS.\n"); - pr_info(GHES_PFX "Its SMBIOS info is wrong. It is doubtful that the error report would\n"); - pr_info(GHES_PFX "work on such system. Use this driver with caution\n"); + pr_info("This system has a very crappy BIOS: It doesn't even list the DIMMS.\n"); + pr_info("Its SMBIOS info is wrong. It is doubtful that the error report would\n"); + pr_info("work on such system. Use this driver with caution\n"); } } @@ -291,7 +293,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) rc = edac_mc_add_mc(mci); if (rc < 0) { - pr_info(GHES_PFX "Can't register at EDAC core\n"); + pr_info("Can't register at EDAC core\n"); edac_mc_free(mci); mutex_unlock(&ghes_edac_lock); return -ENODEV;