* Re: [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc
From: Benjamin Herrenschmidt @ 2014-04-28 1:37 UTC (permalink / raw)
To: Rob Herring
Cc: devicetree, Rob Herring, linux-kernel, Paul Mackerras,
Grant Likely, linuxppc-dev
In-Reply-To: <1398215901-25609-22-git-send-email-robherring2@gmail.com>
On Tue, 2014-04-22 at 20:18 -0500, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
>
> Now powerpc is the only user of struct boot_param_header and FDT defines,
> so they can be moved into the powerpc architecture code.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
I assume we want to get rid of that too eventually ? :-)
We should be able to get the definitions from libfdt too....
In the meantime:
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--
> v2: no change
>
> arch/powerpc/include/asm/prom.h | 39 +++++++++++++++++++++++++++++++++++++++
> include/linux/of_fdt.h | 37 -------------------------------------
> 2 files changed, 39 insertions(+), 37 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index d977b9b..74b79f0 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -26,6 +26,45 @@
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
>
> +#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
> +#define OF_DT_END_NODE 0x2 /* End node */
> +#define OF_DT_PROP 0x3 /* Property: name off, size,
> + * content */
> +#define OF_DT_NOP 0x4 /* nop */
> +#define OF_DT_END 0x9
> +
> +#define OF_DT_VERSION 0x10
> +
> +/*
> + * This is what gets passed to the kernel by prom_init or kexec
> + *
> + * The dt struct contains the device tree structure, full pathes and
> + * property contents. The dt strings contain a separate block with just
> + * the strings for the property names, and is fully page aligned and
> + * self contained in a page, so that it can be kept around by the kernel,
> + * each property name appears only once in this page (cheap compression)
> + *
> + * the mem_rsvmap contains a map of reserved ranges of physical memory,
> + * passing it here instead of in the device-tree itself greatly simplifies
> + * the job of everybody. It's just a list of u64 pairs (base/size) that
> + * ends when size is 0
> + */
> +struct boot_param_header {
> + __be32 magic; /* magic word OF_DT_HEADER */
> + __be32 totalsize; /* total size of DT block */
> + __be32 off_dt_struct; /* offset to structure */
> + __be32 off_dt_strings; /* offset to strings */
> + __be32 off_mem_rsvmap; /* offset to memory reserve map */
> + __be32 version; /* format version */
> + __be32 last_comp_version; /* last compatible version */
> + /* version 2 fields below */
> + __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
> + /* version 3 fields below */
> + __be32 dt_strings_size; /* size of the DT strings block */
> + /* version 17 fields below */
> + __be32 dt_struct_size; /* size of the DT structure block */
> +};
> +
> /*
> * OF address retreival & translation
> */
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 1f882e1..5c0ab05 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -17,45 +17,8 @@
>
> /* Definitions used by the flattened device tree */
> #define OF_DT_HEADER 0xd00dfeed /* marker */
> -#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
> -#define OF_DT_END_NODE 0x2 /* End node */
> -#define OF_DT_PROP 0x3 /* Property: name off, size,
> - * content */
> -#define OF_DT_NOP 0x4 /* nop */
> -#define OF_DT_END 0x9
> -
> -#define OF_DT_VERSION 0x10
>
> #ifndef __ASSEMBLY__
> -/*
> - * This is what gets passed to the kernel by prom_init or kexec
> - *
> - * The dt struct contains the device tree structure, full pathes and
> - * property contents. The dt strings contain a separate block with just
> - * the strings for the property names, and is fully page aligned and
> - * self contained in a page, so that it can be kept around by the kernel,
> - * each property name appears only once in this page (cheap compression)
> - *
> - * the mem_rsvmap contains a map of reserved ranges of physical memory,
> - * passing it here instead of in the device-tree itself greatly simplifies
> - * the job of everybody. It's just a list of u64 pairs (base/size) that
> - * ends when size is 0
> - */
> -struct boot_param_header {
> - __be32 magic; /* magic word OF_DT_HEADER */
> - __be32 totalsize; /* total size of DT block */
> - __be32 off_dt_struct; /* offset to structure */
> - __be32 off_dt_strings; /* offset to strings */
> - __be32 off_mem_rsvmap; /* offset to memory reserve map */
> - __be32 version; /* format version */
> - __be32 last_comp_version; /* last compatible version */
> - /* version 2 fields below */
> - __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
> - /* version 3 fields below */
> - __be32 dt_strings_size; /* size of the DT strings block */
> - /* version 17 fields below */
> - __be32 dt_struct_size; /* size of the DT structure block */
> -};
>
> #if defined(CONFIG_OF_FLATTREE)
>
^ permalink raw reply
* Re: [PATCH 08/13] PCI, rpaphp: Use new pci_is_bridge() to simplify code
From: Benjamin Herrenschmidt @ 2014-04-28 0:43 UTC (permalink / raw)
To: Yijing Wang
Cc: Tony Luck, linux-ia64, x86, linux-kernel, sparclinux,
Bjorn Helgaas, Thomas Gleixner, linuxppc-dev, David S. Miller
In-Reply-To: <1398417515-8740-9-git-send-email-wangyijing@huawei.com>
On Fri, 2014-04-25 at 17:18 +0800, Yijing Wang wrote:
> Now we can use new pci_is_bridge() helper function
> to simplify code.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/pci/hotplug/rpadlpar_core.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
> index 4fcdeed..7660232 100644
> --- a/drivers/pci/hotplug/rpadlpar_core.c
> +++ b/drivers/pci/hotplug/rpadlpar_core.c
> @@ -157,8 +157,7 @@ static void dlpar_pci_add_bus(struct device_node *dn)
> }
>
> /* Scan below the new bridge */
> - if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
> - dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
> + if (pci_is_bridge(dev))
> of_scan_pci_bridge(dev);
>
> /* Map IO space for child bus, which may or may not succeed */
^ permalink raw reply
* [PATCH] powerpc: Fix Oops in rtas_stop_self()
From: Li Zhong @ 2014-04-28 0:29 UTC (permalink / raw)
To: Anton Blanchard
Cc: Paul Mackerras, Benjamin Herrenschmidt, PowerPC email list
In-Reply-To: <20140425221833.3cc04b0c@kryten>
commit 41dd03a9 may cause Oops in rtas_stop_self().
The reason is that the rtas_args was moved into stack space. For a box
with more that 4GB RAM, the stack could easily be outside 32bit range,
but RTAS is 32bit.
So the patch moves rtas_args away from stack by adding static before
it.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Cc: stable@vger.kernel.org # 3.14+
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 9b8e050..20d6297 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -88,13 +88,14 @@ void set_default_offline_state(int cpu)
static void rtas_stop_self(void)
{
- struct rtas_args args = {
- .token = cpu_to_be32(rtas_stop_self_token),
+ static struct rtas_args args = {
.nargs = 0,
.nret = 1,
.rets = &args.args[0],
};
+ args.token = cpu_to_be32(rtas_stop_self_token);
+
local_irq_disable();
BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE);
^ permalink raw reply related
* Re: [RFC PATCH] Fix Oops in rtas_stop_self()
From: Li Zhong @ 2014-04-28 0:26 UTC (permalink / raw)
To: Anton Blanchard
Cc: Paul Mackerras, Benjamin Herrenschmidt, PowerPC email list
In-Reply-To: <20140425221833.3cc04b0c@kryten>
On Fri, 2014-04-25 at 22:18 +1000, Anton Blanchard wrote:
> Hi,
>
> > When trying offline cpus, I noticed following Oops in
> > rtas_stop_self(), and it seems caused by commit 41dd03a9. The Oops
> > disappears after reverting this commit.
> >
> > After reading the code, I guess it might be caused by moving the
> > rtas_args to stack. Still need some more time to read enter_rtas to
> > understand why it happens, but the problem seems could be solved by
> > moving the rtas_args away from stack by adding static before it.
>
> Nice catch. RTAS is 32bit and if your box has more than 4GB RAM then
> your stack could easily be outside 32bit range.
Ah, yes, the stack here is obviously at a much higher address than 4GB.
>
> You can add:
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
>
> And also:
>
> Cc: stable@vger.kernel.org # 3.14+
OK,
Thanks, Zhong
>
> > Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> > ---
> > arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> > b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 9b8e050..20d6297
> > 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> > +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> > @@ -88,13 +88,14 @@ void set_default_offline_state(int cpu)
> >
> > static void rtas_stop_self(void)
> > {
> > - struct rtas_args args = {
> > - .token = cpu_to_be32(rtas_stop_self_token),
> > + static struct rtas_args args = {
> > .nargs = 0,
> > .nret = 1,
> > .rets = &args.args[0],
> > };
> >
> > + args.token = cpu_to_be32(rtas_stop_self_token);
> > +
> > local_irq_disable();
> >
> > BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE);
> >
> >
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev
>
^ permalink raw reply
* [PATCH] powerpc: export flush_icache_range
From: Jeff Mahoney @ 2014-04-27 22:10 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras; +Cc: linuxppc-dev
Commit aac416fc38c (lkdtm: flush icache and report actions) calls
flush_icache_range from a module. It's exported on most architectures
that implement it, but not on powerpc. This patch exports it to fix
the module link failure.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
arch/powerpc/kernel/ppc_ksyms.c | 1 +
1 file changed, 1 insertion(+)
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -120,6 +120,7 @@ EXPORT_SYMBOL(giveup_spe);
EXPORT_SYMBOL(flush_instruction_cache);
#endif
EXPORT_SYMBOL(flush_dcache_range);
+EXPORT_SYMBOL(flush_icache_range);
#ifdef CONFIG_SMP
#ifdef CONFIG_PPC32
--
Jeff Mahoney
SUSE Labs
^ permalink raw reply
* Re: [PATCH v5 2/8] cpufreq: Use cpufreq_for_each_* macros for frequency table iteration
From: Stratos Karafotis @ 2014-04-26 11:35 UTC (permalink / raw)
To: Prabhakar Lad
Cc: Kukjin Kim, linux-pm, Viresh Kumar, Rafael J. Wysocki, LKML,
cpufreq@vger.kernel.org, linux-samsung-soc, Sudeep Holla,
Olof Johansson, linuxppc-dev,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <CA+V-a8sg9sBi5mf9KoFWrCJjw6WN+tGrb=bgJwfV3VDZ2DGYig@mail.gmail.com>
Hi Prabhakar,
On 26/04/2014 12:57 μμ, Prabhakar Lad wrote:
> Hi Stratos,
>
> Thanks for the patch,
>
> On Sat, Apr 26, 2014 at 1:45 AM, Stratos Karafotis
> <stratosk@semaphore.gr> wrote:
>> The cpufreq core now supports the cpufreq_for_each_entry and
>> cpufreq_for_each_valid_entry macros helpers for iteration over the
>> cpufreq_frequency_table, so use them.
>>
>> It should have no functional changes.
>>
>> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
>
> For patches 1 & 2: Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>
> and for patch 3: Acked-and-tested-by: Lad, Prabhakar
> <prabhakar.csengg@gmail.com>
>
> Thanks,
> --Prabhakar lad
>
Thank you very much!
Stratos Karafotis
^ permalink raw reply
* Re: [PATCH v5 2/8] cpufreq: Use cpufreq_for_each_* macros for frequency table iteration
From: Prabhakar Lad @ 2014-04-26 9:57 UTC (permalink / raw)
To: Stratos Karafotis
Cc: Kukjin Kim, linux-pm, Viresh Kumar, Rafael J. Wysocki, LKML,
cpufreq@vger.kernel.org, linux-samsung-soc, Sudeep Holla,
Olof Johansson, linuxppc-dev,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <535AC26A.1000006@semaphore.gr>
Hi Stratos,
Thanks for the patch,
On Sat, Apr 26, 2014 at 1:45 AM, Stratos Karafotis
<stratosk@semaphore.gr> wrote:
> The cpufreq core now supports the cpufreq_for_each_entry and
> cpufreq_for_each_valid_entry macros helpers for iteration over the
> cpufreq_frequency_table, so use them.
>
> It should have no functional changes.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
For patches 1 & 2: Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
and for patch 3: Acked-and-tested-by: Lad, Prabhakar
<prabhakar.csengg@gmail.com>
Thanks,
--Prabhakar lad
> ---
> drivers/cpufreq/acpi-cpufreq.c | 9 +++---
> drivers/cpufreq/arm_big_little.c | 16 +++++------
> drivers/cpufreq/cpufreq_stats.c | 24 ++++++----------
> drivers/cpufreq/dbx500-cpufreq.c | 8 ++----
> drivers/cpufreq/elanfreq.c | 9 +++---
> drivers/cpufreq/exynos-cpufreq.c | 11 ++++---
> drivers/cpufreq/exynos5440-cpufreq.c | 30 +++++++++----------
> drivers/cpufreq/freq_table.c | 56 ++++++++++++++++--------------------
> drivers/cpufreq/longhaul.c | 11 ++++---
> drivers/cpufreq/pasemi-cpufreq.c | 10 +++----
> drivers/cpufreq/powernow-k6.c | 14 ++++-----
> drivers/cpufreq/ppc_cbe_cpufreq.c | 9 +++---
> drivers/cpufreq/s3c2416-cpufreq.c | 40 +++++++++++---------------
> drivers/cpufreq/s3c64xx-cpufreq.c | 15 ++++------
> 14 files changed, 116 insertions(+), 146 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 000e4e0..b0c18ed 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -213,7 +213,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
>
> static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> struct acpi_processor_performance *perf;
>
> if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> @@ -223,10 +223,9 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
>
> perf = data->acpi_data;
>
> - for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - if (msr == perf->states[data->freq_table[i].driver_data].status)
> - return data->freq_table[i].frequency;
> - }
> + cpufreq_for_each_entry(pos, data->freq_table)
> + if (msr == perf->states[pos->driver_data].status)
> + return pos->frequency;
> return data->freq_table[0].frequency;
> }
>
> diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
> index bad2ed3..1f4d4e3 100644
> --- a/drivers/cpufreq/arm_big_little.c
> +++ b/drivers/cpufreq/arm_big_little.c
> @@ -226,22 +226,22 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table)
> /* get the minimum frequency in the cpufreq_frequency_table */
> static inline u32 get_table_min(struct cpufreq_frequency_table *table)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> uint32_t min_freq = ~0;
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
> - if (table[i].frequency < min_freq)
> - min_freq = table[i].frequency;
> + cpufreq_for_each_entry(pos, table)
> + if (pos->frequency < min_freq)
> + min_freq = pos->frequency;
> return min_freq;
> }
>
> /* get the maximum frequency in the cpufreq_frequency_table */
> static inline u32 get_table_max(struct cpufreq_frequency_table *table)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> uint32_t max_freq = 0;
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
> - if (table[i].frequency > max_freq)
> - max_freq = table[i].frequency;
> + cpufreq_for_each_entry(pos, table)
> + if (pos->frequency > max_freq)
> + max_freq = pos->frequency;
> return max_freq;
> }
>
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index ecaaebf..0cd9b4d 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -182,11 +182,11 @@ static void cpufreq_stats_free_table(unsigned int cpu)
>
> static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> {
> - unsigned int i, j, count = 0, ret = 0;
> + unsigned int i, count = 0, ret = 0;
> struct cpufreq_stats *stat;
> unsigned int alloc_size;
> unsigned int cpu = policy->cpu;
> - struct cpufreq_frequency_table *table;
> + struct cpufreq_frequency_table *pos, *table;
>
> table = cpufreq_frequency_get_table(cpu);
> if (unlikely(!table))
> @@ -205,12 +205,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> stat->cpu = cpu;
> per_cpu(cpufreq_stats_table, cpu) = stat;
>
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table)
> count++;
> - }
>
> alloc_size = count * sizeof(int) + count * sizeof(u64);
>
> @@ -228,15 +224,11 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> #ifdef CONFIG_CPU_FREQ_STAT_DETAILS
> stat->trans_table = stat->freq_table + count;
> #endif
> - j = 0;
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> - if (freq_table_get_index(stat, freq) == -1)
> - stat->freq_table[j++] = freq;
> - }
> - stat->state_num = j;
> + i = 0;
> + cpufreq_for_each_valid_entry(pos, table)
> + if (freq_table_get_index(stat, pos->frequency) == -1)
> + stat->freq_table[i++] = pos->frequency;
> + stat->state_num = i;
> spin_lock(&cpufreq_stats_lock);
> stat->last_time = get_jiffies_64();
> stat->last_index = freq_table_get_index(stat, policy->cur);
> diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
> index 412a78b..4bebc1b 100644
> --- a/drivers/cpufreq/dbx500-cpufreq.c
> +++ b/drivers/cpufreq/dbx500-cpufreq.c
> @@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
>
> static int dbx500_cpufreq_probe(struct platform_device *pdev)
> {
> - int i = 0;
> + struct cpufreq_frequency_table *pos;
>
> freq_table = dev_get_platdata(&pdev->dev);
> if (!freq_table) {
> @@ -60,10 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev)
> }
>
> pr_info("dbx500-cpufreq: Available frequencies:\n");
> - while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
> - pr_info(" %d Mhz\n", freq_table[i].frequency/1000);
> - i++;
> - }
> + cpufreq_for_each_entry(pos, freq_table)
> + pr_info(" %d Mhz\n", pos->frequency / 1000);
>
> return cpufreq_register_driver(&dbx500_cpufreq_driver);
> }
> diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
> index 7f5d2a6..1c06e78 100644
> --- a/drivers/cpufreq/elanfreq.c
> +++ b/drivers/cpufreq/elanfreq.c
> @@ -147,7 +147,7 @@ static int elanfreq_target(struct cpufreq_policy *policy,
> static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> {
> struct cpuinfo_x86 *c = &cpu_data(0);
> - unsigned int i;
> + struct cpufreq_frequency_table *pos;
>
> /* capability check */
> if ((c->x86_vendor != X86_VENDOR_AMD) ||
> @@ -159,10 +159,9 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> max_freq = elanfreq_get_cpu_frequency(0);
>
> /* table init */
> - for (i = 0; (elanfreq_table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (elanfreq_table[i].frequency > max_freq)
> - elanfreq_table[i].frequency = CPUFREQ_ENTRY_INVALID;
> - }
> + cpufreq_for_each_entry(pos, elanfreq_table)
> + if (pos->frequency > max_freq)
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
>
> /* cpuinfo and default policy values */
> policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
> diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
> index f99cfe2..9c13255 100644
> --- a/drivers/cpufreq/exynos-cpufreq.c
> +++ b/drivers/cpufreq/exynos-cpufreq.c
> @@ -29,17 +29,16 @@ static unsigned int locking_frequency;
> static int exynos_cpufreq_get_index(unsigned int freq)
> {
> struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
> - int index;
> + struct cpufreq_frequency_table *pos;
>
> - for (index = 0;
> - freq_table[index].frequency != CPUFREQ_TABLE_END; index++)
> - if (freq_table[index].frequency == freq)
> + cpufreq_for_each_entry(pos, freq_table)
> + if (pos->frequency == freq)
> break;
>
> - if (freq_table[index].frequency == CPUFREQ_TABLE_END)
> + if (pos->frequency == CPUFREQ_TABLE_END)
> return -EINVAL;
>
> - return index;
> + return pos - freq_table;
> }
>
> static int exynos_cpufreq_scale(unsigned int target_freq)
> diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c
> index a6b8214..f33f25b 100644
> --- a/drivers/cpufreq/exynos5440-cpufreq.c
> +++ b/drivers/cpufreq/exynos5440-cpufreq.c
> @@ -114,25 +114,23 @@ static struct cpufreq_freqs freqs;
>
> static int init_div_table(void)
> {
> - struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
> + struct cpufreq_frequency_table *pos, *freq_tbl = dvfs_info->freq_table;
> unsigned int tmp, clk_div, ema_div, freq, volt_id;
> - int i = 0;
> struct dev_pm_opp *opp;
>
> rcu_read_lock();
> - for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
> -
> + cpufreq_for_each_entry(pos, freq_tbl) {
> opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
> - freq_tbl[i].frequency * 1000, true);
> + pos->frequency * 1000, true);
> if (IS_ERR(opp)) {
> rcu_read_unlock();
> dev_err(dvfs_info->dev,
> "failed to find valid OPP for %u KHZ\n",
> - freq_tbl[i].frequency);
> + pos->frequency);
> return PTR_ERR(opp);
> }
>
> - freq = freq_tbl[i].frequency / 1000; /* In MHZ */
> + freq = pos->frequency / 1000; /* In MHZ */
> clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK)
> << P0_7_CPUCLKDEV_SHIFT;
> clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK)
> @@ -157,7 +155,8 @@ static int init_div_table(void)
> tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT)
> | ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT));
>
> - __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i);
> + __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 *
> + (pos - freq_tbl));
> }
>
> rcu_read_unlock();
> @@ -166,8 +165,9 @@ static int init_div_table(void)
>
> static void exynos_enable_dvfs(unsigned int cur_frequency)
> {
> - unsigned int tmp, i, cpu;
> + unsigned int tmp, cpu;
> struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
> + struct cpufreq_frequency_table *pos;
> /* Disable DVFS */
> __raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL);
>
> @@ -182,15 +182,15 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
> __raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN);
>
> /* Set initial performance index */
> - for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
> - if (freq_table[i].frequency == cur_frequency)
> + cpufreq_for_each_entry(pos, freq_table)
> + if (pos->frequency == cur_frequency)
> break;
>
> - if (freq_table[i].frequency == CPUFREQ_TABLE_END) {
> + if (pos->frequency == CPUFREQ_TABLE_END) {
> dev_crit(dvfs_info->dev, "Boot up frequency not supported\n");
> /* Assign the highest frequency */
> - i = 0;
> - cur_frequency = freq_table[i].frequency;
> + pos = freq_table;
> + cur_frequency = pos->frequency;
> }
>
> dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ",
> @@ -199,7 +199,7 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
> for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) {
> tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
> tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT);
> - tmp |= (i << C0_3_PSTATE_NEW_SHIFT);
> + tmp |= ((pos - freq_table) << C0_3_PSTATE_NEW_SHIFT);
> __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
> }
>
> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
> index 08e7bbc..8e518c6 100644
> --- a/drivers/cpufreq/freq_table.c
> +++ b/drivers/cpufreq/freq_table.c
> @@ -21,22 +21,19 @@
> int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
> struct cpufreq_frequency_table *table)
> {
> + struct cpufreq_frequency_table *pos;
> unsigned int min_freq = ~0;
> unsigned int max_freq = 0;
> - unsigned int i;
> + unsigned int freq;
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID) {
> - pr_debug("table entry %u is invalid, skipping\n", i);
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
>
> - continue;
> - }
> if (!cpufreq_boost_enabled()
> - && (table[i].flags & CPUFREQ_BOOST_FREQ))
> + && (pos->flags & CPUFREQ_BOOST_FREQ))
> continue;
>
> - pr_debug("table entry %u: %u kHz\n", i, freq);
> + pr_debug("table entry %u: %u kHz\n", (int)(pos - table), freq);
> if (freq < min_freq)
> min_freq = freq;
> if (freq > max_freq)
> @@ -57,7 +54,8 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_cpuinfo);
> int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
> struct cpufreq_frequency_table *table)
> {
> - unsigned int next_larger = ~0, freq, i = 0;
> + struct cpufreq_frequency_table *pos;
> + unsigned int freq, next_larger = ~0;
> bool found = false;
>
> pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
> @@ -65,9 +63,9 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
>
> cpufreq_verify_within_cpu_limits(policy);
>
> - for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) {
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
> +
> if ((freq >= policy->min) && (freq <= policy->max)) {
> found = true;
> break;
> @@ -118,7 +116,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
> .driver_data = ~0,
> .frequency = 0,
> };
> - unsigned int i;
> + struct cpufreq_frequency_table *pos;
> + unsigned int freq, i = 0;
>
> pr_debug("request for target %u kHz (relation: %u) for cpu %u\n",
> target_freq, relation, policy->cpu);
> @@ -132,10 +131,10 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
> break;
> }
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
> +
> + i = pos - table;
> if ((freq < policy->min) || (freq > policy->max))
> continue;
> switch (relation) {
> @@ -184,8 +183,7 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target);
> int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
> unsigned int freq)
> {
> - struct cpufreq_frequency_table *table;
> - int i;
> + struct cpufreq_frequency_table *pos, *table;
>
> table = cpufreq_frequency_get_table(policy->cpu);
> if (unlikely(!table)) {
> @@ -193,10 +191,9 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
> return -ENOENT;
> }
>
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - if (table[i].frequency == freq)
> - return i;
> - }
> + cpufreq_for_each_valid_entry(pos, table)
> + if (pos->frequency == freq)
> + return pos - table;
>
> return -EINVAL;
> }
> @@ -208,16 +205,13 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index);
> static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
> bool show_boost)
> {
> - unsigned int i = 0;
> ssize_t count = 0;
> - struct cpufreq_frequency_table *table = policy->freq_table;
> + struct cpufreq_frequency_table *pos, *table = policy->freq_table;
>
> if (!table)
> return -ENODEV;
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> /*
> * show_boost = true and driver_data = BOOST freq
> * display BOOST freqs
> @@ -229,10 +223,10 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
> * show_boost = false and driver_data != BOOST freq
> * display NON BOOST freqs
> */
> - if (show_boost ^ (table[i].flags & CPUFREQ_BOOST_FREQ))
> + if (show_boost ^ (pos->flags & CPUFREQ_BOOST_FREQ))
> continue;
>
> - count += sprintf(&buf[count], "%d ", table[i].frequency);
> + count += sprintf(&buf[count], "%d ", pos->frequency);
> }
> count += sprintf(&buf[count], "\n");
>
> diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
> index d00e5d1..f4024d4 100644
> --- a/drivers/cpufreq/longhaul.c
> +++ b/drivers/cpufreq/longhaul.c
> @@ -528,6 +528,7 @@ static int longhaul_get_ranges(void)
>
> static void longhaul_setup_voltagescaling(void)
> {
> + struct cpufreq_frequency_table *freq_pos;
> union msr_longhaul longhaul;
> struct mV_pos minvid, maxvid, vid;
> unsigned int j, speed, pos, kHz_step, numvscales;
> @@ -606,18 +607,16 @@ static void longhaul_setup_voltagescaling(void)
> /* Calculate kHz for one voltage step */
> kHz_step = (highest_speed - min_vid_speed) / numvscales;
>
> - j = 0;
> - while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) {
> - speed = longhaul_table[j].frequency;
> + cpufreq_for_each_entry(freq_pos, longhaul_table) {
> + speed = freq_pos->frequency;
> if (speed > min_vid_speed)
> pos = (speed - min_vid_speed) / kHz_step + minvid.pos;
> else
> pos = minvid.pos;
> - longhaul_table[j].driver_data |= mV_vrm_table[pos] << 8;
> + freq_pos->driver_data |= mV_vrm_table[pos] << 8;
> vid = vrm_mV_table[mV_vrm_table[pos]];
> printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n",
> - speed, j, vid.mV);
> - j++;
> + speed, (int)(freq_pos - longhaul_table), vid.mV);
> }
>
> can_scale_voltage = 1;
> diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c
> index 84c84b5..35dd4d7 100644
> --- a/drivers/cpufreq/pasemi-cpufreq.c
> +++ b/drivers/cpufreq/pasemi-cpufreq.c
> @@ -136,9 +136,10 @@ void restore_astate(int cpu)
>
> static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> const u32 *max_freqp;
> u32 max_freq;
> - int i, cur_astate;
> + int cur_astate;
> struct resource res;
> struct device_node *cpu, *dn;
> int err = -ENODEV;
> @@ -197,10 +198,9 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
> pr_debug("initializing frequency table\n");
>
> /* initialize frequency table */
> - for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
> - pas_freqs[i].frequency =
> - get_astate_freq(pas_freqs[i].driver_data) * 100000;
> - pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
> + cpufreq_for_each_entry(pos, pas_freqs) {
> + pos->frequency = get_astate_freq(pos->driver_data) * 100000;
> + pr_debug("%d: %d\n", (int)(pos - pas_freqs), pos->frequency);
> }
>
> cur_astate = get_cur_astate(policy->cpu);
> diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
> index 49f120e..a133236 100644
> --- a/drivers/cpufreq/powernow-k6.c
> +++ b/drivers/cpufreq/powernow-k6.c
> @@ -159,6 +159,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
>
> static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> unsigned int i, f;
> unsigned khz;
>
> @@ -176,12 +177,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
> }
> }
> if (param_max_multiplier) {
> - for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (clock_ratio[i].driver_data == param_max_multiplier) {
> + cpufreq_for_each_entry(pos, clock_ratio)
> + if (pos->driver_data == param_max_multiplier) {
> max_multiplier = param_max_multiplier;
> goto have_max_multiplier;
> }
> - }
> printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n");
> return -EINVAL;
> }
> @@ -209,12 +209,12 @@ have_busfreq:
> param_busfreq = busfreq * 10;
>
> /* table init */
> - for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
> - f = clock_ratio[i].driver_data;
> + cpufreq_for_each_entry(pos, clock_ratio) {
> + f = pos->driver_data;
> if (f > max_multiplier)
> - clock_ratio[i].frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> else
> - clock_ratio[i].frequency = busfreq * f;
> + pos->frequency = busfreq * f;
> }
>
> /* cpuinfo and default policy values */
> diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c
> index 5be8a48..5a4c5a6 100644
> --- a/drivers/cpufreq/ppc_cbe_cpufreq.c
> +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c
> @@ -67,9 +67,10 @@ static int set_pmode(unsigned int cpu, unsigned int slow_mode)
>
> static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> const u32 *max_freqp;
> u32 max_freq;
> - int i, cur_pmode;
> + int cur_pmode;
> struct device_node *cpu;
>
> cpu = of_get_cpu_node(policy->cpu, NULL);
> @@ -102,9 +103,9 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
> pr_debug("initializing frequency table\n");
>
> /* initialize frequency table */
> - for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
> - cbe_freqs[i].frequency = max_freq / cbe_freqs[i].driver_data;
> - pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
> + cpufreq_for_each_entry(pos, cbe_freqs) {
> + pos->frequency = max_freq / pos->driver_data;
> + pr_debug("%d: %d\n", (int)(pos - cbe_freqs), pos->frequency);
> }
>
> /* if DEBUG is enabled set_pmode() measures the latency
> diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
> index 4626f90..2fd53ea 100644
> --- a/drivers/cpufreq/s3c2416-cpufreq.c
> +++ b/drivers/cpufreq/s3c2416-cpufreq.c
> @@ -266,7 +266,7 @@ out:
> static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
> {
> int count, v, i, found;
> - struct cpufreq_frequency_table *freq;
> + struct cpufreq_frequency_table *pos;
> struct s3c2416_dvfs *dvfs;
>
> count = regulator_count_voltages(s3c_freq->vddarm);
> @@ -275,12 +275,11 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
> return;
> }
>
> - freq = s3c_freq->freq_table;
> - while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
> - if (freq->frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + if (!count)
> + goto out;
>
> - dvfs = &s3c2416_dvfs_table[freq->driver_data];
> + cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) {
> + dvfs = &s3c2416_dvfs_table[pos->driver_data];
> found = 0;
>
> /* Check only the min-voltage, more is always ok on S3C2416 */
> @@ -292,13 +291,12 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
>
> if (!found) {
> pr_debug("cpufreq: %dkHz unsupported by regulator\n",
> - freq->frequency);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> +out:
> /* Guessed */
> s3c_freq->regulator_latency = 1 * 1000 * 1000;
> }
> @@ -338,7 +336,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
> static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
> {
> struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
> - struct cpufreq_frequency_table *freq;
> + struct cpufreq_frequency_table *pos;
> struct clk *msysclk;
> unsigned long rate;
> int ret;
> @@ -427,31 +425,27 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
> s3c_freq->regulator_latency = 0;
> #endif
>
> - freq = s3c_freq->freq_table;
> - while (freq->frequency != CPUFREQ_TABLE_END) {
> + cpufreq_for_each_entry(pos, s3c_freq->freq_table) {
> /* special handling for dvs mode */
> - if (freq->driver_data == 0) {
> + if (pos->driver_data == 0) {
> if (!s3c_freq->hclk) {
> pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
> - freq->frequency);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> } else {
> - freq++;
> continue;
> }
> }
>
> /* Check for frequencies we can generate */
> rate = clk_round_rate(s3c_freq->armdiv,
> - freq->frequency * 1000);
> + pos->frequency * 1000);
> rate /= 1000;
> - if (rate != freq->frequency) {
> + if (rate != pos->frequency) {
> pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n",
> - freq->frequency, rate);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency, rate);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> /* Datasheet says PLL stabalisation time must be at least 300us,
> diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c
> index ff7d3ec..176e84c 100644
> --- a/drivers/cpufreq/s3c64xx-cpufreq.c
> +++ b/drivers/cpufreq/s3c64xx-cpufreq.c
> @@ -118,11 +118,10 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
> pr_err("Unable to check supported voltages\n");
> }
>
> - freq = s3c64xx_freq_table;
> - while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
> - if (freq->frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + if (!count)
> + goto out;
>
> + cpufreq_for_each_valid_entry(freq, s3c64xx_freq_table) {
> dvfs = &s3c64xx_dvfs_table[freq->driver_data];
> found = 0;
>
> @@ -137,10 +136,9 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
> freq->frequency);
> freq->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> +out:
> /* Guess based on having to do an I2C/SPI write; in future we
> * will be able to query the regulator performance here. */
> regulator_latency = 1 * 1000 * 1000;
> @@ -179,8 +177,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
> }
> #endif
>
> - freq = s3c64xx_freq_table;
> - while (freq->frequency != CPUFREQ_TABLE_END) {
> + cpufreq_for_each_entry(freq, s3c64xx_freq_table) {
> unsigned long r;
>
> /* Check for frequencies we can generate */
> @@ -196,8 +193,6 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
> * frequency is the maximum we can support. */
> if (!vddarm && freq->frequency > clk_get_rate(policy->clk) / 1000)
> freq->frequency = CPUFREQ_ENTRY_INVALID;
> -
> - freq++;
> }
>
> /* Datasheet says PLL stabalisation time (if we were to use
> --
> 1.9.0
^ permalink raw reply
* Re: [PATCH 00/13] Refactor pci_is_brdige() to simplify code
From: Yijing Wang @ 2014-04-26 2:49 UTC (permalink / raw)
To: David Laight, Bjorn Helgaas
Cc: Tony Luck, linux-ia64@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,
Thomas Gleixner, linuxppc-dev@lists.ozlabs.org, David S. Miller
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D0F6FEEB0@AcuExch.aculab.com>
On 2014/4/25 17:42, David Laight wrote:
> From: Yijing Wang
>> This patchset rename the current pci_is_bridge() to pci_has_subordinate(),
>> and introduce a new pci_is_bridge() which determine pci bridge by check
>> dev->hdr_type. The new one is more accurate. PCIe Spec define the pci
>> device is a bridge by the dev->hdr_type = 0x01 || 0x02.
>
> That is a dangerous rename and is likely to cause difficult to
Hi David,
I renamed pci_is_bridge() to pci_has_subordinate() because
static inline bool pci_is_bridge(struct pci_dev *pci_dev)
{
return !!(pci_dev->subordinate);
}
which always check dev->subordinate.
> identify bugs in any code you've missed.
What are you referring to ?
Thanks!
Yijing.
>
> David
>
> \x04�{.n�+�������+%��lzwm��b�맲��r��zX��\x19\x1e�w��{ay�\x1dʇڙ�,j\a��f���h���z�\x1e�w���\f���j:+v���w�j�m����\a����zZ+�����ݢj"��!�iO��z��v�^\x14\x04\x1a�^[m����\vnƊ��Y&�
>
--
Thanks!
Yijing
^ permalink raw reply
* Re: [PATCH 2/3] powerpc, ptrace: Add new ptrace request macros for transactional memory
From: Pedro Alves @ 2014-04-25 23:42 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: mikey, avagin, oleg, linux-kernel, linuxppc-dev
In-Reply-To: <1396422144-11032-3-git-send-email-khandual@linux.vnet.ibm.com>
On 04/02/2014 08:02 AM, Anshuman Khandual wrote:
> This patch adds following new sets of ptrace request macros for transactional
> memory expanding the existing ptrace ABI on PowerPC.
>
> /* TM special purpose registers */
> PTRACE_GETTM_SPRREGS
> PTRACE_SETTM_SPRREGS
>
> /* TM checkpointed GPR registers */
> PTRACE_GETTM_CGPRREGS
> PTRACE_SETTM_CGPRREGS
>
> /* TM checkpointed FPR registers */
> PTRACE_GETTM_CFPRREGS
> PTRACE_SETTM_CFPRREGS
>
> /* TM checkpointed VMX registers */
> PTRACE_GETTM_CVMXREGS
> PTRACE_SETTM_CVMXREGS
Urgh, we're _still_ adding specialized register specific calls?
Why aren't these exported as new register sets, accessible through
PTRACE_GETREGSET / PTRACE_SETREGSET? That's supposed to be the
Modern Way to do things.
--
Pedro Alves
^ permalink raw reply
* Re: [PATCH v2 1/2] powerpc/pm: add api to get suspend state which is STANDBY or MEM
From: Scott Wood @ 2014-04-25 21:45 UTC (permalink / raw)
To: Dongsheng Wang; +Cc: linuxppc-dev, chenhui.zhao, jason.jin
In-Reply-To: <1398319908-30166-1-git-send-email-dongsheng.wang@freescale.com>
On Thu, 2014-04-24 at 14:11 +0800, Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> Add set_pm_suspend_state & pm_suspend_state functions to set/get
> suspend state. When system going to sleep or deep sleep, devices
> can get the system suspend state(STANDBY/MEM) through pm_suspend_state
> function and to handle different situations.
>
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
> ---
> *v2*
> Move pm api from fsl platform to powerpc general framework.
What is powerpc-specific about this?
-Scott
^ permalink raw reply
* [PATCH v5 2/8] cpufreq: Use cpufreq_for_each_* macros for frequency table iteration
From: Stratos Karafotis @ 2014-04-25 20:15 UTC (permalink / raw)
To: Rafael J. Wysocki, Viresh Kumar
Cc: Kukjin Kim, linux-pm, LKML, cpufreq@vger.kernel.org,
Prabhakar Lad, linux-samsung-soc, Sudeep Holla, Olof Johansson,
linuxppc-dev, linux-arm-kernel@lists.infradead.org
The cpufreq core now supports the cpufreq_for_each_entry and
cpufreq_for_each_valid_entry macros helpers for iteration over the
cpufreq_frequency_table, so use them.
It should have no functional changes.
Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
---
drivers/cpufreq/acpi-cpufreq.c | 9 +++---
drivers/cpufreq/arm_big_little.c | 16 +++++------
drivers/cpufreq/cpufreq_stats.c | 24 ++++++----------
drivers/cpufreq/dbx500-cpufreq.c | 8 ++----
drivers/cpufreq/elanfreq.c | 9 +++---
drivers/cpufreq/exynos-cpufreq.c | 11 ++++---
drivers/cpufreq/exynos5440-cpufreq.c | 30 +++++++++----------
drivers/cpufreq/freq_table.c | 56 ++++++++++++++++--------------------
drivers/cpufreq/longhaul.c | 11 ++++---
drivers/cpufreq/pasemi-cpufreq.c | 10 +++----
drivers/cpufreq/powernow-k6.c | 14 ++++-----
drivers/cpufreq/ppc_cbe_cpufreq.c | 9 +++---
drivers/cpufreq/s3c2416-cpufreq.c | 40 +++++++++++---------------
drivers/cpufreq/s3c64xx-cpufreq.c | 15 ++++------
14 files changed, 116 insertions(+), 146 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 000e4e0..b0c18ed 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -213,7 +213,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
{
- int i;
+ struct cpufreq_frequency_table *pos;
struct acpi_processor_performance *perf;
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
@@ -223,10 +223,9 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
perf = data->acpi_data;
- for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
- if (msr == perf->states[data->freq_table[i].driver_data].status)
- return data->freq_table[i].frequency;
- }
+ cpufreq_for_each_entry(pos, data->freq_table)
+ if (msr == perf->states[pos->driver_data].status)
+ return pos->frequency;
return data->freq_table[0].frequency;
}
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index bad2ed3..1f4d4e3 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -226,22 +226,22 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table)
/* get the minimum frequency in the cpufreq_frequency_table */
static inline u32 get_table_min(struct cpufreq_frequency_table *table)
{
- int i;
+ struct cpufreq_frequency_table *pos;
uint32_t min_freq = ~0;
- for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
- if (table[i].frequency < min_freq)
- min_freq = table[i].frequency;
+ cpufreq_for_each_entry(pos, table)
+ if (pos->frequency < min_freq)
+ min_freq = pos->frequency;
return min_freq;
}
/* get the maximum frequency in the cpufreq_frequency_table */
static inline u32 get_table_max(struct cpufreq_frequency_table *table)
{
- int i;
+ struct cpufreq_frequency_table *pos;
uint32_t max_freq = 0;
- for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
- if (table[i].frequency > max_freq)
- max_freq = table[i].frequency;
+ cpufreq_for_each_entry(pos, table)
+ if (pos->frequency > max_freq)
+ max_freq = pos->frequency;
return max_freq;
}
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index ecaaebf..0cd9b4d 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -182,11 +182,11 @@ static void cpufreq_stats_free_table(unsigned int cpu)
static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
{
- unsigned int i, j, count = 0, ret = 0;
+ unsigned int i, count = 0, ret = 0;
struct cpufreq_stats *stat;
unsigned int alloc_size;
unsigned int cpu = policy->cpu;
- struct cpufreq_frequency_table *table;
+ struct cpufreq_frequency_table *pos, *table;
table = cpufreq_frequency_get_table(cpu);
if (unlikely(!table))
@@ -205,12 +205,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
stat->cpu = cpu;
per_cpu(cpufreq_stats_table, cpu) = stat;
- for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
- unsigned int freq = table[i].frequency;
- if (freq == CPUFREQ_ENTRY_INVALID)
- continue;
+ cpufreq_for_each_valid_entry(pos, table)
count++;
- }
alloc_size = count * sizeof(int) + count * sizeof(u64);
@@ -228,15 +224,11 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
stat->trans_table = stat->freq_table + count;
#endif
- j = 0;
- for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
- unsigned int freq = table[i].frequency;
- if (freq == CPUFREQ_ENTRY_INVALID)
- continue;
- if (freq_table_get_index(stat, freq) == -1)
- stat->freq_table[j++] = freq;
- }
- stat->state_num = j;
+ i = 0;
+ cpufreq_for_each_valid_entry(pos, table)
+ if (freq_table_get_index(stat, pos->frequency) == -1)
+ stat->freq_table[i++] = pos->frequency;
+ stat->state_num = i;
spin_lock(&cpufreq_stats_lock);
stat->last_time = get_jiffies_64();
stat->last_index = freq_table_get_index(stat, policy->cur);
diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
index 412a78b..4bebc1b 100644
--- a/drivers/cpufreq/dbx500-cpufreq.c
+++ b/drivers/cpufreq/dbx500-cpufreq.c
@@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
static int dbx500_cpufreq_probe(struct platform_device *pdev)
{
- int i = 0;
+ struct cpufreq_frequency_table *pos;
freq_table = dev_get_platdata(&pdev->dev);
if (!freq_table) {
@@ -60,10 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev)
}
pr_info("dbx500-cpufreq: Available frequencies:\n");
- while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
- pr_info(" %d Mhz\n", freq_table[i].frequency/1000);
- i++;
- }
+ cpufreq_for_each_entry(pos, freq_table)
+ pr_info(" %d Mhz\n", pos->frequency / 1000);
return cpufreq_register_driver(&dbx500_cpufreq_driver);
}
diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
index 7f5d2a6..1c06e78 100644
--- a/drivers/cpufreq/elanfreq.c
+++ b/drivers/cpufreq/elanfreq.c
@@ -147,7 +147,7 @@ static int elanfreq_target(struct cpufreq_policy *policy,
static int elanfreq_cpu_init(struct cpufreq_policy *policy)
{
struct cpuinfo_x86 *c = &cpu_data(0);
- unsigned int i;
+ struct cpufreq_frequency_table *pos;
/* capability check */
if ((c->x86_vendor != X86_VENDOR_AMD) ||
@@ -159,10 +159,9 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
max_freq = elanfreq_get_cpu_frequency(0);
/* table init */
- for (i = 0; (elanfreq_table[i].frequency != CPUFREQ_TABLE_END); i++) {
- if (elanfreq_table[i].frequency > max_freq)
- elanfreq_table[i].frequency = CPUFREQ_ENTRY_INVALID;
- }
+ cpufreq_for_each_entry(pos, elanfreq_table)
+ if (pos->frequency > max_freq)
+ pos->frequency = CPUFREQ_ENTRY_INVALID;
/* cpuinfo and default policy values */
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index f99cfe2..9c13255 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -29,17 +29,16 @@ static unsigned int locking_frequency;
static int exynos_cpufreq_get_index(unsigned int freq)
{
struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
- int index;
+ struct cpufreq_frequency_table *pos;
- for (index = 0;
- freq_table[index].frequency != CPUFREQ_TABLE_END; index++)
- if (freq_table[index].frequency == freq)
+ cpufreq_for_each_entry(pos, freq_table)
+ if (pos->frequency == freq)
break;
- if (freq_table[index].frequency == CPUFREQ_TABLE_END)
+ if (pos->frequency == CPUFREQ_TABLE_END)
return -EINVAL;
- return index;
+ return pos - freq_table;
}
static int exynos_cpufreq_scale(unsigned int target_freq)
diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c
index a6b8214..f33f25b 100644
--- a/drivers/cpufreq/exynos5440-cpufreq.c
+++ b/drivers/cpufreq/exynos5440-cpufreq.c
@@ -114,25 +114,23 @@ static struct cpufreq_freqs freqs;
static int init_div_table(void)
{
- struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
+ struct cpufreq_frequency_table *pos, *freq_tbl = dvfs_info->freq_table;
unsigned int tmp, clk_div, ema_div, freq, volt_id;
- int i = 0;
struct dev_pm_opp *opp;
rcu_read_lock();
- for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
-
+ cpufreq_for_each_entry(pos, freq_tbl) {
opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
- freq_tbl[i].frequency * 1000, true);
+ pos->frequency * 1000, true);
if (IS_ERR(opp)) {
rcu_read_unlock();
dev_err(dvfs_info->dev,
"failed to find valid OPP for %u KHZ\n",
- freq_tbl[i].frequency);
+ pos->frequency);
return PTR_ERR(opp);
}
- freq = freq_tbl[i].frequency / 1000; /* In MHZ */
+ freq = pos->frequency / 1000; /* In MHZ */
clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK)
<< P0_7_CPUCLKDEV_SHIFT;
clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK)
@@ -157,7 +155,8 @@ static int init_div_table(void)
tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT)
| ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT));
- __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i);
+ __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 *
+ (pos - freq_tbl));
}
rcu_read_unlock();
@@ -166,8 +165,9 @@ static int init_div_table(void)
static void exynos_enable_dvfs(unsigned int cur_frequency)
{
- unsigned int tmp, i, cpu;
+ unsigned int tmp, cpu;
struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
+ struct cpufreq_frequency_table *pos;
/* Disable DVFS */
__raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL);
@@ -182,15 +182,15 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
__raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN);
/* Set initial performance index */
- for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
- if (freq_table[i].frequency == cur_frequency)
+ cpufreq_for_each_entry(pos, freq_table)
+ if (pos->frequency == cur_frequency)
break;
- if (freq_table[i].frequency == CPUFREQ_TABLE_END) {
+ if (pos->frequency == CPUFREQ_TABLE_END) {
dev_crit(dvfs_info->dev, "Boot up frequency not supported\n");
/* Assign the highest frequency */
- i = 0;
- cur_frequency = freq_table[i].frequency;
+ pos = freq_table;
+ cur_frequency = pos->frequency;
}
dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ",
@@ -199,7 +199,7 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) {
tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT);
- tmp |= (i << C0_3_PSTATE_NEW_SHIFT);
+ tmp |= ((pos - freq_table) << C0_3_PSTATE_NEW_SHIFT);
__raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
}
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index 08e7bbc..8e518c6 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -21,22 +21,19 @@
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table)
{
+ struct cpufreq_frequency_table *pos;
unsigned int min_freq = ~0;
unsigned int max_freq = 0;
- unsigned int i;
+ unsigned int freq;
- for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
- unsigned int freq = table[i].frequency;
- if (freq == CPUFREQ_ENTRY_INVALID) {
- pr_debug("table entry %u is invalid, skipping\n", i);
+ cpufreq_for_each_valid_entry(pos, table) {
+ freq = pos->frequency;
- continue;
- }
if (!cpufreq_boost_enabled()
- && (table[i].flags & CPUFREQ_BOOST_FREQ))
+ && (pos->flags & CPUFREQ_BOOST_FREQ))
continue;
- pr_debug("table entry %u: %u kHz\n", i, freq);
+ pr_debug("table entry %u: %u kHz\n", (int)(pos - table), freq);
if (freq < min_freq)
min_freq = freq;
if (freq > max_freq)
@@ -57,7 +54,8 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_cpuinfo);
int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
struct cpufreq_frequency_table *table)
{
- unsigned int next_larger = ~0, freq, i = 0;
+ struct cpufreq_frequency_table *pos;
+ unsigned int freq, next_larger = ~0;
bool found = false;
pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
@@ -65,9 +63,9 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
cpufreq_verify_within_cpu_limits(policy);
- for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) {
- if (freq == CPUFREQ_ENTRY_INVALID)
- continue;
+ cpufreq_for_each_valid_entry(pos, table) {
+ freq = pos->frequency;
+
if ((freq >= policy->min) && (freq <= policy->max)) {
found = true;
break;
@@ -118,7 +116,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
.driver_data = ~0,
.frequency = 0,
};
- unsigned int i;
+ struct cpufreq_frequency_table *pos;
+ unsigned int freq, i = 0;
pr_debug("request for target %u kHz (relation: %u) for cpu %u\n",
target_freq, relation, policy->cpu);
@@ -132,10 +131,10 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
break;
}
- for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
- unsigned int freq = table[i].frequency;
- if (freq == CPUFREQ_ENTRY_INVALID)
- continue;
+ cpufreq_for_each_valid_entry(pos, table) {
+ freq = pos->frequency;
+
+ i = pos - table;
if ((freq < policy->min) || (freq > policy->max))
continue;
switch (relation) {
@@ -184,8 +183,7 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target);
int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
unsigned int freq)
{
- struct cpufreq_frequency_table *table;
- int i;
+ struct cpufreq_frequency_table *pos, *table;
table = cpufreq_frequency_get_table(policy->cpu);
if (unlikely(!table)) {
@@ -193,10 +191,9 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
return -ENOENT;
}
- for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
- if (table[i].frequency == freq)
- return i;
- }
+ cpufreq_for_each_valid_entry(pos, table)
+ if (pos->frequency == freq)
+ return pos - table;
return -EINVAL;
}
@@ -208,16 +205,13 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index);
static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
bool show_boost)
{
- unsigned int i = 0;
ssize_t count = 0;
- struct cpufreq_frequency_table *table = policy->freq_table;
+ struct cpufreq_frequency_table *pos, *table = policy->freq_table;
if (!table)
return -ENODEV;
- for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
- if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
- continue;
+ cpufreq_for_each_valid_entry(pos, table) {
/*
* show_boost = true and driver_data = BOOST freq
* display BOOST freqs
@@ -229,10 +223,10 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
* show_boost = false and driver_data != BOOST freq
* display NON BOOST freqs
*/
- if (show_boost ^ (table[i].flags & CPUFREQ_BOOST_FREQ))
+ if (show_boost ^ (pos->flags & CPUFREQ_BOOST_FREQ))
continue;
- count += sprintf(&buf[count], "%d ", table[i].frequency);
+ count += sprintf(&buf[count], "%d ", pos->frequency);
}
count += sprintf(&buf[count], "\n");
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index d00e5d1..f4024d4 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -528,6 +528,7 @@ static int longhaul_get_ranges(void)
static void longhaul_setup_voltagescaling(void)
{
+ struct cpufreq_frequency_table *freq_pos;
union msr_longhaul longhaul;
struct mV_pos minvid, maxvid, vid;
unsigned int j, speed, pos, kHz_step, numvscales;
@@ -606,18 +607,16 @@ static void longhaul_setup_voltagescaling(void)
/* Calculate kHz for one voltage step */
kHz_step = (highest_speed - min_vid_speed) / numvscales;
- j = 0;
- while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) {
- speed = longhaul_table[j].frequency;
+ cpufreq_for_each_entry(freq_pos, longhaul_table) {
+ speed = freq_pos->frequency;
if (speed > min_vid_speed)
pos = (speed - min_vid_speed) / kHz_step + minvid.pos;
else
pos = minvid.pos;
- longhaul_table[j].driver_data |= mV_vrm_table[pos] << 8;
+ freq_pos->driver_data |= mV_vrm_table[pos] << 8;
vid = vrm_mV_table[mV_vrm_table[pos]];
printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n",
- speed, j, vid.mV);
- j++;
+ speed, (int)(freq_pos - longhaul_table), vid.mV);
}
can_scale_voltage = 1;
diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c
index 84c84b5..35dd4d7 100644
--- a/drivers/cpufreq/pasemi-cpufreq.c
+++ b/drivers/cpufreq/pasemi-cpufreq.c
@@ -136,9 +136,10 @@ void restore_astate(int cpu)
static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
+ struct cpufreq_frequency_table *pos;
const u32 *max_freqp;
u32 max_freq;
- int i, cur_astate;
+ int cur_astate;
struct resource res;
struct device_node *cpu, *dn;
int err = -ENODEV;
@@ -197,10 +198,9 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
pr_debug("initializing frequency table\n");
/* initialize frequency table */
- for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
- pas_freqs[i].frequency =
- get_astate_freq(pas_freqs[i].driver_data) * 100000;
- pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
+ cpufreq_for_each_entry(pos, pas_freqs) {
+ pos->frequency = get_astate_freq(pos->driver_data) * 100000;
+ pr_debug("%d: %d\n", (int)(pos - pas_freqs), pos->frequency);
}
cur_astate = get_cur_astate(policy->cpu);
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
index 49f120e..a133236 100644
--- a/drivers/cpufreq/powernow-k6.c
+++ b/drivers/cpufreq/powernow-k6.c
@@ -159,6 +159,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
{
+ struct cpufreq_frequency_table *pos;
unsigned int i, f;
unsigned khz;
@@ -176,12 +177,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
}
}
if (param_max_multiplier) {
- for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
- if (clock_ratio[i].driver_data == param_max_multiplier) {
+ cpufreq_for_each_entry(pos, clock_ratio)
+ if (pos->driver_data == param_max_multiplier) {
max_multiplier = param_max_multiplier;
goto have_max_multiplier;
}
- }
printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n");
return -EINVAL;
}
@@ -209,12 +209,12 @@ have_busfreq:
param_busfreq = busfreq * 10;
/* table init */
- for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
- f = clock_ratio[i].driver_data;
+ cpufreq_for_each_entry(pos, clock_ratio) {
+ f = pos->driver_data;
if (f > max_multiplier)
- clock_ratio[i].frequency = CPUFREQ_ENTRY_INVALID;
+ pos->frequency = CPUFREQ_ENTRY_INVALID;
else
- clock_ratio[i].frequency = busfreq * f;
+ pos->frequency = busfreq * f;
}
/* cpuinfo and default policy values */
diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c
index 5be8a48..5a4c5a6 100644
--- a/drivers/cpufreq/ppc_cbe_cpufreq.c
+++ b/drivers/cpufreq/ppc_cbe_cpufreq.c
@@ -67,9 +67,10 @@ static int set_pmode(unsigned int cpu, unsigned int slow_mode)
static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
+ struct cpufreq_frequency_table *pos;
const u32 *max_freqp;
u32 max_freq;
- int i, cur_pmode;
+ int cur_pmode;
struct device_node *cpu;
cpu = of_get_cpu_node(policy->cpu, NULL);
@@ -102,9 +103,9 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
pr_debug("initializing frequency table\n");
/* initialize frequency table */
- for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
- cbe_freqs[i].frequency = max_freq / cbe_freqs[i].driver_data;
- pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
+ cpufreq_for_each_entry(pos, cbe_freqs) {
+ pos->frequency = max_freq / pos->driver_data;
+ pr_debug("%d: %d\n", (int)(pos - cbe_freqs), pos->frequency);
}
/* if DEBUG is enabled set_pmode() measures the latency
diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
index 4626f90..2fd53ea 100644
--- a/drivers/cpufreq/s3c2416-cpufreq.c
+++ b/drivers/cpufreq/s3c2416-cpufreq.c
@@ -266,7 +266,7 @@ out:
static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
{
int count, v, i, found;
- struct cpufreq_frequency_table *freq;
+ struct cpufreq_frequency_table *pos;
struct s3c2416_dvfs *dvfs;
count = regulator_count_voltages(s3c_freq->vddarm);
@@ -275,12 +275,11 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
return;
}
- freq = s3c_freq->freq_table;
- while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
- if (freq->frequency == CPUFREQ_ENTRY_INVALID)
- continue;
+ if (!count)
+ goto out;
- dvfs = &s3c2416_dvfs_table[freq->driver_data];
+ cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) {
+ dvfs = &s3c2416_dvfs_table[pos->driver_data];
found = 0;
/* Check only the min-voltage, more is always ok on S3C2416 */
@@ -292,13 +291,12 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
if (!found) {
pr_debug("cpufreq: %dkHz unsupported by regulator\n",
- freq->frequency);
- freq->frequency = CPUFREQ_ENTRY_INVALID;
+ pos->frequency);
+ pos->frequency = CPUFREQ_ENTRY_INVALID;
}
-
- freq++;
}
+out:
/* Guessed */
s3c_freq->regulator_latency = 1 * 1000 * 1000;
}
@@ -338,7 +336,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
{
struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
- struct cpufreq_frequency_table *freq;
+ struct cpufreq_frequency_table *pos;
struct clk *msysclk;
unsigned long rate;
int ret;
@@ -427,31 +425,27 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
s3c_freq->regulator_latency = 0;
#endif
- freq = s3c_freq->freq_table;
- while (freq->frequency != CPUFREQ_TABLE_END) {
+ cpufreq_for_each_entry(pos, s3c_freq->freq_table) {
/* special handling for dvs mode */
- if (freq->driver_data == 0) {
+ if (pos->driver_data == 0) {
if (!s3c_freq->hclk) {
pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
- freq->frequency);
- freq->frequency = CPUFREQ_ENTRY_INVALID;
+ pos->frequency);
+ pos->frequency = CPUFREQ_ENTRY_INVALID;
} else {
- freq++;
continue;
}
}
/* Check for frequencies we can generate */
rate = clk_round_rate(s3c_freq->armdiv,
- freq->frequency * 1000);
+ pos->frequency * 1000);
rate /= 1000;
- if (rate != freq->frequency) {
+ if (rate != pos->frequency) {
pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n",
- freq->frequency, rate);
- freq->frequency = CPUFREQ_ENTRY_INVALID;
+ pos->frequency, rate);
+ pos->frequency = CPUFREQ_ENTRY_INVALID;
}
-
- freq++;
}
/* Datasheet says PLL stabalisation time must be at least 300us,
diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c
index ff7d3ec..176e84c 100644
--- a/drivers/cpufreq/s3c64xx-cpufreq.c
+++ b/drivers/cpufreq/s3c64xx-cpufreq.c
@@ -118,11 +118,10 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
pr_err("Unable to check supported voltages\n");
}
- freq = s3c64xx_freq_table;
- while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
- if (freq->frequency == CPUFREQ_ENTRY_INVALID)
- continue;
+ if (!count)
+ goto out;
+ cpufreq_for_each_valid_entry(freq, s3c64xx_freq_table) {
dvfs = &s3c64xx_dvfs_table[freq->driver_data];
found = 0;
@@ -137,10 +136,9 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
freq->frequency);
freq->frequency = CPUFREQ_ENTRY_INVALID;
}
-
- freq++;
}
+out:
/* Guess based on having to do an I2C/SPI write; in future we
* will be able to query the regulator performance here. */
regulator_latency = 1 * 1000 * 1000;
@@ -179,8 +177,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
}
#endif
- freq = s3c64xx_freq_table;
- while (freq->frequency != CPUFREQ_TABLE_END) {
+ cpufreq_for_each_entry(freq, s3c64xx_freq_table) {
unsigned long r;
/* Check for frequencies we can generate */
@@ -196,8 +193,6 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
* frequency is the maximum we can support. */
if (!vddarm && freq->frequency > clk_get_rate(policy->clk) / 1000)
freq->frequency = CPUFREQ_ENTRY_INVALID;
-
- freq++;
}
/* Datasheet says PLL stabalisation time (if we were to use
--
1.9.0
^ permalink raw reply related
* Re: [PATCH] PCI/hotplug/rphahp: Fix endianess issues
From: Bjorn Helgaas @ 2014-04-25 17:50 UTC (permalink / raw)
To: Laurent Dufour; +Cc: linux-pci, linuxppc-dev, mdroth
In-Reply-To: <20140410130213.8435.16459.stgit@nimbus>
On Thu, Apr 10, 2014 at 03:02:13PM +0200, Laurent Dufour wrote:
> Numerical values stored in the device tree are encoded in Big Endian and
> should be byte swapped when running in Little Endian.
>
> RPA hot plug module should convert those values as well.
>
> Note that in rpaphp_get_drc_props the comparison between indexes[i+1] and
> *index is done using the BE values (whatever is the current endianess).
> This doesn't matter since we are checking for equality here. This way only
> the returned value is byte swapped.
>
> RPA also made RTAS calls which implies BE values to be used. According to
> the patch done in RTAS (http://patchwork.ozlabs.org/patch/336865), no
> additional conversion is required in RPA.
>
> Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
I applied this to pci/hotplug for v3.16, thanks!
> ---
> drivers/pci/hotplug/rpaphp_core.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index 4796c15..984d708 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -223,16 +223,16 @@ int rpaphp_get_drc_props(struct device_node *dn, int *drc_index,
> type_tmp = (char *) &types[1];
>
> /* Iterate through parent properties, looking for my-drc-index */
> - for (i = 0; i < indexes[0]; i++) {
> + for (i = 0; i < be32_to_cpu(indexes[0]); i++) {
> if ((unsigned int) indexes[i + 1] == *my_index) {
> if (drc_name)
> *drc_name = name_tmp;
> if (drc_type)
> *drc_type = type_tmp;
> if (drc_index)
> - *drc_index = *my_index;
> + *drc_index = be32_to_cpu(*my_index);
> if (drc_power_domain)
> - *drc_power_domain = domains[i+1];
> + *drc_power_domain = be32_to_cpu(domains[i+1]);
> return 0;
> }
> name_tmp += (strlen(name_tmp) + 1);
> @@ -321,16 +321,19 @@ int rpaphp_add_slot(struct device_node *dn)
> /* register PCI devices */
> name = (char *) &names[1];
> type = (char *) &types[1];
> - for (i = 0; i < indexes[0]; i++) {
> + for (i = 0; i < be32_to_cpu(indexes[0]); i++) {
> + int index;
>
> - slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]);
> + index = be32_to_cpu(indexes[i + 1]);
> + slot = alloc_slot_struct(dn, index, name,
> + be32_to_cpu(power_domains[i + 1]));
> if (!slot)
> return -ENOMEM;
>
> slot->type = simple_strtoul(type, NULL, 10);
>
> dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
> - indexes[i + 1], name, type);
> + index, name, type);
>
> retval = rpaphp_enable_slot(slot);
> if (!retval)
>
^ permalink raw reply
* Re: [PATCH 07/13] sparc/PCI: Use new pci_is_bridge() to simplify code
From: David Miller @ 2014-04-25 16:49 UTC (permalink / raw)
To: wangyijing
Cc: tony.luck, linux-ia64, x86, linux-kernel, sparclinux, bhelgaas,
tglx, linuxppc-dev
In-Reply-To: <1398417515-8740-8-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Fri, 25 Apr 2014 17:18:29 +0800
> Now we can use new pci_is_bridge() helper function
> to simplify code.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Acked-by: David S. Miller <davem@davemloft.net>
^ permalink raw reply
* Re: [PATCH v4 2/8] cpufreq: Use cpufreq_for_each_* macros for frequency table iteration
From: Stratos Karafotis @ 2014-04-25 15:11 UTC (permalink / raw)
To: Prabhakar Lad
Cc: Kukjin Kim, linux-pm, Viresh Kumar, Rafael J. Wysocki, LKML,
cpufreq@vger.kernel.org, linux-samsung-soc, Sudeep Holla,
Olof Johansson, linuxppc-dev,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <CA+V-a8swMCPkf=rwbLOjiqAgpaQ7TZPutTQTh_sSFmbJvHz-1Q@mail.gmail.com>
Hi Prabhakar,
On 25/04/2014 03:31 μμ, Prabhakar Lad wrote:
> Hi Stratos,
>
> Thanks for the patch.
>
> On Tue, Apr 22, 2014 at 4:30 AM, Stratos Karafotis
> <stratosk@semaphore.gr> wrote:
>> The cpufreq core now supports the cpufreq_for_each_entry and
>> cpufreq_for_each_valid_entry macros helpers for iteration over the
>> cpufreq_frequency_table, so use them.
>>
>> It should have no functional changes.
>>
> This patch produces following build warning,
>
> drivers/cpufreq/freq_table.c: In function 'cpufreq_frequency_table_cpuinfo':
> drivers/cpufreq/freq_table.c:36:3: warning: format '%lu' expects
> argument of type 'long unsigned int', but argument 2 has type 'int'
> [-Wformat=]
> pr_debug("table entry %lu: %u kHz\n", pos - table, freq);
Thanks for this finding.
I will fix it and resend the patch.
Stratos Karafotis
^ permalink raw reply
* [PATCH 22/32] mmc: sdhci: convert sdhci_set_uhs_signaling() into a library function
From: Russell King @ 2014-04-25 13:26 UTC (permalink / raw)
To: Chris Ball, linux-mmc, Markus Pargmann
Cc: Barry Song, spear-devel, Stephen Warren, Anton Vorontsov,
Ulf Hansson, Michal Simek, Thierry Reding, Viresh Kumar,
Ben Dooks, linux-tegra, linuxppc-dev, linux-arm-kernel
In-Reply-To: <20140425132245.GO26756@n2100.arm.linux.org.uk>
Add sdhci_set_uhs_signaling() and always call the set_uhs_signaling
method. This avoids quirks being added into sdhci_set_uhs_signaling().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
drivers/mmc/host/sdhci-acpi.c | 2 ++
drivers/mmc/host/sdhci-bcm-kona.c | 1 +
drivers/mmc/host/sdhci-bcm2835.c | 1 +
drivers/mmc/host/sdhci-cns3xxx.c | 1 +
drivers/mmc/host/sdhci-dove.c | 1 +
drivers/mmc/host/sdhci-of-arasan.c | 1 +
drivers/mmc/host/sdhci-of-esdhc.c | 1 +
drivers/mmc/host/sdhci-of-hlwd.c | 1 +
drivers/mmc/host/sdhci-pci.c | 1 +
drivers/mmc/host/sdhci-pltfm.c | 1 +
drivers/mmc/host/sdhci-pxav2.c | 1 +
drivers/mmc/host/sdhci-pxav3.c | 1 +
drivers/mmc/host/sdhci-s3c.c | 1 +
drivers/mmc/host/sdhci-sirf.c | 1 +
drivers/mmc/host/sdhci-spear.c | 1 +
drivers/mmc/host/sdhci-tegra.c | 1 +
drivers/mmc/host/sdhci.c | 43 ++++++++++++++++++++------------------
drivers/mmc/host/sdhci.h | 1 +
18 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 323e2a688563..8ce3c28cb76e 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -106,6 +106,7 @@ static const struct sdhci_ops sdhci_acpi_ops_dflt = {
.enable_dma = sdhci_acpi_enable_dma,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_ops sdhci_acpi_ops_int = {
@@ -113,6 +114,7 @@ static const struct sdhci_ops sdhci_acpi_ops_int = {
.enable_dma = sdhci_acpi_enable_dma,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
.hw_reset = sdhci_acpi_int_hw_reset,
};
diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index e610811c09b0..dd780c315a63 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -212,6 +212,7 @@ static struct sdhci_ops sdhci_bcm_kona_ops = {
.platform_send_init_74_clocks = sdhci_bcm_kona_init_74_clocks,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
.card_event = sdhci_bcm_kona_card_event,
};
diff --git a/drivers/mmc/host/sdhci-bcm2835.c b/drivers/mmc/host/sdhci-bcm2835.c
index 74906d6008e1..46af9a439d7b 100644
--- a/drivers/mmc/host/sdhci-bcm2835.c
+++ b/drivers/mmc/host/sdhci-bcm2835.c
@@ -136,6 +136,7 @@ static const struct sdhci_ops bcm2835_sdhci_ops = {
.get_min_clock = bcm2835_sdhci_get_min_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data bcm2835_sdhci_pdata = {
diff --git a/drivers/mmc/host/sdhci-cns3xxx.c b/drivers/mmc/host/sdhci-cns3xxx.c
index 587d73ef33ff..14b74075589a 100644
--- a/drivers/mmc/host/sdhci-cns3xxx.c
+++ b/drivers/mmc/host/sdhci-cns3xxx.c
@@ -81,6 +81,7 @@ static const struct sdhci_ops sdhci_cns3xxx_ops = {
.set_clock = sdhci_cns3xxx_set_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data sdhci_cns3xxx_pdata = {
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 8ef4ab52f8e0..0d315f4496c8 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -89,6 +89,7 @@ static const struct sdhci_ops sdhci_dove_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data sdhci_dove_pdata = {
diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index f0ee594f25d1..5bd1092310f2 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -57,6 +57,7 @@ static struct sdhci_ops sdhci_arasan_ops = {
.get_timeout_clock = sdhci_arasan_get_timeout_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static struct sdhci_pltfm_data sdhci_arasan_pdata = {
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index c4f8cd3f83c8..fcaeae5f55b8 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -309,6 +309,7 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
.adma_workaround = esdhci_of_adma_workaround,
.set_bus_width = esdhc_pltfm_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data sdhci_esdhc_pdata = {
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
index a4a1f0f2c0a0..b341661369a2 100644
--- a/drivers/mmc/host/sdhci-of-hlwd.c
+++ b/drivers/mmc/host/sdhci-of-hlwd.c
@@ -61,6 +61,7 @@ static const struct sdhci_ops sdhci_hlwd_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data sdhci_hlwd_pdata = {
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index b3a28f6b170e..52c42fcc284c 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -1082,6 +1082,7 @@ static const struct sdhci_ops sdhci_pci_ops = {
.enable_dma = sdhci_pci_enable_dma,
.set_bus_width = sdhci_pci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
.hw_reset = sdhci_pci_hw_reset,
};
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 1fb89f44bd58..7e834fb78f42 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -48,6 +48,7 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
#ifdef CONFIG_OF
diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index db5257bf032e..3c0f3c0a1cc8 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -116,6 +116,7 @@ static const struct sdhci_ops pxav2_sdhci_ops = {
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
.set_bus_width = pxav2_mmc_set_bus_width,
.reset = pxav2_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
#ifdef CONFIG_OF
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 05574104a254..f4f128947561 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -229,6 +229,7 @@ static const struct sdhci_ops pxav3_sdhci_ops = {
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = pxav3_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static struct sdhci_pltfm_data sdhci_pxav3_pdata = {
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 0ac075dfd844..76d7c12d8ef9 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -374,6 +374,7 @@ static struct sdhci_ops sdhci_s3c_ops = {
.get_min_clock = sdhci_s3c_get_min_clock,
.set_bus_width = sdhci_s3c_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index 3b775348b470..17004531d089 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -32,6 +32,7 @@ static struct sdhci_ops sdhci_sirf_ops = {
.get_max_clock = sdhci_sirf_get_max_clk,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static struct sdhci_pltfm_data sdhci_sirf_pdata = {
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 8bf64ab36720..9d535c7336ef 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -41,6 +41,7 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
#ifdef CONFIG_OF
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index a0a8b5cc3b0c..d06b6ff60432 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -156,6 +156,7 @@ static const struct sdhci_ops tegra_sdhci_ops = {
.set_clock = sdhci_set_clock,
.set_bus_width = tegra_sdhci_set_bus_width,
.reset = tegra_sdhci_reset,
+ .set_uhs_signaling = sdhci_set_uhs_signaling,
};
static const struct sdhci_pltfm_data sdhci_tegra20_pdata = {
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index bbf8d8bcfde6..1d88345f88cd 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1404,6 +1404,28 @@ void sdhci_set_bus_width(struct sdhci_host *host, int width)
}
EXPORT_SYMBOL_GPL(sdhci_set_bus_width);
+void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
+{
+ u16 ctrl_2;
+
+ ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
+ /* Select Bus Speed Mode for host */
+ ctrl_2 &= ~SDHCI_CTRL_UHS_MASK;
+ if ((timing == MMC_TIMING_MMC_HS200) ||
+ (timing == MMC_TIMING_UHS_SDR104))
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
+ else if (timing == MMC_TIMING_UHS_SDR12)
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
+ else if (timing == MMC_TIMING_UHS_SDR25)
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
+ else if (timing == MMC_TIMING_UHS_SDR50)
+ ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
+ else if (timing == MMC_TIMING_UHS_DDR50)
+ ctrl_2 |= SDHCI_CTRL_UHS_DDR50;
+ sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
+}
+EXPORT_SYMBOL_GPL(sdhci_set_uhs_signaling);
+
static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
{
unsigned long flags;
@@ -1507,31 +1529,12 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
host->ops->set_clock(host, host->clock);
}
-
/* Reset SD Clock Enable */
clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
clk &= ~SDHCI_CLOCK_CARD_EN;
sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
- if (host->ops->set_uhs_signaling)
- host->ops->set_uhs_signaling(host, ios->timing);
- else {
- ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
- /* Select Bus Speed Mode for host */
- ctrl_2 &= ~SDHCI_CTRL_UHS_MASK;
- if ((ios->timing == MMC_TIMING_MMC_HS200) ||
- (ios->timing == MMC_TIMING_UHS_SDR104))
- ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
- else if (ios->timing == MMC_TIMING_UHS_SDR12)
- ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
- else if (ios->timing == MMC_TIMING_UHS_SDR25)
- ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
- else if (ios->timing == MMC_TIMING_UHS_SDR50)
- ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
- else if (ios->timing == MMC_TIMING_UHS_DDR50)
- ctrl_2 |= SDHCI_CTRL_UHS_DDR50;
- sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
- }
+ host->ops->set_uhs_signaling(host, ios->timing);
if (!(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN) &&
((ios->timing == MMC_TIMING_UHS_SDR12) ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 3179a8053019..7a35395e5f56 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -403,6 +403,7 @@ static inline bool sdhci_sdio_irq_enabled(struct sdhci_host *host)
void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);
void sdhci_set_bus_width(struct sdhci_host *host, int width);
void sdhci_reset(struct sdhci_host *host, u8 mask);
+void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing);
#ifdef CONFIG_PM
extern int sdhci_suspend_host(struct sdhci_host *host);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v4 2/8] cpufreq: Use cpufreq_for_each_* macros for frequency table iteration
From: Prabhakar Lad @ 2014-04-25 12:31 UTC (permalink / raw)
To: Stratos Karafotis
Cc: Kukjin Kim, linux-pm, Viresh Kumar, Rafael J. Wysocki, LKML,
cpufreq@vger.kernel.org, linux-samsung-soc, Sudeep Holla,
Olof Johansson, linuxppc-dev,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <5355A327.3020308@semaphore.gr>
Hi Stratos,
Thanks for the patch.
On Tue, Apr 22, 2014 at 4:30 AM, Stratos Karafotis
<stratosk@semaphore.gr> wrote:
> The cpufreq core now supports the cpufreq_for_each_entry and
> cpufreq_for_each_valid_entry macros helpers for iteration over the
> cpufreq_frequency_table, so use them.
>
> It should have no functional changes.
>
This patch produces following build warning,
drivers/cpufreq/freq_table.c: In function 'cpufreq_frequency_table_cpuinfo':
drivers/cpufreq/freq_table.c:36:3: warning: format '%lu' expects
argument of type 'long unsigned int', but argument 2 has type 'int'
[-Wformat=]
pr_debug("table entry %lu: %u kHz\n", pos - table, freq);
Thanks,
--Prabhakar Lad
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 9 +++---
> drivers/cpufreq/arm_big_little.c | 16 +++++------
> drivers/cpufreq/cpufreq_stats.c | 24 ++++++----------
> drivers/cpufreq/dbx500-cpufreq.c | 8 ++----
> drivers/cpufreq/elanfreq.c | 9 +++---
> drivers/cpufreq/exynos-cpufreq.c | 11 ++++---
> drivers/cpufreq/exynos5440-cpufreq.c | 30 +++++++++----------
> drivers/cpufreq/freq_table.c | 56 ++++++++++++++++--------------------
> drivers/cpufreq/longhaul.c | 13 ++++-----
> drivers/cpufreq/pasemi-cpufreq.c | 10 +++----
> drivers/cpufreq/powernow-k6.c | 14 ++++-----
> drivers/cpufreq/ppc_cbe_cpufreq.c | 9 +++---
> drivers/cpufreq/s3c2416-cpufreq.c | 40 +++++++++++---------------
> drivers/cpufreq/s3c64xx-cpufreq.c | 15 ++++------
> 14 files changed, 117 insertions(+), 147 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 000e4e0..b0c18ed 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -213,7 +213,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
>
> static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> struct acpi_processor_performance *perf;
>
> if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
> @@ -223,10 +223,9 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
>
> perf = data->acpi_data;
>
> - for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - if (msr == perf->states[data->freq_table[i].driver_data].status)
> - return data->freq_table[i].frequency;
> - }
> + cpufreq_for_each_entry(pos, data->freq_table)
> + if (msr == perf->states[pos->driver_data].status)
> + return pos->frequency;
> return data->freq_table[0].frequency;
> }
>
> diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
> index bad2ed3..1f4d4e3 100644
> --- a/drivers/cpufreq/arm_big_little.c
> +++ b/drivers/cpufreq/arm_big_little.c
> @@ -226,22 +226,22 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table)
> /* get the minimum frequency in the cpufreq_frequency_table */
> static inline u32 get_table_min(struct cpufreq_frequency_table *table)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> uint32_t min_freq = ~0;
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
> - if (table[i].frequency < min_freq)
> - min_freq = table[i].frequency;
> + cpufreq_for_each_entry(pos, table)
> + if (pos->frequency < min_freq)
> + min_freq = pos->frequency;
> return min_freq;
> }
>
> /* get the maximum frequency in the cpufreq_frequency_table */
> static inline u32 get_table_max(struct cpufreq_frequency_table *table)
> {
> - int i;
> + struct cpufreq_frequency_table *pos;
> uint32_t max_freq = 0;
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++)
> - if (table[i].frequency > max_freq)
> - max_freq = table[i].frequency;
> + cpufreq_for_each_entry(pos, table)
> + if (pos->frequency > max_freq)
> + max_freq = pos->frequency;
> return max_freq;
> }
>
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index ecaaebf..0cd9b4d 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -182,11 +182,11 @@ static void cpufreq_stats_free_table(unsigned int cpu)
>
> static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> {
> - unsigned int i, j, count = 0, ret = 0;
> + unsigned int i, count = 0, ret = 0;
> struct cpufreq_stats *stat;
> unsigned int alloc_size;
> unsigned int cpu = policy->cpu;
> - struct cpufreq_frequency_table *table;
> + struct cpufreq_frequency_table *pos, *table;
>
> table = cpufreq_frequency_get_table(cpu);
> if (unlikely(!table))
> @@ -205,12 +205,8 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> stat->cpu = cpu;
> per_cpu(cpufreq_stats_table, cpu) = stat;
>
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table)
> count++;
> - }
>
> alloc_size = count * sizeof(int) + count * sizeof(u64);
>
> @@ -228,15 +224,11 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy)
> #ifdef CONFIG_CPU_FREQ_STAT_DETAILS
> stat->trans_table = stat->freq_table + count;
> #endif
> - j = 0;
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> - if (freq_table_get_index(stat, freq) == -1)
> - stat->freq_table[j++] = freq;
> - }
> - stat->state_num = j;
> + i = 0;
> + cpufreq_for_each_valid_entry(pos, table)
> + if (freq_table_get_index(stat, pos->frequency) == -1)
> + stat->freq_table[i++] = pos->frequency;
> + stat->state_num = i;
> spin_lock(&cpufreq_stats_lock);
> stat->last_time = get_jiffies_64();
> stat->last_index = freq_table_get_index(stat, policy->cur);
> diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c
> index 412a78b..4bebc1b 100644
> --- a/drivers/cpufreq/dbx500-cpufreq.c
> +++ b/drivers/cpufreq/dbx500-cpufreq.c
> @@ -45,7 +45,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = {
>
> static int dbx500_cpufreq_probe(struct platform_device *pdev)
> {
> - int i = 0;
> + struct cpufreq_frequency_table *pos;
>
> freq_table = dev_get_platdata(&pdev->dev);
> if (!freq_table) {
> @@ -60,10 +60,8 @@ static int dbx500_cpufreq_probe(struct platform_device *pdev)
> }
>
> pr_info("dbx500-cpufreq: Available frequencies:\n");
> - while (freq_table[i].frequency != CPUFREQ_TABLE_END) {
> - pr_info(" %d Mhz\n", freq_table[i].frequency/1000);
> - i++;
> - }
> + cpufreq_for_each_entry(pos, freq_table)
> + pr_info(" %d Mhz\n", pos->frequency / 1000);
>
> return cpufreq_register_driver(&dbx500_cpufreq_driver);
> }
> diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c
> index 7f5d2a6..1c06e78 100644
> --- a/drivers/cpufreq/elanfreq.c
> +++ b/drivers/cpufreq/elanfreq.c
> @@ -147,7 +147,7 @@ static int elanfreq_target(struct cpufreq_policy *policy,
> static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> {
> struct cpuinfo_x86 *c = &cpu_data(0);
> - unsigned int i;
> + struct cpufreq_frequency_table *pos;
>
> /* capability check */
> if ((c->x86_vendor != X86_VENDOR_AMD) ||
> @@ -159,10 +159,9 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy)
> max_freq = elanfreq_get_cpu_frequency(0);
>
> /* table init */
> - for (i = 0; (elanfreq_table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (elanfreq_table[i].frequency > max_freq)
> - elanfreq_table[i].frequency = CPUFREQ_ENTRY_INVALID;
> - }
> + cpufreq_for_each_entry(pos, elanfreq_table)
> + if (pos->frequency > max_freq)
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
>
> /* cpuinfo and default policy values */
> policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
> diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
> index f99cfe2..9c13255 100644
> --- a/drivers/cpufreq/exynos-cpufreq.c
> +++ b/drivers/cpufreq/exynos-cpufreq.c
> @@ -29,17 +29,16 @@ static unsigned int locking_frequency;
> static int exynos_cpufreq_get_index(unsigned int freq)
> {
> struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
> - int index;
> + struct cpufreq_frequency_table *pos;
>
> - for (index = 0;
> - freq_table[index].frequency != CPUFREQ_TABLE_END; index++)
> - if (freq_table[index].frequency == freq)
> + cpufreq_for_each_entry(pos, freq_table)
> + if (pos->frequency == freq)
> break;
>
> - if (freq_table[index].frequency == CPUFREQ_TABLE_END)
> + if (pos->frequency == CPUFREQ_TABLE_END)
> return -EINVAL;
>
> - return index;
> + return pos - freq_table;
> }
>
> static int exynos_cpufreq_scale(unsigned int target_freq)
> diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c
> index a6b8214..f33f25b 100644
> --- a/drivers/cpufreq/exynos5440-cpufreq.c
> +++ b/drivers/cpufreq/exynos5440-cpufreq.c
> @@ -114,25 +114,23 @@ static struct cpufreq_freqs freqs;
>
> static int init_div_table(void)
> {
> - struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;
> + struct cpufreq_frequency_table *pos, *freq_tbl = dvfs_info->freq_table;
> unsigned int tmp, clk_div, ema_div, freq, volt_id;
> - int i = 0;
> struct dev_pm_opp *opp;
>
> rcu_read_lock();
> - for (i = 0; freq_tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
> -
> + cpufreq_for_each_entry(pos, freq_tbl) {
> opp = dev_pm_opp_find_freq_exact(dvfs_info->dev,
> - freq_tbl[i].frequency * 1000, true);
> + pos->frequency * 1000, true);
> if (IS_ERR(opp)) {
> rcu_read_unlock();
> dev_err(dvfs_info->dev,
> "failed to find valid OPP for %u KHZ\n",
> - freq_tbl[i].frequency);
> + pos->frequency);
> return PTR_ERR(opp);
> }
>
> - freq = freq_tbl[i].frequency / 1000; /* In MHZ */
> + freq = pos->frequency / 1000; /* In MHZ */
> clk_div = ((freq / CPU_DIV_FREQ_MAX) & P0_7_CPUCLKDEV_MASK)
> << P0_7_CPUCLKDEV_SHIFT;
> clk_div |= ((freq / CPU_ATB_FREQ_MAX) & P0_7_ATBCLKDEV_MASK)
> @@ -157,7 +155,8 @@ static int init_div_table(void)
> tmp = (clk_div | ema_div | (volt_id << P0_7_VDD_SHIFT)
> | ((freq / FREQ_UNIT) << P0_7_FREQ_SHIFT));
>
> - __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 * i);
> + __raw_writel(tmp, dvfs_info->base + XMU_PMU_P0_7 + 4 *
> + (pos - freq_tbl));
> }
>
> rcu_read_unlock();
> @@ -166,8 +165,9 @@ static int init_div_table(void)
>
> static void exynos_enable_dvfs(unsigned int cur_frequency)
> {
> - unsigned int tmp, i, cpu;
> + unsigned int tmp, cpu;
> struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table;
> + struct cpufreq_frequency_table *pos;
> /* Disable DVFS */
> __raw_writel(0, dvfs_info->base + XMU_DVFS_CTRL);
>
> @@ -182,15 +182,15 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
> __raw_writel(tmp, dvfs_info->base + XMU_PMUIRQEN);
>
> /* Set initial performance index */
> - for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
> - if (freq_table[i].frequency == cur_frequency)
> + cpufreq_for_each_entry(pos, freq_table)
> + if (pos->frequency == cur_frequency)
> break;
>
> - if (freq_table[i].frequency == CPUFREQ_TABLE_END) {
> + if (pos->frequency == CPUFREQ_TABLE_END) {
> dev_crit(dvfs_info->dev, "Boot up frequency not supported\n");
> /* Assign the highest frequency */
> - i = 0;
> - cur_frequency = freq_table[i].frequency;
> + pos = freq_table;
> + cur_frequency = pos->frequency;
> }
>
> dev_info(dvfs_info->dev, "Setting dvfs initial frequency = %uKHZ",
> @@ -199,7 +199,7 @@ static void exynos_enable_dvfs(unsigned int cur_frequency)
> for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) {
> tmp = __raw_readl(dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
> tmp &= ~(P_VALUE_MASK << C0_3_PSTATE_NEW_SHIFT);
> - tmp |= (i << C0_3_PSTATE_NEW_SHIFT);
> + tmp |= ((pos - freq_table) << C0_3_PSTATE_NEW_SHIFT);
> __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + cpu * 4);
> }
>
> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
> index 08e7bbc..cf004a5 100644
> --- a/drivers/cpufreq/freq_table.c
> +++ b/drivers/cpufreq/freq_table.c
> @@ -21,22 +21,19 @@
> int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
> struct cpufreq_frequency_table *table)
> {
> + struct cpufreq_frequency_table *pos;
> unsigned int min_freq = ~0;
> unsigned int max_freq = 0;
> - unsigned int i;
> + unsigned int freq;
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID) {
> - pr_debug("table entry %u is invalid, skipping\n", i);
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
>
> - continue;
> - }
> if (!cpufreq_boost_enabled()
> - && (table[i].flags & CPUFREQ_BOOST_FREQ))
> + && (pos->flags & CPUFREQ_BOOST_FREQ))
> continue;
>
> - pr_debug("table entry %u: %u kHz\n", i, freq);
> + pr_debug("table entry %lu: %u kHz\n", pos - table, freq);
> if (freq < min_freq)
> min_freq = freq;
> if (freq > max_freq)
> @@ -57,7 +54,8 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_cpuinfo);
> int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
> struct cpufreq_frequency_table *table)
> {
> - unsigned int next_larger = ~0, freq, i = 0;
> + struct cpufreq_frequency_table *pos;
> + unsigned int freq, next_larger = ~0;
> bool found = false;
>
> pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
> @@ -65,9 +63,9 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
>
> cpufreq_verify_within_cpu_limits(policy);
>
> - for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) {
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
> +
> if ((freq >= policy->min) && (freq <= policy->max)) {
> found = true;
> break;
> @@ -118,7 +116,8 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
> .driver_data = ~0,
> .frequency = 0,
> };
> - unsigned int i;
> + struct cpufreq_frequency_table *pos;
> + unsigned int freq, i = 0;
>
> pr_debug("request for target %u kHz (relation: %u) for cpu %u\n",
> target_freq, relation, policy->cpu);
> @@ -132,10 +131,10 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
> break;
> }
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - unsigned int freq = table[i].frequency;
> - if (freq == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> + freq = pos->frequency;
> +
> + i = pos - table;
> if ((freq < policy->min) || (freq > policy->max))
> continue;
> switch (relation) {
> @@ -184,8 +183,7 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target);
> int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
> unsigned int freq)
> {
> - struct cpufreq_frequency_table *table;
> - int i;
> + struct cpufreq_frequency_table *pos, *table;
>
> table = cpufreq_frequency_get_table(policy->cpu);
> if (unlikely(!table)) {
> @@ -193,10 +191,9 @@ int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
> return -ENOENT;
> }
>
> - for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
> - if (table[i].frequency == freq)
> - return i;
> - }
> + cpufreq_for_each_valid_entry(pos, table)
> + if (pos->frequency == freq)
> + return pos - table;
>
> return -EINVAL;
> }
> @@ -208,16 +205,13 @@ EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index);
> static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
> bool show_boost)
> {
> - unsigned int i = 0;
> ssize_t count = 0;
> - struct cpufreq_frequency_table *table = policy->freq_table;
> + struct cpufreq_frequency_table *pos, *table = policy->freq_table;
>
> if (!table)
> return -ENODEV;
>
> - for (i = 0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (table[i].frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + cpufreq_for_each_valid_entry(pos, table) {
> /*
> * show_boost = true and driver_data = BOOST freq
> * display BOOST freqs
> @@ -229,10 +223,10 @@ static ssize_t show_available_freqs(struct cpufreq_policy *policy, char *buf,
> * show_boost = false and driver_data != BOOST freq
> * display NON BOOST freqs
> */
> - if (show_boost ^ (table[i].flags & CPUFREQ_BOOST_FREQ))
> + if (show_boost ^ (pos->flags & CPUFREQ_BOOST_FREQ))
> continue;
>
> - count += sprintf(&buf[count], "%d ", table[i].frequency);
> + count += sprintf(&buf[count], "%d ", pos->frequency);
> }
> count += sprintf(&buf[count], "\n");
>
> diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
> index d00e5d1..5e12646 100644
> --- a/drivers/cpufreq/longhaul.c
> +++ b/drivers/cpufreq/longhaul.c
> @@ -528,6 +528,7 @@ static int longhaul_get_ranges(void)
>
> static void longhaul_setup_voltagescaling(void)
> {
> + struct cpufreq_frequency_table *freq_pos;
> union msr_longhaul longhaul;
> struct mV_pos minvid, maxvid, vid;
> unsigned int j, speed, pos, kHz_step, numvscales;
> @@ -606,18 +607,16 @@ static void longhaul_setup_voltagescaling(void)
> /* Calculate kHz for one voltage step */
> kHz_step = (highest_speed - min_vid_speed) / numvscales;
>
> - j = 0;
> - while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) {
> - speed = longhaul_table[j].frequency;
> + cpufreq_for_each_entry(freq_pos, longhaul_table) {
> + speed = freq_pos->frequency;
> if (speed > min_vid_speed)
> pos = (speed - min_vid_speed) / kHz_step + minvid.pos;
> else
> pos = minvid.pos;
> - longhaul_table[j].driver_data |= mV_vrm_table[pos] << 8;
> + freq_pos->driver_data |= mV_vrm_table[pos] << 8;
> vid = vrm_mV_table[mV_vrm_table[pos]];
> - printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n",
> - speed, j, vid.mV);
> - j++;
> + printk(KERN_INFO PFX "f: %u kHz, index: %u, vid: %d mV\n",
> + speed, freq_pos - longhaul_table, vid.mV);
> }
>
> can_scale_voltage = 1;
> diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c
> index 84c84b5..9a64492 100644
> --- a/drivers/cpufreq/pasemi-cpufreq.c
> +++ b/drivers/cpufreq/pasemi-cpufreq.c
> @@ -136,9 +136,10 @@ void restore_astate(int cpu)
>
> static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> const u32 *max_freqp;
> u32 max_freq;
> - int i, cur_astate;
> + int cur_astate;
> struct resource res;
> struct device_node *cpu, *dn;
> int err = -ENODEV;
> @@ -197,10 +198,9 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
> pr_debug("initializing frequency table\n");
>
> /* initialize frequency table */
> - for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
> - pas_freqs[i].frequency =
> - get_astate_freq(pas_freqs[i].driver_data) * 100000;
> - pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
> + cpufreq_for_each_entry(pos, pas_freqs) {
> + pos->frequency = get_astate_freq(pos->driver_data) * 100000;
> + pr_debug("%lu: %d\n", pos - pas_freqs, pos->frequency);
> }
>
> cur_astate = get_cur_astate(policy->cpu);
> diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
> index 49f120e..a133236 100644
> --- a/drivers/cpufreq/powernow-k6.c
> +++ b/drivers/cpufreq/powernow-k6.c
> @@ -159,6 +159,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
>
> static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> unsigned int i, f;
> unsigned khz;
>
> @@ -176,12 +177,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
> }
> }
> if (param_max_multiplier) {
> - for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
> - if (clock_ratio[i].driver_data == param_max_multiplier) {
> + cpufreq_for_each_entry(pos, clock_ratio)
> + if (pos->driver_data == param_max_multiplier) {
> max_multiplier = param_max_multiplier;
> goto have_max_multiplier;
> }
> - }
> printk(KERN_ERR "powernow-k6: invalid max_multiplier parameter, valid parameters 20, 30, 35, 40, 45, 50, 55, 60\n");
> return -EINVAL;
> }
> @@ -209,12 +209,12 @@ have_busfreq:
> param_busfreq = busfreq * 10;
>
> /* table init */
> - for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
> - f = clock_ratio[i].driver_data;
> + cpufreq_for_each_entry(pos, clock_ratio) {
> + f = pos->driver_data;
> if (f > max_multiplier)
> - clock_ratio[i].frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> else
> - clock_ratio[i].frequency = busfreq * f;
> + pos->frequency = busfreq * f;
> }
>
> /* cpuinfo and default policy values */
> diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c
> index 5be8a48..b550d5c 100644
> --- a/drivers/cpufreq/ppc_cbe_cpufreq.c
> +++ b/drivers/cpufreq/ppc_cbe_cpufreq.c
> @@ -67,9 +67,10 @@ static int set_pmode(unsigned int cpu, unsigned int slow_mode)
>
> static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
> {
> + struct cpufreq_frequency_table *pos;
> const u32 *max_freqp;
> u32 max_freq;
> - int i, cur_pmode;
> + int cur_pmode;
> struct device_node *cpu;
>
> cpu = of_get_cpu_node(policy->cpu, NULL);
> @@ -102,9 +103,9 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
> pr_debug("initializing frequency table\n");
>
> /* initialize frequency table */
> - for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
> - cbe_freqs[i].frequency = max_freq / cbe_freqs[i].driver_data;
> - pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
> + cpufreq_for_each_entry(pos, cbe_freqs) {
> + pos->frequency = max_freq / pos->driver_data;
> + pr_debug("%lu: %d\n", pos - cbe_freqs, pos->frequency);
> }
>
> /* if DEBUG is enabled set_pmode() measures the latency
> diff --git a/drivers/cpufreq/s3c2416-cpufreq.c b/drivers/cpufreq/s3c2416-cpufreq.c
> index 4626f90..2fd53ea 100644
> --- a/drivers/cpufreq/s3c2416-cpufreq.c
> +++ b/drivers/cpufreq/s3c2416-cpufreq.c
> @@ -266,7 +266,7 @@ out:
> static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
> {
> int count, v, i, found;
> - struct cpufreq_frequency_table *freq;
> + struct cpufreq_frequency_table *pos;
> struct s3c2416_dvfs *dvfs;
>
> count = regulator_count_voltages(s3c_freq->vddarm);
> @@ -275,12 +275,11 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
> return;
> }
>
> - freq = s3c_freq->freq_table;
> - while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
> - if (freq->frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + if (!count)
> + goto out;
>
> - dvfs = &s3c2416_dvfs_table[freq->driver_data];
> + cpufreq_for_each_valid_entry(pos, s3c_freq->freq_table) {
> + dvfs = &s3c2416_dvfs_table[pos->driver_data];
> found = 0;
>
> /* Check only the min-voltage, more is always ok on S3C2416 */
> @@ -292,13 +291,12 @@ static void __init s3c2416_cpufreq_cfg_regulator(struct s3c2416_data *s3c_freq)
>
> if (!found) {
> pr_debug("cpufreq: %dkHz unsupported by regulator\n",
> - freq->frequency);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> +out:
> /* Guessed */
> s3c_freq->regulator_latency = 1 * 1000 * 1000;
> }
> @@ -338,7 +336,7 @@ static struct notifier_block s3c2416_cpufreq_reboot_notifier = {
> static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
> {
> struct s3c2416_data *s3c_freq = &s3c2416_cpufreq;
> - struct cpufreq_frequency_table *freq;
> + struct cpufreq_frequency_table *pos;
> struct clk *msysclk;
> unsigned long rate;
> int ret;
> @@ -427,31 +425,27 @@ static int __init s3c2416_cpufreq_driver_init(struct cpufreq_policy *policy)
> s3c_freq->regulator_latency = 0;
> #endif
>
> - freq = s3c_freq->freq_table;
> - while (freq->frequency != CPUFREQ_TABLE_END) {
> + cpufreq_for_each_entry(pos, s3c_freq->freq_table) {
> /* special handling for dvs mode */
> - if (freq->driver_data == 0) {
> + if (pos->driver_data == 0) {
> if (!s3c_freq->hclk) {
> pr_debug("cpufreq: %dkHz unsupported as it would need unavailable dvs mode\n",
> - freq->frequency);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> } else {
> - freq++;
> continue;
> }
> }
>
> /* Check for frequencies we can generate */
> rate = clk_round_rate(s3c_freq->armdiv,
> - freq->frequency * 1000);
> + pos->frequency * 1000);
> rate /= 1000;
> - if (rate != freq->frequency) {
> + if (rate != pos->frequency) {
> pr_debug("cpufreq: %dkHz unsupported by clock (clk_round_rate return %lu)\n",
> - freq->frequency, rate);
> - freq->frequency = CPUFREQ_ENTRY_INVALID;
> + pos->frequency, rate);
> + pos->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> /* Datasheet says PLL stabalisation time must be at least 300us,
> diff --git a/drivers/cpufreq/s3c64xx-cpufreq.c b/drivers/cpufreq/s3c64xx-cpufreq.c
> index ff7d3ec..176e84c 100644
> --- a/drivers/cpufreq/s3c64xx-cpufreq.c
> +++ b/drivers/cpufreq/s3c64xx-cpufreq.c
> @@ -118,11 +118,10 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
> pr_err("Unable to check supported voltages\n");
> }
>
> - freq = s3c64xx_freq_table;
> - while (count > 0 && freq->frequency != CPUFREQ_TABLE_END) {
> - if (freq->frequency == CPUFREQ_ENTRY_INVALID)
> - continue;
> + if (!count)
> + goto out;
>
> + cpufreq_for_each_valid_entry(freq, s3c64xx_freq_table) {
> dvfs = &s3c64xx_dvfs_table[freq->driver_data];
> found = 0;
>
> @@ -137,10 +136,9 @@ static void __init s3c64xx_cpufreq_config_regulator(void)
> freq->frequency);
> freq->frequency = CPUFREQ_ENTRY_INVALID;
> }
> -
> - freq++;
> }
>
> +out:
> /* Guess based on having to do an I2C/SPI write; in future we
> * will be able to query the regulator performance here. */
> regulator_latency = 1 * 1000 * 1000;
> @@ -179,8 +177,7 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
> }
> #endif
>
> - freq = s3c64xx_freq_table;
> - while (freq->frequency != CPUFREQ_TABLE_END) {
> + cpufreq_for_each_entry(freq, s3c64xx_freq_table) {
> unsigned long r;
>
> /* Check for frequencies we can generate */
> @@ -196,8 +193,6 @@ static int s3c64xx_cpufreq_driver_init(struct cpufreq_policy *policy)
> * frequency is the maximum we can support. */
> if (!vddarm && freq->frequency > clk_get_rate(policy->clk) / 1000)
> freq->frequency = CPUFREQ_ENTRY_INVALID;
> -
> - freq++;
> }
>
> /* Datasheet says PLL stabalisation time (if we were to use
> --
> 1.9.0
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC PATCH] Fix Oops in rtas_stop_self()
From: Anton Blanchard @ 2014-04-25 12:18 UTC (permalink / raw)
To: Li Zhong; +Cc: Paul Mackerras, Benjamin Herrenschmidt, PowerPC email list
In-Reply-To: <1398418381.2805.168.camel@ThinkPad-T5421.cn.ibm.com>
Hi,
> When trying offline cpus, I noticed following Oops in
> rtas_stop_self(), and it seems caused by commit 41dd03a9. The Oops
> disappears after reverting this commit.
>
> After reading the code, I guess it might be caused by moving the
> rtas_args to stack. Still need some more time to read enter_rtas to
> understand why it happens, but the problem seems could be solved by
> moving the rtas_args away from stack by adding static before it.
Nice catch. RTAS is 32bit and if your box has more than 4GB RAM then
your stack could easily be outside 32bit range.
You can add:
Signed-off-by: Anton Blanchard <anton@samba.org>
And also:
Cc: stable@vger.kernel.org # 3.14+
> Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> ---
> arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 9b8e050..20d6297
> 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
> @@ -88,13 +88,14 @@ void set_default_offline_state(int cpu)
>
> static void rtas_stop_self(void)
> {
> - struct rtas_args args = {
> - .token = cpu_to_be32(rtas_stop_self_token),
> + static struct rtas_args args = {
> .nargs = 0,
> .nret = 1,
> .rets = &args.args[0],
> };
>
> + args.token = cpu_to_be32(rtas_stop_self_token);
> +
> local_irq_disable();
>
> BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE);
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* [PATCH 2/2] powerpc/powernv: Set memory_block_size_bytes to 256MB
From: Anton Blanchard @ 2014-04-25 11:42 UTC (permalink / raw)
To: benh, paulus, nfont; +Cc: linuxppc-dev
In-Reply-To: <1398426149-27359-1-git-send-email-anton@samba.org>
powerpc sets a low SECTION_SIZE_BITS to accomodate small pseries
boxes. We default to 16MB memory blocks, and boxes with a lot
of memory end up with enormous numbers of sysfs memory nodes.
Set a more reasonable default for powernv of 256MB.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/powerpc/platforms/powernv/setup.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 61cf8fa..a55921a 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -178,6 +178,11 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
}
#endif /* CONFIG_KEXEC */
+static unsigned long pnv_memory_block_size(void)
+{
+ return 256UL * 1024 * 1024;
+}
+
static void __init pnv_setup_machdep_opal(void)
{
ppc_md.get_boot_time = opal_get_boot_time;
@@ -240,4 +245,5 @@ define_machine(powernv) {
#ifdef CONFIG_KEXEC
.kexec_cpu_down = pnv_kexec_cpu_down,
#endif
+ .memory_block_size = pnv_memory_block_size,
};
--
1.8.3.2
^ permalink raw reply related
* [PATCH 1/2] powerpc: Allow ppc_md platform hook to override memory_block_size_bytes
From: Anton Blanchard @ 2014-04-25 11:42 UTC (permalink / raw)
To: benh, paulus, nfont; +Cc: linuxppc-dev
The pseries platform code unconditionally overrides
memory_block_size_bytes regardless of the running platform.
Create a ppc_md hook that so each platform can choose to
do what it wants.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
arch/powerpc/include/asm/machdep.h | 1 +
arch/powerpc/kernel/setup_64.c | 8 ++++++++
arch/powerpc/platforms/pseries/hotplug-memory.c | 17 +++--------------
arch/powerpc/platforms/pseries/pseries.h | 2 ++
arch/powerpc/platforms/pseries/setup.c | 1 +
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 5b6c03f..1f1c828 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -98,6 +98,7 @@ struct machdep_calls {
void (*iommu_save)(void);
void (*iommu_restore)(void);
#endif
+ unsigned long (*memory_block_size)(void);
#endif /* CONFIG_PPC64 */
void (*pci_dma_dev_setup)(struct pci_dev *dev);
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index fbe2437..eaeb0e7 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -36,6 +36,7 @@
#include <linux/lockdep.h>
#include <linux/memblock.h>
#include <linux/hugetlb.h>
+#include <linux/memory.h>
#include <asm/io.h>
#include <asm/kdump.h>
@@ -780,6 +781,13 @@ void __init setup_per_cpu_areas(void)
}
#endif
+unsigned long memory_block_size_bytes(void)
+{
+ if (ppc_md.memory_block_size)
+ return ppc_md.memory_block_size();
+
+ return MIN_MEMORY_BLOCK_SIZE;
+}
#if defined(CONFIG_PPC_INDIRECT_PIO) || defined(CONFIG_PPC_INDIRECT_MMIO)
struct ppc_pci_io ppc_pci_io;
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 573b488..b926fbb 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -21,7 +21,7 @@
#include <asm/prom.h>
#include <asm/sparsemem.h>
-static unsigned long get_memblock_size(void)
+unsigned long pseries_memory_block_size(void)
{
struct device_node *np;
unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE;
@@ -64,17 +64,6 @@ static unsigned long get_memblock_size(void)
return memblock_size;
}
-/* WARNING: This is going to override the generic definition whenever
- * pseries is built-in regardless of what platform is active at boot
- * time. This is fine for now as this is the only "option" and it
- * should work everywhere. If not, we'll have to turn this into a
- * ppc_md. callback
- */
-unsigned long memory_block_size_bytes(void)
-{
- return get_memblock_size();
-}
-
#ifdef CONFIG_MEMORY_HOTREMOVE
static int pseries_remove_memory(u64 start, u64 size)
{
@@ -105,7 +94,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
return 0;
}
- block_sz = memory_block_size_bytes();
+ block_sz = pseries_memory_block_size();
sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
nid = memory_add_physaddr_to_nid(base);
@@ -199,7 +188,7 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr)
u32 *p;
int i, rc = -EINVAL;
- memblock_size = get_memblock_size();
+ memblock_size = pseries_memory_block_size();
if (!memblock_size)
return -EINVAL;
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h
index 9921953..361add6 100644
--- a/arch/powerpc/platforms/pseries/pseries.h
+++ b/arch/powerpc/platforms/pseries/pseries.h
@@ -64,4 +64,6 @@ extern int dlpar_detach_node(struct device_node *);
struct pci_host_bridge;
int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
+unsigned long pseries_memory_block_size(void);
+
#endif /* _PSERIES_PSERIES_H */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2db8cc6..6e01fba 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -806,4 +806,5 @@ define_machine(pseries) {
#ifdef CONFIG_KEXEC
.machine_kexec = pSeries_machine_kexec,
#endif
+ .memory_block_size = pseries_memory_block_size,
};
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH 00/38] MMC updates, plus CuBox-i WiFi support
From: Ulf Hansson @ 2014-04-25 11:40 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Mark Rutland, Stephen Warren, linux-doc, Seungwon Jeon,
Chris Ball, Thierry Reding, Anton Vorontsov, Michal Simek,
Jaehoon Chung, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org, Pawel Moll, Ian Campbell, spear-devel,
Rob Herring, Ben Dooks, linux-tegra@vger.kernel.org, Shawn Guo,
Barry Song, Randy Dunlap, linux-mmc, Viresh Kumar, Sascha Hauer,
Kumar Gala, linuxppc-dev
In-Reply-To: <20140425112018.GJ26756@n2100.arm.linux.org.uk>
On 25 April 2014 13:20, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Fri, Apr 25, 2014 at 01:18:28PM +0200, Ulf Hansson wrote:
>> On 25 April 2014 11:03, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>> > On Thu, Apr 24, 2014 at 01:13:05PM +0200, Ulf Hansson wrote:
>> >> On 24 April 2014 12:57, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>> >> > This is nothing new or unexpected - it was last posted back in February,
>> >> > and I elected that it should be held off until after the last merge
>> >> > window.
>> >> >
>> >> > Unfortunately, I didn't have time to post it immediately after the merge
>> >> > window closed, partly because it needed to be rebased on top of tglx's
>> >> > IRQ changes on which it depends. I was carrying those as separate commits
>> >> > to the ones Thomas was carrying in his tree - and in the event, Thomas had
>> >> > modified his patches slightly between sending me copies of them and the
>> >> > versions he sent during the merge window.
>> >>
>> >> Okay, so let's keep up the frequency here then. I only had some minor
>> >> comments, please fix them and send a v2.
>> >
>> > Right, so I've updated the patches, and added one ack to one patch.
>> > That seems insufficient to me - the only platform these have been
>> > tested on is iMX6, which is sdhci-esdhc-imx.c.
>> >
>> > They _really_ need testing elsewhere too. Or is the plan to merge
>> > them and then see about getting people to test them and fix them up
>> > afterwards?
>>
>> I was hoping people could start doing tests, before Chris actually
>> decided to pull them in. Now, if that doesn't happen, we could just
>> merge them, as you say, and thus we have to fix potential problems
>> afterwards. I would expect you to help out if problem occurs.
>>
>> If we decide to not merge in a while, I am not sure how long we could
>> prevent other sdhci patches from being merged. I guess Chris will have
>> to take the final call.
>
> Or we just drop them for yet another cycle and show how mainline kernel
> development sucks, why getting stuff into mainline is utterly painful,
> and why using vendor kernels is /soo/ much better than this crap.
Dropping them is too me a bad option and I really don't think that
should be needed.
I would like to encourage people to help out with testing and I
suppose we have to give this at least some time.
Anyway, post your new version. I will create the pull request based on that.
>
> --
> FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
> improving, and getting towards what was expected from it.
^ permalink raw reply
* Re: [PATCH 00/38] MMC updates, plus CuBox-i WiFi support
From: Russell King - ARM Linux @ 2014-04-25 11:20 UTC (permalink / raw)
To: Ulf Hansson
Cc: Mark Rutland, Stephen Warren, linux-doc, Seungwon Jeon,
Chris Ball, Thierry Reding, Anton Vorontsov, Michal Simek,
Jaehoon Chung, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org, Pawel Moll, Ian Campbell, spear-devel,
Rob Herring, Ben Dooks, linux-tegra@vger.kernel.org, Shawn Guo,
Barry Song, Randy Dunlap, linux-mmc, Viresh Kumar, Sascha Hauer,
Kumar Gala, linuxppc-dev
In-Reply-To: <CAPDyKFpAiegwfh=kA8NyB+DdwKT=wSGJsB=gbEgLbyv0RJ2EOQ@mail.gmail.com>
On Fri, Apr 25, 2014 at 01:18:28PM +0200, Ulf Hansson wrote:
> On 25 April 2014 11:03, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> > On Thu, Apr 24, 2014 at 01:13:05PM +0200, Ulf Hansson wrote:
> >> On 24 April 2014 12:57, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> >> > This is nothing new or unexpected - it was last posted back in February,
> >> > and I elected that it should be held off until after the last merge
> >> > window.
> >> >
> >> > Unfortunately, I didn't have time to post it immediately after the merge
> >> > window closed, partly because it needed to be rebased on top of tglx's
> >> > IRQ changes on which it depends. I was carrying those as separate commits
> >> > to the ones Thomas was carrying in his tree - and in the event, Thomas had
> >> > modified his patches slightly between sending me copies of them and the
> >> > versions he sent during the merge window.
> >>
> >> Okay, so let's keep up the frequency here then. I only had some minor
> >> comments, please fix them and send a v2.
> >
> > Right, so I've updated the patches, and added one ack to one patch.
> > That seems insufficient to me - the only platform these have been
> > tested on is iMX6, which is sdhci-esdhc-imx.c.
> >
> > They _really_ need testing elsewhere too. Or is the plan to merge
> > them and then see about getting people to test them and fix them up
> > afterwards?
>
> I was hoping people could start doing tests, before Chris actually
> decided to pull them in. Now, if that doesn't happen, we could just
> merge them, as you say, and thus we have to fix potential problems
> afterwards. I would expect you to help out if problem occurs.
>
> If we decide to not merge in a while, I am not sure how long we could
> prevent other sdhci patches from being merged. I guess Chris will have
> to take the final call.
Or we just drop them for yet another cycle and show how mainline kernel
development sucks, why getting stuff into mainline is utterly painful,
and why using vendor kernels is /soo/ much better than this crap.
--
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
^ permalink raw reply
* Re: [PATCH 00/38] MMC updates, plus CuBox-i WiFi support
From: Ulf Hansson @ 2014-04-25 11:18 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Mark Rutland, Stephen Warren, linux-doc, Seungwon Jeon,
Chris Ball, Thierry Reding, Anton Vorontsov, Michal Simek,
Jaehoon Chung, linux-arm-kernel@lists.infradead.org,
devicetree@vger.kernel.org, Pawel Moll, Ian Campbell, spear-devel,
Rob Herring, Ben Dooks, linux-tegra@vger.kernel.org, Shawn Guo,
Barry Song, Randy Dunlap, linux-mmc, Viresh Kumar, Sascha Hauer,
Kumar Gala, linuxppc-dev
In-Reply-To: <20140425090343.GH26756@n2100.arm.linux.org.uk>
On 25 April 2014 11:03, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Thu, Apr 24, 2014 at 01:13:05PM +0200, Ulf Hansson wrote:
>> On 24 April 2014 12:57, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>> > This is nothing new or unexpected - it was last posted back in February,
>> > and I elected that it should be held off until after the last merge
>> > window.
>> >
>> > Unfortunately, I didn't have time to post it immediately after the merge
>> > window closed, partly because it needed to be rebased on top of tglx's
>> > IRQ changes on which it depends. I was carrying those as separate commits
>> > to the ones Thomas was carrying in his tree - and in the event, Thomas had
>> > modified his patches slightly between sending me copies of them and the
>> > versions he sent during the merge window.
>>
>> Okay, so let's keep up the frequency here then. I only had some minor
>> comments, please fix them and send a v2.
>
> Right, so I've updated the patches, and added one ack to one patch.
> That seems insufficient to me - the only platform these have been
> tested on is iMX6, which is sdhci-esdhc-imx.c.
>
> They _really_ need testing elsewhere too. Or is the plan to merge
> them and then see about getting people to test them and fix them up
> afterwards?
I was hoping people could start doing tests, before Chris actually
decided to pull them in. Now, if that doesn't happen, we could just
merge them, as you say, and thus we have to fix potential problems
afterwards. I would expect you to help out if problem occurs.
If we decide to not merge in a while, I am not sure how long we could
prevent other sdhci patches from being merged. I guess Chris will have
to take the final call.
>
> --
> FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
> improving, and getting towards what was expected from it.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH 00/13] Refactor pci_is_brdige() to simplify code
From: David Laight @ 2014-04-25 9:42 UTC (permalink / raw)
To: 'Yijing Wang', Bjorn Helgaas
Cc: Tony Luck, linux-ia64@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,
Thomas Gleixner, linuxppc-dev@lists.ozlabs.org, David S. Miller
In-Reply-To: <1398417515-8740-1-git-send-email-wangyijing@huawei.com>
RnJvbTogWWlqaW5nIFdhbmcNCj4gVGhpcyBwYXRjaHNldCByZW5hbWUgdGhlIGN1cnJlbnQgcGNp
X2lzX2JyaWRnZSgpIHRvIHBjaV9oYXNfc3Vib3JkaW5hdGUoKSwNCj4gYW5kIGludHJvZHVjZSBh
IG5ldyBwY2lfaXNfYnJpZGdlKCkgd2hpY2ggZGV0ZXJtaW5lIHBjaSBicmlkZ2UgYnkgY2hlY2sN
Cj4gZGV2LT5oZHJfdHlwZS4gVGhlIG5ldyBvbmUgaXMgbW9yZSBhY2N1cmF0ZS4gUENJZSBTcGVj
IGRlZmluZSB0aGUgcGNpDQo+IGRldmljZSBpcyBhIGJyaWRnZSBieSB0aGUgZGV2LT5oZHJfdHlw
ZSA9IDB4MDEgfHwgMHgwMi4NCg0KVGhhdCBpcyBhIGRhbmdlcm91cyByZW5hbWUgYW5kIGlzIGxp
a2VseSB0byBjYXVzZSBkaWZmaWN1bHQgdG8NCmlkZW50aWZ5IGJ1Z3MgaW4gYW55IGNvZGUgeW91
J3ZlIG1pc3NlZC4NCg0KCURhdmlkDQoNCg==
^ permalink raw reply
* [RFC PATCH] Fix Oops in rtas_stop_self()
From: Li Zhong @ 2014-04-25 9:33 UTC (permalink / raw)
To: PowerPC email list; +Cc: Paul Mackerras
When trying offline cpus, I noticed following Oops in rtas_stop_self(),
and it seems caused by commit 41dd03a9. The Oops disappears after
reverting this commit.
After reading the code, I guess it might be caused by moving the
rtas_args to stack. Still need some more time to read enter_rtas to
understand why it happens, but the problem seems could be solved by
moving the rtas_args away from stack by adding static before it.
[ 247.194623] cpu 28 (hwid 28) Ready to die...
[ 247.194641] Unable to handle kernel paging request for data at address 0xecb213c50
[ 247.194642] Faulting instruction address: 0x0f34157c
[ 247.194645] Oops: Kernel access of bad area, sig: 11 [#1]
[ 247.194648] SMP NR_CPUS=1024 NUMA pSeries
[ 247.194664] Modules linked in: nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6table_nat nf_nat_ipv6 ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 iptable_nat nf_nat_ipv4 nf_nat iptable_mangle nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ebtable_filter ebtables ip6table_filter ip6_tables ehea ibmvscsi scsi_transport_srp scsi_tgt
[ 247.194667] CPU: 28 PID: 0 Comm: swapper/28 Not tainted 3.15.0-rc1+ #10
[ 247.194670] CPU: 27 PID: 1171 Comm: drmgr Not tainted 3.15.0-rc1+ #10
[ 247.194673] task: c0000007ca2f0ba0 ti: c000000ecb210000 task.ti: c000000ecb210000
[ 247.194679] NIP: 000000000f34157c LR: 000000000000a84c CTR: 0000000000000151
[ 247.194680] REGS: c000000ecb213780 TRAP: 0300 Not tainted (3.15.0-rc1+)
[ 247.194684] MSR: 8000000000001000 <SF,ME> CR: 00000000 XER: 00000000
[ 247.194707] CFAR: c00000000000a844 DAR: 0000000ecb213c50 DSISR: 40000000 SOFTE: 0
[ 247.194707] GPR00: 8000000000001030 c000000ecb213a00 c0000000014c7880 0000000ecb213c50
[ 247.194707] GPR04: 000000000f340000 0000000ecb213c50 0000000000000000 8000000000001032
[ 247.194707] GPR08: 0000000000001000 c000000ecb213a00 0000000000000000 0000000000000000
[ 247.194707] GPR12: 0000000000000000 c00000000f227e00 c00000000091f5b0 000000000f394e2c
[ 247.194707] GPR16: 000000000000001c 0000000000000001 000000000000001c c0000000013ad5b0
[ 247.194707] GPR20: 0000000000000001 0000000000000000 c0000000013bfb89 c000000000d57688
[ 247.194707] GPR24: 000000000000001c c000000000d44e2c c000000ecb210000 c0000000013c0f48
[ 247.194707] GPR28: c000000000d44e28 c00000000150ca68 00000000000000e0 c000000ecb210000
[ 247.194710] NIP [000000000f34157c] 0xf34157c
[ 247.194712] LR [000000000000a84c] 0xa84c
[ 247.194714] Call Trace:
[ 247.194716] [c000000ecb213a00] [000000000000001c] 0x1c (unreliable)
[ 247.194722] [c000000ecb213be0] [c00000000007ffe0] .pseries_mach_cpu_die+0x150/0x350
[ 247.194725] [c000000ecb213cf0] [c0000000000420cc] .cpu_die+0x3c/0x60
[ 247.194727] [c000000ecb213d60] [c000000000017e58] .arch_cpu_idle_dead+0x28/0x40
[ 247.194732] [c000000ecb213dd0] [c000000000104f40] .cpu_startup_entry+0x570/0x590
[ 247.194735] [c000000ecb213ed0] [c000000000041d4c] .start_secondary+0x2dc/0x310
[ 247.194738] [c000000ecb213f90] [c00000000000996c] .start_secondary_prolog+0x10/0x14
[ 247.194740] Instruction dump:
[ 247.194744] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
[ 247.194748] XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
[ 247.194751] ---[ end trace d1d21584135396ba ]---
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 9b8e050..20d6297 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -88,13 +88,14 @@ void set_default_offline_state(int cpu)
static void rtas_stop_self(void)
{
- struct rtas_args args = {
- .token = cpu_to_be32(rtas_stop_self_token),
+ static struct rtas_args args = {
.nargs = 0,
.nret = 1,
.rets = &args.args[0],
};
+ args.token = cpu_to_be32(rtas_stop_self_token);
+
local_irq_disable();
BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE);
^ permalink raw reply related
* [PATCH 13/13] PCI, pciehp: Use new pci_is_bridge() to simplify code
From: Yijing Wang @ 2014-04-25 9:18 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Tony Luck, linux-ia64, x86, linux-kernel, Yijing Wang, sparclinux,
Thomas Gleixner, linuxppc-dev, David S. Miller
In-Reply-To: <1398417515-8740-1-git-send-email-wangyijing@huawei.com>
Now we can use new pci_is_bridge() helper function
to simplify code.
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
drivers/pci/hotplug/pciehp_pci.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index 1b53306..b6cb1df 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -62,8 +62,7 @@ int pciehp_configure_device(struct slot *p_slot)
}
list_for_each_entry(dev, &parent->devices, bus_list)
- if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
- (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
+ if (pci_is_bridge(dev))
pci_hp_add_bridge(dev);
pci_assign_unassigned_bridge_resources(bridge);
--
1.7.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox