Linux EFI development
 help / color / mirror / Atom feed
From: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
To: Peter Jones <pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Matt Fleming
	<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Matthew Garrett
	<matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] Print the actual UEFI error name, not just the error code.
Date: Thu, 23 May 2013 12:06:53 -0700	[thread overview]
Message-ID: <1369336013.2075.47.camel@joe-AO722> (raw)
In-Reply-To: <1369334231-11100-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, 2013-05-23 at 14:37 -0400, Peter Jones wrote:
> EFI error numbers are useful, but symbol names are way easier to
> understand when you're reading bug reports.  And since, for the most
> part, we know the names, we should show them.
[]
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
[]
> +#define efi_pr_warn(status, fmt, ...) ({				\
> +		typeof(status) __status = EFI_REVERSE_ERROR(status);	\
> +		if (__status >= 0 &&					\
> +				__status <= EFI_REVERSE_ERROR(EFI_MAX_ERROR))\
> +			pr_warn(fmt ": %s (0x%lx)\n", ## __VA_ARGS__,	\
> +				efi_error_strings[__status], __status);	\
> +		else							\
> +			pr_warn(fmt ": 0x%lx\n", ## __VA_ARGS__, __status);\
> +	})

This doubles the number of formats (and code size text) used.

Please don't remove trailing newlines from these sorts
of messages.  

I think a function to return "unknown efi error" would be
acceptable and these should become something like:

const char *efi_error_string(unsigned long status)
{
	if (status <= EFI_REVERSE_ERROR(EFI_MAX_ERROR))
		return efi_error_strings[status];
	return "unknown efi error";
}

and the uses something like:

> -		printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
> -			status);
--
	pr_warn("set_variable() failed: %s (%lx)\n",
		efi_error_string(status), status);

(with #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt)

      parent reply	other threads:[~2013-05-23 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 18:37 [PATCH] Print the actual UEFI error name, not just the error code Peter Jones
     [not found] ` <1369334231-11100-1-git-send-email-pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-23 19:06   ` Joe Perches [this message]

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=1369336013.2075.47.camel@joe-AO722 \
    --to=joe-6d6dil74uinbdgjk7y7tuq@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org \
    --cc=pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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