linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: move mips_{set,get}_machine_name() to a more generic p

To: John Crispin <blogic@openwrt.org>
Subject: Re: [PATCH] MIPS: move mips_{set,get}_machine_name() to a more generic place
From: Gabor Juhos <juhosg@openwrt.org>
Date: Fri, 12 Apr 2013 19:34:35 +0200
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
In-reply-to: <1365662099-3981-1-git-send-email-blogic@openwrt.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1365662099-3981-1-git-send-email-blogic@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
2013.04.11. 8:34 keltezéssel, John Crispin írta:
> Previously this functionality was only available to users of the mips_machine
> api. Moving the code to prom.c allows us to also add a OF wrapper.
> 
> Signed-off-by: John Crispin <blogic@openwrt.org>
> ---
>  arch/mips/include/asm/mips_machine.h |    4 ----
>  arch/mips/include/asm/prom.h         |    3 +++
>  arch/mips/kernel/mips_machine.c      |   20 --------------------
>  arch/mips/kernel/proc.c              |    1 +
>  arch/mips/kernel/prom.c              |   33 +++++++++++++++++++++++++++++++++
>  5 files changed, 37 insertions(+), 24 deletions(-)
> 

<...>

> diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
> index 028f6f8..9d653e1 100644
> --- a/arch/mips/kernel/prom.c
> +++ b/arch/mips/kernel/prom.c
> @@ -23,6 +23,21 @@
>  #include <asm/page.h>
>  #include <asm/prom.h>
>  
> +static char mips_machine_name[64] = "Unknown";
> +
> +__init void mips_set_machine_name(const char *name)
> +{
> +     if (name == NULL)
> +             return;
> +
> +     snprintf(mips_machine_name, sizeof(mips_machine_name), name);

Any specific reason why you are using snprintf? If someone would call this with
format characters in the 'name' that would cause weird things.

-Gabor

<Prev in Thread] Current Thread [Next in Thread>