LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH V1] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Markus Pargmann @ 2014-09-10 10:53 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, lgirdwood, tiwai, Li.Xiubo, timur, perex,
	Nicolin Chen, broonie, linuxppc-dev, linux-kernel
In-Reply-To: <20140910103005.GB17326@audiosh1>

[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]

Hi,

On Wed, Sep 10, 2014 at 06:30:06PM +0800, Shengjiu Wang wrote:
> On Wed, Sep 10, 2014 at 08:21:18AM +0200, Markus Pargmann wrote:
> > On Tue, Sep 09, 2014 at 11:38:05AM -0700, Nicolin Chen wrote:
> > > On Tue, Sep 09, 2014 at 05:18:07PM +0800, Shengjiu Wang wrote:
> > > > @@ -1321,7 +1333,11 @@ static int fsl_ssi_probe(struct platform_device *pdev)
> > > >  		return -ENOMEM;
> > > >  	}
> > > >  
> > > > -	ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
> > > > +	if (ssi_private->soc->imx)
> > > > +		ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
> > > > +			"ipg", iomem, &fsl_ssi_regconfig);
> > > > +	else
> > > > +		ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
> > > 
> > > As Markus mentioned, the key point here is to be compatible with those
> > > non-clock-name platforms.
> > > 
> > > I think it would be safer to keep the current code while adding an extra
> > > clk_disable_unprepare() at the end of probe() as a common routine. And
> > > meantime, make sure to have the call for imx only because it seems that
> > > the other platforms do not depend on the clock. //a bit guessing here :)
> > > 
> > > Then we can get a patch like:
> > > open() {
> > > +	clk_prepare_enable();
> > > 	....
> > > }
> > > 
> > > close() {
> > > 	....
> > > +	clk_disable_unprepare()
> > > }
> > > 
> > > probe() {
> > > 	clk_get();
> > > 	clk_prepare_enable();
> > > 	....
> > > 	if (xxx)
> > > -		goto err_xx;
> > > +		return ret;
> > > 	....
> > > +	clk_disable_unprepare();
> > > 	return 0;
> > > -err_xx:
> > > -	clk_disable_unprepare()
> > > }
> > > 
> > > remove() {
> > > 	....
> > > -	clk_disable_unprepare()
> > > }
> > 
> > If I remember correctly, there may be AC97 communication with the codec
> > before any substream is created. That's why we enable the SSI unit right
> > at the beginning for AC97 in fsl_ssi_setup_reg_vals(). So we need to
> > check for AC97 before disabling clocks.
> > 
> > Best regards,
> > 
> > Markus
> 
> hi Markus
> 
> I think if clk_prepare_enable() in startup(), and clk_disable_unprepare()
> in shutdown can meet this requirement, right?

Yes that could work.

> 
> done:
>         if (ssi_private->dai_fmt)
>                 _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
> 
> I find that in end of probe, there is setting of dai_fmt. Can we remove this?
> because this setting need to enable ipg clock, and if ac97, ipg clock can't be
> disabled.

No you can't remove it. It is necessary for the DT property "fsl,mode".
Most dts do not have this property anymore because the sound cards are
setting the dai-fmt. But there are still some powerpc dts files that
contain that property.

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH 2/2 v6] powerpc/kvm: common sw breakpoint instr across ppc
From: Alexander Graf @ 2014-09-10 12:36 UTC (permalink / raw)
  To: Madhavan Srinivasan, benh, paulus, mpe; +Cc: linuxppc-dev, kvm-ppc, kvm
In-Reply-To: <1410282456-11287-3-git-send-email-maddy@linux.vnet.ibm.com>



On 09.09.14 19:07, Madhavan Srinivasan wrote:
> This patch extends the use of illegal instruction as software
> breakpoint instruction across the ppc platform. Patch extends
> booke program interrupt code to support software breakpoint.
> 
> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> ---
> Patch is only compile tested. Will really help if
> someone can try it out and let me know the comments.

I've squashed the following patch into this one to make it work on booke hv.

Alex


diff --git a/arch/powerpc/kvm/bookehv_interrupts.S
b/arch/powerpc/kvm/bookehv_interrupts.S
index c8e4da5..81bd8a0 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -238,7 +238,7 @@ kvm_handler BOOKE_INTERRUPT_EXTERNAL, EX_PARAMS(GEN), \
 kvm_handler BOOKE_INTERRUPT_ALIGNMENT, EX_PARAMS(GEN), \
 	SPRN_SRR0, SPRN_SRR1,(NEED_DEAR | NEED_ESR)
 kvm_handler BOOKE_INTERRUPT_PROGRAM, EX_PARAMS(GEN), \
-	SPRN_SRR0, SPRN_SRR1,NEED_ESR
+	SPRN_SRR0, SPRN_SRR1, (NEED_ESR | NEED_EMU)
 kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, EX_PARAMS(GEN), \
 	SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, EX_PARAMS(GEN), \
@@ -348,7 +348,7 @@ kvm_handler BOOKE_INTERRUPT_INST_STORAGE, SPRN_SRR0,
SPRN_SRR1, NEED_ESR
 kvm_handler BOOKE_INTERRUPT_EXTERNAL, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_ALIGNMENT, \
 	SPRN_SRR0, SPRN_SRR1, (NEED_DEAR | NEED_ESR)
-kvm_handler BOOKE_INTERRUPT_PROGRAM, SPRN_SRR0, SPRN_SRR1, NEED_ESR
+kvm_handler BOOKE_INTERRUPT_PROGRAM, SPRN_SRR0, SPRN_SRR1, (NEED_ESR |
NEED_EMU)
 kvm_handler BOOKE_INTERRUPT_FP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_SYSCALL, SPRN_SRR0, SPRN_SRR1, 0
 kvm_handler BOOKE_INTERRUPT_AP_UNAVAIL, SPRN_SRR0, SPRN_SRR1, 0

^ permalink raw reply related

* Re: [Xen-devel] [PATCH v1 04/21] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()
From: David Vrabel @ 2014-09-10 12:36 UTC (permalink / raw)
  To: Yijing Wang, Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Chris Metcalf, Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan,
	Tony Luck, Ralf Baechle, iommu, Wuyun, linuxppc-dev,
	David S. Miller
In-Reply-To: <1409911806-10519-5-git-send-email-wangyijing@huawei.com>

On 05/09/14 11:09, Yijing Wang wrote:
> Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq()
> and arch_msi_mask_irq() to fix a bug found when running xen in x86.
> Introduced these two funcntions make MSI code complex. And mask/unmask
> is the irq actions related to interrupt controller, should not use
> weak arch functions to override mask/unmask interfaces. This patch
> reverted commit 0e4ccb150 and export struct irq_chip msi_chip, modify
> msi_chip->irq_mask/irq_unmask() in xen init functions to fix this
> bug for simplicity. Also this is preparation for using struct
> msi_chip instead of weak arch MSI functions in all platforms.

Acked-by: David Vrabel <david.vrabel@citrix.com>

But I wonder if it would be better the Xen subsystem to provide its own
struct irq_chip instead of adjusting the fields in the generic x86 one.

David

^ permalink raw reply

* Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: David Vrabel @ 2014-09-10 12:38 UTC (permalink / raw)
  To: Yijing Wang, David Vrabel, Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Chris Metcalf, Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan,
	Tony Luck, Ralf Baechle, iommu, Wuyun, linuxppc-dev,
	David S. Miller
In-Reply-To: <540E6095.8030409@huawei.com>

On 09/09/14 03:06, Yijing Wang wrote:
> On 2014/9/5 22:29, David Vrabel wrote:
>> On 05/09/14 11:09, Yijing Wang wrote:
>>> Use MSI chip framework instead of arch MSI functions to configure
>>> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
>> [...]
>>> --- a/arch/x86/pci/xen.c
>>> +++ b/arch/x86/pci/xen.c
>> [...]
>>> @@ -418,9 +430,9 @@ int __init pci_xen_init(void)
>>>  #endif
>>>  
>>>  #ifdef CONFIG_PCI_MSI
>>> -	x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
>>> -	x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
>>> -	x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
>>> +	xen_msi_chip.setup_irqs = xen_setup_msi_irqs;
>>> +	xen_msi_chip.teardown_irqs = xen_teardown_msi_irqs;
>>> +	x86_msi_chip = &xen_msi_chip;
>>>  	msi_chip.irq_mask = xen_nop_msi_mask;
>>>  	msi_chip.irq_unmask = xen_nop_msi_mask;
>>
>> Why have these not been changed to set the x86_msi_chip.mask/unmask
>> fields instead?
> 
> Hi David, x86_msi_chip here is struct msi_chip data type, used to configure MSI/MSI-X
> irq. msi_chip above is struct irq_chip data type, represent the MSI irq controller. They are
> not the same object. Their name easily confusing people.

Ok, it all makes sense now.

Acked-by: David Vrabel <david.vrabel@citrix.com>

David

^ permalink raw reply

* Re: [PATCH v2 1/3] init/main.c: Give init_task a canary
From: Aaron Tomlin @ 2014-09-10 13:29 UTC (permalink / raw)
  To: Chuck Ebbert
  Cc: dzickus, jcastillo, riel, x86, akpm, peterz, bmr, prarit, oleg,
	rostedt, linux-kernel, minchan, mingo, aneesh.kumar, akpm, hannes,
	jgh, linuxppc-dev, tglx, pzijlstr
In-Reply-To: <20140910022654.29abc9f3@as>

On Wed, Sep 10, 2014 at 02:26:54AM -0500, Chuck Ebbert wrote:
> On Tue,  9 Sep 2014 10:42:27 +0100
> Aaron Tomlin <atomlin@redhat.com> wrote:
> 
> > +void task_stack_end_magic(struct task_struct *tsk)
> > +{
> > +	unsigned long *stackend;
> > +
> > +	stackend = end_of_stack(tsk);
> > +	*stackend = STACK_END_MAGIC;	/* for overflow detection */
> > +}
> > +
> 
> For clarity this should probably be called set_task_stack_end_magic().

Agreed.

> And has this been tested on parisc and metag, which use STACK_GROWSUP ?
> I can't see how end_of_stack() as it's defined now could work on those archs.

AFAIU, dup_task_struct() has always done this explicitly.
I see no reason why init_task requires special attention.

-- 
Aaron Tomlin

^ permalink raw reply

* [PATCH] sound: aoa: printk replacement
From: Sudip Mukherjee @ 2014-09-10 13:51 UTC (permalink / raw)
  To: Johannes Berg, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linuxppc-dev, Sudip Mukherjee, linux-kernel

as pr_* macros are more preffered over printk, so printk replaced
with corresponding pr_* macros.
this patch will generate warning from checkpatch as it only did printk
replacement and didnot fixed the other warning of :
Alignment should match open parenthesis and 
Possible unnecessary 'out of memory' message

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

The replacement was done by a bash script to avoid copy paste error. The script is as follows :

OLD1="printk(KERN_DEBUG \?"
OLD2="printk(KERN_ERR \?"
OLD3="printk(KERN_INFO \?"
OLD4="printk(KERN_WARNING \?"
OLD5="printk(KERN_ALERT \?"
NEW1="pr_debug("
NEW2="pr_err("
NEW3="pr_info("
NEW4="pr_warn("
NEW5="pr_alert("
find . -type d -mindepth 0 -maxdepth 2 | while read DIR
do
for f in "${DIR}"/*.c
do
sed -i -e "s/$OLD1/$NEW1/g" -e "s/$OLD2/$NEW2/g" -e "s/$OLD3/$NEW3/g" -e "s/$OLD4/$NEW4/g" -e "s/$OLD5/$NEW5/g" "$f"
done
done

Takashi : thanks for the -i option.

for the codecs section another future patch can define proper pr_fmt
and eliminate the use of PFX while printing.

this patch is not build tested and i understand that you can reject the patch without even seeing at it.

 sound/aoa/codecs/onyx.c             | 16 ++++++++--------
 sound/aoa/codecs/tas.c              | 10 +++++-----
 sound/aoa/codecs/toonie.c           |  6 +++---
 sound/aoa/core/alsa.c               | 10 +++++-----
 sound/aoa/core/core.c               |  6 +++---
 sound/aoa/core/gpio-pmf.c           |  6 +++---
 sound/aoa/fabrics/layout.c          | 16 ++++++++--------
 sound/aoa/soundbus/core.c           |  2 +-
 sound/aoa/soundbus/i2sbus/control.c |  4 ++--
 sound/aoa/soundbus/i2sbus/core.c    |  8 ++++----
 sound/aoa/soundbus/i2sbus/pcm.c     | 28 ++++++++++++++--------------
 11 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/sound/aoa/codecs/onyx.c b/sound/aoa/codecs/onyx.c
index 401107b..55aa69f 100644
--- a/sound/aoa/codecs/onyx.c
+++ b/sound/aoa/codecs/onyx.c
@@ -873,7 +873,7 @@ static int onyx_init_codec(struct aoa_codec *codec)
 	int err;
 
 	if (!onyx->codec.gpio || !onyx->codec.gpio->methods) {
-		printk(KERN_ERR PFX "gpios not assigned!!\n");
+		pr_err(PFX "gpios not assigned!!\n");
 		return -EINVAL;
 	}
 
@@ -885,12 +885,12 @@ static int onyx_init_codec(struct aoa_codec *codec)
 	msleep(1);
 
 	if (onyx_register_init(onyx)) {
-		printk(KERN_ERR PFX "failed to initialise onyx registers\n");
+		pr_err(PFX "failed to initialise onyx registers\n");
 		return -ENODEV;
 	}
 
 	if (aoa_snd_device_new(SNDRV_DEV_CODEC, onyx, &ops)) {
-		printk(KERN_ERR PFX "failed to create onyx snd device!\n");
+		pr_err(PFX "failed to create onyx snd device!\n");
 		return -ENODEV;
 	}
 
@@ -925,7 +925,7 @@ static int onyx_init_codec(struct aoa_codec *codec)
 	if (onyx->codec.soundbus_dev->attach_codec(onyx->codec.soundbus_dev,
 						   aoa_get_card(),
 						   ci, onyx)) {
-		printk(KERN_ERR PFX "error creating onyx pcm\n");
+		pr_err(PFX "error creating onyx pcm\n");
 		return -ENODEV;
 	}
 #define ADDCTL(n)							\
@@ -977,7 +977,7 @@ static int onyx_init_codec(struct aoa_codec *codec)
 		}
 	}
 #undef ADDCTL
-	printk(KERN_INFO PFX "attached to onyx codec via i2c\n");
+	pr_info(PFX "attached to onyx codec via i2c\n");
 
 	return 0;
  error:
@@ -991,7 +991,7 @@ static void onyx_exit_codec(struct aoa_codec *codec)
 	struct onyx *onyx = codec_to_onyx(codec);
 
 	if (!onyx->codec.soundbus_dev) {
-		printk(KERN_ERR PFX "onyx_exit_codec called without soundbus_dev!\n");
+		pr_err(PFX "onyx_exit_codec called without soundbus_dev!\n");
 		return;
 	}
 	onyx->codec.soundbus_dev->detach_codec(onyx->codec.soundbus_dev, onyx);
@@ -1016,7 +1016,7 @@ static int onyx_i2c_probe(struct i2c_client *client,
 	/* we try to read from register ONYX_REG_CONTROL
 	 * to check if the codec is present */
 	if (onyx_read_register(onyx, ONYX_REG_CONTROL, &dummy) != 0) {
-		printk(KERN_ERR PFX "failed to read control register\n");
+		pr_err(PFX "failed to read control register\n");
 		goto fail;
 	}
 
