From: Timur Tabi <timur@freescale.com>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org
Subject: Re: [PATCH] Check mac-address first in fsl_soc.c
Date: Tue, 13 Feb 2007 11:45:15 -0600 [thread overview]
Message-ID: <45D1F92B.3000000@freescale.com> (raw)
In-Reply-To: <5B1BBAE9-00FC-454B-8855-7D362DF59850@kernel.crashing.org>
Kumar Gala wrote:
> How about something like comparing against a local null array instead.
> Something like:
>
> u8 null_mac_addr[6] = { 0 };
> if (!mac_addr || (memcmp(mac_addr, null_mac_addr, 6) == 0)) {
I believe this will cause the compiler to generate more code, not less. When
you declare an initialized array as a local variable, the compiler reserves
space on the stack, and then it generates code to copy the data from some global
storage to the stack.
If I inline a string instead, however, the compiler will just put the string in
global storage and reference it directly. The compiler should be able to detect
multiple instances of the same string, and store them as a single string.
If you still want null_mac_addr[], you would need to do this:
static const u8 null_mac_addr[6] = { 0 };
Although frankly it would be nice if the Ethernet module had static globals and
functions for this sort of thing.
Do you still want me to create null_mac_addr[], as above? I was going to put
the code inside an inline function anyway, per Sergei's request.
--
Timur Tabi
Linux Kernel Developer @ Freescale
next prev parent reply other threads:[~2007-02-13 17:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-09 20:02 [PATCH] Check mac-address first in fsl_soc.c Timur Tabi
2007-02-09 20:52 ` Sergei Shtylyov
2007-02-09 20:55 ` Timur Tabi
2007-02-09 20:58 ` Sergei Shtylyov
2007-02-09 21:00 ` Timur Tabi
2007-02-09 21:06 ` Kumar Gala
2007-02-09 21:09 ` Timur Tabi
2007-02-13 17:25 ` Timur Tabi
2007-02-13 17:33 ` Sergei Shtylyov
2007-02-13 17:37 ` Timur Tabi
2007-02-13 17:37 ` Kumar Gala
2007-02-13 17:45 ` Timur Tabi [this message]
2007-02-13 18:01 ` Kumar Gala
2007-02-13 18:51 ` Timur Tabi
2007-02-13 19:01 ` Kumar Gala
2007-02-13 19:10 ` Timur Tabi
2007-02-13 19:20 ` Timur Tabi
2007-02-13 19:50 ` Timur Tabi
2007-02-13 21:23 ` Timur Tabi
2007-02-13 22:14 ` Kumar Gala
2007-02-09 21:24 ` Jerry Van Baren
2007-02-09 21:51 ` Timur Tabi
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=45D1F92B.3000000@freescale.com \
--to=timur@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.