LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 09/13] PCI, shpchp: 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/shpchp_pci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c
index 2bf69fe..ea8ad31 100644
--- a/drivers/pci/hotplug/shpchp_pci.c
+++ b/drivers/pci/hotplug/shpchp_pci.c
@@ -64,8 +64,7 @@ int __ref shpchp_configure_device(struct slot *p_slot)
 	list_for_each_entry(dev, &parent->devices, bus_list) {
 		if (PCI_SLOT(dev->devfn) != p_slot->device)
 			continue;
-		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);
 	}
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH 11/13] PCI, acpiphp: 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/acpiphp_glue.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index bccc27e..f1f9bd1 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -516,8 +516,7 @@ static void __ref enable_slot(struct acpiphp_slot *slot)
 			if (PCI_SLOT(dev->devfn) != slot->device)
 				continue;
 
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
+			if (pci_is_bridge(dev)) {
 				max = pci_scan_bridge(bus, dev, max, pass);
 				if (pass && dev->subordinate) {
 					check_hotplug_bridge(slot, dev);
-- 
1.7.1

^ permalink raw reply related

* [PATCH 06/13] powerpc/PCI: 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>
---
 arch/powerpc/kernel/pci-hotplug.c |    3 +--
 arch/powerpc/kernel/pci_of_scan.c |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index c1e17ae..5b78917 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -98,8 +98,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
 		max = bus->busn_res.start;
 		for (pass = 0; pass < 2; pass++) {
 			list_for_each_entry(dev, &bus->devices, bus_list) {
-				if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-				    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+				if (pci_is_bridge(dev))
 					max = pci_scan_bridge(bus, dev,
 							      max, pass);
 			}
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 83c26d8..059e244 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -362,8 +362,7 @@ static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
 
 	/* Now scan child busses */
 	list_for_each_entry(dev, &bus->devices, bus_list) {
-		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);
 		}
 	}
-- 
1.7.1

^ permalink raw reply related

* [PATCH 01/13] PCI: rename pci_is_bridge() to pci_has_subordinate()
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>

pci_is_bridge() which seems to determine whether device is a bridge,
returns true only when the subordinate bus exists. This confuses
people. PCI device is a bridge means its header type(bit 0 through 6)
is 0x1(PCI bridge) or 0x2(CardBus bridge). Rename the current
pci_is_bridge() helper function to pci_has_subordinate().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/pci/pci-driver.c |    8 ++++----
 drivers/pci/pci.h        |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d911e0c..b7850cb 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -580,14 +580,14 @@ static void pci_pm_default_resume(struct pci_dev *pci_dev)
 {
 	pci_fixup_device(pci_fixup_resume, pci_dev);
 
-	if (!pci_is_bridge(pci_dev))
+	if (!pci_has_subordinate(pci_dev))
 		pci_enable_wake(pci_dev, PCI_D0, false);
 }
 
 static void pci_pm_default_suspend(struct pci_dev *pci_dev)
 {
 	/* Disable non-bridge devices without PM support */
-	if (!pci_is_bridge(pci_dev))
+	if (!pci_has_subordinate(pci_dev))
 		pci_disable_enabled_device(pci_dev);
 }
 
@@ -717,7 +717,7 @@ static int pci_pm_suspend_noirq(struct device *dev)
 
 	if (!pci_dev->state_saved) {
 		pci_save_state(pci_dev);
-		if (!pci_is_bridge(pci_dev))
+		if (!pci_has_subordinate(pci_dev))
 			pci_prepare_to_sleep(pci_dev);
 	}
 
@@ -971,7 +971,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
 			return error;
 	}
 
-	if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
+	if (!pci_dev->state_saved && !pci_has_subordinate(pci_dev))
 		pci_prepare_to_sleep(pci_dev);
 
 	/*
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 6bd0822..65108fc 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -77,7 +77,7 @@ static inline void pci_wakeup_event(struct pci_dev *dev)
 	pm_wakeup_event(&dev->dev, 100);
 }
 
-static inline bool pci_is_bridge(struct pci_dev *pci_dev)
+static inline bool pci_has_subordinate(struct pci_dev *pci_dev)
 {
 	return !!(pci_dev->subordinate);
 }
-- 
1.7.1

^ permalink raw reply related

* [PATCH 04/13] x86/PCI: 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>
---
 arch/x86/pci/fixup.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 94ae9ae..e5f000c 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -337,9 +337,7 @@ static void pci_fixup_video(struct pci_dev *pdev)
 		 * type BRIDGE, or CARDBUS. Host to PCI controllers use
 		 * PCI header type NORMAL.
 		 */
-		if (bridge
-		    && ((bridge->hdr_type == PCI_HEADER_TYPE_BRIDGE)
-		       || (bridge->hdr_type == PCI_HEADER_TYPE_CARDBUS))) {
+		if (bridge && (pci_is_bridge(bridge))) {
 			pci_read_config_word(bridge, PCI_BRIDGE_CONTROL,
 						&config);
 			if (!(config & PCI_BRIDGE_CTL_VGA))
-- 
1.7.1

^ permalink raw reply related

* [PATCH 00/13] Refactor pci_is_brdige() 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

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.

Yijing Wang (13):
  PCI: rename pci_is_bridge() to pci_has_subordinate()
  PCI: Introduce new pci_is_bridge() helper function
  PCI: Use new pci_is_bridge() to simplify code
  x86/PCI: Use new pci_is_bridge() to simplify code
  IA64/PCI: Use new pci_is_bridge() to simplify code
  powerpc/PCI: Use new pci_is_bridge() to simplify code
  sparc/PCI: Use new pci_is_bridge() to simplify code
  PCI, rpaphp: Use new pci_is_bridge() to simplify code
  PCI, shpchp: Use new pci_is_bridge() to simplify code
  PCI, cpcihp: Use new pci_is_bridge() to simplify code
  PCI, acpiphp: Use new pci_is_bridge() to simplify code
  PCI, pcmcia: Use new pci_is_bridge() to simplify code
  PCI, pciehp: Use new pci_is_bridge() to simplify code

 arch/ia64/pci/fixup.c                  |    4 +---
 arch/powerpc/kernel/pci-hotplug.c      |    3 +--
 arch/powerpc/kernel/pci_of_scan.c      |    3 +--
 arch/sparc/kernel/pci.c                |    3 +--
 arch/x86/pci/fixup.c                   |    4 +---
 drivers/pci/hotplug/acpiphp_glue.c     |    3 +--
 drivers/pci/hotplug/cpci_hotplug_pci.c |    3 +--
 drivers/pci/hotplug/pciehp_pci.c       |    3 +--
 drivers/pci/hotplug/rpadlpar_core.c    |    3 +--
 drivers/pci/hotplug/shpchp_pci.c       |    3 +--
 drivers/pci/pci-acpi.c                 |    8 +-------
 drivers/pci/pci-driver.c               |    8 ++++----
 drivers/pci/pci.h                      |    2 +-
 drivers/pci/probe.c                    |    3 +--
 drivers/pci/setup-bus.c                |    4 +---
 drivers/pcmcia/cardbus.c               |    3 +--
 include/linux/pci.h                    |    6 ++++++
 17 files changed, 25 insertions(+), 41 deletions(-)

^ permalink raw reply

* [PATCH 02/13] PCI: Introduce new pci_is_bridge() helper function
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>

PCIe Spec define the PCI bridge is the PCI device
which header type(bit 0 through 6) is 0x1(PCI bridge)
or 0x2(CardBus bridge).

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 include/linux/pci.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index aab57b4..827077a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -477,6 +477,12 @@ static inline bool pci_is_root_bus(struct pci_bus *pbus)
 	return !(pbus->parent);
 }
 
+static inline bool pci_is_bridge(struct pci_dev *dev)
+{
+	return dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
+		dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
+}
+
 static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
 {
 	dev = pci_physfn(dev);
-- 
1.7.1

^ permalink raw reply related

* [PATCH 10/13] PCI, cpcihp: 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/cpci_hotplug_pci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 8c14648..9843371 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -289,8 +289,7 @@ int __ref cpci_configure_slot(struct slot *slot)
 	list_for_each_entry(dev, &parent->devices, bus_list)
 		if (PCI_SLOT(dev->devfn) != PCI_SLOT(slot->devfn))
 			continue;
-		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);
 
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH 08/13] PCI, rpaphp: 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/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 */
-- 
1.7.1

^ permalink raw reply related

* [PATCH 07/13] sparc/PCI: 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>
---
 arch/sparc/kernel/pci.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 1555bbc..857ad77 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -543,8 +543,7 @@ static void pci_of_scan_bus(struct pci_pbm_info *pbm,
 			printk("PCI: dev header type: %x\n",
 			       dev->hdr_type);
 
-		if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-		    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+		if (pci_is_bridge(dev))
 			of_scan_pci_bridge(pbm, child, dev);
 	}
 }
-- 
1.7.1

^ permalink raw reply related

* [PATCH 12/13] PCI, pcmcia: 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/pcmcia/cardbus.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index 8bde619..4fe4cc4 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -78,8 +78,7 @@ int __ref cb_alloc(struct pcmcia_socket *s)
 	max = bus->busn_res.start;
 	for (pass = 0; pass < 2; pass++)
 		list_for_each_entry(dev, &bus->devices, bus_list)
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+			if (pci_is_bridge(dev))
 				max = pci_scan_bridge(bus, dev, max, pass);
 
 	/*
-- 
1.7.1

^ permalink raw reply related

* [PATCH 03/13] PCI: 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/pci-acpi.c  |    8 +-------
 drivers/pci/probe.c     |    3 +--
 drivers/pci/setup-bus.c |    4 +---
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index f49abef..ca4927b 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -309,13 +309,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev)
 	bool check_children;
 	u64 addr;
 
-	/*
-	 * pci_is_bridge() is not suitable here, because pci_dev->subordinate
-	 * is set only after acpi_pci_find_device() has been called for the
-	 * given device.
-	 */
-	check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
-			|| pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
+	check_children = pci_is_bridge(pci_dev);
 	/* Please ref to ACPI spec for the syntax of _ADR */
 	addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
 	return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ef09f5f..f831dd8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1670,8 +1670,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 
 	for (pass=0; pass < 2; pass++)
 		list_for_each_entry(dev, &bus->devices, bus_list) {
-			if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-			    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+			if (pci_is_bridge(dev))
 				max = pci_scan_bridge(bus, dev, max, pass);
 		}
 
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 138bdd6..e399d00 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1629,9 +1629,7 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus)
 
 	down_read(&pci_bus_sem);
 	list_for_each_entry(dev, &bus->devices, bus_list)
-		if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-		    dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
-			if (dev->subordinate)
+		if (pci_is_bridge(dev) && pci_has_subordinate(dev))
 				__pci_bus_size_bridges(dev->subordinate,
 							 &add_list);
 	up_read(&pci_bus_sem);
-- 
1.7.1

^ 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

* [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

* 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

* 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/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: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

* [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

* [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

* 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

* 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

* [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: 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

* 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


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