linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: haojian.zhuang@linaro.org (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 03/14] clocksource: sp804: append CONFIG_OF
Date: Wed, 13 Mar 2013 11:25:57 +0800	[thread overview]
Message-ID: <CAD6h2NQHjP2YSv2=BAqTa+MaZKvSe6JPwmuhMLkJcjuaMtVtsA@mail.gmail.com> (raw)
In-Reply-To: <201303121917.24928.arnd@arndb.de>

On 13 March 2013 03:17, Arnd Bergmann <arnd@arndb.de> wrote:
> (resending this email as I got a few rejects from mailing lists when
> I accidentally had an invalid email address for Mike)
>
> On Tuesday 12 March 2013, Haojian Zhuang wrote:
>> of_find_matching_node() & of_device_is_available() are depend on CONFIG_OF
>> macro. If CONFIG_OF isn't defined for non-DT mode, the build error
>> occurs.
>>
>> So add CONFIG_OF for those DT functions.
>
> I don't like this patch too much:
>
> We should be able to do this without the #ifdef. The problem is really that the
> declarations are also hidden behind an #ifdef. I think we should change the
> linux/of.h header file to either provide alternative empty inline functions
> or at least leave the declarations visible so we can compile the code as
> long as the call gets discarded.
>
>>
>> +#ifdef CONFIG_OF
>>  static struct device_node *from = NULL;
>>
>>  static struct of_device_id sp804_timer_match[] __initdata = {
>> @@ -294,3 +295,4 @@ err:
>>       iounmap(base);
>>  }
>>  CLOCKSOURCE_OF_DECLARE(sp804, "arm,sp804", sp804_dt_init);
>> +#endif
>
> There is actually an empty definition for CLOCKSOURCE_OF_DECLARE(),
> but I think it would be better to still define it the same way as
> with CONFIG_OF enabled but attribute((__unused__)), like:
>
> #ifdef CONFIG_CLKSRC_OF
> extern void clocksource_of_init(void);
> #define CLOCKSOURCE_OF_DECLARE(name, compat, fn)                        \
>         static const struct of_device_id __clksrc_of_table_##name       \
>                 __used __section(__clksrc_of_table)                     \
>                  = { .compatible = compat, .data = fn };
> #else
> static inline void clocksource_of_init(void) {}
> #define CLOCKSOURCE_OF_DECLARE(name, compat, fn)                        \
>         static const struct of_device_id __clksrc_of_table_##name       \
>                 __unused = { .compatible = compat, .data = fn };
> #endif
>
> This way, all the code still gets built, but since there is nothing
> pointing to __clksrc_of_table_##name and it is marked __unused, it
> gets dropped along with all other symbols that are only referenced
> from it.
>
>         Arnd
>

If CONFIG_CLKSRC_OF is depend on CONFIG_USEOF, I think that
we can resolve all these issue. We don't need to define
CLOCKSOURCE_OF_DECLARE() for non-DT mode, and we also
don't need to define of_device_is_available(), ... in non-DT mode.

We only need to add "depends on USE_OF" for CLKSRC_OF
configuration. It's simpler. What's your opinion?

Regards
Haojian

  reply	other threads:[~2013-03-13  3:25 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 17:08 [PATCH v2 00/14] add hisilicon soc support Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 01/14] clocksource: move sp timer driver Haojian Zhuang
2013-03-12 18:11   ` Arnd Bergmann
2013-03-13  2:20     ` Haojian Zhuang
2013-03-12 19:08   ` Russell King - ARM Linux
2013-03-12 17:08 ` [PATCH v2 02/14] clocksource: sp804: add device tree support Haojian Zhuang
2013-03-12 18:14   ` Arnd Bergmann
2013-03-12 18:51   ` Arnd Bergmann
2013-03-12 18:53     ` Rob Herring
2013-03-12 17:08 ` [PATCH v2 03/14] clocksource: sp804: append CONFIG_OF Haojian Zhuang
2013-03-12 19:17   ` Arnd Bergmann
2013-03-13  3:25     ` Haojian Zhuang [this message]
2013-03-14 13:48       ` Arnd Bergmann
2013-03-12 17:08 ` [PATCH v2 04/14] ARM: highbank: use clocksource_of_init for sp804 Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 05/14] ARM: integrator: " Haojian Zhuang
2013-03-12 18:54   ` Arnd Bergmann
2013-03-13  2:00     ` Haojian Zhuang
2013-03-13  5:25     ` Linus Walleij
2013-03-12 19:15   ` Rob Herring
2013-03-12 19:33     ` Arnd Bergmann
2013-03-12 20:52       ` Rob Herring
2013-03-13  2:04         ` Haojian Zhuang
2013-03-13  6:41           ` Linus Walleij
2013-03-13  7:09             ` Haojian Zhuang
2013-03-13  8:43               ` Arnd Bergmann
2013-03-13  9:00               ` Linus Walleij
2013-03-15 12:15                 ` Russell King - ARM Linux
2013-03-15 13:59                   ` Linus Walleij
2013-03-13 13:56             ` Rob Herring
2013-03-13  9:03       ` Linus Walleij
2013-03-15 11:54     ` Russell King - ARM Linux
2013-03-13  6:35   ` Linus Walleij
2013-03-12 17:08 ` [PATCH v2 06/14] ARM: vexpress: " Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 07/14] ARM: debug: support debug ll on hisilicon soc Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 08/14] clk: hs: add clock support Haojian Zhuang
2013-03-12 19:00   ` Arnd Bergmann
2013-03-13  4:08     ` Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 09/14] ARM: hs: add board support with device tree Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 10/14] ARM: hs: enable hi4511 " Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 11/14] ARM: config: append arch hs into multi defconfig Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 12/14] Document: append hisilicon clock binding Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 13/14] Document: dts: create hisilicon document Haojian Zhuang
2013-03-12 17:08 ` [PATCH v2 14/14] Document: add device tree binding file for sp804 Haojian Zhuang
2013-03-12 19:02   ` Arnd Bergmann
2013-03-13  1:45     ` Haojian Zhuang

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='CAD6h2NQHjP2YSv2=BAqTa+MaZKvSe6JPwmuhMLkJcjuaMtVtsA@mail.gmail.com' \
    --to=haojian.zhuang@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).