linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] ARM: Add interface for registering and calling firmware-specific operations
Date: Sat, 22 Sep 2012 15:17:14 +0200	[thread overview]
Message-ID: <2370637.l5XxG4tm0Y@flatron> (raw)
In-Reply-To: <20120922062322.GA6264@quad.lixom.net>

Hi Olof, Kyungmin,

On Friday 21 of September 2012 23:23:22 Olof Johansson wrote:
> On Sat, Sep 22, 2012 at 03:01:56PM +0900, Kyungmin Park wrote:
> > On 9/22/12, Olof Johansson <olof@lixom.net> wrote:
> > > On Thu, Sep 13, 2012 at 10:13:35AM +0200, Tomasz Figa wrote:
> > >> +#define call_firmware_op(op, ...)					\
> > >> +	((firmware_ops->op) ? firmware_ops->op(__VA_ARGS__) : 0)
> > > 
> > > I think this will cause sparse warnings for
> > > call_firmware_op(cpu_boot_reg) if there are no ops defined, since
> > > the '0' isn't annotated as __iomem. And you can't annotate it since
> > > the other function pointers don't need it.
> > > 
> > > I think you might be better off with stub functions as fallbacks
> > > instead of allowing and checking for NULL here.
> > 
> > do you mean like this?
> > 
> > #Ifdef CONFIG_ARM_FIRMWARE
> > #define call_firmware_op(op, ...) ((firmware_ops->op) ?
> > firmware_ops->op(__VA_ARGS__) : 0)
> > #else
> > #define call_firmware_op(op, ...) do { } while (0)
> > #endif
> > 
> > No problem to modify it.
> 
> To get the types and return values right you still need to do something
> like:
> 
> #define call_firmware_op(op, ...) (firmware_ops->op(__VA_ARGS))
> 
> And then, in firmware.c:
> 
> static int default_do_idle(void)
> {
> 	return 0;
> }
> 
> static default_cpu_boot(int cpu)
> {
> 	return;
> }
> 
> static void __iomem *default_cpu_boot_reg(int cpu)
> {
> 	return (void __iomem *)0;
> }
> 
> static const struct firmware_ops default_firmware_ops = {
> 	.do_idle = default_do_idle,
> 	.cpu_boot = default_cpu_boot,
> 	.cpu_boot_reg = default_cpu_boot_reg,
> }

Thanks for pointing this out. I will address it in next version of the 
series.

Also it might be useful to be able to check if an operation was provided, 
so maybe an unimplemented operation should return an error value (which one 
would be the most appropriate? -ENOSYS?)? What do you think?

Best regards,
Tomasz Figa

  reply	other threads:[~2012-09-22 13:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  8:13 [PATCH 0/5] ARM: EXYNOS: Add secure firmware support Tomasz Figa
2012-09-13  8:13 ` [PATCH 1/5] ARM: EXYNOS: Add IO mapping for non-secure SYSRAM Tomasz Figa
2012-09-13  8:13 ` [PATCH 2/5] ARM: Add interface for registering and calling firmware-specific operations Tomasz Figa
2012-09-13  8:25   ` Tomasz Figa
2012-09-22  5:50   ` Olof Johansson
2012-09-22  6:01     ` Kyungmin Park
2012-09-22  6:23       ` Olof Johansson
2012-09-22 13:17         ` Tomasz Figa [this message]
2012-09-22 13:22         ` Russell King - ARM Linux
2012-09-13  8:13 ` [PATCH 3/5] ARM: EXYNOS: Add support for secure monitor calls Tomasz Figa
2012-09-13  8:13 ` [PATCH 4/5] ARM: EXYNOS: Add support for Exynos secure firmware Tomasz Figa
2012-09-16  0:44   ` Olof Johansson
2012-09-19 10:10     ` Tomasz Figa
2012-09-22  5:39       ` Olof Johansson
2012-09-22  5:57         ` Kyungmin Park
2012-09-22  6:36           ` Olof Johansson
2012-09-22  6:39             ` Kyungmin Park
2012-09-24 14:39     ` Tomasz Figa
2012-09-13  8:13 ` [PATCH 5/5] ARM: EXYNOS: Add secure firmware support to secondary CPU bring-up Tomasz Figa
2012-09-19 13:29 ` [PATCH 0/5] ARM: EXYNOS: Add secure firmware support Tomasz Figa
2012-09-21  8:39   ` Kyungmin Park
2012-09-22  5:52     ` Olof Johansson

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=2370637.l5XxG4tm0Y@flatron \
    --to=tomasz.figa@gmail.com \
    --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).