All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jon Medhurst (Tixy)" <tixy@linaro.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	devicetree-discuss@lists.ozlabs.org,
	Samuel Ortiz <sameo@linux.intel.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Amit Kucheria <amit.kucheria@linaro.org>,
	Achin Gupta <achin.gupta@arm.com>,
	Sudeep KarkadaNagesha <Sudeep.KarkadaNagesha@arm.com>
Subject: Re: [RFC PATCH v2 2/2] drivers: mfd: vexpress: add Serial Power Controller (SPC) support
Date: Wed, 05 Jun 2013 17:32:30 +0100	[thread overview]
Message-ID: <1370449950.3496.12.camel@linaro1.home> (raw)
In-Reply-To: <1370432767-6620-3-git-send-email-lorenzo.pieralisi@arm.com>

On Wed, 2013-06-05 at 12:46 +0100, Lorenzo Pieralisi wrote:
[...]
> +
> +static bool __init __vexpress_spc_check_loaded(void);
> +static bool (*spc_check_loaded)(void) = &__vexpress_spc_check_loaded;

We get a section mismatch warning from the above because
__vexpress_spc_check_loaded is marked __init.

Now, we know the code is safe because we replace the reference in the
early_initcall below, before the init section is discarded (which is the
whole point of the construct) so we can add __refdata to the declaration
of spc_check_loaded to silence the warning.

Other than that I've not noticed any issues when testing the patches.

> +
> +static bool __init __vexpress_spc_check_loaded(void)
> +{
> +	if (vexpress_spc_load_result == -EAGAIN)
> +		vexpress_spc_load_result = vexpress_spc_init();
> +	spc_check_loaded = &vexpress_spc_initialized;
> +	return vexpress_spc_initialized();
> +}
> +
> +/*
> + * Function exported to manage early_initcall ordering.
> + * SPC code is needed very early in the boot process
> + * to bring CPUs out of reset and initialize power
> + * management back-end. After boot swap pointers to
> + * make the functionality check available to loadable
> + * modules, when early boot init functions have been
> + * already freed from kernel address space.
> + */
> +bool vexpress_spc_check_loaded(void)
> +{
> +	return spc_check_loaded();
> +}
> +EXPORT_SYMBOL_GPL(vexpress_spc_check_loaded);
> +
> +static int __init vexpress_spc_early_init(void)
> +{
> +	__vexpress_spc_check_loaded();
> +	return vexpress_spc_load_result;
> +}
> +early_initcall(vexpress_spc_early_init);
[...]

-- 
Tixy


WARNING: multiple messages have this Message-ID (diff)
From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH v2 2/2] drivers: mfd: vexpress: add Serial Power Controller (SPC) support
Date: Wed, 05 Jun 2013 17:32:30 +0100	[thread overview]
Message-ID: <1370449950.3496.12.camel@linaro1.home> (raw)
In-Reply-To: <1370432767-6620-3-git-send-email-lorenzo.pieralisi@arm.com>

On Wed, 2013-06-05 at 12:46 +0100, Lorenzo Pieralisi wrote:
[...]
> +
> +static bool __init __vexpress_spc_check_loaded(void);
> +static bool (*spc_check_loaded)(void) = &__vexpress_spc_check_loaded;

We get a section mismatch warning from the above because
__vexpress_spc_check_loaded is marked __init.

Now, we know the code is safe because we replace the reference in the
early_initcall below, before the init section is discarded (which is the
whole point of the construct) so we can add __refdata to the declaration
of spc_check_loaded to silence the warning.

Other than that I've not noticed any issues when testing the patches.

> +
> +static bool __init __vexpress_spc_check_loaded(void)
> +{
> +	if (vexpress_spc_load_result == -EAGAIN)
> +		vexpress_spc_load_result = vexpress_spc_init();
> +	spc_check_loaded = &vexpress_spc_initialized;
> +	return vexpress_spc_initialized();
> +}
> +
> +/*
> + * Function exported to manage early_initcall ordering.
> + * SPC code is needed very early in the boot process
> + * to bring CPUs out of reset and initialize power
> + * management back-end. After boot swap pointers to
> + * make the functionality check available to loadable
> + * modules, when early boot init functions have been
> + * already freed from kernel address space.
> + */
> +bool vexpress_spc_check_loaded(void)
> +{
> +	return spc_check_loaded();
> +}
> +EXPORT_SYMBOL_GPL(vexpress_spc_check_loaded);
> +
> +static int __init vexpress_spc_early_init(void)
> +{
> +	__vexpress_spc_check_loaded();
> +	return vexpress_spc_load_result;
> +}
> +early_initcall(vexpress_spc_early_init);
[...]

-- 
Tixy

  parent reply	other threads:[~2013-06-05 16:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 11:46 [RFC PATCH v2 0/2] drivers: mfd: Versatile Express SPC support Lorenzo Pieralisi
2013-06-05 11:46 ` Lorenzo Pieralisi
2013-06-05 11:46 ` Lorenzo Pieralisi
2013-06-05 11:46 ` [RFC PATCH v2 1/2] drivers: mfd: refactor the vexpress config bridge API Lorenzo Pieralisi
2013-06-05 11:46   ` Lorenzo Pieralisi
2013-06-05 13:52   ` Nicolas Pitre
2013-06-05 13:52     ` Nicolas Pitre
2013-06-05 11:46 ` [RFC PATCH v2 2/2] drivers: mfd: vexpress: add Serial Power Controller (SPC) support Lorenzo Pieralisi
2013-06-05 11:46   ` Lorenzo Pieralisi
2013-06-05 14:07   ` Nicolas Pitre
2013-06-05 14:07     ` Nicolas Pitre
2013-06-05 16:32   ` Jon Medhurst (Tixy) [this message]
2013-06-05 16:32     ` Jon Medhurst (Tixy)
2013-06-05 18:08   ` Jon Medhurst (Tixy)
2013-06-05 18:08     ` Jon Medhurst (Tixy)
2013-06-05 18:22     ` Lorenzo Pieralisi
2013-06-05 18:22       ` Lorenzo Pieralisi
2013-06-05 18:22       ` Lorenzo Pieralisi
2013-06-05 14:15 ` [RFC PATCH v2 0/2] drivers: mfd: Versatile Express SPC support Nicolas Pitre
2013-06-05 14:15   ` Nicolas Pitre

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=1370449950.3496.12.camel@linaro1.home \
    --to=tixy@linaro.org \
    --cc=Sudeep.KarkadaNagesha@arm.com \
    --cc=achin.gupta@arm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=pawel.moll@arm.com \
    --cc=sameo@linux.intel.com \
    /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.