@@ -1029,7 +1029,7 @@ static int onyx_i2c_probe(struct i2c_client *client,
 	if (aoa_codec_register(&onyx->codec)) {
 		goto fail;
 	}
-	printk(KERN_DEBUG PFX "created and attached onyx instance\n");
+	pr_debug(PFX "created and attached onyx instance\n");
 	return 0;
  fail:
 	kfree(onyx);
diff --git a/sound/aoa/codecs/tas.c b/sound/aoa/codecs/tas.c
index cf3c630..abf6e8a 100644
--- a/sound/aoa/codecs/tas.c
+++ b/sound/aoa/codecs/tas.c
@@ -806,13 +806,13 @@ static int tas_init_codec(struct aoa_codec *codec)
 	int err;
 
 	if (!tas->codec.gpio || !tas->codec.gpio->methods) {
-		printk(KERN_ERR PFX "gpios not assigned!!\n");
+		pr_err(PFX "gpios not assigned!!\n");
 		return -EINVAL;
 	}
 
 	mutex_lock(&tas->mtx);
 	if (tas_reset_init(tas)) {
-		printk(KERN_ERR PFX "tas failed to initialise\n");
+		pr_err(PFX "tas failed to initialise\n");
 		mutex_unlock(&tas->mtx);
 		return -ENXIO;
 	}
@@ -822,12 +822,12 @@ static int tas_init_codec(struct aoa_codec *codec)
 	if (tas->codec.soundbus_dev->attach_codec(tas->codec.soundbus_dev,
 						   aoa_get_card(),
 						   &tas_codec_info, tas)) {
-		printk(KERN_ERR PFX "error attaching tas to soundbus\n");
+		pr_err(PFX "error attaching tas to soundbus\n");
 		return -ENODEV;
 	}
 
 	if (aoa_snd_device_new(SNDRV_DEV_CODEC, tas, &ops)) {
-		printk(KERN_ERR PFX "failed to create tas snd device!\n");
+		pr_err(PFX "failed to create tas snd device!\n");
 		return -ENODEV;
 	}
 	err = aoa_snd_ctl_add(snd_ctl_new1(&volume_control, tas));
@@ -910,7 +910,7 @@ static int tas_i2c_probe(struct i2c_client *client,
 	if (aoa_codec_register(&tas->codec)) {
 		goto fail;
 	}
-	printk(KERN_DEBUG
+	pr_debug(
 	       "snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n",
 	       (unsigned int)client->addr, node->full_name);
 	return 0;
diff --git a/sound/aoa/codecs/toonie.c b/sound/aoa/codecs/toonie.c
index 7e8c341..f382d7f 100644
--- a/sound/aoa/codecs/toonie.c
+++ b/sound/aoa/codecs/toonie.c
@@ -93,14 +93,14 @@ static int toonie_init_codec(struct aoa_codec *codec)
 		return -ENOTCONN;
 
 	if (aoa_snd_device_new(SNDRV_DEV_CODEC, toonie, &ops)) {
-		printk(KERN_ERR PFX "failed to create toonie snd device!\n");
+		pr_err(PFX "failed to create toonie snd device!\n");
 		return -ENODEV;
 	}
 
 	if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev,
 						     aoa_get_card(),
 						     &toonie_codec_info, toonie)) {
-		printk(KERN_ERR PFX "error creating toonie pcm\n");
+		pr_err(PFX "error creating toonie pcm\n");
 		snd_device_free(aoa_get_card(), toonie);
 		return -ENODEV;
 	}
@@ -113,7 +113,7 @@ static void toonie_exit_codec(struct aoa_codec *codec)
 	struct toonie *toonie = codec_to_toonie(codec);
 
 	if (!toonie->codec.soundbus_dev) {
-		printk(KERN_ERR PFX "toonie_exit_codec called without soundbus_dev!\n");
+		pr_err(PFX "toonie_exit_codec called without soundbus_dev!\n");
 		return;
 	}
 	toonie->codec.soundbus_dev->detach_codec(toonie->codec.soundbus_dev, toonie);
diff --git a/sound/aoa/core/alsa.c b/sound/aoa/core/alsa.c
index 4a7e4e6..65367c3 100644
--- a/sound/aoa/core/alsa.c
+++ b/sound/aoa/core/alsa.c
@@ -35,7 +35,7 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
 	strlcpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
 	err = snd_card_register(aoa_card->alsa_card);
 	if (err < 0) {
-		printk(KERN_ERR "snd-aoa: couldn't register alsa card\n");
+		pr_err("snd-aoa: couldn't register alsa card\n");
 		snd_card_free(aoa_card->alsa_card);
 		aoa_card = NULL;
 		return err;
@@ -69,14 +69,14 @@ int aoa_snd_device_new(enum snd_device_type type,
 
 	err = snd_device_new(card, type, device_data, ops);
 	if (err) {
-		printk(KERN_ERR "snd-aoa: failed to create snd device (%d)\n", err);
+		pr_err("snd-aoa: failed to create snd device (%d)\n", err);
 		return err;
 	}
 	err = snd_device_register(card, device_data);
 	if (err) {
-		printk(KERN_ERR "snd-aoa: failed to register "
+		pr_err("snd-aoa: failed to register "
 				"snd device (%d)\n", err);
-		printk(KERN_ERR "snd-aoa: have you forgotten the "
+		pr_err("snd-aoa: have you forgotten the "
 				"dev_register callback?\n");
 		snd_device_free(card, device_data);
 	}
@@ -92,7 +92,7 @@ int aoa_snd_ctl_add(struct snd_kcontrol* control)
 
 	err = snd_ctl_add(aoa_card->alsa_card, control);
 	if (err)
-		printk(KERN_ERR "snd-aoa: failed to add alsa control (%d)\n",
+		pr_err("snd-aoa: failed to add alsa control (%d)\n",
 		       err);
 	return err;
 }
diff --git a/sound/aoa/core/core.c b/sound/aoa/core/core.c
index 10bec6c..263ea80 100644
--- a/sound/aoa/core/core.c
+++ b/sound/aoa/core/core.c
@@ -33,7 +33,7 @@ static int attach_codec_to_fabric(struct aoa_codec *c)
 		err = fabric->found_codec(c);
 	if (err) {
 		module_put(c->owner);
-		printk(KERN_ERR "snd-aoa: fabric didn't like codec %s\n",
+		pr_err("snd-aoa: fabric didn't like codec %s\n",
 				c->name);
 		return err;
 	}
@@ -43,7 +43,7 @@ static int attach_codec_to_fabric(struct aoa_codec *c)
 	if (c->init)
 		err = c->init(c);
 	if (err) {
-		printk(KERN_ERR "snd-aoa: codec %s didn't init\n", c->name);
+		pr_err("snd-aoa: codec %s didn't init\n", c->name);
 		c->fabric = NULL;
 		if (fabric->remove_codec)
 			fabric->remove_codec(c);
@@ -134,7 +134,7 @@ EXPORT_SYMBOL_GPL(aoa_fabric_unregister);
 void aoa_fabric_unlink_codec(struct aoa_codec *codec)
 {
 	if (!codec->fabric) {
-		printk(KERN_ERR "snd-aoa: fabric unassigned "
+		pr_err("snd-aoa: fabric unassigned "
 				"in aoa_fabric_unlink_codec\n");
 		dump_stack();
 		return;
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index c8d8a1a..4a34f7b6 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -20,7 +20,7 @@ static void pmf_gpio_set_##name(struct gpio_runtime *rt, int on)\
 	if (unlikely(!rt)) return;				\
 	rc = pmf_call_function(rt->node, #name "-mute", &args);	\
 	if (rc && rc != -ENODEV)				\
-		printk(KERN_WARNING "pmf_gpio_set_" #name	\
+		pr_warn("pmf_gpio_set_" #name	\
 		" failed, rc: %d\n", rc);			\
 	rt->implementation_private &= ~(1<<bit);		\
 	rt->implementation_private |= (!!on << bit);		\
@@ -43,7 +43,7 @@ static void pmf_gpio_set_hw_reset(struct gpio_runtime *rt, int on)
 	if (unlikely(!rt)) return;
 	rc = pmf_call_function(rt->node, "hw-reset", &args);
 	if (rc)
-		printk(KERN_WARNING "pmf_gpio_set_hw_reset"
+		pr_warn("pmf_gpio_set_hw_reset"
 		       " failed, rc: %d\n", rc);
 }
 
@@ -190,7 +190,7 @@ static int pmf_set_notify(struct gpio_runtime *rt,
 					      name,
 					      irq_client);
 		if (err) {
-			printk(KERN_ERR "snd-aoa: gpio layer failed to"
+			pr_err("snd-aoa: gpio layer failed to"
 					" register %s irq (%d)\n", name, err);
 			kfree(irq_client);
 			goto out_unlock;
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 9dc5806..c9d1956 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -773,18 +773,18 @@ static int check_codec(struct aoa_codec *codec,
 			 "platform-%s-codec-ref", codec->name);
 		ref = of_get_property(ldev->sound, propname, NULL);
 		if (!ref) {
-			printk(KERN_INFO "snd-aoa-fabric-layout: "
+			pr_info("snd-aoa-fabric-layout: "
 				"required property %s not present\n", propname);
 			return -ENODEV;
 		}
 		if (*ref != codec->node->phandle) {
-			printk(KERN_INFO "snd-aoa-fabric-layout: "
+			pr_info("snd-aoa-fabric-layout: "
 				"%s doesn't match!\n", propname);
 			return -ENODEV;
 		}
 	} else {
 		if (layouts_list_items != 1) {
-			printk(KERN_INFO "snd-aoa-fabric-layout: "
+			pr_info("snd-aoa-fabric-layout: "
 				"more than one soundbus, but no references.\n");
 			return -ENODEV;
 		}
@@ -796,7 +796,7 @@ static int check_codec(struct aoa_codec *codec,
 	if (!cc)
 		return -EINVAL;
 
-	printk(KERN_INFO "snd-aoa-fabric-layout: can use this codec\n");
+	pr_info("snd-aoa-fabric-layout: can use this codec\n");
 
 	codec->connected = 0;
 	codec->fabric_data = cc;
@@ -1017,7 +1017,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
 	}
 
 	if (!layout) {
-		printk(KERN_ERR "snd-aoa-fabric-layout: unknown layout\n");
+		pr_err("snd-aoa-fabric-layout: unknown layout\n");
 		goto outnodev;
 	}
 
@@ -1036,12 +1036,12 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
 	case 51: /* PowerBook5,4 */
 	case 58: /* Mac Mini */
 		ldev->gpio.methods = ftr_gpio_methods;
-		printk(KERN_DEBUG
+		pr_debug(
 		       "snd-aoa-fabric-layout: Using direct GPIOs\n");
 		break;
 	default:
 		ldev->gpio.methods = pmf_gpio_methods;
-		printk(KERN_DEBUG
+		pr_debug(
 		       "snd-aoa-fabric-layout: Using PMF GPIOs\n");
 	}
 	ldev->selfptr_headphone.ptr = ldev;
@@ -1064,7 +1064,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
 
 	err = aoa_fabric_register(&layout_fabric, &sdev->ofdev.dev);
 	if (err && err != -EALREADY) {
-		printk(KERN_INFO "snd-aoa-fabric-layout: can't use,"
+		pr_info("snd-aoa-fabric-layout: can't use,"
 				 " another fabric is active!\n");
 		goto outlistdel;
 	}
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index 7487eb7..c1438eb 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -172,7 +172,7 @@ int soundbus_add_one(struct soundbus_dev *dev)
 	    !dev->ofdev.dev.of_node ||
 	    dev->pcmname ||
 	    dev->pcmid != -1) {
-		printk(KERN_ERR "soundbus: adding device failed sanity check!\n");
+		pr_err("soundbus: adding device failed sanity check!\n");
 		return -EINVAL;
 	}
 
diff --git a/sound/aoa/soundbus/i2sbus/control.c b/sound/aoa/soundbus/i2sbus/control.c
index 4dc9b49..2672d1c 100644
--- a/sound/aoa/soundbus/i2sbus/control.c
+++ b/sound/aoa/soundbus/i2sbus/control.c
@@ -124,7 +124,7 @@ int i2sbus_control_cell(struct i2sbus_control *c,
 			return pmf_call_one(i2sdev->cell_enable, &args);
 		break;
 	default:
-		printk(KERN_ERR "i2sbus: INVALID CELL ENABLE VALUE\n");
+		pr_err("i2sbus: INVALID CELL ENABLE VALUE\n");
 		return -ENODEV;
 	}
 
@@ -167,7 +167,7 @@ int i2sbus_control_clock(struct i2sbus_control *c,
 			return pmf_call_one(i2sdev->clock_enable, &args);
 		break;
 	default:
-		printk(KERN_ERR "i2sbus: INVALID CLOCK ENABLE VALUE\n");
+		pr_err("i2sbus: INVALID CLOCK ENABLE VALUE\n");
 		return -ENODEV;
 	}
 
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index a80d5ea..d7bb0de 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -264,7 +264,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
 					   resource_size(&dev->resources[i]),
 					   dev->rnames[i]);
 		if (!dev->allocated_resource[i]) {
-			printk(KERN_ERR "i2sbus: failed to claim resource %d!\n", i);
+			pr_err("i2sbus: failed to claim resource %d!\n", i);
 			goto err;
 		}
 	}
@@ -298,12 +298,12 @@ static int i2sbus_add_dev(struct macio_dev *macio,
 		goto err;
 
 	if (i2sbus_control_add_dev(dev->control, dev)) {
-		printk(KERN_ERR "i2sbus: control layer didn't like bus\n");
+		pr_err("i2sbus: control layer didn't like bus\n");
 		goto err;
 	}
 
 	if (soundbus_add_one(&dev->sound)) {
-		printk(KERN_DEBUG "i2sbus: device registration error!\n");
+		pr_debug("i2sbus: device registration error!\n");
 		goto err;
 	}
 
@@ -340,7 +340,7 @@ static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
 	if (err)
 		return err;
 	if (!control) {
-		printk(KERN_ERR "i2sbus_control_init API breakage\n");
+		pr_err("i2sbus_control_init API breakage\n");
 		return -ENODEV;
 	}
 
diff --git a/sound/aoa/soundbus/i2sbus/pcm.c b/sound/aoa/soundbus/i2sbus/pcm.c
index 7b74a4b..f9e272c 100644
--- a/sound/aoa/soundbus/i2sbus/pcm.c
+++ b/sound/aoa/soundbus/i2sbus/pcm.c
@@ -268,7 +268,7 @@ static void i2sbus_wait_for_stop(struct i2sbus_dev *i2sdev,
 		pi->stop_completion = NULL;
 		if (timeout == 0) {
 			/* timeout expired, stop dbdma forcefully */
-			printk(KERN_ERR "i2sbus_wait_for_stop: timed out\n");
+			pr_err("i2sbus_wait_for_stop: timed out\n");
 			/* make sure RUN, PAUSE and S0 bits are cleared */
 			out_le32(&pi->dbdma->control, (RUN | PAUSE | 1) << 16);
 			pi->dbdma_ring.stopping = 0;
@@ -681,7 +681,7 @@ static inline void handle_interrupt(struct i2sbus_dev *i2sdev, int in)
 			if (!(status & ACTIVE) && (!in || (status & 0x80)))
 				break;
 			if (--timeout <= 0) {
-				printk(KERN_ERR "i2sbus: timed out "
+				pr_err("i2sbus: timed out "
 				       "waiting for DMA to stop!\n");
 				break;
 			}
@@ -868,7 +868,7 @@ static void i2sbus_private_free(struct snd_pcm *pcm)
 	i2sdev->out.created = 0;
 	i2sdev->in.created = 0;
 	list_for_each_entry_safe(p, tmp, &i2sdev->sound.codec_list, list) {
-		printk(KERN_ERR "i2sbus: a codec didn't unregister!\n");
+		pr_err("i2sbus: a codec didn't unregister!\n");
 		list_del(&p->list);
 		module_put(p->codec->owner);
 		kfree(p);
@@ -887,7 +887,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 	struct codec_info_item *cii;
 
 	if (!dev->pcmname || dev->pcmid == -1) {
-		printk(KERN_ERR "i2sbus: pcm name and id must be set!\n");
+		pr_err("i2sbus: pcm name and id must be set!\n");
 		return -EINVAL;
 	}
 
@@ -910,12 +910,12 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 	 * sysclock/busclock stuff above to depend on which is usable */
 	list_for_each_entry(cii, &dev->codec_list, list) {
 		if (cii->codec->sysclock_factor != ci->sysclock_factor) {
-			printk(KERN_DEBUG
+			pr_debug(
 			       "cannot yet handle multiple different sysclocks!\n");
 			return -EINVAL;
 		}
 		if (cii->codec->bus_factor != ci->bus_factor) {
-			printk(KERN_DEBUG
+			pr_debug(
 			       "cannot yet handle multiple different bus clocks!\n");
 			return -EINVAL;
 		}
@@ -932,7 +932,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 
 	cii = kzalloc(sizeof(struct codec_info_item), GFP_KERNEL);
 	if (!cii) {
-		printk(KERN_DEBUG "i2sbus: failed to allocate cii\n");
+		pr_debug("i2sbus: failed to allocate cii\n");
 		return -ENOMEM;
 	}
 
@@ -942,20 +942,20 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 	cii->codec_data = data;
 
 	if (!cii->sdev) {
-		printk(KERN_DEBUG
+		pr_debug(
 		       "i2sbus: failed to get soundbus dev reference\n");
 		err = -ENODEV;
 		goto out_free_cii;
 	}
 
 	if (!try_module_get(THIS_MODULE)) {
-		printk(KERN_DEBUG "i2sbus: failed to get module reference!\n");
+		pr_debug("i2sbus: failed to get module reference!\n");
 		err = -EBUSY;
 		goto out_put_sdev;
 	}
 
 	if (!try_module_get(ci->owner)) {
-		printk(KERN_DEBUG
+		pr_debug(
 		       "i2sbus: failed to get module reference to codec owner!\n");
 		err = -EBUSY;
 		goto out_put_this_module;
@@ -965,7 +965,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 		err = snd_pcm_new(card, dev->pcmname, dev->pcmid, 0, 0,
 				  &dev->pcm);
 		if (err) {
-			printk(KERN_DEBUG "i2sbus: failed to create pcm\n");
+			pr_debug("i2sbus: failed to create pcm\n");
 			goto out_put_ci_module;
 		}
 		dev->pcm->dev = &dev->ofdev.dev;
@@ -978,7 +978,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 	if (!i2sdev->out.created && out) {
 		if (dev->pcm->card != card) {
 			/* eh? */
-			printk(KERN_ERR
+			pr_err(
 			       "Can't attach same bus to different cards!\n");
 			err = -EINVAL;
 			goto out_put_ci_module;
@@ -993,7 +993,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 
 	if (!i2sdev->in.created && in) {
 		if (dev->pcm->card != card) {
-			printk(KERN_ERR
+			pr_err(
 			       "Can't attach same bus to different cards!\n");
 			err = -EINVAL;
 			goto out_put_ci_module;
@@ -1014,7 +1014,7 @@ i2sbus_attach_codec(struct soundbus_dev *dev, struct snd_card *card,
 	 */
 	err = snd_device_register(card, dev->pcm);
 	if (err) {
-		printk(KERN_ERR "i2sbus: error registering new pcm\n");
+		pr_err("i2sbus: error registering new pcm\n");
 		goto out_put_ci_module;
 	}
 	/* no errors any more, so let's add this to our list */
-- 
1.8.1.2

^ permalink raw reply related

* Re: [PATCH] sound: aoa: printk replacement
From: Johannes Berg @ 2014-09-10 13:57 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Takashi Iwai, alsa-devel, linuxppc-dev, linux-kernel,
	Jaroslav Kysela
In-Reply-To: <1410357107-29933-1-git-send-email-sudipm.mukherjee@gmail.com>

On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> as pr_* macros are more preffered over printk, so printk replaced
> with corresponding pr_* macros.

Are you simply running checkpatch on every file and decided to do
something about it? :)

I'll let Takashi decide whether to take this or not as I no longer care
about this code, but IMHO this changes is completely pointless since you
don't also clean up the code to have a common prefix with #define pr_fmt
and then clean up the callers etc.

There's a reason pr_* is preferred, but random code changes like this
aren't it, I think.

johannes

^ permalink raw reply

* Re: [PATCH] sound: aoa: printk replacement
From: Sudip Mukherjee @ 2014-09-10 14:32 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Takashi Iwai, alsa-devel, linuxppc-dev, linux-kernel,
	Jaroslav Kysela
In-Reply-To: <1410357424.2761.5.camel@jlt4.sipsolutions.net>

On Wed, Sep 10, 2014 at 03:57:04PM +0200, Johannes Berg wrote:
> On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> > as pr_* macros are more preffered over printk, so printk replaced
> > with corresponding pr_* macros.
> 
> Are you simply running checkpatch on every file and decided to do
> something about it? :)
> 
i am running checkpatch on the patch generated. if i am doing checkpatch
cleanups then that i do it only in the staging.
only exception : printk .. :)

> I'll let Takashi decide whether to take this or not as I no longer care
> about this code, but IMHO this changes is completely pointless since you
> don't also clean up the code to have a common prefix with #define pr_fmt
> and then clean up the callers etc.
> 
i mentioned in the comment that in a future patch we can have pr_fmt,
it was not done in this patch since the changes for this patch is
generated by a script and not manually.
if Takashi accepts this then the next patch will have pr_fmt.

thanks
sudip

> There's a reason pr_* is preferred, but random code changes like this
> aren't it, I think.
> 
> johannes
> 

^ permalink raw reply

* Re: [PATCH] sound: aoa: printk replacement
From: Takashi Iwai @ 2014-09-10 14:43 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: linux-kernel, Johannes Berg, linuxppc-dev, alsa-devel,
	Jaroslav Kysela
In-Reply-To: <20140910143204.GA30695@sudip-PC>

At Wed, 10 Sep 2014 20:02:04 +0530,
Sudip Mukherjee wrote:
> 
> On Wed, Sep 10, 2014 at 03:57:04PM +0200, Johannes Berg wrote:
> > On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> > > as pr_* macros are more preffered over printk, so printk replaced
> > > with corresponding pr_* macros.
> > 
> > Are you simply running checkpatch on every file and decided to do
> > something about it? :)
> > 
> i am running checkpatch on the patch generated. if i am doing checkpatch
> cleanups then that i do it only in the staging.
> only exception : printk .. :)
> 
> > I'll let Takashi decide whether to take this or not as I no longer care
> > about this code, but IMHO this changes is completely pointless since you
> > don't also clean up the code to have a common prefix with #define pr_fmt
> > and then clean up the callers etc.
> > 
> i mentioned in the comment that in a future patch we can have pr_fmt,
> it was not done in this patch since the changes for this patch is
> generated by a script and not manually.
> if Takashi accepts this then the next patch will have pr_fmt.

If you're going to work on it, please give a patch series and let me
merge once.  There is no good merit to merge a half-baked piece by
piece.

Regarding the changes you've made: so far, I've merged two such
patches just because it's a good exercise for newbies.  You've played
it and experienced it enough.  So it's time to go up to a higher
stage, more "real" fixes.

For example, if you are still interested in printk stuff, try to
change the calls to dev_err() and co.  Of course, this needs more
understanding of the code you'll handle, which object is passed for
which messages.


thanks,

Takashi

^ permalink raw reply

* Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Konrad Rzeszutek Wilk @ 2014-09-10 14:59 UTC (permalink / raw)
  To: David Vrabel
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, Yijing Wang,
	sparclinux, linux-arch, linux-s390, Russell King, Joerg Roedel,
	x86, Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Chris Metcalf, Bjorn Helgaas, Thomas Gleixner, linux-arm-kernel,
	Bharat.Bhushan, Tony Luck, Ralf Baechle, iommu, Wuyun,
	linuxppc-dev, David S. Miller
In-Reply-To: <54104641.7020007@citrix.com>

On Wed, Sep 10, 2014 at 01:38:25PM +0100, David Vrabel wrote:
> On 09/09/14 03:06, Yijing Wang wrote:
> > On 2014/9/5 22:29, David Vrabel wrote:
> >> On 05/09/14 11:09, Yijing Wang wrote:
> >>> Use MSI chip framework instead of arch MSI functions to configure
> >>> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
> >> [...]
> >>> --- a/arch/x86/pci/xen.c
> >>> +++ b/arch/x86/pci/xen.c
> >> [...]
> >>> @@ -418,9 +430,9 @@ int __init pci_xen_init(void)
> >>>  #endif
> >>>  
> >>>  #ifdef CONFIG_PCI_MSI
> >>> -	x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
> >>> -	x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
> >>> -	x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
> >>> +	xen_msi_chip.setup_irqs = xen_setup_msi_irqs;
> >>> +	xen_msi_chip.teardown_irqs = xen_teardown_msi_irqs;
> >>> +	x86_msi_chip = &xen_msi_chip;
> >>>  	msi_chip.irq_mask = xen_nop_msi_mask;
> >>>  	msi_chip.irq_unmask = xen_nop_msi_mask;
> >>
> >> Why have these not been changed to set the x86_msi_chip.mask/unmask
> >> fields instead?
> > 
> > Hi David, x86_msi_chip here is struct msi_chip data type, used to configure MSI/MSI-X
> > irq. msi_chip above is struct irq_chip data type, represent the MSI irq controller. They are
> > not the same object. Their name easily confusing people.
> 
> Ok, it all makes sense now.
> 
> Acked-by: David Vrabel <david.vrabel@citrix.com>

You can also add 'Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>'

on the whole series - I ran it through on Xen and on baremetal with a mix of 32/64 builds.

Oh, and also Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> the Xen parts.

> 
> David
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply

* Re: [PATCH] sound: aoa: printk replacement
From: Sudip Mukherjee @ 2014-09-10 15:07 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linux-kernel, Johannes Berg, linuxppc-dev, alsa-devel,
	Jaroslav Kysela
In-Reply-To: <s5hk35b4juw.wl-tiwai@suse.de>

On Wed, Sep 10, 2014 at 04:43:03PM +0200, Takashi Iwai wrote:
> At Wed, 10 Sep 2014 20:02:04 +0530,
> Sudip Mukherjee wrote:
> > 
> > On Wed, Sep 10, 2014 at 03:57:04PM +0200, Johannes Berg wrote:
> > > On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> > > > as pr_* macros are more preffered over printk, so printk replaced
> > > > with corresponding pr_* macros.
> > > 
> > > Are you simply running checkpatch on every file and decided to do
> > > something about it? :)
> > > 
> > i am running checkpatch on the patch generated. if i am doing checkpatch
> > cleanups then that i do it only in the staging.
> > only exception : printk .. :)
> > 
> > > I'll let Takashi decide whether to take this or not as I no longer care
> > > about this code, but IMHO this changes is completely pointless since you
> > > don't also clean up the code to have a common prefix with #define pr_fmt
> > > and then clean up the callers etc.
> > > 
> > i mentioned in the comment that in a future patch we can have pr_fmt,
> > it was not done in this patch since the changes for this patch is
> > generated by a script and not manually.
> > if Takashi accepts this then the next patch will have pr_fmt.
> 
> If you're going to work on it, please give a patch series and let me
> merge once.  There is no good merit to merge a half-baked piece by
> piece.
> 
> Regarding the changes you've made: so far, I've merged two such
> patches just because it's a good exercise for newbies.  You've played
> it and experienced it enough.  So it's time to go up to a higher
> stage, more "real" fixes.
can you please give me some hint of fixes that can be attempted by
newbies. except printk :)
so far i have started with fixing the sparse warnings in staging.

> 
> For example, if you are still interested in printk stuff, try to
> change the calls to dev_err() and co.  Of course, this needs more
> understanding of the code you'll handle, which object is passed for
> which messages.
> 
sure , i will send you this one.

thanks
sudip


> 
> thanks,
> 
> Takashi

^ permalink raw reply

* Re: [PATCH] sound: aoa: printk replacement
From: Takashi Iwai @ 2014-09-10 15:38 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: linux-kernel, Johannes Berg, linuxppc-dev, alsa-devel,
	Jaroslav Kysela
In-Reply-To: <20140910150749.GA30775@sudip-PC>

At Wed, 10 Sep 2014 20:37:50 +0530,
Sudip Mukherjee wrote:
> 
> On Wed, Sep 10, 2014 at 04:43:03PM +0200, Takashi Iwai wrote:
> > At Wed, 10 Sep 2014 20:02:04 +0530,
> > Sudip Mukherjee wrote:
> > > 
> > > On Wed, Sep 10, 2014 at 03:57:04PM +0200, Johannes Berg wrote:
> > > > On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> > > > > as pr_* macros are more preffered over printk, so printk replaced
> > > > > with corresponding pr_* macros.
> > > > 
> > > > Are you simply running checkpatch on every file and decided to do
> > > > something about it? :)
> > > > 
> > > i am running checkpatch on the patch generated. if i am doing checkpatch
> > > cleanups then that i do it only in the staging.
> > > only exception : printk .. :)
> > > 
> > > > I'll let Takashi decide whether to take this or not as I no longer care
> > > > about this code, but IMHO this changes is completely pointless since you
> > > > don't also clean up the code to have a common prefix with #define pr_fmt
> > > > and then clean up the callers etc.
> > > > 
> > > i mentioned in the comment that in a future patch we can have pr_fmt,
> > > it was not done in this patch since the changes for this patch is
> > > generated by a script and not manually.
> > > if Takashi accepts this then the next patch will have pr_fmt.
> > 
> > If you're going to work on it, please give a patch series and let me
> > merge once.  There is no good merit to merge a half-baked piece by
> > piece.
> > 
> > Regarding the changes you've made: so far, I've merged two such
> > patches just because it's a good exercise for newbies.  You've played
> > it and experienced it enough.  So it's time to go up to a higher
> > stage, more "real" fixes.
> can you please give me some hint of fixes that can be attempted by
> newbies. except printk :)

You should study the code at first.  There is nothing you can "fix"
without understanding the code.  So, pick up a driver you're
interested in.  You may or may not find bugs there.  Or, if you see /
know any bug, try to join debugging.


Takashi

^ permalink raw reply

* Re: [PATCH] sound: aoa: printk replacement
From: Sudip Mukherjee @ 2014-09-10 17:14 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linux-kernel, Johannes Berg, linuxppc-dev, alsa-devel,
	Jaroslav Kysela
In-Reply-To: <s5hd2b3zdst.wl-tiwai@suse.de>

On Wed, Sep 10, 2014 at 05:38:10PM +0200, Takashi Iwai wrote:
> At Wed, 10 Sep 2014 20:37:50 +0530,
> Sudip Mukherjee wrote:
> > 
> > On Wed, Sep 10, 2014 at 04:43:03PM +0200, Takashi Iwai wrote:
> > > At Wed, 10 Sep 2014 20:02:04 +0530,
> > > Sudip Mukherjee wrote:
> > > > 
> > > > On Wed, Sep 10, 2014 at 03:57:04PM +0200, Johannes Berg wrote:
> > > > > On Wed, 2014-09-10 at 19:21 +0530, Sudip Mukherjee wrote:
> > > > > > as pr_* macros are more preffered over printk, so printk replaced
> > > > > > with corresponding pr_* macros.
> > > > > 
> > > > > Are you simply running checkpatch on every file and decided to do
> > > > > something about it? :)
> > > > > 
> > > > i am running checkpatch on the patch generated. if i am doing checkpatch
> > > > cleanups then that i do it only in the staging.
> > > > only exception : printk .. :)
> > > > 
> > > > > I'll let Takashi decide whether to take this or not as I no longer care
> > > > > about this code, but IMHO this changes is completely pointless since you
> > > > > don't also clean up the code to have a common prefix with #define pr_fmt
> > > > > and then clean up the callers etc.
> > > > > 
> > > > i mentioned in the comment that in a future patch we can have pr_fmt,
> > > > it was not done in this patch since the changes for this patch is
> > > > generated by a script and not manually.
> > > > if Takashi accepts this then the next patch will have pr_fmt.
> > > 
> > > If you're going to work on it, please give a patch series and let me
> > > merge once.  There is no good merit to merge a half-baked piece by
> > > piece.
> > > 
> > > Regarding the changes you've made: so far, I've merged two such
> > > patches just because it's a good exercise for newbies.  You've played
> > > it and experienced it enough.  So it's time to go up to a higher
> > > stage, more "real" fixes.
> > can you please give me some hint of fixes that can be attempted by
> > newbies. except printk :)
> 
> You should study the code at first.  There is nothing you can "fix"
> without understanding the code.  So, pick up a driver you're
> interested in.  You may or may not find bugs there.  Or, if you see /
> know any bug, try to join debugging.
> 
> 
> Takashi

one of my patch has alredy changed printk to pr_* in ctxfi. but that can be improved
to dev_*. since this has to be done manully and not through script , so should i send the
patch for one file at a time or for all of them together in a single patch?

thanks
sudip

^ permalink raw reply

* Re: [PATCH V1] ASoC: fsl_ssi: refine ipg clock usage in this module
From: Nicolin Chen @ 2014-09-10 17:42 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, lgirdwood, tiwai, Li.Xiubo, timur, perex, broonie,
	mpa, linuxppc-dev, linux-kernel
In-Reply-To: <20140910081251.GA14662@audiosh1>

On Wed, Sep 10, 2014 at 04:12:53PM +0800, Shengjiu Wang wrote:
> > Then we can get a patch like:
> > open() {
> > +	clk_prepare_enable();
> > 	....
> > }
> > 
> > close() {
> > 	....
> > +	clk_disable_unprepare()
> > }

> what is the open() and close()? do you mean the fsl_ssi_startup()
> and fsl_ssi_shutdown()?

Yea.

> > probe() {
> > 	clk_get();
> > 	clk_prepare_enable();
> > 	....
> > 	if (xxx)
> > -		goto err_xx;
> > +		return ret;
> > 	....
> > +	clk_disable_unprepare();
> > 	return 0;
> > -err_xx:
> > -	clk_disable_unprepare()
> > }

> If this probe() is fsl_ssi_imx_probe(), I think no need to add
> clk_prepare_enable() or clk_disable_unprepare(), seems there is no 
> registers accessing in this probe.

This is trying to be safe, especially for such a driver being used
by multiple platforms. You can omit this as long as the patch can
pass the test on old imx, PowerPC, and AC97 platforms.

>

And another risk just came to my mind is that there would be a
possibility that a machine driver would call set_dai_fmt() early,
after SSI's probe() and before SSI's startup(), if the machine
driver contains dai_fmt assignment in its probe(). Then, without
regmap_mmio_clk(), it'll be tough for us over here because we may
also need to add clock enable/disable for set_dai_fmt/set_sysclk(),
even if there might be still tiny risk that we missed something.

Then there could be a selfish approach to circumvent it is to use
regmap_mmio_clk() with "ipg" at the beginning and call regmap_mmio()
without "ipg" if getting a failed return value from regmap_mmio_clk,
and meanwhile to keep the clock always enabled for the regmap_mmio()
case just like what the current driver is doing. This may result
those non-ipg-clk platforms can't benefit from this refinement
unless they update their DT bindings -- use "ipg" for core clock
This might be the safest and simplest way for us, I'm not sure
everyone would be comfortable with this idea though.

Best regards,
Nicolin

^ permalink raw reply

* Re: [PATCH v3] topology: add support for node_to_mem_node() to determine the fallback node
From: Andrew Morton @ 2014-09-10 19:06 UTC (permalink / raw)
  To: Nishanth Aravamudan
  Cc: Han Pingtian, Matt Mackall, David Rientjes, Pekka Enberg,
	Linux Memory Management List, Paul Mackerras, Tejun Heo,
	Joonsoo Kim, linuxppc-dev, Christoph Lameter, Wanpeng Li,
	Anton Blanchard
In-Reply-To: <20140910004723.GH22906@linux.vnet.ibm.com>

On Tue, 9 Sep 2014 17:47:23 -0700 Nishanth Aravamudan <nacc@linux.vnet.ibm.com> wrote:

> On 09.09.2014 [17:11:15 -0700], Andrew Morton wrote:
> > On Tue, 9 Sep 2014 12:03:27 -0700 Nishanth Aravamudan <nacc@linux.vnet.ibm.com> wrote:
> > 
> > > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > 
> > > We need to determine the fallback node in slub allocator if the
> > > allocation target node is memoryless node. Without it, the SLUB wrongly
> > > select the node which has no memory and can't use a partial slab,
> > > because of node mismatch. Introduced function, node_to_mem_node(X), will
> > > return a node Y with memory that has the nearest distance. If X is
> > > memoryless node, it will return nearest distance node, but, if X is
> > > normal node, it will return itself.
> > > 
> > > We will use this function in following patch to determine the fallback
> > > node.
> > > 
> > > ...
> > >
> > > --- a/include/linux/topology.h
> > > +++ b/include/linux/topology.h
> > > @@ -119,11 +119,20 @@ static inline int numa_node_id(void)
> > >   * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
> > 
> > This comment could be updated.
> 
> Will do, do you prefer a follow-on patch or one that replaces this one?

Either is OK for me.  I always turn replacement patches into
incrementals so I (and others) can see what changed.

> > >   */
> > >  DECLARE_PER_CPU(int, _numa_mem_);
> > > +extern int _node_numa_mem_[MAX_NUMNODES];
> > >  
> > >  #ifndef set_numa_mem
> > >  static inline void set_numa_mem(int node)
> > >  {
> > >  	this_cpu_write(_numa_mem_, node);
> > > +	_node_numa_mem_[numa_node_id()] = node;
> > > +}
> > > +#endif
> > > +
> > > +#ifndef node_to_mem_node
> > > +static inline int node_to_mem_node(int node)
> > > +{
> > > +	return _node_numa_mem_[node];
> > >  }
> > 
> > A wee bit of documentation wouldn't hurt.

This?

> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -85,6 +85,7 @@ EXPORT_PER_CPU_SYMBOL(numa_node);
> > >   */
> > >  DEFINE_PER_CPU(int, _numa_mem_);		/* Kernel "local memory" node */
> > >  EXPORT_PER_CPU_SYMBOL(_numa_mem_);
> > > +int _node_numa_mem_[MAX_NUMNODES];
> > 
> > How does this get updated as CPUs, memory and nodes are hot-added and
> > removed?
> 
> As CPUs are added, the architecture code in the CPU bringup will update
> the NUMA topology. Memory and node hotplug are still open issues, I
> mentioned the former in the cover letter. I should have mentioned it in
> this commit message as well.

Please define "open issue".  The computer will crash and catch fire?
If not that, then what?

> I do notice that Lee's commit message from 7aac78988551 ("numa:
> introduce numa_mem_id()- effective local memory node id"):
> 
> "Generic initialization of 'numa_mem' occurs in __build_all_zonelists().
> This will initialize the boot cpu at boot time, and all cpus on change
> of numa_zonelist_order, or when node or memory hot-plug requires
> zonelist rebuild.  Archs that support memoryless nodes will need to
> initialize 'numa_mem' for secondary cpus as they're brought on-line."
> 
> And since we update the _node_numa_mem_ value on set_cpu_numa_mem()
> calls, which were already needed for numa_mem_id(), we might be covered.
> Testing these cases (hotplug) is next in my plans.

^ permalink raw reply

* [PATCH] powerpc: make of_device_ids const
From: Uwe Kleine-König @ 2014-09-10 19:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: Grant Likely, devicetree, Rob Herring, linuxppc-dev, kernel

of_device_ids (i.e. compatible strings and the respective data) are not
supposed to change at runtime. All functions working with of_device_ids
provided by <linux/of.h> work with const of_device_ids. This allows to
mark all struct of_device_id const, too.

While touching these line also put the __init annotation at the right
position where necessary.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

I don't know how arch/powerpc is maintained. So please tell me if I
should split this patch further.

I manually checked that all const annotations are OK, and the 0day build
bot didn't find a regression.

Best regards
Uwe

 arch/powerpc/kernel/ibmebus.c                    |  2 +-
 arch/powerpc/kernel/legacy_serial.c              |  2 +-
 arch/powerpc/kernel/of_platform.c                |  2 +-
 arch/powerpc/platforms/40x/ep405.c               |  2 +-
 arch/powerpc/platforms/40x/ppc40x_simple.c       |  2 +-
 arch/powerpc/platforms/40x/virtex.c              |  2 +-
 arch/powerpc/platforms/40x/walnut.c              |  2 +-
 arch/powerpc/platforms/44x/canyonlands.c         |  2 +-
 arch/powerpc/platforms/44x/ebony.c               |  2 +-
 arch/powerpc/platforms/44x/iss4xx.c              |  2 +-
 arch/powerpc/platforms/44x/ppc44x_simple.c       |  2 +-
 arch/powerpc/platforms/44x/ppc476.c              |  2 +-
 arch/powerpc/platforms/44x/sam440ep.c            |  2 +-
 arch/powerpc/platforms/44x/virtex.c              |  2 +-
 arch/powerpc/platforms/44x/warp.c                |  2 +-
 arch/powerpc/platforms/512x/mpc512x_shared.c     |  2 +-
 arch/powerpc/platforms/52xx/lite5200.c           |  4 ++--
 arch/powerpc/platforms/52xx/media5200.c          |  2 +-
 arch/powerpc/platforms/52xx/mpc52xx_common.c     | 12 ++++++------
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c    |  2 +-
 arch/powerpc/platforms/52xx/mpc52xx_pic.c        |  4 ++--
 arch/powerpc/platforms/82xx/ep8248e.c            |  2 +-
 arch/powerpc/platforms/82xx/km82xx.c             |  2 +-
 arch/powerpc/platforms/82xx/mpc8272_ads.c        |  2 +-
 arch/powerpc/platforms/82xx/pq2fads.c            |  2 +-
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c   |  2 +-
 arch/powerpc/platforms/83xx/misc.c               |  2 +-
 arch/powerpc/platforms/83xx/mpc834x_itx.c        |  2 +-
 arch/powerpc/platforms/83xx/suspend.c            |  4 ++--
 arch/powerpc/platforms/85xx/common.c             |  2 +-
 arch/powerpc/platforms/85xx/ppa8548.c            |  2 +-
 arch/powerpc/platforms/85xx/sgy_cts1000.c        |  4 ++--
 arch/powerpc/platforms/86xx/gef_ppc9a.c          |  2 +-
 arch/powerpc/platforms/86xx/gef_sbc310.c         |  2 +-
 arch/powerpc/platforms/86xx/gef_sbc610.c         |  2 +-
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c       |  2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c       |  2 +-
 arch/powerpc/platforms/86xx/sbc8641d.c           |  2 +-
 arch/powerpc/platforms/8xx/adder875.c            |  2 +-
 arch/powerpc/platforms/8xx/ep88xc.c              |  2 +-
 arch/powerpc/platforms/8xx/mpc86xads_setup.c     |  2 +-
 arch/powerpc/platforms/8xx/mpc885ads_setup.c     |  2 +-
 arch/powerpc/platforms/8xx/tqm8xx_setup.c        |  2 +-
 arch/powerpc/platforms/cell/celleb_pci.c         |  2 +-
 arch/powerpc/platforms/cell/celleb_setup.c       |  2 +-
 arch/powerpc/platforms/embedded6xx/gamecube.c    |  2 +-
 arch/powerpc/platforms/embedded6xx/linkstation.c |  2 +-
 arch/powerpc/platforms/embedded6xx/mvme5100.c    |  2 +-
 arch/powerpc/platforms/embedded6xx/storcenter.c  |  2 +-
 arch/powerpc/platforms/embedded6xx/wii.c         |  2 +-
 arch/powerpc/platforms/pasemi/gpio_mdio.c        |  2 +-
 arch/powerpc/platforms/pasemi/setup.c            |  2 +-
 arch/powerpc/sysdev/axonram.c                    |  2 +-
 arch/powerpc/sysdev/fsl_85xx_l2ctlr.c            |  2 +-
 arch/powerpc/sysdev/mv64x60_dev.c                |  2 +-
 arch/powerpc/sysdev/pmi.c                        |  2 +-
 arch/powerpc/sysdev/xilinx_intc.c                |  2 +-
 arch/powerpc/sysdev/xilinx_pci.c                 |  2 +-
 58 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 1114d13ac19f..ac86c53e2542 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -55,7 +55,7 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
 struct bus_type ibmebus_bus_type;
 
 /* These devices will automatically be added to the bus during init */
-static struct of_device_id __initdata ibmebus_matches[] = {
+static const struct of_device_id ibmebus_matches[] __initconst = {
 	{ .compatible = "IBM,lhca" },
 	{ .compatible = "IBM,lhea" },
 	{},
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 936258881c98..7b750c4ed5c7 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -35,7 +35,7 @@ static struct legacy_serial_info {
 	phys_addr_t			taddr;
 } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
 
-static struct of_device_id legacy_serial_parents[] __initdata = {
+static const struct of_device_id legacy_serial_parents[] __initconst = {
 	{.type = "soc",},
 	{.type = "tsi-bridge",},
 	{.type = "opb", },
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index a7b743076720..f87bc1b4bdda 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -97,7 +97,7 @@ static int of_pci_phb_probe(struct platform_device *dev)
 	return 0;
 }
 
-static struct of_device_id of_pci_phb_ids[] = {
+static const struct of_device_id of_pci_phb_ids[] = {
 	{ .type = "pci", },
 	{ .type = "pcix", },
 	{ .type = "pcie", },
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index b0389bbe4f94..ddc12a1926ef 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -49,7 +49,7 @@ static void __iomem *bcsr_regs;
 /* there's more, can't be bothered typing them tho */
 
 
-static __initdata struct of_device_id ep405_of_bus[] = {
+static const struct of_device_id ep405_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb3", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 8f3920e5a046..b0c46375dd95 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -24,7 +24,7 @@
 #include <linux/init.h>
 #include <linux/of_platform.h>
 
-static __initdata struct of_device_id ppc40x_of_bus[] = {
+static const struct of_device_id ppc40x_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb3", },
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index d0fc6866b00c..9aa7ae2f4164 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -17,7 +17,7 @@
 #include <asm/xilinx_pci.h>
 #include <asm/ppc4xx.h>
 
-static struct of_device_id xilinx_of_bus_ids[] __initdata = {
+static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
 	{ .compatible = "xlnx,plb-v46-1.00.a", },
 	{ .compatible = "xlnx,plb-v34-1.01.a", },
 	{ .compatible = "xlnx,plb-v34-1.02.a", },
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index 8b691df72f74..f7ac2d0fcb44 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -28,7 +28,7 @@
 #include <asm/pci-bridge.h>
 #include <asm/ppc4xx.h>
 
-static __initdata struct of_device_id walnut_of_bus[] = {
+static const struct of_device_id walnut_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb3", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
index e300dd4c89bf..22ca5430c9cb 100644
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -33,7 +33,7 @@
 
 #define BCSR_USB_EN	0x11
 
-static __initdata struct of_device_id ppc460ex_of_bus[] = {
+static const struct of_device_id ppc460ex_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 6a4232bbdf88..ae893226392d 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -28,7 +28,7 @@
 #include <asm/pci-bridge.h>
 #include <asm/ppc4xx.h>
 
-static __initdata struct of_device_id ebony_of_bus[] = {
+static const struct of_device_id ebony_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index 4241bc825800..c7c6758b3cfe 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -32,7 +32,7 @@
 #include <asm/mpic.h>
 #include <asm/mmu.h>
 
-static __initdata struct of_device_id iss4xx_of_bus[] = {
+static const struct of_device_id iss4xx_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,plb6", },
 	{ .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 3ffb915446e3..573c3d2689c6 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -24,7 +24,7 @@
 #include <linux/init.h>
 #include <linux/of_platform.h>
 
-static __initdata struct of_device_id ppc44x_of_bus[] = {
+static const struct of_device_id ppc44x_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 33986c1a05da..58db9d083969 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -38,7 +38,7 @@
 #include <linux/pci.h>
 #include <linux/i2c.h>
 
-static struct of_device_id ppc47x_of_bus[] __initdata = {
+static const struct of_device_id ppc47x_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,plb6", },
 	{ .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index 9e09b835758b..3ee4a03c1496 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -29,7 +29,7 @@
 #include <asm/ppc4xx.h>
 #include <linux/i2c.h>
 
-static __initdata struct of_device_id sam440ep_of_bus[] = {
+static const struct of_device_id sam440ep_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/virtex.c b/arch/powerpc/platforms/44x/virtex.c
index cf96ccaa760c..ad272c17c640 100644
--- a/arch/powerpc/platforms/44x/virtex.c
+++ b/arch/powerpc/platforms/44x/virtex.c
@@ -21,7 +21,7 @@
 #include <asm/ppc4xx.h>
 #include "44x.h"
 
-static struct of_device_id xilinx_of_bus_ids[] __initdata = {
+static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "xlnx,plb-v46-1.00.a", },
 	{ .compatible = "xlnx,plb-v46-1.02.a", },
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index 3a104284b338..501333cf42cf 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -28,7 +28,7 @@
 #include <asm/dma.h>
 
 
-static __initdata struct of_device_id warp_of_bus[] = {
+static const struct of_device_id warp_of_bus[] __initconst = {
 	{ .compatible = "ibm,plb4", },
 	{ .compatible = "ibm,opb", },
 	{ .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index adb95f03d4d4..e996e007bc44 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -337,7 +337,7 @@ void __init mpc512x_init_IRQ(void)
 /*
  * Nodes to do bus probe on, soc and localbus
  */
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5121-immr", },
 	{ .compatible = "fsl,mpc5121-localbus", },
 	{ .compatible = "fsl,mpc5121-mbx", },
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 1843bc932011..7492de3cf6d0 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -34,13 +34,13 @@
  */
 
 /* mpc5200 device tree match tables */
-static struct of_device_id mpc5200_cdm_ids[] __initdata = {
+static const struct of_device_id mpc5200_cdm_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-cdm", },
 	{ .compatible = "mpc5200-cdm", },
 	{}
 };
 
-static struct of_device_id mpc5200_gpio_ids[] __initdata = {
+static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-gpio", },
 	{ .compatible = "mpc5200-gpio", },
 	{}
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index 070d315dd6cd..32cae33c4266 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -30,7 +30,7 @@
 #include <asm/machdep.h>
 #include <asm/mpc52xx.h>
 
-static struct of_device_id mpc5200_gpio_ids[] __initdata = {
+static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-gpio", },
 	{ .compatible = "mpc5200-gpio", },
 	{}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index d7e94f49532a..26993826a797 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -23,12 +23,12 @@
 #include <asm/mpc52xx.h>
 
 /* MPC5200 device tree match tables */
-static struct of_device_id mpc52xx_xlb_ids[] __initdata = {
+static const struct of_device_id mpc52xx_xlb_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-xlb", },
 	{ .compatible = "mpc5200-xlb", },
 	{}
 };
-static struct of_device_id mpc52xx_bus_ids[] __initdata = {
+static const struct of_device_id mpc52xx_bus_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-immr", },
 	{ .compatible = "fsl,mpc5200b-immr", },
 	{ .compatible = "simple-bus", },
@@ -108,21 +108,21 @@ void __init mpc52xx_declare_of_platform_devices(void)
 /*
  * match tables used by mpc52xx_map_common_devices()
  */
-static struct of_device_id mpc52xx_gpt_ids[] __initdata = {
+static const struct of_device_id mpc52xx_gpt_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-gpt", },
 	{ .compatible = "mpc5200-gpt", }, /* old */
 	{}
 };
-static struct of_device_id mpc52xx_cdm_ids[] __initdata = {
+static const struct of_device_id mpc52xx_cdm_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-cdm", },
 	{ .compatible = "mpc5200-cdm", }, /* old */
 	{}
 };
-static const struct of_device_id mpc52xx_gpio_simple[] = {
+static const struct of_device_id mpc52xx_gpio_simple[] __initconst = {
 	{ .compatible = "fsl,mpc5200-gpio", },
 	{}
 };
-static const struct of_device_id mpc52xx_gpio_wkup[] = {
+static const struct of_device_id mpc52xx_gpio_wkup[] __initconst = {
 	{ .compatible = "fsl,mpc5200-gpio-wkup", },
 	{}
 };
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index 37f7a89c10f2..f8f0081759fb 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -564,7 +564,7 @@ static int mpc52xx_lpbfifo_remove(struct platform_device *op)
 	return 0;
 }
 
-static struct of_device_id mpc52xx_lpbfifo_match[] = {
+static const struct of_device_id mpc52xx_lpbfifo_match[] = {
 	{ .compatible = "fsl,mpc5200-lpbfifo", },
 	{},
 };
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 2898b737deb7..2944bc84b9d6 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -119,12 +119,12 @@
 
 
 /* MPC5200 device tree match tables */
-static struct of_device_id mpc52xx_pic_ids[] __initdata = {
+static const struct of_device_id mpc52xx_pic_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-pic", },
 	{ .compatible = "mpc5200-pic", },
 	{}
 };
-static struct of_device_id mpc52xx_sdma_ids[] __initdata = {
+static const struct of_device_id mpc52xx_sdma_ids[] __initconst = {
 	{ .compatible = "fsl,mpc5200-bestcomm", },
 	{ .compatible = "mpc5200-bestcomm", },
 	{}
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 79799b29ffe2..3d0c3a01143d 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -298,7 +298,7 @@ static void __init ep8248e_setup_arch(void)
 		ppc_md.progress("ep8248e_setup_arch(), finish", 0);
 }
 
-static  __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "fsl,ep8248e-bcsr", },
 	{},
diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
index 058cc1895c88..89eb12065018 100644
--- a/arch/powerpc/platforms/82xx/km82xx.c
+++ b/arch/powerpc/platforms/82xx/km82xx.c
@@ -180,7 +180,7 @@ static void __init km82xx_setup_arch(void)
 		ppc_md.progress("km82xx_setup_arch(), finish", 0);
 }
 
-static  __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __init_const = {
 	{ .compatible = "simple-bus", },
 	{},
 };
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 6a14cf50f4a2..d24deacf07d0 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -181,7 +181,7 @@ static void __init mpc8272_ads_setup_arch(void)
 		ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0);
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index e5f82ec8df17..3a5164ad10ad 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -168,7 +168,7 @@ static int __init pq2fads_probe(void)
 	return of_flat_dt_is_compatible(root, "fsl,pq2fads");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index e238b6a55b15..31053eec5cd0 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -213,7 +213,7 @@ static const struct i2c_device_id mcu_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mcu_ids);
 
-static struct of_device_id mcu_of_match_table[] = {
+static const struct of_device_id mcu_of_match_table[] = {
 	{ .compatible = "fsl,mcu-mpc8349emitx", },
 	{ },
 };
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
index 125336f750c6..ef9d01a049c1 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -114,7 +114,7 @@ void __init mpc83xx_ipic_and_qe_init_IRQ(void)
 }
 #endif /* CONFIG_QUICC_ENGINE */
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .compatible = "simple-bus" },
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index a494fa57bdf9..80aea8c4b5a3 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -38,7 +38,7 @@
 
 #include "mpc83xx.h"
 
-static struct of_device_id __initdata mpc834x_itx_ids[] = {
+static const struct of_device_id mpc834x_itx_ids[] __initconst = {
 	{ .compatible = "fsl,pq2pro-localbus", },
 	{},
 };
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 4b4c081df94d..eeb80e25214d 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -321,7 +321,7 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
 	.end = mpc83xx_suspend_end,
 };
 
-static struct of_device_id pmc_match[];
+static const struct of_device_id pmc_match[];
 static int pmc_probe(struct platform_device *ofdev)
 {
 	const struct of_device_id *match;
@@ -420,7 +420,7 @@ static struct pmc_type pmc_types[] = {
 	}
 };
 
-static struct of_device_id pmc_match[] = {
+static const struct of_device_id pmc_match[] = {
 	{
 		.compatible = "fsl,mpc8313-pmc",
 		.data = &pmc_types[0],
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index b564b5e23f7c..4a9ad871a168 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -14,7 +14,7 @@
 
 #include "mpc85xx.h"
 
-static struct of_device_id __initdata mpc85xx_common_ids[] = {
+static const struct of_device_id mpc85xx_common_ids[] __initconst = {
 	{ .type = "soc", },
 	{ .compatible = "soc", },
 	{ .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c
index 3daff7c63569..12019f17f297 100644
--- a/arch/powerpc/platforms/85xx/ppa8548.c
+++ b/arch/powerpc/platforms/85xx/ppa8548.c
@@ -59,7 +59,7 @@ static void ppa8548_show_cpuinfo(struct seq_file *m)
 	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .type = "soc", },
 	{ .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index bb75add67084..8162b0412117 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -24,7 +24,7 @@
 
 static struct device_node *halt_node;
 
-static struct of_device_id child_match[] = {
+static const struct of_device_id child_match[] = {
 	{
 		.compatible = "sgy,gpio-halt",
 	},
@@ -147,7 +147,7 @@ static int gpio_halt_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static struct of_device_id gpio_halt_match[] = {
+static const struct of_device_id gpio_halt_match[] = {
 	/* We match on the gpio bus itself and scan the children since they
 	 * wont be matched against us. We know the bus wont match until it
 	 * has been registered too. */
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index c23f3443880a..bf17933b20f3 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -213,7 +213,7 @@ static long __init mpc86xx_time_init(void)
 	return 0;
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "gianfar", },
 	{ .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 8a6ac20686ea..8facf5873866 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -200,7 +200,7 @@ static long __init mpc86xx_time_init(void)
 	return 0;
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "gianfar", },
 	{ .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 06c72636f299..8c9058df5642 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -190,7 +190,7 @@ static long __init mpc86xx_time_init(void)
 	return 0;
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "gianfar", },
 	{ .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index d479d68fbb2b..55413a547ea8 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -85,7 +85,7 @@ static void __init mpc8610_suspend_init(void)
 static inline void mpc8610_suspend_init(void) { }
 #endif /* CONFIG_SUSPEND */
 
-static struct of_device_id __initdata mpc8610_ids[] = {
+static const struct of_device_id mpc8610_ids[] __initconst = {
 	{ .compatible = "fsl,mpc8610-immr", },
 	{ .compatible = "fsl,mpc8610-guts", },
 	{ .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index e8bf3fae5606..07ccb1b0cc7d 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -127,7 +127,7 @@ mpc86xx_time_init(void)
 	return 0;
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "fsl,srio", },
 	{ .compatible = "gianfar", },
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index b47a8fd0f3d3..6810b71d54a7 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -92,7 +92,7 @@ mpc86xx_time_init(void)
 	return 0;
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{ .compatible = "gianfar", },
 	{ .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/8xx/adder875.c b/arch/powerpc/platforms/8xx/adder875.c
index 82363e98f50e..61cae4c1edb8 100644
--- a/arch/powerpc/platforms/8xx/adder875.c
+++ b/arch/powerpc/platforms/8xx/adder875.c
@@ -92,7 +92,7 @@ static int __init adder875_probe(void)
 	return of_flat_dt_is_compatible(root, "analogue-and-micro,adder875");
 }
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .compatible = "simple-bus", },
 	{},
 };
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index e62166681d08..2bedeb7d5f8f 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -147,7 +147,7 @@ static int __init ep88xc_probe(void)
 	return of_flat_dt_is_compatible(root, "fsl,ep88xc");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 63084640c5c5..78180c5e73ff 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -122,7 +122,7 @@ static int __init mpc86xads_probe(void)
 	return of_flat_dt_is_compatible(root, "fsl,mpc866ads");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 5921dcb498fd..4d62bf9dc789 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -197,7 +197,7 @@ static int __init mpc885ads_probe(void)
 	return of_flat_dt_is_compatible(root, "fsl,mpc885ads");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index dda607807def..bee47a2b23e6 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -124,7 +124,7 @@ static int __init tqm8xx_probe(void)
 	return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .name = "soc", },
 	{ .name = "cpm", },
 	{ .name = "localbus", },
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index 173568140a32..2b98a36ef8fb 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -454,7 +454,7 @@ static struct celleb_phb_spec celleb_fake_pci_spec __initdata = {
 	.setup = celleb_setup_fake_pci,
 };
 
-static struct of_device_id celleb_phb_match[] __initdata = {
+static const struct of_device_id celleb_phb_match[] __initconst = {
 	{
 		.name = "pci-pseudo",
 		.data = &celleb_fake_pci_spec,
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index 1d5a4d8ddad9..34e8ce2976aa 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -102,7 +102,7 @@ static void __init celleb_setup_arch_common(void)
 #endif
 }
 
-static struct of_device_id celleb_bus_ids[] __initdata = {
+static const struct of_device_id celleb_bus_ids[] __initconst = {
 	{ .type = "scc", },
 	{ .type = "ioif", },	/* old style */
 	{},
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index a138e14bad2e..bd4ba5d7d568 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -90,7 +90,7 @@ define_machine(gamecube) {
 };
 
 
-static struct of_device_id gamecube_of_bus[] = {
+static const struct of_device_id gamecube_of_bus[] = {
 	{ .compatible = "nintendo,flipper", },
 	{ },
 };
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 455e7c087422..168e1d80b2e5 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -21,7 +21,7 @@
 
 #include "mpc10x.h"
 
-static __initdata struct of_device_id of_bus_ids[] = {
+static const struct of_device_id of_bus_ids[] __initconst = {
 	{ .type = "soc", },
 	{ .compatible = "simple-bus", },
 	{},
diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
index 25e3bfb64efb..1613303177e6 100644
--- a/arch/powerpc/platforms/embedded6xx/mvme5100.c
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -149,7 +149,7 @@ static int __init mvme5100_add_bridge(struct device_node *dev)
 	return 0;
 }
 
-static struct of_device_id mvme5100_of_bus_ids[] __initdata = {
+static const struct of_device_id mvme5100_of_bus_ids[] __initconst = {
 	{ .compatible = "hawk-bridge", },
 	{},
 };
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index c458b60d14c4..d572833ebd00 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -24,7 +24,7 @@
 #include "mpc10x.h"
 
 
-static __initdata struct of_device_id storcenter_of_bus[] = {
+static const struct of_device_id storcenter_of_bus[] __initconst = {
 	{ .name = "soc", },
 	{},
 };
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 6d8dadf19f0b..388e29bab8f6 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -235,7 +235,7 @@ define_machine(wii) {
 	.machine_shutdown	= wii_shutdown,
 };
 
-static struct of_device_id wii_of_bus[] = {
+static const struct of_device_id wii_of_bus[] = {
 	{ .compatible = "nintendo,hollywood", },
 	{ },
 };
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 15adee544638..ada33358950d 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -290,7 +290,7 @@ static int gpio_mdio_remove(struct platform_device *dev)
 	return 0;
 }
 
-static struct of_device_id gpio_mdio_match[] =
+static const struct of_device_id gpio_mdio_match[] =
 {
 	{
 		.compatible      = "gpio-mdio",
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 8c54de6d8ec4..d71b2c7e8403 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -393,7 +393,7 @@ static inline void pasemi_pcmcia_init(void)
 #endif
 
 
-static struct of_device_id pasemi_bus_ids[] = {
+static const struct of_device_id pasemi_bus_ids[] = {
 	/* Unfortunately needed for legacy firmwares */
 	{ .type = "localbus", },
 	{ .type = "sdc", },
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 47b6b9f81d43..ad56edc39919 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -314,7 +314,7 @@ axon_ram_remove(struct platform_device *device)
 	return 0;
 }
 
-static struct of_device_id axon_ram_device_id[] = {
+static const struct of_device_id axon_ram_device_id[] = {
 	{
 		.type	= "dma-memory"
 	},
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index afc2dbf37011..90545ad1626e 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -171,7 +171,7 @@ static int mpc85xx_l2ctlr_of_remove(struct platform_device *dev)
 	return 0;
 }
 
-static struct of_device_id mpc85xx_l2ctlr_of_match[] = {
+static const struct of_device_id mpc85xx_l2ctlr_of_match[] = {
 	{
 		.compatible = "fsl,p2020-l2-cache-controller",
 	},
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index c2dba7db71ad..026bbc3b2c47 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -23,7 +23,7 @@
 
 /* These functions provide the necessary setup for the mv64x60 drivers. */
 
-static struct of_device_id __initdata of_mv64x60_devices[] = {
+static const struct of_device_id of_mv64x60_devices[] __initconst = {
 	{ .compatible = "marvell,mv64306-devctrl", },
 	{}
 };
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index 5aaf86c03893..13e67d93a7c1 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -101,7 +101,7 @@ out:
 }
 
 
-static struct of_device_id pmi_match[] = {
+static const struct of_device_id pmi_match[] = {
 	{ .type = "ibm,pmi", .name = "ibm,pmi" },
 	{ .type = "ibm,pmi" },
 	{},
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c
index 83f943a8e0db..56f0524e47a6 100644
--- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -265,7 +265,7 @@ static void __init xilinx_i8259_setup_cascade(void)
 static inline void xilinx_i8259_setup_cascade(void) { return; }
 #endif /* defined(CONFIG_PPC_I8259) */
 
-static struct of_device_id xilinx_intc_match[] __initconst = {
+static const struct of_device_id xilinx_intc_match[] __initconst = {
 	{ .compatible = "xlnx,opb-intc-1.00.c", },
 	{ .compatible = "xlnx,xps-intc-1.00.a", },
 	{}
diff --git a/arch/powerpc/sysdev/xilinx_pci.c b/arch/powerpc/sysdev/xilinx_pci.c
index 1453b0eed220..fea5667699ed 100644
--- a/arch/powerpc/sysdev/xilinx_pci.c
+++ b/arch/powerpc/sysdev/xilinx_pci.c
@@ -27,7 +27,7 @@
 
 #define PCI_HOST_ENABLE_CMD PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY
 
-static struct of_device_id xilinx_pci_match[] = {
+static const struct of_device_id xilinx_pci_match[] = {
 	{ .compatible = "xlnx,plbv46-pci-1.03.a", },
 	{}
 };
-- 
2.1.0

^ permalink raw reply related

* Re: bit fields && data tearing
From: H. Peter Anvin @ 2014-09-10 20:18 UTC (permalink / raw)
  To: One Thousand Gnomes
  Cc: Jakub Jelinek, linux-arch@vger.kernel.org, Tony Luck,
	linux-ia64@vger.kernel.org, Peter Hurley, Oleg Nesterov,
	linux-kernel@vger.kernel.org, David Laight, Paul Mackerras,
	linux-alpha, Paul E. McKenney, linuxppc-dev@lists.ozlabs.org,
	Miroslav Franc, Richard Henderson
In-Reply-To: <20140908185240.21f52ca0@alan.etchedpixels.co.uk>

On 09/08/2014 10:52 AM, One Thousand Gnomes wrote:
> 
> I think the whole "removing Alpha EV5" support is basically bonkers. Just
> use set_bit in the tty layer. Alpha will continue to work as well as it
> always has done and you won't design out support for any future processor
> that turns out not to do byte aligned stores.
> 

I think it's pretty safe to say such a processor is unlikely to ever be
created, for the same reason there weren't any 48-bit computers when
32-bit computers ran out of steam: it caused more problems than it
solved, and Alpha pretty much proved that.  The engineering advantages
would have to be so overwhelmingly in favor for someone to want to walk
down that road again.

	-hpa

^ permalink raw reply

* Re: bit fields && data tearing
From: Rob Landley @ 2014-09-10 21:10 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Jakub Jelinek, One Thousand Gnomes, Tony Luck,
	linux-ia64@vger.kernel.org, Peter Hurley, linux-alpha,
	Oleg Nesterov, linux-kernel@vger.kernel.org, David Laight,
	Paul Mackerras, linux-arch@vger.kernel.org, Paul E. McKenney,
	linuxppc-dev@lists.ozlabs.org, Miroslav Franc, Richard Henderson
In-Reply-To: <5410B1FE.9090504@zytor.com>

On Wed, Sep 10, 2014 at 3:18 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 09/08/2014 10:52 AM, One Thousand Gnomes wrote:
>>
>> I think the whole "removing Alpha EV5" support is basically bonkers. Just
>> use set_bit in the tty layer. Alpha will continue to work as well as it
>> always has done and you won't design out support for any future processor
>> that turns out not to do byte aligned stores.
>>
>
> I think it's pretty safe to say such a processor is unlikely to ever be
> created, for the same reason there weren't any 48-bit computers when
> 32-bit computers ran out of steam: it caused more problems than it
> solved, and Alpha pretty much proved that.  The engineering advantages
> would have to be so overwhelmingly in favor for someone to want to walk
> down that road again.
>
>         -hpa

I note for the record I'm trying to get basic Alpha support working in
http://landley.net/aboriginal/about.html now that qemu at least offers
a qemu-system-alpha, and if I do get it working I may take a stab at
adding alpha support to musl-libc.

It's not just that I want to get cross platform testing of package
builds working on a convenient/reproducible/portable way on as many
different targets as I can. My project is designed the way it is
because I think losing the ability to reproduce things from first
principles (and thus understand why it was done that way in the first
place) is a _bad_idea_. And an increasingly real-world problem, see
http://wrttn.in/04af1a for example. (And the way NASA lost the plans
for the Saturn V rocket... In fact scientists' general disinclination
to reproduce old experimental results to see if they were actually
true or not comes up on a regular basis, most recent I saw was
http://www.theglobeandmail.com/life/health-and-fitness/health/the-curious-case-of-the-cyclists-unshaved-legs/article20370814/
)

Of course Peter has consistently dismissed my concerns as "academic":

http://lkml.iu.edu/hypermail/linux/kernel/0802.1/4400.html

Personally, I hope the projects I work on _do_ outlive me, an try to
make it easy for newbies to recapitulate phylogeny. That's why I
thought requiring perl dependencies to build was a bad idea, and why I
thought removing 386 support entirely (instead of restricting it to
UP) was a bad idea. The idea that Linux no longer needs to build on
the original machine Linus designed it for, and now it no longer needs
to work on the machine the "arch" directory was created for (and the
first 64 bit machine)... These positions would appear to have a single
consistent proponent, with whom I disagree.

Oh well, just wanted to get that out there,

Rob

^ permalink raw reply

* Re: bit fields && data tearing
From: James Bottomley @ 2014-09-10 21:48 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Jakub Jelinek, One Thousand Gnomes, linux-arch, linux-ia64,
	Mikael Pettersson, Oleg Nesterov, linux-kernel, Tony Luck,
	Paul Mackerras, H. Peter Anvin, paulmck, linuxppc-dev,
	Miroslav Franc, Richard Henderson
In-Reply-To: <540ED929.5040305@hurleysoftware.com>

On Tue, 2014-09-09 at 06:40 -0400, Peter Hurley wrote:
> On 09/08/2014 10:56 PM, James Bottomley wrote:
> > On Mon, 2014-09-08 at 19:30 -0400, Peter Hurley wrote:
> >> On 09/08/2014 01:50 AM, James Bottomley wrote:
> >>>> But additionally, even if gcc combines adjacent writes _that are part
> >>>> of the program flow_ then I believe the situation is no worse than
> >>>> would otherwise exist.
> >>>>
> >>>> For instance, given the following:
> >>>>
> >>>> struct x {
> >>>> 	spinlock_t lock;
> >>>> 	long a;
> >>>> 	byte b;
> >>>> 	byte c;
> >>>> };
> >>>>
> >>>> void locked_store_b(struct x *p)
> >>>> {
> >>>> 	spin_lock(&p->lock);
> >>>> 	p->b = 1;
> >>>> 	spin_unlock(&p->lock);
> >>>> 	p->c = 2;
> >>>> }
> >>>>
> >>>> Granted, the author probably expects ordered writes of
> >>>> 	STORE B
> >>>> 	STORE C
> >>>> but that's not guaranteed because there is no memory barrier
> >>>> ordering B before C.
> >>>
> >>> Yes, there is: loads and stores may not migrate into or out of critical
> >>> sections.
> >>
> >> That's a common misconception.
> >>
> >> The processor is free to re-order this to:
> >>
> >> 	STORE C
> >> 	STORE B
> >> 	UNLOCK
> >>
> >> That's because the unlock() only guarantees that:
> >>
> >> Stores before the unlock in program order are guaranteed to complete
> >> before the unlock completes. Stores after the unlock _may_ complete
> >> before the unlock completes.
> >>
> >> My point was that even if compiler barriers had the same semantics
> >> as memory barriers, the situation would be no worse. That is, code
> >> that is sensitive to memory barriers (like the example I gave above)
> >> would merely have the same fragility with one-way compiler barriers
> >> (with respect to the compiler combining writes).
> >>
> >> That's what I meant by "no worse than would otherwise exist".
> > 
> > Actually, that's not correct.  This is actually deja vu with me on the
> > other side of the argument.  When we first did spinlocks on PA, I argued
> > as you did: lock only a barrier for code after and unlock for code
> > before.  The failing case is that you can have a critical section which
> > performs an atomically required operation and a following unit which
> > depends on it being performed.  If you begin the following unit before
> > the atomic requirement, you may end up losing.  It turns out this kind
> > of pattern is inherent in a lot of mail box device drivers: you need to
> > set up the mailbox atomically then poke it.  Setup is usually atomic,
> > deciding which mailbox to prime and actually poking it is in the
> > following unit.  Priming often involves an I/O bus transaction and if
> > you poke before priming, you get a misfire.
> 
> Take it up with the man because this was discussed extensively last
> year and it was decided that unlocks would not be full barriers.
> Thus the changes to memory-barriers.txt that explicitly note this
> and the addition of smp_mb__after_unlock_lock() (for two different
> locks; an unlock followed by a lock on the same lock is a full barrier).
> 
> Code that expects ordered writes after an unlock needs to explicitly
> add the memory barrier.

I don't really care what ARM does; spin locks are full barriers on
architectures that need them.  The driver problem we had that detected
our semi permeable spinlocks was an LSI 53c875 which is enterprise class
PCI, so presumably not relevant to ARM anyway.

James

^ permalink raw reply

* [PATCH 2/2] pseries: Fix endian issues in cpu hot-removal
From: Thomas Falcon @ 2014-09-10 22:41 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Thomas Falcon

When removing a cpu, this patch makes sure that values
gotten from or passed to firmware are in the correct
endian format.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/dlpar.c       | 14 +++++++-------
 arch/powerpc/platforms/pseries/hotplug-cpu.c |  8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index cd425dc..c5ecfdb 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -442,7 +442,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
 	int rc = 0;
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
 
 	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -453,7 +453,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != be32_to_cpu(intserv[i]))
 				continue;
 
 			if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
@@ -475,14 +475,14 @@ static int dlpar_offline_cpu(struct device_node *dn)
 			 * Upgrade it's state to CPU_STATE_OFFLINE.
 			 */
 			set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
-			BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
+			BUG_ON(plpar_hcall_norets(H_PROD, be32_to_cpu(intserv[i]))
 								!= H_SUCCESS);
 			__cpu_die(cpu);
 			break;
 		}
 		if (cpu == num_possible_cpus())
 			printk(KERN_WARNING "Could not find cpu to offline "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", be32_to_cpu(intserv[i]));
 	}
 	cpu_maps_update_done();
 
@@ -494,7 +494,7 @@ out:
 static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 {
 	struct device_node *dn;
-	const u32 *drc_index;
+	const __be32 *drc_index;
 	int rc;
 
 	dn = of_find_node_by_path(buf);
@@ -513,7 +513,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 		return -EINVAL;
 	}
 
-	rc = dlpar_release_drc(*drc_index);
+	rc = dlpar_release_drc(be32_to_cpup(drc_index));
 	if (rc) {
 		of_node_put(dn);
 		return rc;
@@ -521,7 +521,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
 
 	rc = dlpar_detach_node(dn);
 	if (rc) {
-		dlpar_acquire_drc(*drc_index);
+		dlpar_acquire_drc(be32_to_cpup(drc_index));
 		return rc;
 	}
 
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 447f8c6..031762d 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -90,7 +90,7 @@ static void rtas_stop_self(void)
 {
 	static struct rtas_args args = {
 		.nargs = 0,
-		.nret = 1,
+		.nret = cpu_to_be32(1),
 		.rets = &args.args[0],
 	};
 
@@ -312,7 +312,7 @@ static void pseries_remove_processor(struct device_node *np)
 {
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
 
 	intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -323,7 +323,7 @@ static void pseries_remove_processor(struct device_node *np)
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != be32_to_cpu(intserv[i]))
 				continue;
 			BUG_ON(cpu_online(cpu));
 			set_cpu_present(cpu, false);
@@ -332,7 +332,7 @@ static void pseries_remove_processor(struct device_node *np)
 		}
 		if (cpu >= nr_cpu_ids)
 			printk(KERN_WARNING "Could not find cpu to remove "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", be32_to_cpu(intserv[i]));
 	}
 	cpu_maps_update_done();
 }
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH 1/2] pseries: Fix endian issues in onlining cpu threads
From: Thomas Falcon @ 2014-09-10 22:41 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Thomas Falcon

The ibm,ppc-interrupt-server#s property is in big endian format.
These values need to be converted when used by little endian
architectures.

Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/dlpar.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index c2806c8..cd425dc 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -363,7 +363,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 	int rc = 0;
 	unsigned int cpu;
 	int len, nthreads, i;
-	const u32 *intserv;
+	const __be32 *intserv;
 
 	intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
@@ -374,7 +374,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 	cpu_maps_update_begin();
 	for (i = 0; i < nthreads; i++) {
 		for_each_present_cpu(cpu) {
-			if (get_hard_smp_processor_id(cpu) != intserv[i])
+			if (get_hard_smp_processor_id(cpu) != be32_to_cpu(intserv[i]))
 				continue;
 			BUG_ON(get_cpu_current_state(cpu)
 					!= CPU_STATE_OFFLINE);
@@ -388,7 +388,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 		}
 		if (cpu == num_possible_cpus())
 			printk(KERN_WARNING "Could not find cpu to online "
-			       "with physical id 0x%x\n", intserv[i]);
+			       "with physical id 0x%x\n", be32_to_cpu(intserv[i]));
 	}
 	cpu_maps_update_done();
 
-- 
1.8.5.2

^ permalink raw reply related

* Re: [PATCH v3] topology: add support for node_to_mem_node() to determine the fallback node
From: Nishanth Aravamudan @ 2014-09-10 22:49 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Han Pingtian, Matt Mackall, David Rientjes, Pekka Enberg,
	Linux Memory Management List, Paul Mackerras, Tejun Heo,
	Joonsoo Kim, linuxppc-dev, Christoph Lameter, Wanpeng Li,
	Anton Blanchard
In-Reply-To: <20140910120616.4aa03ed0c0c88fdd1b3fd6c2@linux-foundation.org>

On 10.09.2014 [12:06:16 -0700], Andrew Morton wrote:
> On Tue, 9 Sep 2014 17:47:23 -0700 Nishanth Aravamudan <nacc@linux.vnet.ibm.com> wrote:
> 
> > On 09.09.2014 [17:11:15 -0700], Andrew Morton wrote:
> > > On Tue, 9 Sep 2014 12:03:27 -0700 Nishanth Aravamudan <nacc@linux.vnet.ibm.com> wrote:
> > > 
> > > > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > > 
> > > > We need to determine the fallback node in slub allocator if the
> > > > allocation target node is memoryless node. Without it, the SLUB wrongly
> > > > select the node which has no memory and can't use a partial slab,
> > > > because of node mismatch. Introduced function, node_to_mem_node(X), will
> > > > return a node Y with memory that has the nearest distance. If X is
> > > > memoryless node, it will return nearest distance node, but, if X is
> > > > normal node, it will return itself.
> > > > 
> > > > We will use this function in following patch to determine the fallback
> > > > node.
> > > > 
> > > > ...
> > > >
> > > > --- a/include/linux/topology.h
> > > > +++ b/include/linux/topology.h
> > > > @@ -119,11 +119,20 @@ static inline int numa_node_id(void)
> > > >   * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
> > > 
> > > This comment could be updated.
> > 
> > Will do, do you prefer a follow-on patch or one that replaces this one?
> 
> Either is OK for me.  I always turn replacement patches into
> incrementals so I (and others) can see what changed.

Ok, I'll probably send you just an incremental then myself.

> > > >   */
> > > >  DECLARE_PER_CPU(int, _numa_mem_);
> > > > +extern int _node_numa_mem_[MAX_NUMNODES];
> > > >  
> > > >  #ifndef set_numa_mem
> > > >  static inline void set_numa_mem(int node)
> > > >  {
> > > >  	this_cpu_write(_numa_mem_, node);
> > > > +	_node_numa_mem_[numa_node_id()] = node;
> > > > +}
> > > > +#endif
> > > > +
> > > > +#ifndef node_to_mem_node
> > > > +static inline int node_to_mem_node(int node)
> > > > +{
> > > > +	return _node_numa_mem_[node];
> > > >  }
> > > 
> > > A wee bit of documentation wouldn't hurt.
> 
> This?

Yep, I'll make sure it gets added.

> > > > --- a/mm/page_alloc.c
> > > > +++ b/mm/page_alloc.c
> > > > @@ -85,6 +85,7 @@ EXPORT_PER_CPU_SYMBOL(numa_node);
> > > >   */
> > > >  DEFINE_PER_CPU(int, _numa_mem_);		/* Kernel "local memory" node */
> > > >  EXPORT_PER_CPU_SYMBOL(_numa_mem_);
> > > > +int _node_numa_mem_[MAX_NUMNODES];
> > > 
> > > How does this get updated as CPUs, memory and nodes are hot-added and
> > > removed?
> > 
> > As CPUs are added, the architecture code in the CPU bringup will update
> > the NUMA topology. Memory and node hotplug are still open issues, I
> > mentioned the former in the cover letter. I should have mentioned it in
> > this commit message as well.
> 
> Please define "open issue".  The computer will crash and catch fire?
> If not that, then what?

Umm, let's call it "undefined" (untested?). Which is no different than
where we are today, afaict, with memoryless nodes. I think going from
memoryless->memoryful probably works, but the other direction may not
(and may not be possible in the common case).

-Nish

^ permalink raw reply

* Re: bit fields && data tearing
From: Peter Hurley @ 2014-09-10 23:50 UTC (permalink / raw)
  To: James Bottomley
  Cc: Jakub Jelinek, One Thousand Gnomes, linux-arch, linux-ia64,
	Mikael Pettersson, Oleg Nesterov, linux-kernel, Tony Luck,
	Paul Mackerras, H. Peter Anvin, paulmck, linuxppc-dev,
	Miroslav Franc, Richard Henderson
In-Reply-To: <1410385686.28237.5.camel@jarvis>

On 09/10/2014 05:48 PM, James Bottomley wrote:
> On Tue, 2014-09-09 at 06:40 -0400, Peter Hurley wrote:
>> On 09/08/2014 10:56 PM, James Bottomley wrote:
>>> On Mon, 2014-09-08 at 19:30 -0400, Peter Hurley wrote:
>>>> On 09/08/2014 01:50 AM, James Bottomley wrote:
>>>>>> But additionally, even if gcc combines adjacent writes _that are part
>>>>>> of the program flow_ then I believe the situation is no worse than
>>>>>> would otherwise exist.
>>>>>>
>>>>>> For instance, given the following:
>>>>>>
>>>>>> struct x {
>>>>>> 	spinlock_t lock;
>>>>>> 	long a;
>>>>>> 	byte b;
>>>>>> 	byte c;
>>>>>> };
>>>>>>
>>>>>> void locked_store_b(struct x *p)
>>>>>> {
>>>>>> 	spin_lock(&p->lock);
>>>>>> 	p->b = 1;
>>>>>> 	spin_unlock(&p->lock);
>>>>>> 	p->c = 2;
>>>>>> }
>>>>>>
>>>>>> Granted, the author probably expects ordered writes of
>>>>>> 	STORE B
>>>>>> 	STORE C
>>>>>> but that's not guaranteed because there is no memory barrier
>>>>>> ordering B before C.
>>>>>
>>>>> Yes, there is: loads and stores may not migrate into or out of critical
>>>>> sections.
>>>>
>>>> That's a common misconception.
>>>>
>>>> The processor is free to re-order this to:
>>>>
>>>> 	STORE C
>>>> 	STORE B
>>>> 	UNLOCK
>>>>
>>>> That's because the unlock() only guarantees that:
>>>>
>>>> Stores before the unlock in program order are guaranteed to complete
>>>> before the unlock completes. Stores after the unlock _may_ complete
>>>> before the unlock completes.
>>>>
>>>> My point was that even if compiler barriers had the same semantics
>>>> as memory barriers, the situation would be no worse. That is, code
>>>> that is sensitive to memory barriers (like the example I gave above)
>>>> would merely have the same fragility with one-way compiler barriers
>>>> (with respect to the compiler combining writes).
>>>>
>>>> That's what I meant by "no worse than would otherwise exist".
>>>
>>> Actually, that's not correct.  This is actually deja vu with me on the
>>> other side of the argument.  When we first did spinlocks on PA, I argued
>>> as you did: lock only a barrier for code after and unlock for code
>>> before.  The failing case is that you can have a critical section which
>>> performs an atomically required operation and a following unit which
>>> depends on it being performed.  If you begin the following unit before
>>> the atomic requirement, you may end up losing.  It turns out this kind
>>> of pattern is inherent in a lot of mail box device drivers: you need to
>>> set up the mailbox atomically then poke it.  Setup is usually atomic,
>>> deciding which mailbox to prime and actually poking it is in the
>>> following unit.  Priming often involves an I/O bus transaction and if
>>> you poke before priming, you get a misfire.
>>
>> Take it up with the man because this was discussed extensively last
>> year and it was decided that unlocks would not be full barriers.
>> Thus the changes to memory-barriers.txt that explicitly note this
>> and the addition of smp_mb__after_unlock_lock() (for two different
>> locks; an unlock followed by a lock on the same lock is a full barrier).
>>
>> Code that expects ordered writes after an unlock needs to explicitly
>> add the memory barrier.
> 
> I don't really care what ARM does; spin locks are full barriers on
> architectures that need them.  The driver problem we had that detected
> our semi permeable spinlocks was an LSI 53c875 which is enterprise class
> PCI, so presumably not relevant to ARM anyway.

Almost certainly ia64 arch_spin_unlock() is not a full barrier.

^ permalink raw reply

* Re: [Xen-devel] [PATCH v1 04/21] x86/xen/MSI: Eliminate arch_msix_mask_irq() and arch_msi_mask_irq()
From: Yijing Wang @ 2014-09-11  1:22 UTC (permalink / raw)
  To: David Vrabel, Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Chris Metcalf, Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan,
	Tony Luck, Ralf Baechle, iommu, Wuyun, linuxppc-dev,
	David S. Miller
In-Reply-To: <541045BE.9050804@citrix.com>

On 2014/9/10 20:36, David Vrabel wrote:
> On 05/09/14 11:09, Yijing Wang wrote:
>> Commit 0e4ccb150 added two __weak arch functions arch_msix_mask_irq()
>> and arch_msi_mask_irq() to fix a bug found when running xen in x86.
>> Introduced these two funcntions make MSI code complex. And mask/unmask
>> is the irq actions related to interrupt controller, should not use
>> weak arch functions to override mask/unmask interfaces. This patch
>> reverted commit 0e4ccb150 and export struct irq_chip msi_chip, modify
>> msi_chip->irq_mask/irq_unmask() in xen init functions to fix this
>> bug for simplicity. Also this is preparation for using struct
>> msi_chip instead of weak arch MSI functions in all platforms.
> 
> Acked-by: David Vrabel <david.vrabel@citrix.com>
> 
> But I wonder if it would be better the Xen subsystem to provide its own
> struct irq_chip instead of adjusting the fields in the generic x86 one.

Thanks! Currently, Xen and the bare x86 system only have the different irq_chip->irq_mask/irq_unmask.
So I chose to override the two ops of bare x86 irq_chip in xen. Konrad Rzeszutek Wilk has been tested it
ok in his platform, so I think we could use its own irq_chip for xen later if the difference become large.

Thanks!
Yijing.

> 
> David
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply

* Re: [Xen-devel] [PATCH v1 08/21] x86/xen/MSI: Use MSI chip framework to configure MSI/MSI-X irq
From: Yijing Wang @ 2014-09-11  1:27 UTC (permalink / raw)
  To: David Vrabel, Bjorn Helgaas
  Cc: linux-mips, linux-ia64, linux-pci, Xinwei Hu, sparclinux,
	linux-arch, linux-s390, Russell King, Joerg Roedel, x86,
	Sebastian Ott, xen-devel, arnab.basu, Arnd Bergmann,
	Chris Metcalf, Thomas Gleixner, linux-arm-kernel, Bharat.Bhushan,
	Tony Luck, Ralf Baechle, iommu, Wuyun, linuxppc-dev,
	David S. Miller
In-Reply-To: <54104641.7020007@citrix.com>

On 2014/9/10 20:38, David Vrabel wrote:
> On 09/09/14 03:06, Yijing Wang wrote:
>> On 2014/9/5 22:29, David Vrabel wrote:
>>> On 05/09/14 11:09, Yijing Wang wrote:
>>>> Use MSI chip framework instead of arch MSI functions to configure
>>>> MSI/MSI-X irq. So we can manage MSI/MSI-X irq in a unified framework.
>>> [...]
>>>> --- a/arch/x86/pci/xen.c
>>>> +++ b/arch/x86/pci/xen.c
>>> [...]
>>>> @@ -418,9 +430,9 @@ int __init pci_xen_init(void)
>>>>  #endif
>>>>  
>>>>  #ifdef CONFIG_PCI_MSI
>>>> -	x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
>>>> -	x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
>>>> -	x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
>>>> +	xen_msi_chip.setup_irqs = xen_setup_msi_irqs;
>>>> +	xen_msi_chip.teardown_irqs = xen_teardown_msi_irqs;
>>>> +	x86_msi_chip = &xen_msi_chip;
>>>>  	msi_chip.irq_mask = xen_nop_msi_mask;
>>>>  	msi_chip.irq_unmask = xen_nop_msi_mask;
>>>
>>> Why have these not been changed to set the x86_msi_chip.mask/unmask
>>> fields instead?
>>
>> Hi David, x86_msi_chip here is struct msi_chip data type, used to configure MSI/MSI-X
>> irq. msi_chip above is struct irq_chip data type, represent the MSI irq controller. They are
>> not the same object. Their name easily confusing people.
> 
> Ok, it all makes sense now.
> 
> Acked-by: David Vrabel <david.vrabel@citrix.com>

Thanks!

> 
> David
> 
> .
> 


-- 
Thanks!
Yijing

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox