* [2/5] dmaengine: sprd: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-11 15:47 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul, Baolin Wang
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/dma/sprd-dma.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 38d4e4f07c66..c226dc93e401 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -847,9 +847,6 @@ static int sprd_dma_slave_config(struct dma_chan *chan,
struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
struct dma_slave_config *slave_cfg = &schan->slave_cfg;
- if (!is_slave_direction(config->direction))
- return -EINVAL;
-
memcpy(slave_cfg, config, sizeof(*config));
return 0;
}
^ permalink raw reply related
* [3/5] dmaengine: imx-sdma: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-11 15:47 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul, Robin Gong
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/dma/imx-sdma.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index b4ec2d20e661..49ac851bb352 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -335,6 +335,7 @@ struct sdma_desc {
* @sdma: pointer to the SDMA engine for this channel
* @channel: the channel number, matches dmaengine chan_id + 1
* @direction: transfer type. Needed for setting SDMA script
+ * @slave_config Slave configuration
* @peripheral_type: Peripheral type. Needed for setting SDMA script
* @event_id0: aka dma request line
* @event_id1: for channels that use 2 events
@@ -362,6 +363,7 @@ struct sdma_channel {
struct sdma_engine *sdma;
unsigned int channel;
enum dma_transfer_direction direction;
+ struct dma_slave_config slave_config;
enum sdma_peripheral_type peripheral_type;
unsigned int event_id0;
unsigned int event_id1;
@@ -440,6 +442,10 @@ struct sdma_engine {
struct sdma_buffer_descriptor *bd0;
};
+static int sdma_config_write(struct dma_chan *chan,
+ struct dma_slave_config *dmaengine_cfg,
+ enum dma_transfer_direction direction);
+
static struct sdma_driver_data sdma_imx31 = {
.chnenbl0 = SDMA_CHNENBL0_IMX31,
.num_events = 32,
@@ -1415,6 +1421,8 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg(
struct scatterlist *sg;
struct sdma_desc *desc;
+ sdma_config_write(chan, &sdmac->slave_config, direction);
+
desc = sdma_transfer_init(sdmac, direction, sg_len);
if (!desc)
goto err_out;
@@ -1499,6 +1507,8 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel);
+ sdma_config_write(chan, &sdmac->slave_config, direction);
+
desc = sdma_transfer_init(sdmac, direction, num_periods);
if (!desc)
goto err_out;
@@ -1554,17 +1564,18 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic(
return NULL;
}
-static int sdma_config(struct dma_chan *chan,
- struct dma_slave_config *dmaengine_cfg)
+static int sdma_config_write(struct dma_chan *chan,
+ struct dma_slave_config *dmaengine_cfg,
+ enum dma_transfer_direction direction)
{
struct sdma_channel *sdmac = to_sdma_chan(chan);
- if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) {
+ if (direction == DMA_DEV_TO_MEM) {
sdmac->per_address = dmaengine_cfg->src_addr;
sdmac->watermark_level = dmaengine_cfg->src_maxburst *
dmaengine_cfg->src_addr_width;
sdmac->word_size = dmaengine_cfg->src_addr_width;
- } else if (dmaengine_cfg->direction == DMA_DEV_TO_DEV) {
+ } else if (direction == DMA_DEV_TO_DEV) {
sdmac->per_address2 = dmaengine_cfg->src_addr;
sdmac->per_address = dmaengine_cfg->dst_addr;
sdmac->watermark_level = dmaengine_cfg->src_maxburst &
@@ -1578,10 +1589,20 @@ static int sdma_config(struct dma_chan *chan,
dmaengine_cfg->dst_addr_width;
sdmac->word_size = dmaengine_cfg->dst_addr_width;
}
- sdmac->direction = dmaengine_cfg->direction;
+ sdmac->direction = direction;
return sdma_config_channel(chan);
}
+static int sdma_config(struct dma_chan *chan,
+ struct dma_slave_config *dmaengine_cfg)
+{
+ struct sdma_channel *sdmac = to_sdma_chan(chan);
+
+ memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
+
+ return 0;
+}
+
static enum dma_status sdma_tx_status(struct dma_chan *chan,
dma_cookie_t cookie,
struct dma_tx_state *txstate)
^ permalink raw reply related
* [4/5] dmaengine: pl330: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-11 15:47 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/dma/pl330.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 88750a34e859..cff1b143fff5 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -448,6 +448,7 @@ struct dma_pl330_chan {
/* DMA-mapped view of the FIFO; may differ if an IOMMU is present */
dma_addr_t fifo_dma;
enum dma_data_direction dir;
+ struct dma_slave_config slave_config;
/* for cyclic capability */
bool cyclic;
@@ -542,6 +543,10 @@ struct _xfer_spec {
struct dma_pl330_desc *desc;
};
+static int pl330_config_write(struct dma_chan *chan,
+ struct dma_slave_config *slave_config,
+ enum dma_transfer_direction direction);
+
static inline bool _queue_full(struct pl330_thread *thrd)
{
return thrd->req[0].desc != NULL && thrd->req[1].desc != NULL;
@@ -2220,20 +2225,21 @@ static int fixup_burst_len(int max_burst_len, int quirks)
return max_burst_len;
}
-static int pl330_config(struct dma_chan *chan,
- struct dma_slave_config *slave_config)
+static int pl330_config_write(struct dma_chan *chan,
+ struct dma_slave_config *slave_config,
+ enum dma_transfer_direction direction)
{
struct dma_pl330_chan *pch = to_pchan(chan);
pl330_unprep_slave_fifo(pch);
- if (slave_config->direction == DMA_MEM_TO_DEV) {
+ if (direction == DMA_MEM_TO_DEV) {
if (slave_config->dst_addr)
pch->fifo_addr = slave_config->dst_addr;
if (slave_config->dst_addr_width)
pch->burst_sz = __ffs(slave_config->dst_addr_width);
pch->burst_len = fixup_burst_len(slave_config->dst_maxburst,
pch->dmac->quirks);
- } else if (slave_config->direction == DMA_DEV_TO_MEM) {
+ } else if (direction == DMA_DEV_TO_MEM) {
if (slave_config->src_addr)
pch->fifo_addr = slave_config->src_addr;
if (slave_config->src_addr_width)
@@ -2245,6 +2251,16 @@ static int pl330_config(struct dma_chan *chan,
return 0;
}
+static int pl330_config(struct dma_chan *chan,
+ struct dma_slave_config *slave_config)
+{
+ struct dma_pl330_chan *pch = to_pchan(chan);
+
+ memcpy(&pch->slave_config, slave_config, sizeof(*slave_config));
+
+ return 0;
+}
+
static int pl330_terminate_all(struct dma_chan *chan)
{
struct dma_pl330_chan *pch = to_pchan(chan);
@@ -2661,6 +2677,8 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
return NULL;
}
+ pl330_config_write(chan, &pch->slave_config, direction);
+
if (!pl330_prep_slave_fifo(pch, direction))
return NULL;
@@ -2815,6 +2833,8 @@ pl330_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
if (unlikely(!pch || !sgl || !sg_len))
return NULL;
+ pl330_config_write(chan, &pch->slave_config, direction);
+
if (!pl330_prep_slave_fifo(pch, direction))
return NULL;
^ permalink raw reply related
* [5/5] dmaengine: ste_dma40: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-11 15:47 UTC (permalink / raw)
To: dmaengine; +Cc: Vinod Koul, Linus Walleij
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/dma/ste_dma40.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 5e328bd10c27..907ae97a3ef4 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -442,6 +442,7 @@ struct d40_base;
* @queue: Queued jobs.
* @prepare_queue: Prepared jobs.
* @dma_cfg: The client configuration of this dma channel.
+ * @slave_config: DMA slave configuration.
* @configured: whether the dma_cfg configuration is valid
* @base: Pointer to the device instance struct.
* @src_def_cfg: Default cfg register setting for src.
@@ -468,6 +469,7 @@ struct d40_chan {
struct list_head queue;
struct list_head prepare_queue;
struct stedma40_chan_cfg dma_cfg;
+ struct dma_slave_config slave_config;
bool configured;
struct d40_base *base;
/* Default register configurations */
@@ -625,6 +627,10 @@ static void __iomem *chan_base(struct d40_chan *chan)
#define chan_err(d40c, format, arg...) \
d40_err(chan2dev(d40c), format, ## arg)
+static int d40_set_runtime_config_write(struct dma_chan *chan,
+ struct dma_slave_config *config,
+ enum dma_transfer_direction direction);
+
static int d40_pool_lli_alloc(struct d40_chan *d40c, struct d40_desc *d40d,
int lli_len)
{
@@ -2216,6 +2222,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src,
return NULL;
}
+ d40_set_runtime_config_write(dchan, &chan->slave_config, direction);
+
spin_lock_irqsave(&chan->lock, flags);
desc = d40_prep_desc(chan, sg_src, sg_len, dma_flags);
@@ -2634,11 +2642,22 @@ dma40_config_to_halfchannel(struct d40_chan *d40c,
return 0;
}
-/* Runtime reconfiguration extension */
static int d40_set_runtime_config(struct dma_chan *chan,
struct dma_slave_config *config)
{
struct d40_chan *d40c = container_of(chan, struct d40_chan, chan);
+
+ memcpy(&d40c->slave_config, config, sizeof(*config));
+
+ return 0;
+}
+
+/* Runtime reconfiguration extension */
+static int d40_set_runtime_config_write(struct dma_chan *chan,
+ struct dma_slave_config *config,
+ enum dma_transfer_direction direction)
+{
+ struct d40_chan *d40c = container_of(chan, struct d40_chan, chan);
struct stedma40_chan_cfg *cfg = &d40c->dma_cfg;
enum dma_slave_buswidth src_addr_width, dst_addr_width;
dma_addr_t config_addr;
@@ -2655,7 +2674,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
dst_addr_width = config->dst_addr_width;
dst_maxburst = config->dst_maxburst;
- if (config->direction == DMA_DEV_TO_MEM) {
+ if (direction == DMA_DEV_TO_MEM) {
config_addr = config->src_addr;
if (cfg->dir != DMA_DEV_TO_MEM)
@@ -2671,7 +2690,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
if (dst_maxburst == 0)
dst_maxburst = src_maxburst;
- } else if (config->direction == DMA_MEM_TO_DEV) {
+ } else if (direction == DMA_MEM_TO_DEV) {
config_addr = config->dst_addr;
if (cfg->dir != DMA_MEM_TO_DEV)
@@ -2689,7 +2708,7 @@ static int d40_set_runtime_config(struct dma_chan *chan,
} else {
dev_err(d40c->base->dev,
"unrecognized channel direction %d\n",
- config->direction);
+ direction);
return -EINVAL;
}
@@ -2746,12 +2765,12 @@ static int d40_set_runtime_config(struct dma_chan *chan,
/* These settings will take precedence later */
d40c->runtime_addr = config_addr;
- d40c->runtime_direction = config->direction;
+ d40c->runtime_direction = direction;
dev_dbg(d40c->base->dev,
"configured channel %s for %s, data width %d/%d, "
"maxburst %d/%d elements, LE, no flow control\n",
dma_chan_name(chan),
- (config->direction == DMA_DEV_TO_MEM) ? "RX" : "TX",
+ (direction == DMA_DEV_TO_MEM) ? "RX" : "TX",
src_addr_width, dst_addr_width,
src_maxburst, dst_maxburst);
^ permalink raw reply related
* [1/2] firmware: add nowarn variant of request_firmware_nowait()
From: Greg Kroah-Hartman @ 2018-11-11 17:41 UTC (permalink / raw)
To: Lucas Stach
Cc: Luis R . Rodriguez, Vinod Koul, dmaengine, linux-kernel,
patchwork-lst, kernel
On Mon, Nov 05, 2018 at 06:02:31PM +0100, Lucas Stach wrote:
> Device drivers with optional firmware may still want to use the
> asynchronous firmware loading interface. To avoid printing a
> warning into the kernel log when the optional firmware is
> absent, add a nowarn variant of this interface.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/base/firmware_loader/main.c | 85 ++++++++++++++++++++---------
> include/linux/firmware.h | 12 ++++
> 2 files changed, 70 insertions(+), 27 deletions(-)
0-day blew up over this, so can you fix that up and resend the series?
thanks,
greg k-h
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12 2:41 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
At present there are multiple places where invalid node number is encoded
as -1. Even though implicitly understood it is always better to have macros
in there. Replace these open encodings for an invalid node number with the
global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
'invalid node' from various places redirecting them to a common definition.
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
Build tested this with multiple cross compiler options like alpha, sparc,
arm64, x86, powerpc64le etc with their default config which might not have
compiled tested all driver related changes. I will appreciate folks giving
this a test in their respective build environment.
All these places for replacement were found by running the following grep
patterns on the entire kernel code. Please let me know if this might have
missed some instances. This might also have replaced some false positives.
I will appreciate suggestions, inputs and review.
1. git grep "nid == -1"
2. git grep "node == -1"
3. git grep "nid = -1"
4. git grep "node = -1"
arch/alpha/include/asm/topology.h | 2 +-
arch/ia64/kernel/numa.c | 2 +-
arch/ia64/mm/discontig.c | 6 +++---
arch/ia64/sn/kernel/io_common.c | 2 +-
arch/powerpc/include/asm/pci-bridge.h | 2 +-
arch/powerpc/kernel/paca.c | 2 +-
arch/powerpc/kernel/pci-common.c | 2 +-
arch/powerpc/mm/numa.c | 14 +++++++-------
arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
arch/sparc/kernel/auxio_32.c | 2 +-
arch/sparc/kernel/pci_fire.c | 2 +-
arch/sparc/kernel/pci_schizo.c | 2 +-
arch/sparc/kernel/pcic.c | 6 +++---
arch/sparc/kernel/psycho_common.c | 2 +-
arch/sparc/kernel/sbus.c | 2 +-
arch/sparc/mm/init_64.c | 6 +++---
arch/sparc/prom/init_32.c | 2 +-
arch/sparc/prom/init_64.c | 4 ++--
arch/sparc/prom/tree_32.c | 12 ++++++------
arch/sparc/prom/tree_64.c | 18 +++++++++---------
arch/x86/include/asm/pci.h | 2 +-
arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
arch/x86/kernel/smpboot.c | 2 +-
arch/x86/platform/olpc/olpc_dt.c | 16 ++++++++--------
drivers/block/mtip32xx/mtip32xx.c | 4 ++--
drivers/dma/dmaengine.c | 3 ++-
drivers/infiniband/hw/hfi1/affinity.c | 2 +-
drivers/infiniband/hw/hfi1/init.c | 2 +-
drivers/iommu/dmar.c | 4 ++--
drivers/iommu/intel-iommu.c | 2 +-
drivers/media/pci/ivtv/ivtvfb.c | 2 +-
drivers/media/platform/vivid/vivid-osd.c | 2 +-
drivers/misc/sgi-xp/xpc_uv.c | 2 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++--
drivers/video/fbdev/mmp/fb/mmpfb.c | 2 +-
drivers/video/fbdev/pxa168fb.c | 2 +-
drivers/video/fbdev/w100fb.c | 2 +-
fs/ocfs2/dlm/dlmcommon.h | 2 +-
fs/ocfs2/dlm/dlmdomain.c | 10 +++++-----
fs/ocfs2/dlm/dlmmaster.c | 2 +-
fs/ocfs2/dlm/dlmrecovery.c | 2 +-
fs/ocfs2/stack_user.c | 6 +++---
init/init_task.c | 2 +-
kernel/kthread.c | 2 +-
kernel/sched/fair.c | 15 ++++++++-------
lib/cpumask.c | 2 +-
mm/huge_memory.c | 12 ++++++------
mm/hugetlb.c | 2 +-
mm/ksm.c | 2 +-
mm/memory.c | 6 +++---
mm/memory_hotplug.c | 12 ++++++------
mm/mempolicy.c | 2 +-
mm/page_alloc.c | 4 ++--
mm/page_ext.c | 2 +-
net/core/pktgen.c | 2 +-
net/qrtr/qrtr.c | 2 +-
tools/perf/bench/numa.c | 6 +++---
57 files changed, 125 insertions(+), 123 deletions(-)
diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
index e6e13a8..f6dc89c 100644
--- a/arch/alpha/include/asm/topology.h
+++ b/arch/alpha/include/asm/topology.h
@@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
{
int cpu;
- if (node == -1)
+ if (node == NUMA_NO_NODE)
return cpu_all_mask;
cpumask_clear(&node_to_cpumask_map[node]);
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index 92c3762..1315da6 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
cpumask_clear(&node_to_cpu_mask[node]);
for_each_possible_early_cpu(cpu) {
- node = -1;
+ node = NUMA_NO_NODE;
for (i = 0; i < NR_CPUS; ++i)
if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
node = node_cpuid[i].nid;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 8a96578..f9c3675 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
* CPUs are put into groups according to node. Walk cpu_map
* and create new groups at node boundaries.
*/
- prev_node = -1;
+ prev_node = NUMA_NO_NODE;
ai->nr_groups = 0;
for (unit = 0; unit < nr_units; unit++) {
cpu = cpu_map[unit];
@@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
{
void *ptr = NULL;
u8 best = 0xff;
- int bestnode = -1, node, anynode = 0;
+ int bestnode = NUMA_NO_NODE, node, anynode = 0;
for_each_online_node(node) {
if (node_isset(node, memory_less_mask))
@@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
anynode = node;
}
- if (bestnode == -1)
+ if (bestnode == NUMA_NO_NODE)
bestnode = anynode;
ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 8df13d0..86b3fcb 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -344,7 +344,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
printk(KERN_WARNING "on node %d but only %d nodes online."
"Association set to undetermined.\n",
controller->node, num_online_nodes());
- controller->node = -1;
+ controller->node = NUMA_NO_NODE;
}
}
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 94d4490..25a9e33 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -264,7 +264,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
#ifdef CONFIG_NUMA
#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
#else
-#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
+#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
#endif
#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 913bfca..6a0bd51 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -36,7 +36,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
* which will put its paca in the right place.
*/
if (cpu == boot_cpuid) {
- nid = -1;
+ nid = NUMA_NO_NODE;
memblock_set_bottom_up(true);
} else {
nid = early_cpu_to_node(cpu);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 88e4f69..14c33a9 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -132,7 +132,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
int nid = of_node_to_nid(dev);
if (nid < 0 || !node_online(nid))
- nid = -1;
+ nid = NUMA_NO_NODE;
PHB_SET_NODE(phb, nid);
}
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 3a048e9..77808a2 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
*/
static int associativity_to_nid(const __be32 *associativity)
{
- int nid = -1;
+ int nid = NUMA_NO_NODE;
if (min_common_depth == -1)
goto out;
@@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
/* POWER4 LPAR uses 0xffff as invalid node */
if (nid == 0xffff || nid >= MAX_NUMNODES)
- nid = -1;
+ nid = NUMA_NO_NODE;
if (nid > 0 &&
of_read_number(associativity, 1) >= distance_ref_points_depth) {
@@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
*/
static int of_node_to_nid_single(struct device_node *device)
{
- int nid = -1;
+ int nid = NUMA_NO_NODE;
const __be32 *tmp;
tmp = of_get_associativity(device);
@@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
/* Walk the device tree upwards, looking for an associativity id */
int of_node_to_nid(struct device_node *device)
{
- int nid = -1;
+ int nid = NUMA_NO_NODE;
of_node_get(device);
while (device) {
@@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
*/
static int numa_setup_cpu(unsigned long lcpu)
{
- int nid = -1;
+ int nid = NUMA_NO_NODE;
struct device_node *cpu;
/*
@@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
{
struct drmem_lmb *lmb;
unsigned long lmb_size;
- int nid = -1;
+ int nid = NUMA_NO_NODE;
lmb_size = drmem_lmb_size();
@@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
static int hot_add_node_scn_to_nid(unsigned long scn_addr)
{
struct device_node *memory;
- int nid = -1;
+ int nid = NUMA_NO_NODE;
for_each_node_by_type(memory, "memory") {
unsigned long start, size;
diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 84d038e..1ce3bfc 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -223,7 +223,7 @@ static int memtrace_online(void)
ent = &memtrace_array[i];
/* We have onlined this chunk previously */
- if (ent->nid == -1)
+ if (ent->nid == NUMA_NO_NODE)
continue;
/* Remove from io mappings */
@@ -257,7 +257,7 @@ static int memtrace_online(void)
*/
debugfs_remove_recursive(ent->dir);
pr_info("Added trace memory back to node %d\n", ent->nid);
- ent->size = ent->start = ent->nid = -1;
+ ent->size = ent->start = ent->nid = NUMA_NO_NODE;
}
if (ret)
return ret;
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index a32d588..39f6c59 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -120,7 +120,7 @@ void __init auxio_power_probe(void)
node = prom_searchsiblings(node, "obio");
node = prom_getchild(node);
node = prom_searchsiblings(node, "power");
- if (node == 0 || (s32)node == -1)
+ if (node == 0 || (s32)node == NUMA_NO_NODE)
return;
/* Map the power control register. */
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index be71ae0..474d3be 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -416,7 +416,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
struct device_node *dp = op->dev.of_node;
int err;
- pbm->numa_node = -1;
+ pbm->numa_node = NUMA_NO_NODE;
pbm->pci_ops = &sun4u_pci_ops;
pbm->config_space_reg_bits = 12;
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 934b97c..87bb231 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1347,7 +1347,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
pbm->next = pci_pbm_root;
pci_pbm_root = pbm;
- pbm->numa_node = -1;
+ pbm->numa_node = NUMA_NO_NODE;
pbm->pci_ops = &sun4u_pci_ops;
pbm->config_space_reg_bits = 8;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index ee4c9a9..d5fe898 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -476,7 +476,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
unsigned long flags;
int j;
- if (node == 0 || node == -1) {
+ if (node == 0 || node == NUMA_NO_NODE) {
strcpy(namebuf, "???");
} else {
prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
@@ -535,7 +535,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
int i, ivec;
char namebuf[64];
- if (node == 0 || node == -1) {
+ if (node == 0 || node == NUMA_NO_NODE) {
strcpy(namebuf, "???");
} else {
prom_getstring(node, "name", namebuf, sizeof(namebuf));
@@ -625,7 +625,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
list_for_each_entry(dev, &bus->devices, bus_list) {
node = pdev_to_pnode(&pcic->pbm, dev);
if(node == 0)
- node = -1;
+ node = NUMA_NO_NODE;
/* cookies */
pcp = pci_devcookie_alloc();
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 81aa91e..dcbf492 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -454,7 +454,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
struct device_node *dp = op->dev.of_node;
pbm->name = dp->full_name;
- pbm->numa_node = -1;
+ pbm->numa_node = NUMA_NO_NODE;
pbm->chip_type = chip_type;
pbm->chip_version = of_getintprop_default(dp, "version#", 0);
pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index c133dfc..28a4aa9 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -561,7 +561,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
op->dev.archdata.iommu = iommu;
op->dev.archdata.stc = strbuf;
- op->dev.archdata.numa_node = -1;
+ op->dev.archdata.numa_node = NUMA_NO_NODE;
reg_base = regs + SYSIO_IOMMUREG_BASE;
iommu->iommu_control = reg_base + IOMMU_CONTROL;
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 3c8aac2..cb1bed1 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
{
int prev_nid, new_nid;
- prev_nid = -1;
+ prev_nid = NUMA_NO_NODE;
for ( ; start < end; start += PAGE_SIZE) {
for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
struct node_mem_mask *p = &node_masks[new_nid];
if ((start & p->mask) == p->match) {
- if (prev_nid == -1)
+ if (prev_nid == NUMA_NO_NODE)
prev_nid = new_nid;
break;
}
@@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
md = mdesc_grab();
count = 0;
- nid = -1;
+ nid = NUMA_NO_NODE;
mdesc_for_each_node_by_name(md, grp, "group") {
if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
nid = count;
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
index d204701..4c6e540 100644
--- a/arch/sparc/prom/init_32.c
+++ b/arch/sparc/prom/init_32.c
@@ -58,7 +58,7 @@ void __init prom_init(struct linux_romvec *rp)
prom_nodeops = romvec->pv_nodeops;
prom_root_node = prom_getsibling(0);
- if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
+ if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
prom_halt();
if((((unsigned long) prom_nodeops) == 0) ||
diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
index 103aa91..85669c0 100644
--- a/arch/sparc/prom/init_64.c
+++ b/arch/sparc/prom/init_64.c
@@ -36,13 +36,13 @@ void __init prom_init(void *cif_handler)
prom_cif_init(cif_handler);
prom_chosen_node = prom_finddevice(prom_chosen_path);
- if (!prom_chosen_node || (s32)prom_chosen_node == -1)
+ if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
prom_halt();
prom_stdout = prom_getint(prom_chosen_node, "stdout");
node = prom_finddevice("/openprom");
- if (!node || (s32)node == -1)
+ if (!node || (s32)node == NUMA_NO_NODE)
prom_halt();
prom_getstring(node, "version", prom_version, sizeof(prom_version));
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
index 0fed893..2d0a204 100644
--- a/arch/sparc/prom/tree_32.c
+++ b/arch/sparc/prom/tree_32.c
@@ -41,11 +41,11 @@ phandle prom_getchild(phandle node)
{
phandle cnode;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
cnode = __prom_getchild(node);
- if (cnode == 0 || (s32)cnode == -1)
+ if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
return 0;
return cnode;
@@ -73,11 +73,11 @@ phandle prom_getsibling(phandle node)
{
phandle sibnode;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
sibnode = __prom_getsibling(node);
- if (sibnode == 0 || (s32)sibnode == -1)
+ if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
return 0;
return sibnode;
@@ -220,7 +220,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
*/
char *prom_nextprop(phandle node, char *oprop, char *buffer)
{
- if (node == 0 || (s32)node == -1)
+ if (node == 0 || (s32)node == NUMA_NO_NODE)
return "";
return __prom_nextprop(node, oprop);
@@ -304,7 +304,7 @@ phandle prom_inst2pkg(int inst)
node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
return node;
}
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 989e799..2b4c515 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -44,10 +44,10 @@ phandle prom_getchild(phandle node)
{
phandle cnode;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
cnode = __prom_getchild(node);
- if ((s32)cnode == -1)
+ if ((s32)cnode == NUMA_NO_NODE)
return 0;
return cnode;
}
@@ -57,10 +57,10 @@ inline phandle prom_getparent(phandle node)
{
phandle cnode;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
cnode = prom_node_to_node("parent", node);
- if ((s32)cnode == -1)
+ if ((s32)cnode == NUMA_NO_NODE)
return 0;
return cnode;
}
@@ -77,10 +77,10 @@ phandle prom_getsibling(phandle node)
{
phandle sibnode;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
sibnode = __prom_getsibling(node);
- if ((s32)sibnode == -1)
+ if ((s32)sibnode == NUMA_NO_NODE)
return 0;
return sibnode;
@@ -241,7 +241,7 @@ char *prom_firstprop(phandle node, char *buffer)
unsigned long args[7];
*buffer = 0;
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return buffer;
args[0] = (unsigned long) prom_nextprop_name;
@@ -267,7 +267,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
unsigned long args[7];
char buf[32];
- if ((s32)node == -1) {
+ if ((s32)node == NUMA_NO_NODE) {
*buffer = 0;
return buffer;
}
@@ -370,7 +370,7 @@ inline phandle prom_inst2pkg(int inst)
p1275_cmd_direct(args);
node = (int) args[4];
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
return node;
}
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 6629636..dee2a31 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -141,7 +141,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
int node;
node = __pcibus_to_node(bus);
- return (node == -1) ? cpu_online_mask :
+ return (node == NUMA_NO_NODE) ? cpu_online_mask :
cpumask_of_node(node);
}
#endif
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 391f358..3c3378a 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1390,7 +1390,7 @@ static void __init build_socket_tables(void)
}
/* Set socket -> node values: */
- lnid = -1;
+ lnid = NUMA_NO_NODE;
for_each_present_cpu(cpu) {
int nid = cpu_to_node(cpu);
int apicid, sockid;
@@ -1521,7 +1521,7 @@ static void __init uv_system_init_hub(void)
new_hub->pnode = 0xffff;
new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
- new_hub->memory_nid = -1;
+ new_hub->memory_nid = NUMA_NO_NODE;
new_hub->nr_possible_cpus = 0;
new_hub->nr_online_cpus = 0;
}
@@ -1538,7 +1538,7 @@ static void __init uv_system_init_hub(void)
uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
- if (uv_cpu_hub_info(cpu)->memory_nid == -1)
+ if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
/* Init memoryless node: */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a9134d1..c1d45dc 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -841,7 +841,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
/* reduce the number of lines printed when booting a large cpu count system */
static void announce_cpu(int cpu, int apicid)
{
- static int current_node = -1;
+ static int current_node = NUMA_NO_NODE;
int node = early_cpu_to_node(cpu);
static int width, node_width;
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index 24d2175..7098127 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -29,10 +29,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
const void *args[] = { (void *)node };
void *res[] = { &node };
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
- if (olpc_ofw("peer", args, res) || (s32)node == -1)
+ if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
return 0;
return node;
@@ -43,10 +43,10 @@ static phandle __init olpc_dt_getchild(phandle node)
const void *args[] = { (void *)node };
void *res[] = { &node };
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return 0;
- if (olpc_ofw("child", args, res) || (s32)node == -1) {
+ if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
pr_err("PROM: %s: fetching child failed!\n", __func__);
return 0;
}
@@ -60,7 +60,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
int len;
void *res[] = { &len };
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return -1;
if (olpc_ofw("getproplen", args, res)) {
@@ -100,7 +100,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
buf[0] = '\0';
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return -1;
if (olpc_ofw("nextprop", args, res) || success != 1)
@@ -115,7 +115,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
const void *args[] = { (void *)node, buf, (void *)buflen };
void *res[] = { len };
- if ((s32)node == -1)
+ if ((s32)node == NUMA_NO_NODE)
return -1;
if (olpc_ofw("package-to-path", args, res) || *len < 1)
@@ -176,7 +176,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
return 0;
}
- if ((s32) node == -1)
+ if ((s32) node == NUMA_NO_NODE)
return 0;
return node;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index a7daa8a..b889452 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4084,9 +4084,9 @@ static int get_least_used_cpu_on_node(int node)
/* Helper for selecting a node in round robin mode */
static inline int mtip_get_next_rr_node(void)
{
- static int next_node = -1;
+ static int next_node = NUMA_NO_NODE;
- if (next_node == -1) {
+ if (next_node == NUMA_NO_NODE) {
next_node = first_online_node;
return next_node;
}
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index f1a441ab..1aeefc7 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
{
int node = dev_to_node(chan->device->dev);
- return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
+ return node == NUMA_NO_NODE ||
+ cpumask_test_cpu(cpu, cpumask_of_node(node));
}
/**
diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
index 2baf38c..3e8acb8 100644
--- a/drivers/infiniband/hw/hfi1/affinity.c
+++ b/drivers/infiniband/hw/hfi1/affinity.c
@@ -777,7 +777,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
_dev_comp_vect_cpu_mask_clean_up(dd, entry);
unlock:
mutex_unlock(&node_affinity.lock);
- dd->node = -1;
+ dd->node = NUMA_NO_NODE;
}
/*
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index 0904490..0bf4577 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -1303,7 +1303,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
dd->unit = ret;
list_add(&dd->list, &hfi1_dev_list);
}
- dd->node = -1;
+ dd->node = NUMA_NO_NODE;
spin_unlock_irqrestore(&hfi1_devs_lock, flags);
idr_preload_end();
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index d9c748b..86a9c19 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -477,7 +477,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
if (!node_online(node))
- node = -1;
+ node = NUMA_NO_NODE;
drhd->iommu->node = node;
return 0;
}
@@ -1062,7 +1062,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
iommu->msagaw = msagaw;
iommu->segment = drhd->segment;
- iommu->node = -1;
+ iommu->node = NUMA_NO_NODE;
ver = readl(iommu->reg + DMAR_VER_REG);
pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f3ccf02..9f6fb13 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1772,7 +1772,7 @@ static struct dmar_domain *alloc_domain(int flags)
return NULL;
memset(domain, 0, sizeof(*domain));
- domain->nid = -1;
+ domain->nid = NUMA_NO_NODE;
domain->flags = flags;
domain->has_iotlb_device = false;
INIT_LIST_HEAD(&domain->devices);
diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
index 3e02de0..81bd41c 100644
--- a/drivers/media/pci/ivtv/ivtvfb.c
+++ b/drivers/media/pci/ivtv/ivtvfb.c
@@ -1054,7 +1054,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
/* Generate valid fb_info */
- oi->ivtvfb_info.node = -1;
+ oi->ivtvfb_info.node = NUMA_NO_NODE;
oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
oi->ivtvfb_info.fbops = &ivtvfb_ops;
oi->ivtvfb_info.par = itv;
diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
index 1a89593..56a2d41 100644
--- a/drivers/media/platform/vivid/vivid-osd.c
+++ b/drivers/media/platform/vivid/vivid-osd.c
@@ -309,7 +309,7 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
/* Generate valid fb_info */
- dev->fb_info.node = -1;
+ dev->fb_info.node = NUMA_NO_NODE;
dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
dev->fb_info.fbops = &vivid_fb_ops;
dev->fb_info.par = dev;
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 0441abe..eef36dd 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -61,7 +61,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
XPC_NOTIFY_MSG_SIZE_UV)
#define XPC_NOTIFY_IRQ_NAME "xpc_notify"
-static int xpc_mq_node = -1;
+static int xpc_mq_node = NUMA_NO_NODE;
static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 113b38e..4fae85c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6414,7 +6414,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
{
struct device *dev = tx_ring->dev;
int orig_node = dev_to_node(dev);
- int ring_node = -1;
+ int ring_node = NUMA_NO_NODE;
int size;
size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
@@ -6508,7 +6508,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
{
struct device *dev = rx_ring->dev;
int orig_node = dev_to_node(dev);
- int ring_node = -1;
+ int ring_node = NUMA_NO_NODE;
int size;
size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
index ee212be..298be9b 100644
--- a/drivers/video/fbdev/mmp/fb/mmpfb.c
+++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
@@ -519,7 +519,7 @@ static int fb_info_setup(struct fb_info *info,
/* Initialise static fb parameters.*/
info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
- info->node = -1;
+ info->node = NUMA_NO_NODE;
strcpy(info->fix.id, fbi->name);
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.type_aux = 0;
diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
index e31340f..7d775de 100644
--- a/drivers/video/fbdev/pxa168fb.c
+++ b/drivers/video/fbdev/pxa168fb.c
@@ -649,7 +649,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
*/
info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
- info->node = -1;
+ info->node = NUMA_NO_NODE;
strlcpy(info->fix.id, mi->id, 16);
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.type_aux = 0;
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index 696106e..8b0f20c 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -703,7 +703,7 @@ int w100fb_probe(struct platform_device *pdev)
info->fbops = &w100fb_ops;
info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
FBINFO_HWACCEL_FILLRECT;
- info->node = -1;
+ info->node = NUMA_NO_NODE;
info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
info->screen_size = REMAPPED_FB_LEN;
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index d06e27e..11111f6 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -1121,7 +1121,7 @@ static inline void dlm_node_iter_init(unsigned long *map,
struct dlm_node_iter *iter)
{
memcpy(iter->node_map, map, sizeof(iter->node_map));
- iter->curnode = -1;
+ iter->curnode = NUMA_NO_NODE;
}
static inline int dlm_node_iter_next(struct dlm_node_iter *iter)
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 2acd58b..381a323 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -546,7 +546,7 @@ static void dlm_mark_domain_leaving(struct dlm_ctxt *dlm)
static void __dlm_print_nodes(struct dlm_ctxt *dlm)
{
- int node = -1, num = 0;
+ int node = NUMA_NO_NODE, num = 0;
assert_spin_locked(&dlm->spinlock);
@@ -613,7 +613,7 @@ static int dlm_send_one_domain_exit(struct dlm_ctxt *dlm, u32 msg_type,
static void dlm_begin_exit_domain(struct dlm_ctxt *dlm)
{
- int node = -1;
+ int node = NUMA_NO_NODE;
/* Support for begin exit domain was added in 1.2 */
if (dlm->dlm_locking_proto.pv_major == 1 &&
@@ -1407,7 +1407,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
}
status = 0;
- node = -1;
+ node = NUMA_NO_NODE;
while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
node + 1)) < O2NM_MAX_NODES) {
if (node == dlm->node_num)
@@ -1547,7 +1547,7 @@ static void dlm_send_join_asserts(struct dlm_ctxt *dlm,
int status, node, live;
status = 0;
- node = -1;
+ node = NUMA_NO_NODE;
while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
node + 1)) < O2NM_MAX_NODES) {
if (node == dlm->node_num)
@@ -1631,7 +1631,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
spin_unlock(&dlm->spinlock);
- node = -1;
+ node = NUMA_NO_NODE;
while ((node = find_next_bit(ctxt->live_map, O2NM_MAX_NODES,
node + 1)) < O2NM_MAX_NODES) {
if (node == dlm->node_num)
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 826f056..e54bbbc 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1183,7 +1183,7 @@ static void dlm_bitmap_diff_iter_init(struct dlm_bitmap_diff_iter *iter,
unsigned long p1, p2;
int i;
- iter->curnode = -1;
+ iter->curnode = NUMA_NO_NODE;
iter->orig_bm = orig_bm;
iter->cur_bm = cur_bm;
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 802636d5..704fa8b 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -2903,7 +2903,7 @@ static int dlm_send_finalize_reco_message(struct dlm_ctxt *dlm)
}
if (stage == 1) {
/* reset the node_iter back to the top and send finalize2 */
- iter.curnode = -1;
+ iter.curnode = NUMA_NO_NODE;
stage = 2;
goto stage2;
}
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index d2fb97b..a673efa 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -171,7 +171,7 @@ union ocfs2_control_message {
static struct ocfs2_stack_plugin ocfs2_user_plugin;
static atomic_t ocfs2_control_opened;
-static int ocfs2_control_this_node = -1;
+static int ocfs2_control_this_node = NUMA_NO_NODE;
static struct ocfs2_protocol_version running_proto;
static LIST_HEAD(ocfs2_live_connection_list);
@@ -589,7 +589,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
* Last valid close clears the node number and resets
* the locking protocol version
*/
- ocfs2_control_this_node = -1;
+ ocfs2_control_this_node = NUMA_NO_NODE;
running_proto.pv_major = 0;
running_proto.pv_minor = 0;
}
@@ -612,7 +612,7 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)
p = kzalloc(sizeof(struct ocfs2_control_private), GFP_KERNEL);
if (!p)
return -ENOMEM;
- p->op_this_node = -1;
+ p->op_this_node = NUMA_NO_NODE;
mutex_lock(&ocfs2_control_lock);
file->private_data = p;
diff --git a/init/init_task.c b/init/init_task.c
index 5aebe3b..6641836 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -154,7 +154,7 @@ struct task_struct init_task
.vtime.state = VTIME_SYS,
#endif
#ifdef CONFIG_NUMA_BALANCING
- .numa_preferred_nid = -1,
+ .numa_preferred_nid = NUMA_NO_NODE,
.numa_group = NULL,
.numa_faults = NULL,
#endif
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 087d18d..77f3d94 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -675,7 +675,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
{
struct kthread_worker *worker;
struct task_struct *task;
- int node = -1;
+ int node = NUMA_NO_NODE;
worker = kzalloc(sizeof(*worker), GFP_KERNEL);
if (!worker)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ee271bb..d830fa7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
/* New address space, reset the preferred nid */
if (!(clone_flags & CLONE_VM)) {
- p->numa_preferred_nid = -1;
+ p->numa_preferred_nid = NUMA_NO_NODE;
return;
}
@@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
{
- rq->nr_numa_running += (p->numa_preferred_nid != -1);
+ rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
}
static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
{
- rq->nr_numa_running -= (p->numa_preferred_nid != -1);
+ rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
}
@@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
* two full passes of the "multi-stage node selection" test that is
* executed below.
*/
- if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
+ if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
(cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
return true;
@@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
unsigned long interval = HZ;
/* This task has no NUMA fault statistics yet */
- if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
+ if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
return;
/* Periodically retry migrating the task to the preferred node */
@@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
static void task_numa_placement(struct task_struct *p)
{
- int seq, nid, max_nid = -1;
+ int seq, nid, max_nid = NUMA_NO_NODE;
unsigned long max_faults = 0;
unsigned long fault_types[2] = { 0, 0 };
unsigned long total_faults;
@@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
* the preferred node.
*/
if (dst_nid == p->numa_preferred_nid ||
- (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
+ (p->numa_preferred_nid != NUMA_NO_NODE &&
+ src_nid != p->numa_preferred_nid))
return;
}
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 8d666ab..a089c3f 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -206,7 +206,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
/* Wrap: we always want a cpu. */
i %= num_online_cpus();
- if (node == -1) {
+ if (node == NUMA_NO_NODE) {
for_each_cpu(cpu, cpu_online_mask)
if (i-- == 0)
return cpu;
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 55478ab..5ccf89e 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1480,7 +1480,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
struct anon_vma *anon_vma = NULL;
struct page *page;
unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
- int page_nid = -1, this_nid = numa_node_id();
+ int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
int target_nid, last_cpupid = -1;
bool page_locked;
bool migrated = false;
@@ -1526,7 +1526,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
*/
page_locked = trylock_page(page);
target_nid = mpol_misplaced(page, vma, haddr);
- if (target_nid == -1) {
+ if (target_nid == NUMA_NO_NODE) {
/* If the page was locked, there are no parallel migrations */
if (page_locked)
goto clear_pmdnuma;
@@ -1534,7 +1534,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
/* Migration could have started since the pmd_trans_migrating check */
if (!page_locked) {
- page_nid = -1;
+ page_nid = NUMA_NO_NODE;
if (!get_page_unless_zero(page))
goto out_unlock;
spin_unlock(vmf->ptl);
@@ -1556,14 +1556,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
unlock_page(page);
put_page(page);
- page_nid = -1;
+ page_nid = NUMA_NO_NODE;
goto out_unlock;
}
/* Bail if we fail to protect against THP splits for any reason */
if (unlikely(!anon_vma)) {
put_page(page);
- page_nid = -1;
+ page_nid = NUMA_NO_NODE;
goto clear_pmdnuma;
}
@@ -1625,7 +1625,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
if (anon_vma)
page_unlock_anon_vma_read(anon_vma);
- if (page_nid != -1)
+ if (page_nid != NUMA_NO_NODE)
task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
flags);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index c007fb5..b769db7 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -887,7 +887,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
struct zonelist *zonelist;
struct zone *zone;
struct zoneref *z;
- int node = -1;
+ int node = NUMA_NO_NODE;
zonelist = node_zonelist(nid, gfp_mask);
diff --git a/mm/ksm.c b/mm/ksm.c
index 5b0894b..d5f8834 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
chain->chain_prune_time = jiffies;
chain->rmap_hlist_len = STABLE_NODE_CHAIN;
#if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
- chain->nid = -1; /* debug */
+ chain->nid = NUMA_NO_NODE; /* debug */
#endif
ksm_stable_node_chains++;
diff --git a/mm/memory.c b/mm/memory.c
index 4ad2d29..c0e0348 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3564,7 +3564,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct page *page = NULL;
- int page_nid = -1;
+ int page_nid = NUMA_NO_NODE;
int last_cpupid;
int target_nid;
bool migrated = false;
@@ -3631,7 +3631,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
&flags);
pte_unmap_unlock(vmf->pte, vmf->ptl);
- if (target_nid == -1) {
+ if (target_nid == NUMA_NO_NODE) {
put_page(page);
goto out;
}
@@ -3645,7 +3645,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
flags |= TNF_MIGRATE_FAIL;
out:
- if (page_nid != -1)
+ if (page_nid != NUMA_NO_NODE)
task_numa_fault(last_cpupid, page_nid, 1, flags);
return 0;
}
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2b2b3cc..70e02f8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
{
int nid = zone_to_nid(zone);
- arg->status_change_nid = -1;
- arg->status_change_nid_normal = -1;
- arg->status_change_nid_high = -1;
+ arg->status_change_nid = NUMA_NO_NODE;
+ arg->status_change_nid_normal = NUMA_NO_NODE;
+ arg->status_change_nid_high = NUMA_NO_NODE;
if (!node_state(nid, N_MEMORY))
arg->status_change_nid = nid;
@@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
unsigned long present_pages = 0;
enum zone_type zt;
- arg->status_change_nid = -1;
- arg->status_change_nid_normal = -1;
- arg->status_change_nid_high = -1;
+ arg->status_change_nid = NUMA_NO_NODE;
+ arg->status_change_nid_normal = NUMA_NO_NODE;
+ arg->status_change_nid_high = NUMA_NO_NODE;
/*
* Check whether node_states[N_NORMAL_MEMORY] will be changed.
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 5837a06..e4f8248 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
unsigned long pgoff;
int thiscpu = raw_smp_processor_id();
int thisnid = cpu_to_node(thiscpu);
- int polnid = -1;
+ int polnid = NUMA_NO_NODE;
int ret = -1;
pol = get_vma_policy(vma, addr);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a919ba5..9d38d9c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5846,7 +5846,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
return state->last_nid;
nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
- if (nid != -1) {
+ if (nid != NUMA_NO_NODE) {
state->last_start = start_pfn;
state->last_end = end_pfn;
state->last_nid = nid;
@@ -6607,7 +6607,7 @@ unsigned long __init node_map_pfn_alignment(void)
{
unsigned long accl_mask = 0, last_end = 0;
unsigned long start, end, mask;
- int last_nid = -1;
+ int last_nid = NUMA_NO_NODE;
int i, nid;
for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
diff --git a/mm/page_ext.c b/mm/page_ext.c
index ae44f7a..dfb0206 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
start = SECTION_ALIGN_DOWN(start_pfn);
end = SECTION_ALIGN_UP(start_pfn + nr_pages);
- if (nid == -1) {
+ if (nid == NUMA_NO_NODE) {
/*
* In this case, "nid" already exists and contains valid memory.
* "start_pfn" passed to us is a pfn which is an arg for
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6ac9198..af3a746 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3625,7 +3625,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
pkt_dev->svlan_cfi = 0;
pkt_dev->svlan_id = 0xffff;
pkt_dev->burst = 1;
- pkt_dev->node = -1;
+ pkt_dev->node = NUMA_NO_NODE;
err = pktgen_setup_dev(t->net, pkt_dev, ifname);
if (err)
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 86e1e37..0c56ae2 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -101,7 +101,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
return container_of(sk, struct qrtr_sock, sk);
}
-static unsigned int qrtr_local_nid = -1;
+static unsigned int qrtr_local_nid = NUMA_NO_NODE;
/* for node ids */
static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 4419551..e0ad5f1 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
CPU_ZERO(&mask);
- if (target_node == -1) {
+ if (target_node == NUMA_NO_NODE) {
for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
CPU_SET(cpu, &mask);
} else {
@@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
unsigned long nodemask;
int ret;
- if (node == -1)
+ if (node == NUMA_NO_NODE)
return;
BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
@@ -1363,7 +1363,7 @@ static void init_thread_data(void)
int cpu;
/* Allow all nodes by default: */
- td->bind_node = -1;
+ td->bind_node = NUMA_NO_NODE;
/* Allow all CPUs by default: */
CPU_ZERO(&td->bind_cpumask);
^ permalink raw reply related
* [2/5] dmaengine: sprd: remove dma_slave_config direction usage
From: Baolin Wang @ 2018-11-12 2:47 UTC (permalink / raw)
To: Vinod Koul; +Cc: dmaengine
Hi Vinod,
On 11 November 2018 at 23:47, Vinod Koul <vkoul@kernel.org> wrote:
> dma_slave_config direction was marked as deprecated quite some
> time back, remove the usage from this driver so that the field
> can be removed
>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
We already posted one patch set to fix this issue, could you have a
look when you feel free? Thanks.
https://lore.kernel.org/patchwork/patch/1007238/
https://lore.kernel.org/patchwork/project/lkml/list/?series=371812
> ---
> drivers/dma/sprd-dma.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index 38d4e4f07c66..c226dc93e401 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -847,9 +847,6 @@ static int sprd_dma_slave_config(struct dma_chan *chan,
> struct sprd_dma_chn *schan = to_sprd_dma_chan(chan);
> struct dma_slave_config *slave_cfg = &schan->slave_cfg;
>
> - if (!is_slave_direction(config->direction))
> - return -EINVAL;
> -
> memcpy(slave_cfg, config, sizeof(*config));
> return 0;
> }
> --
> 2.14.4
>
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Joseph Qi @ 2018-11-12 3:57 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
For ocfs2 part, node means host in the cluster, not NUMA node.
Thanks,
Joseph
On 18/11/12 10:41, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
>
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
>
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
>
> arch/alpha/include/asm/topology.h | 2 +-
> arch/ia64/kernel/numa.c | 2 +-
> arch/ia64/mm/discontig.c | 6 +++---
> arch/ia64/sn/kernel/io_common.c | 2 +-
> arch/powerpc/include/asm/pci-bridge.h | 2 +-
> arch/powerpc/kernel/paca.c | 2 +-
> arch/powerpc/kernel/pci-common.c | 2 +-
> arch/powerpc/mm/numa.c | 14 +++++++-------
> arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
> arch/sparc/kernel/auxio_32.c | 2 +-
> arch/sparc/kernel/pci_fire.c | 2 +-
> arch/sparc/kernel/pci_schizo.c | 2 +-
> arch/sparc/kernel/pcic.c | 6 +++---
> arch/sparc/kernel/psycho_common.c | 2 +-
> arch/sparc/kernel/sbus.c | 2 +-
> arch/sparc/mm/init_64.c | 6 +++---
> arch/sparc/prom/init_32.c | 2 +-
> arch/sparc/prom/init_64.c | 4 ++--
> arch/sparc/prom/tree_32.c | 12 ++++++------
> arch/sparc/prom/tree_64.c | 18 +++++++++---------
> arch/x86/include/asm/pci.h | 2 +-
> arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
> arch/x86/kernel/smpboot.c | 2 +-
> arch/x86/platform/olpc/olpc_dt.c | 16 ++++++++--------
> drivers/block/mtip32xx/mtip32xx.c | 4 ++--
> drivers/dma/dmaengine.c | 3 ++-
> drivers/infiniband/hw/hfi1/affinity.c | 2 +-
> drivers/infiniband/hw/hfi1/init.c | 2 +-
> drivers/iommu/dmar.c | 4 ++--
> drivers/iommu/intel-iommu.c | 2 +-
> drivers/media/pci/ivtv/ivtvfb.c | 2 +-
> drivers/media/platform/vivid/vivid-osd.c | 2 +-
> drivers/misc/sgi-xp/xpc_uv.c | 2 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++--
> drivers/video/fbdev/mmp/fb/mmpfb.c | 2 +-
> drivers/video/fbdev/pxa168fb.c | 2 +-
> drivers/video/fbdev/w100fb.c | 2 +-
> fs/ocfs2/dlm/dlmcommon.h | 2 +-
> fs/ocfs2/dlm/dlmdomain.c | 10 +++++-----
> fs/ocfs2/dlm/dlmmaster.c | 2 +-
> fs/ocfs2/dlm/dlmrecovery.c | 2 +-
> fs/ocfs2/stack_user.c | 6 +++---
> init/init_task.c | 2 +-
> kernel/kthread.c | 2 +-
> kernel/sched/fair.c | 15 ++++++++-------
> lib/cpumask.c | 2 +-
> mm/huge_memory.c | 12 ++++++------
> mm/hugetlb.c | 2 +-
> mm/ksm.c | 2 +-
> mm/memory.c | 6 +++---
> mm/memory_hotplug.c | 12 ++++++------
> mm/mempolicy.c | 2 +-
> mm/page_alloc.c | 4 ++--
> mm/page_ext.c | 2 +-
> net/core/pktgen.c | 2 +-
> net/qrtr/qrtr.c | 2 +-
> tools/perf/bench/numa.c | 6 +++---
> 57 files changed, 125 insertions(+), 123 deletions(-)
>
> diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
> {
> int cpu;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return cpu_all_mask;
>
> cpumask_clear(&node_to_cpumask_map[node]);
> diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
> index 92c3762..1315da6 100644
> --- a/arch/ia64/kernel/numa.c
> +++ b/arch/ia64/kernel/numa.c
> @@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
> cpumask_clear(&node_to_cpu_mask[node]);
>
> for_each_possible_early_cpu(cpu) {
> - node = -1;
> + node = NUMA_NO_NODE;
> for (i = 0; i < NR_CPUS; ++i)
> if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
> node = node_cpuid[i].nid;
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 8a96578..f9c3675 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
> * CPUs are put into groups according to node. Walk cpu_map
> * and create new groups at node boundaries.
> */
> - prev_node = -1;
> + prev_node = NUMA_NO_NODE;
> ai->nr_groups = 0;
> for (unit = 0; unit < nr_units; unit++) {
> cpu = cpu_map[unit];
> @@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> {
> void *ptr = NULL;
> u8 best = 0xff;
> - int bestnode = -1, node, anynode = 0;
> + int bestnode = NUMA_NO_NODE, node, anynode = 0;
>
> for_each_online_node(node) {
> if (node_isset(node, memory_less_mask))
> @@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> anynode = node;
> }
>
> - if (bestnode == -1)
> + if (bestnode == NUMA_NO_NODE)
> bestnode = anynode;
>
> ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
> diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
> index 8df13d0..86b3fcb 100644
> --- a/arch/ia64/sn/kernel/io_common.c
> +++ b/arch/ia64/sn/kernel/io_common.c
> @@ -344,7 +344,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
> printk(KERN_WARNING "on node %d but only %d nodes online."
> "Association set to undetermined.\n",
> controller->node, num_online_nodes());
> - controller->node = -1;
> + controller->node = NUMA_NO_NODE;
> }
> }
>
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 94d4490..25a9e33 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -264,7 +264,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
> #ifdef CONFIG_NUMA
> #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
> #else
> -#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
> +#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
> #endif
>
> #endif /* CONFIG_PPC64 */
> diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
> index 913bfca..6a0bd51 100644
> --- a/arch/powerpc/kernel/paca.c
> +++ b/arch/powerpc/kernel/paca.c
> @@ -36,7 +36,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
> * which will put its paca in the right place.
> */
> if (cpu == boot_cpuid) {
> - nid = -1;
> + nid = NUMA_NO_NODE;
> memblock_set_bottom_up(true);
> } else {
> nid = early_cpu_to_node(cpu);
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 88e4f69..14c33a9 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -132,7 +132,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
> int nid = of_node_to_nid(dev);
>
> if (nid < 0 || !node_online(nid))
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> PHB_SET_NODE(phb, nid);
> }
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 3a048e9..77808a2 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
> */
> static int associativity_to_nid(const __be32 *associativity)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> if (min_common_depth == -1)
> goto out;
> @@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
>
> /* POWER4 LPAR uses 0xffff as invalid node */
> if (nid == 0xffff || nid >= MAX_NUMNODES)
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> if (nid > 0 &&
> of_read_number(associativity, 1) >= distance_ref_points_depth) {
> @@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
> */
> static int of_node_to_nid_single(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> const __be32 *tmp;
>
> tmp = of_get_associativity(device);
> @@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
> /* Walk the device tree upwards, looking for an associativity id */
> int of_node_to_nid(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> of_node_get(device);
> while (device) {
> @@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
> */
> static int numa_setup_cpu(unsigned long lcpu)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> struct device_node *cpu;
>
> /*
> @@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> {
> struct drmem_lmb *lmb;
> unsigned long lmb_size;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> lmb_size = drmem_lmb_size();
>
> @@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> static int hot_add_node_scn_to_nid(unsigned long scn_addr)
> {
> struct device_node *memory;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> for_each_node_by_type(memory, "memory") {
> unsigned long start, size;
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 84d038e..1ce3bfc 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -223,7 +223,7 @@ static int memtrace_online(void)
> ent = &memtrace_array[i];
>
> /* We have onlined this chunk previously */
> - if (ent->nid == -1)
> + if (ent->nid == NUMA_NO_NODE)
> continue;
>
> /* Remove from io mappings */
> @@ -257,7 +257,7 @@ static int memtrace_online(void)
> */
> debugfs_remove_recursive(ent->dir);
> pr_info("Added trace memory back to node %d\n", ent->nid);
> - ent->size = ent->start = ent->nid = -1;
> + ent->size = ent->start = ent->nid = NUMA_NO_NODE;
> }
> if (ret)
> return ret;
> diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
> index a32d588..39f6c59 100644
> --- a/arch/sparc/kernel/auxio_32.c
> +++ b/arch/sparc/kernel/auxio_32.c
> @@ -120,7 +120,7 @@ void __init auxio_power_probe(void)
> node = prom_searchsiblings(node, "obio");
> node = prom_getchild(node);
> node = prom_searchsiblings(node, "power");
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return;
>
> /* Map the power control register. */
> diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
> index be71ae0..474d3be 100644
> --- a/arch/sparc/kernel/pci_fire.c
> +++ b/arch/sparc/kernel/pci_fire.c
> @@ -416,7 +416,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
> struct device_node *dp = op->dev.of_node;
> int err;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 12;
> diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
> index 934b97c..87bb231 100644
> --- a/arch/sparc/kernel/pci_schizo.c
> +++ b/arch/sparc/kernel/pci_schizo.c
> @@ -1347,7 +1347,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
> pbm->next = pci_pbm_root;
> pci_pbm_root = pbm;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 8;
> diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
> index ee4c9a9..d5fe898 100644
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c
> @@ -476,7 +476,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
> unsigned long flags;
> int j;
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
> @@ -535,7 +535,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
> int i, ivec;
> char namebuf[64];
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, sizeof(namebuf));
> @@ -625,7 +625,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
> list_for_each_entry(dev, &bus->devices, bus_list) {
> node = pdev_to_pnode(&pcic->pbm, dev);
> if(node == 0)
> - node = -1;
> + node = NUMA_NO_NODE;
>
> /* cookies */
> pcp = pci_devcookie_alloc();
> diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
> index 81aa91e..dcbf492 100644
> --- a/arch/sparc/kernel/psycho_common.c
> +++ b/arch/sparc/kernel/psycho_common.c
> @@ -454,7 +454,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
> struct device_node *dp = op->dev.of_node;
>
> pbm->name = dp->full_name;
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
> pbm->chip_type = chip_type;
> pbm->chip_version = of_getintprop_default(dp, "version#", 0);
> pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
> diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
> index c133dfc..28a4aa9 100644
> --- a/arch/sparc/kernel/sbus.c
> +++ b/arch/sparc/kernel/sbus.c
> @@ -561,7 +561,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
>
> op->dev.archdata.iommu = iommu;
> op->dev.archdata.stc = strbuf;
> - op->dev.archdata.numa_node = -1;
> + op->dev.archdata.numa_node = NUMA_NO_NODE;
>
> reg_base = regs + SYSIO_IOMMUREG_BASE;
> iommu->iommu_control = reg_base + IOMMU_CONTROL;
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 3c8aac2..cb1bed1 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
> {
> int prev_nid, new_nid;
>
> - prev_nid = -1;
> + prev_nid = NUMA_NO_NODE;
> for ( ; start < end; start += PAGE_SIZE) {
> for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
> struct node_mem_mask *p = &node_masks[new_nid];
>
> if ((start & p->mask) == p->match) {
> - if (prev_nid == -1)
> + if (prev_nid == NUMA_NO_NODE)
> prev_nid = new_nid;
> break;
> }
> @@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
> md = mdesc_grab();
>
> count = 0;
> - nid = -1;
> + nid = NUMA_NO_NODE;
> mdesc_for_each_node_by_name(md, grp, "group") {
> if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
> nid = count;
> diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
> index d204701..4c6e540 100644
> --- a/arch/sparc/prom/init_32.c
> +++ b/arch/sparc/prom/init_32.c
> @@ -58,7 +58,7 @@ void __init prom_init(struct linux_romvec *rp)
> prom_nodeops = romvec->pv_nodeops;
>
> prom_root_node = prom_getsibling(0);
> - if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
> + if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
> prom_halt();
>
> if((((unsigned long) prom_nodeops) == 0) ||
> diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
> index 103aa91..85669c0 100644
> --- a/arch/sparc/prom/init_64.c
> +++ b/arch/sparc/prom/init_64.c
> @@ -36,13 +36,13 @@ void __init prom_init(void *cif_handler)
> prom_cif_init(cif_handler);
>
> prom_chosen_node = prom_finddevice(prom_chosen_path);
> - if (!prom_chosen_node || (s32)prom_chosen_node == -1)
> + if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
> prom_halt();
>
> prom_stdout = prom_getint(prom_chosen_node, "stdout");
>
> node = prom_finddevice("/openprom");
> - if (!node || (s32)node == -1)
> + if (!node || (s32)node == NUMA_NO_NODE)
> prom_halt();
>
> prom_getstring(node, "version", prom_version, sizeof(prom_version));
> diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
> index 0fed893..2d0a204 100644
> --- a/arch/sparc/prom/tree_32.c
> +++ b/arch/sparc/prom/tree_32.c
> @@ -41,11 +41,11 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> cnode = __prom_getchild(node);
> - if (cnode == 0 || (s32)cnode == -1)
> + if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
> return 0;
>
> return cnode;
> @@ -73,11 +73,11 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> sibnode = __prom_getsibling(node);
> - if (sibnode == 0 || (s32)sibnode == -1)
> + if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -220,7 +220,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
> */
> char *prom_nextprop(phandle node, char *oprop, char *buffer)
> {
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return "";
>
> return __prom_nextprop(node, oprop);
> @@ -304,7 +304,7 @@ phandle prom_inst2pkg(int inst)
> node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
> restore_current();
> spin_unlock_irqrestore(&prom_lock, flags);
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
> index 989e799..2b4c515 100644
> --- a/arch/sparc/prom/tree_64.c
> +++ b/arch/sparc/prom/tree_64.c
> @@ -44,10 +44,10 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = __prom_getchild(node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -57,10 +57,10 @@ inline phandle prom_getparent(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = prom_node_to_node("parent", node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -77,10 +77,10 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> sibnode = __prom_getsibling(node);
> - if ((s32)sibnode == -1)
> + if ((s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -241,7 +241,7 @@ char *prom_firstprop(phandle node, char *buffer)
> unsigned long args[7];
>
> *buffer = 0;
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return buffer;
>
> args[0] = (unsigned long) prom_nextprop_name;
> @@ -267,7 +267,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
> unsigned long args[7];
> char buf[32];
>
> - if ((s32)node == -1) {
> + if ((s32)node == NUMA_NO_NODE) {
> *buffer = 0;
> return buffer;
> }
> @@ -370,7 +370,7 @@ inline phandle prom_inst2pkg(int inst)
> p1275_cmd_direct(args);
>
> node = (int) args[4];
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
> index 6629636..dee2a31 100644
> --- a/arch/x86/include/asm/pci.h
> +++ b/arch/x86/include/asm/pci.h
> @@ -141,7 +141,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
> int node;
>
> node = __pcibus_to_node(bus);
> - return (node == -1) ? cpu_online_mask :
> + return (node == NUMA_NO_NODE) ? cpu_online_mask :
> cpumask_of_node(node);
> }
> #endif
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 391f358..3c3378a 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -1390,7 +1390,7 @@ static void __init build_socket_tables(void)
> }
>
> /* Set socket -> node values: */
> - lnid = -1;
> + lnid = NUMA_NO_NODE;
> for_each_present_cpu(cpu) {
> int nid = cpu_to_node(cpu);
> int apicid, sockid;
> @@ -1521,7 +1521,7 @@ static void __init uv_system_init_hub(void)
> new_hub->pnode = 0xffff;
>
> new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
> - new_hub->memory_nid = -1;
> + new_hub->memory_nid = NUMA_NO_NODE;
> new_hub->nr_possible_cpus = 0;
> new_hub->nr_online_cpus = 0;
> }
> @@ -1538,7 +1538,7 @@ static void __init uv_system_init_hub(void)
>
> uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
> uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
> - if (uv_cpu_hub_info(cpu)->memory_nid == -1)
> + if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
> uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
>
> /* Init memoryless node: */
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index a9134d1..c1d45dc 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -841,7 +841,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
> /* reduce the number of lines printed when booting a large cpu count system */
> static void announce_cpu(int cpu, int apicid)
> {
> - static int current_node = -1;
> + static int current_node = NUMA_NO_NODE;
> int node = early_cpu_to_node(cpu);
> static int width, node_width;
>
> diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
> index 24d2175..7098127 100644
> --- a/arch/x86/platform/olpc/olpc_dt.c
> +++ b/arch/x86/platform/olpc/olpc_dt.c
> @@ -29,10 +29,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("peer", args, res) || (s32)node == -1)
> + if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
> return 0;
>
> return node;
> @@ -43,10 +43,10 @@ static phandle __init olpc_dt_getchild(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("child", args, res) || (s32)node == -1) {
> + if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
> pr_err("PROM: %s: fetching child failed!\n", __func__);
> return 0;
> }
> @@ -60,7 +60,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
> int len;
> void *res[] = { &len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("getproplen", args, res)) {
> @@ -100,7 +100,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
>
> buf[0] = '\0';
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("nextprop", args, res) || success != 1)
> @@ -115,7 +115,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
> const void *args[] = { (void *)node, buf, (void *)buflen };
> void *res[] = { len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("package-to-path", args, res) || *len < 1)
> @@ -176,7 +176,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
> return 0;
> }
>
> - if ((s32) node == -1)
> + if ((s32) node == NUMA_NO_NODE)
> return 0;
>
> return node;
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a7daa8a..b889452 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -4084,9 +4084,9 @@ static int get_least_used_cpu_on_node(int node)
> /* Helper for selecting a node in round robin mode */
> static inline int mtip_get_next_rr_node(void)
> {
> - static int next_node = -1;
> + static int next_node = NUMA_NO_NODE;
>
> - if (next_node == -1) {
> + if (next_node == NUMA_NO_NODE) {
> next_node = first_online_node;
> return next_node;
> }
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index f1a441ab..1aeefc7 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
> static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
> {
> int node = dev_to_node(chan->device->dev);
> - return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
> + return node == NUMA_NO_NODE ||
> + cpumask_test_cpu(cpu, cpumask_of_node(node));
> }
>
> /**
> diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
> index 2baf38c..3e8acb8 100644
> --- a/drivers/infiniband/hw/hfi1/affinity.c
> +++ b/drivers/infiniband/hw/hfi1/affinity.c
> @@ -777,7 +777,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
> _dev_comp_vect_cpu_mask_clean_up(dd, entry);
> unlock:
> mutex_unlock(&node_affinity.lock);
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
> }
>
> /*
> diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
> index 0904490..0bf4577 100644
> --- a/drivers/infiniband/hw/hfi1/init.c
> +++ b/drivers/infiniband/hw/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
> dd->unit = ret;
> list_add(&dd->list, &hfi1_dev_list);
> }
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
>
> spin_unlock_irqrestore(&hfi1_devs_lock, flags);
> idr_preload_end();
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index d9c748b..86a9c19 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -477,7 +477,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
> int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
>
> if (!node_online(node))
> - node = -1;
> + node = NUMA_NO_NODE;
> drhd->iommu->node = node;
> return 0;
> }
> @@ -1062,7 +1062,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
> iommu->msagaw = msagaw;
> iommu->segment = drhd->segment;
>
> - iommu->node = -1;
> + iommu->node = NUMA_NO_NODE;
>
> ver = readl(iommu->reg + DMAR_VER_REG);
> pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index f3ccf02..9f6fb13 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -1772,7 +1772,7 @@ static struct dmar_domain *alloc_domain(int flags)
> return NULL;
>
> memset(domain, 0, sizeof(*domain));
> - domain->nid = -1;
> + domain->nid = NUMA_NO_NODE;
> domain->flags = flags;
> domain->has_iotlb_device = false;
> INIT_LIST_HEAD(&domain->devices);
> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
> index 3e02de0..81bd41c 100644
> --- a/drivers/media/pci/ivtv/ivtvfb.c
> +++ b/drivers/media/pci/ivtv/ivtvfb.c
> @@ -1054,7 +1054,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
>
> /* Generate valid fb_info */
>
> - oi->ivtvfb_info.node = -1;
> + oi->ivtvfb_info.node = NUMA_NO_NODE;
> oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
> oi->ivtvfb_info.fbops = &ivtvfb_ops;
> oi->ivtvfb_info.par = itv;
> diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
> index 1a89593..56a2d41 100644
> --- a/drivers/media/platform/vivid/vivid-osd.c
> +++ b/drivers/media/platform/vivid/vivid-osd.c
> @@ -309,7 +309,7 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
>
> /* Generate valid fb_info */
>
> - dev->fb_info.node = -1;
> + dev->fb_info.node = NUMA_NO_NODE;
> dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
> dev->fb_info.fbops = &vivid_fb_ops;
> dev->fb_info.par = dev;
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 0441abe..eef36dd 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -61,7 +61,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
> XPC_NOTIFY_MSG_SIZE_UV)
> #define XPC_NOTIFY_IRQ_NAME "xpc_notify"
>
> -static int xpc_mq_node = -1;
> +static int xpc_mq_node = NUMA_NO_NODE;
>
> static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
> static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 113b38e..4fae85c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6414,7 +6414,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
> {
> struct device *dev = tx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
> @@ -6508,7 +6508,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
> {
> struct device *dev = rx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
> diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
> index ee212be..298be9b 100644
> --- a/drivers/video/fbdev/mmp/fb/mmpfb.c
> +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
> @@ -519,7 +519,7 @@ static int fb_info_setup(struct fb_info *info,
> /* Initialise static fb parameters.*/
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strcpy(info->fix.id, fbi->name);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
> index e31340f..7d775de 100644
> --- a/drivers/video/fbdev/pxa168fb.c
> +++ b/drivers/video/fbdev/pxa168fb.c
> @@ -649,7 +649,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
> */
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strlcpy(info->fix.id, mi->id, 16);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
> index 696106e..8b0f20c 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -703,7 +703,7 @@ int w100fb_probe(struct platform_device *pdev)
> info->fbops = &w100fb_ops;
> info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
> FBINFO_HWACCEL_FILLRECT;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
> info->screen_size = REMAPPED_FB_LEN;
>
> diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> index d06e27e..11111f6 100644
> --- a/fs/ocfs2/dlm/dlmcommon.h
> +++ b/fs/ocfs2/dlm/dlmcommon.h
> @@ -1121,7 +1121,7 @@ static inline void dlm_node_iter_init(unsigned long *map,
> struct dlm_node_iter *iter)
> {
> memcpy(iter->node_map, map, sizeof(iter->node_map));
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> }
>
> static inline int dlm_node_iter_next(struct dlm_node_iter *iter)
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 2acd58b..381a323 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -546,7 +546,7 @@ static void dlm_mark_domain_leaving(struct dlm_ctxt *dlm)
>
> static void __dlm_print_nodes(struct dlm_ctxt *dlm)
> {
> - int node = -1, num = 0;
> + int node = NUMA_NO_NODE, num = 0;
>
> assert_spin_locked(&dlm->spinlock);
>
> @@ -613,7 +613,7 @@ static int dlm_send_one_domain_exit(struct dlm_ctxt *dlm, u32 msg_type,
>
> static void dlm_begin_exit_domain(struct dlm_ctxt *dlm)
> {
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> /* Support for begin exit domain was added in 1.2 */
> if (dlm->dlm_locking_proto.pv_major == 1 &&
> @@ -1407,7 +1407,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
> }
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1547,7 +1547,7 @@ static void dlm_send_join_asserts(struct dlm_ctxt *dlm,
> int status, node, live;
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1631,7 +1631,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
>
> spin_unlock(&dlm->spinlock);
>
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(ctxt->live_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 826f056..e54bbbc 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -1183,7 +1183,7 @@ static void dlm_bitmap_diff_iter_init(struct dlm_bitmap_diff_iter *iter,
> unsigned long p1, p2;
> int i;
>
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> iter->orig_bm = orig_bm;
> iter->cur_bm = cur_bm;
>
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index 802636d5..704fa8b 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -2903,7 +2903,7 @@ static int dlm_send_finalize_reco_message(struct dlm_ctxt *dlm)
> }
> if (stage == 1) {
> /* reset the node_iter back to the top and send finalize2 */
> - iter.curnode = -1;
> + iter.curnode = NUMA_NO_NODE;
> stage = 2;
> goto stage2;
> }
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index d2fb97b..a673efa 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -171,7 +171,7 @@ union ocfs2_control_message {
> static struct ocfs2_stack_plugin ocfs2_user_plugin;
>
> static atomic_t ocfs2_control_opened;
> -static int ocfs2_control_this_node = -1;
> +static int ocfs2_control_this_node = NUMA_NO_NODE;
> static struct ocfs2_protocol_version running_proto;
>
> static LIST_HEAD(ocfs2_live_connection_list);
> @@ -589,7 +589,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
> * Last valid close clears the node number and resets
> * the locking protocol version
> */
> - ocfs2_control_this_node = -1;
> + ocfs2_control_this_node = NUMA_NO_NODE;
> running_proto.pv_major = 0;
> running_proto.pv_minor = 0;
> }
> @@ -612,7 +612,7 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)
> p = kzalloc(sizeof(struct ocfs2_control_private), GFP_KERNEL);
> if (!p)
> return -ENOMEM;
> - p->op_this_node = -1;
> + p->op_this_node = NUMA_NO_NODE;
>
> mutex_lock(&ocfs2_control_lock);
> file->private_data = p;
> diff --git a/init/init_task.c b/init/init_task.c
> index 5aebe3b..6641836 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -154,7 +154,7 @@ struct task_struct init_task
> .vtime.state = VTIME_SYS,
> #endif
> #ifdef CONFIG_NUMA_BALANCING
> - .numa_preferred_nid = -1,
> + .numa_preferred_nid = NUMA_NO_NODE,
> .numa_group = NULL,
> .numa_faults = NULL,
> #endif
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 087d18d..77f3d94 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -675,7 +675,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
> {
> struct kthread_worker *worker;
> struct task_struct *task;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> worker = kzalloc(sizeof(*worker), GFP_KERNEL);
> if (!worker)
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ee271bb..d830fa7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> /* New address space, reset the preferred nid */
> if (!(clone_flags & CLONE_VM)) {
> - p->numa_preferred_nid = -1;
> + p->numa_preferred_nid = NUMA_NO_NODE;
> return;
> }
>
> @@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running += (p->numa_preferred_nid != -1);
> + rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
> }
>
> static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running -= (p->numa_preferred_nid != -1);
> + rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
> }
>
> @@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
> * two full passes of the "multi-stage node selection" test that is
> * executed below.
> */
> - if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
> + if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
> (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
> return true;
>
> @@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
> unsigned long interval = HZ;
>
> /* This task has no NUMA fault statistics yet */
> - if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
> + if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
> return;
>
> /* Periodically retry migrating the task to the preferred node */
> @@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
>
> static void task_numa_placement(struct task_struct *p)
> {
> - int seq, nid, max_nid = -1;
> + int seq, nid, max_nid = NUMA_NO_NODE;
> unsigned long max_faults = 0;
> unsigned long fault_types[2] = { 0, 0 };
> unsigned long total_faults;
> @@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
> * the preferred node.
> */
> if (dst_nid == p->numa_preferred_nid ||
> - (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
> + (p->numa_preferred_nid != NUMA_NO_NODE &&
> + src_nid != p->numa_preferred_nid))
> return;
> }
>
> diff --git a/lib/cpumask.c b/lib/cpumask.c
> index 8d666ab..a089c3f 100644
> --- a/lib/cpumask.c
> +++ b/lib/cpumask.c
> @@ -206,7 +206,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
> /* Wrap: we always want a cpu. */
> i %= num_online_cpus();
>
> - if (node == -1) {
> + if (node == NUMA_NO_NODE) {
> for_each_cpu(cpu, cpu_online_mask)
> if (i-- == 0)
> return cpu;
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 55478ab..5ccf89e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1480,7 +1480,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> struct anon_vma *anon_vma = NULL;
> struct page *page;
> unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
> - int page_nid = -1, this_nid = numa_node_id();
> + int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
> int target_nid, last_cpupid = -1;
> bool page_locked;
> bool migrated = false;
> @@ -1526,7 +1526,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> */
> page_locked = trylock_page(page);
> target_nid = mpol_misplaced(page, vma, haddr);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> /* If the page was locked, there are no parallel migrations */
> if (page_locked)
> goto clear_pmdnuma;
> @@ -1534,7 +1534,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>
> /* Migration could have started since the pmd_trans_migrating check */
> if (!page_locked) {
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> if (!get_page_unless_zero(page))
> goto out_unlock;
> spin_unlock(vmf->ptl);
> @@ -1556,14 +1556,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
> unlock_page(page);
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto out_unlock;
> }
>
> /* Bail if we fail to protect against THP splits for any reason */
> if (unlikely(!anon_vma)) {
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto clear_pmdnuma;
> }
>
> @@ -1625,7 +1625,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (anon_vma)
> page_unlock_anon_vma_read(anon_vma);
>
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
> flags);
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c007fb5..b769db7 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -887,7 +887,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
> struct zonelist *zonelist;
> struct zone *zone;
> struct zoneref *z;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> zonelist = node_zonelist(nid, gfp_mask);
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..d5f8834 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
> chain->chain_prune_time = jiffies;
> chain->rmap_hlist_len = STABLE_NODE_CHAIN;
> #if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
> - chain->nid = -1; /* debug */
> + chain->nid = NUMA_NO_NODE; /* debug */
> #endif
> ksm_stable_node_chains++;
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 4ad2d29..c0e0348 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3564,7 +3564,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> {
> struct vm_area_struct *vma = vmf->vma;
> struct page *page = NULL;
> - int page_nid = -1;
> + int page_nid = NUMA_NO_NODE;
> int last_cpupid;
> int target_nid;
> bool migrated = false;
> @@ -3631,7 +3631,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
> &flags);
> pte_unmap_unlock(vmf->pte, vmf->ptl);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> put_page(page);
> goto out;
> }
> @@ -3645,7 +3645,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> flags |= TNF_MIGRATE_FAIL;
>
> out:
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, 1, flags);
> return 0;
> }
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 2b2b3cc..70e02f8 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
> {
> int nid = zone_to_nid(zone);
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> if (!node_state(nid, N_MEMORY))
> arg->status_change_nid = nid;
> @@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
> unsigned long present_pages = 0;
> enum zone_type zt;
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> /*
> * Check whether node_states[N_NORMAL_MEMORY] will be changed.
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 5837a06..e4f8248 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
> unsigned long pgoff;
> int thiscpu = raw_smp_processor_id();
> int thisnid = cpu_to_node(thiscpu);
> - int polnid = -1;
> + int polnid = NUMA_NO_NODE;
> int ret = -1;
>
> pol = get_vma_policy(vma, addr);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index a919ba5..9d38d9c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5846,7 +5846,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
> return state->last_nid;
>
> nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
> - if (nid != -1) {
> + if (nid != NUMA_NO_NODE) {
> state->last_start = start_pfn;
> state->last_end = end_pfn;
> state->last_nid = nid;
> @@ -6607,7 +6607,7 @@ unsigned long __init node_map_pfn_alignment(void)
> {
> unsigned long accl_mask = 0, last_end = 0;
> unsigned long start, end, mask;
> - int last_nid = -1;
> + int last_nid = NUMA_NO_NODE;
> int i, nid;
>
> for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index ae44f7a..dfb0206 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
> start = SECTION_ALIGN_DOWN(start_pfn);
> end = SECTION_ALIGN_UP(start_pfn + nr_pages);
>
> - if (nid == -1) {
> + if (nid == NUMA_NO_NODE) {
> /*
> * In this case, "nid" already exists and contains valid memory.
> * "start_pfn" passed to us is a pfn which is an arg for
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 6ac9198..af3a746 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3625,7 +3625,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
> pkt_dev->svlan_cfi = 0;
> pkt_dev->svlan_id = 0xffff;
> pkt_dev->burst = 1;
> - pkt_dev->node = -1;
> + pkt_dev->node = NUMA_NO_NODE;
>
> err = pktgen_setup_dev(t->net, pkt_dev, ifname);
> if (err)
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 86e1e37..0c56ae2 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -101,7 +101,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
> return container_of(sk, struct qrtr_sock, sk);
> }
>
> -static unsigned int qrtr_local_nid = -1;
> +static unsigned int qrtr_local_nid = NUMA_NO_NODE;
>
> /* for node ids */
> static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
> diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
> index 4419551..e0ad5f1 100644
> --- a/tools/perf/bench/numa.c
> +++ b/tools/perf/bench/numa.c
> @@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
>
> CPU_ZERO(&mask);
>
> - if (target_node == -1) {
> + if (target_node == NUMA_NO_NODE) {
> for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
> CPU_SET(cpu, &mask);
> } else {
> @@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
> unsigned long nodemask;
> int ret;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return;
>
> BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
> @@ -1363,7 +1363,7 @@ static void init_thread_data(void)
> int cpu;
>
> /* Allow all nodes by default: */
> - td->bind_node = -1;
> + td->bind_node = NUMA_NO_NODE;
>
> /* Allow all CPUs by default: */
> CPU_ZERO(&td->bind_cpumask);
>
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12 4:10 UTC (permalink / raw)
To: Joseph Qi, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
On 11/12/2018 09:27 AM, Joseph Qi wrote:
> For ocfs2 part, node means host in the cluster, not NUMA node.
>
Does not -1 indicate an invalid node which can never be present ?
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12 4:14 UTC (permalink / raw)
To: Joseph Qi, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, linux-media, iommu,
linux-rdma, dmaengine, linux-block, sparclinux, linuxppc-dev,
linux-ia64, linux-alpha
On 11/12/2018 09:40 AM, Anshuman Khandual wrote:
>
>
> On 11/12/2018 09:27 AM, Joseph Qi wrote:
>> For ocfs2 part, node means host in the cluster, not NUMA node.
>>
>
> Does not -1 indicate an invalid node which can never be present ?
>
My bad, got it wrong. Seems like this is nothing to do with NUMA node
at all. Will drop the changes from ocfs2.
^ permalink raw reply
* [3/5] dmaengine: imx-sdma: remove dma_slave_config direction usage
From: Robin Gong @ 2018-11-12 7:18 UTC (permalink / raw)
To: Vinod Koul, dmaengine@vger.kernel.org
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 2018年11月11日 23:47
> To: dmaengine@vger.kernel.org
> Cc: Vinod Koul <vkoul@kernel.org>; Robin Gong <yibin.gong@nxp.com>
> Subject: [PATCH 3/5] dmaengine: imx-sdma: remove dma_slave_config
> direction usage
>
> dma_slave_config direction was marked as deprecated quite some time back,
> remove the usage from this driver so that the field can be removed
>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
> drivers/dma/imx-sdma.c | 31 ++++++++++++++++++++++++++-----
> 1 file changed, 26 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index
> b4ec2d20e661..49ac851bb352 100644
> --- a/drivers/dma/imx-sdma.c
> +++ b/drivers/dma/imx-sdma.c
> @@ -335,6 +335,7 @@ struct sdma_desc {
> * @sdma: pointer to the SDMA engine for this channel
> * @channel: the channel number, matches dmaengine chan_id + 1
> * @direction: transfer type. Needed for setting SDMA script
> + * @slave_config Slave configuration
> * @peripheral_type: Peripheral type. Needed for setting SDMA script
> * @event_id0: aka dma request line
> * @event_id1: for channels that use 2 events
> @@ -362,6 +363,7 @@ struct sdma_channel {
> struct sdma_engine *sdma;
> unsigned int channel;
> enum dma_transfer_direction direction;
> + struct dma_slave_config slave_config;
> enum sdma_peripheral_type peripheral_type;
> unsigned int event_id0;
> unsigned int event_id1;
> @@ -440,6 +442,10 @@ struct sdma_engine {
> struct sdma_buffer_descriptor *bd0;
> };
>
> +static int sdma_config_write(struct dma_chan *chan,
> + struct dma_slave_config *dmaengine_cfg,
> + enum dma_transfer_direction direction);
> +
> static struct sdma_driver_data sdma_imx31 = {
> .chnenbl0 = SDMA_CHNENBL0_IMX31,
> .num_events = 32,
> @@ -1415,6 +1421,8 @@ static struct dma_async_tx_descriptor
> *sdma_prep_slave_sg(
> struct scatterlist *sg;
> struct sdma_desc *desc;
>
> + sdma_config_write(chan, &sdmac->slave_config, direction);
> +
> desc = sdma_transfer_init(sdmac, direction, sg_len);
> if (!desc)
> goto err_out;
> @@ -1499,6 +1507,8 @@ static struct dma_async_tx_descriptor
> *sdma_prep_dma_cyclic(
>
> dev_dbg(sdma->dev, "%s channel: %d\n", __func__, channel);
>
> + sdma_config_write(chan, &sdmac->slave_config, direction);
> +
> desc = sdma_transfer_init(sdmac, direction, num_periods);
> if (!desc)
> goto err_out;
> @@ -1554,17 +1564,18 @@ static struct dma_async_tx_descriptor
> *sdma_prep_dma_cyclic(
> return NULL;
> }
>
> -static int sdma_config(struct dma_chan *chan,
> - struct dma_slave_config *dmaengine_cfg)
> +static int sdma_config_write(struct dma_chan *chan,
> + struct dma_slave_config *dmaengine_cfg,
> + enum dma_transfer_direction direction)
> {
> struct sdma_channel *sdmac = to_sdma_chan(chan);
>
> - if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) {
> + if (direction == DMA_DEV_TO_MEM) {
> sdmac->per_address = dmaengine_cfg->src_addr;
> sdmac->watermark_level = dmaengine_cfg->src_maxburst *
> dmaengine_cfg->src_addr_width;
> sdmac->word_size = dmaengine_cfg->src_addr_width;
> - } else if (dmaengine_cfg->direction == DMA_DEV_TO_DEV) {
> + } else if (direction == DMA_DEV_TO_DEV) {
> sdmac->per_address2 = dmaengine_cfg->src_addr;
> sdmac->per_address = dmaengine_cfg->dst_addr;
> sdmac->watermark_level = dmaengine_cfg->src_maxburst & @@
> -1578,10 +1589,20 @@ static int sdma_config(struct dma_chan *chan,
> dmaengine_cfg->dst_addr_width;
> sdmac->word_size = dmaengine_cfg->dst_addr_width;
> }
> - sdmac->direction = dmaengine_cfg->direction;
> + sdmac->direction = direction;
> return sdma_config_channel(chan);
> }
>
> +static int sdma_config(struct dma_chan *chan,
> + struct dma_slave_config *dmaengine_cfg) {
> + struct sdma_channel *sdmac = to_sdma_chan(chan);
> +
> + memcpy(&sdmac->slave_config, dmaengine_cfg,
> sizeof(*dmaengine_cfg));
> +
> + return 0;
> +}
> +
> static enum dma_status sdma_tx_status(struct dma_chan *chan,
> dma_cookie_t cookie,
> struct dma_tx_state *txstate)
> --
> 2.14.4
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Hans Verkuil @ 2018-11-12 8:43 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
>
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
The 'node' in the drivers/media and the drivers/video sources has nothing to
do with numa. It's an index for a framebuffer instead (i.e. the X in /dev/fbX).
Regards,
Hans
>
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
>
> arch/alpha/include/asm/topology.h | 2 +-
> arch/ia64/kernel/numa.c | 2 +-
> arch/ia64/mm/discontig.c | 6 +++---
> arch/ia64/sn/kernel/io_common.c | 2 +-
> arch/powerpc/include/asm/pci-bridge.h | 2 +-
> arch/powerpc/kernel/paca.c | 2 +-
> arch/powerpc/kernel/pci-common.c | 2 +-
> arch/powerpc/mm/numa.c | 14 +++++++-------
> arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
> arch/sparc/kernel/auxio_32.c | 2 +-
> arch/sparc/kernel/pci_fire.c | 2 +-
> arch/sparc/kernel/pci_schizo.c | 2 +-
> arch/sparc/kernel/pcic.c | 6 +++---
> arch/sparc/kernel/psycho_common.c | 2 +-
> arch/sparc/kernel/sbus.c | 2 +-
> arch/sparc/mm/init_64.c | 6 +++---
> arch/sparc/prom/init_32.c | 2 +-
> arch/sparc/prom/init_64.c | 4 ++--
> arch/sparc/prom/tree_32.c | 12 ++++++------
> arch/sparc/prom/tree_64.c | 18 +++++++++---------
> arch/x86/include/asm/pci.h | 2 +-
> arch/x86/kernel/apic/x2apic_uv_x.c | 6 +++---
> arch/x86/kernel/smpboot.c | 2 +-
> arch/x86/platform/olpc/olpc_dt.c | 16 ++++++++--------
> drivers/block/mtip32xx/mtip32xx.c | 4 ++--
> drivers/dma/dmaengine.c | 3 ++-
> drivers/infiniband/hw/hfi1/affinity.c | 2 +-
> drivers/infiniband/hw/hfi1/init.c | 2 +-
> drivers/iommu/dmar.c | 4 ++--
> drivers/iommu/intel-iommu.c | 2 +-
> drivers/media/pci/ivtv/ivtvfb.c | 2 +-
> drivers/media/platform/vivid/vivid-osd.c | 2 +-
> drivers/misc/sgi-xp/xpc_uv.c | 2 +-
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++--
> drivers/video/fbdev/mmp/fb/mmpfb.c | 2 +-
> drivers/video/fbdev/pxa168fb.c | 2 +-
> drivers/video/fbdev/w100fb.c | 2 +-
> fs/ocfs2/dlm/dlmcommon.h | 2 +-
> fs/ocfs2/dlm/dlmdomain.c | 10 +++++-----
> fs/ocfs2/dlm/dlmmaster.c | 2 +-
> fs/ocfs2/dlm/dlmrecovery.c | 2 +-
> fs/ocfs2/stack_user.c | 6 +++---
> init/init_task.c | 2 +-
> kernel/kthread.c | 2 +-
> kernel/sched/fair.c | 15 ++++++++-------
> lib/cpumask.c | 2 +-
> mm/huge_memory.c | 12 ++++++------
> mm/hugetlb.c | 2 +-
> mm/ksm.c | 2 +-
> mm/memory.c | 6 +++---
> mm/memory_hotplug.c | 12 ++++++------
> mm/mempolicy.c | 2 +-
> mm/page_alloc.c | 4 ++--
> mm/page_ext.c | 2 +-
> net/core/pktgen.c | 2 +-
> net/qrtr/qrtr.c | 2 +-
> tools/perf/bench/numa.c | 6 +++---
> 57 files changed, 125 insertions(+), 123 deletions(-)
>
> diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
> {
> int cpu;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return cpu_all_mask;
>
> cpumask_clear(&node_to_cpumask_map[node]);
> diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
> index 92c3762..1315da6 100644
> --- a/arch/ia64/kernel/numa.c
> +++ b/arch/ia64/kernel/numa.c
> @@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
> cpumask_clear(&node_to_cpu_mask[node]);
>
> for_each_possible_early_cpu(cpu) {
> - node = -1;
> + node = NUMA_NO_NODE;
> for (i = 0; i < NR_CPUS; ++i)
> if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
> node = node_cpuid[i].nid;
> diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
> index 8a96578..f9c3675 100644
> --- a/arch/ia64/mm/discontig.c
> +++ b/arch/ia64/mm/discontig.c
> @@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
> * CPUs are put into groups according to node. Walk cpu_map
> * and create new groups at node boundaries.
> */
> - prev_node = -1;
> + prev_node = NUMA_NO_NODE;
> ai->nr_groups = 0;
> for (unit = 0; unit < nr_units; unit++) {
> cpu = cpu_map[unit];
> @@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> {
> void *ptr = NULL;
> u8 best = 0xff;
> - int bestnode = -1, node, anynode = 0;
> + int bestnode = NUMA_NO_NODE, node, anynode = 0;
>
> for_each_online_node(node) {
> if (node_isset(node, memory_less_mask))
> @@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
> anynode = node;
> }
>
> - if (bestnode == -1)
> + if (bestnode == NUMA_NO_NODE)
> bestnode = anynode;
>
> ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
> diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
> index 8df13d0..86b3fcb 100644
> --- a/arch/ia64/sn/kernel/io_common.c
> +++ b/arch/ia64/sn/kernel/io_common.c
> @@ -344,7 +344,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
> printk(KERN_WARNING "on node %d but only %d nodes online."
> "Association set to undetermined.\n",
> controller->node, num_online_nodes());
> - controller->node = -1;
> + controller->node = NUMA_NO_NODE;
> }
> }
>
> diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
> index 94d4490..25a9e33 100644
> --- a/arch/powerpc/include/asm/pci-bridge.h
> +++ b/arch/powerpc/include/asm/pci-bridge.h
> @@ -264,7 +264,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
> #ifdef CONFIG_NUMA
> #define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
> #else
> -#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1)
> +#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
> #endif
>
> #endif /* CONFIG_PPC64 */
> diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
> index 913bfca..6a0bd51 100644
> --- a/arch/powerpc/kernel/paca.c
> +++ b/arch/powerpc/kernel/paca.c
> @@ -36,7 +36,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
> * which will put its paca in the right place.
> */
> if (cpu == boot_cpuid) {
> - nid = -1;
> + nid = NUMA_NO_NODE;
> memblock_set_bottom_up(true);
> } else {
> nid = early_cpu_to_node(cpu);
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 88e4f69..14c33a9 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -132,7 +132,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
> int nid = of_node_to_nid(dev);
>
> if (nid < 0 || !node_online(nid))
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> PHB_SET_NODE(phb, nid);
> }
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 3a048e9..77808a2 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
> */
> static int associativity_to_nid(const __be32 *associativity)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> if (min_common_depth == -1)
> goto out;
> @@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
>
> /* POWER4 LPAR uses 0xffff as invalid node */
> if (nid == 0xffff || nid >= MAX_NUMNODES)
> - nid = -1;
> + nid = NUMA_NO_NODE;
>
> if (nid > 0 &&
> of_read_number(associativity, 1) >= distance_ref_points_depth) {
> @@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
> */
> static int of_node_to_nid_single(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> const __be32 *tmp;
>
> tmp = of_get_associativity(device);
> @@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
> /* Walk the device tree upwards, looking for an associativity id */
> int of_node_to_nid(struct device_node *device)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> of_node_get(device);
> while (device) {
> @@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
> */
> static int numa_setup_cpu(unsigned long lcpu)
> {
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
> struct device_node *cpu;
>
> /*
> @@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> {
> struct drmem_lmb *lmb;
> unsigned long lmb_size;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> lmb_size = drmem_lmb_size();
>
> @@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
> static int hot_add_node_scn_to_nid(unsigned long scn_addr)
> {
> struct device_node *memory;
> - int nid = -1;
> + int nid = NUMA_NO_NODE;
>
> for_each_node_by_type(memory, "memory") {
> unsigned long start, size;
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 84d038e..1ce3bfc 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -223,7 +223,7 @@ static int memtrace_online(void)
> ent = &memtrace_array[i];
>
> /* We have onlined this chunk previously */
> - if (ent->nid == -1)
> + if (ent->nid == NUMA_NO_NODE)
> continue;
>
> /* Remove from io mappings */
> @@ -257,7 +257,7 @@ static int memtrace_online(void)
> */
> debugfs_remove_recursive(ent->dir);
> pr_info("Added trace memory back to node %d\n", ent->nid);
> - ent->size = ent->start = ent->nid = -1;
> + ent->size = ent->start = ent->nid = NUMA_NO_NODE;
> }
> if (ret)
> return ret;
> diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
> index a32d588..39f6c59 100644
> --- a/arch/sparc/kernel/auxio_32.c
> +++ b/arch/sparc/kernel/auxio_32.c
> @@ -120,7 +120,7 @@ void __init auxio_power_probe(void)
> node = prom_searchsiblings(node, "obio");
> node = prom_getchild(node);
> node = prom_searchsiblings(node, "power");
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return;
>
> /* Map the power control register. */
> diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
> index be71ae0..474d3be 100644
> --- a/arch/sparc/kernel/pci_fire.c
> +++ b/arch/sparc/kernel/pci_fire.c
> @@ -416,7 +416,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
> struct device_node *dp = op->dev.of_node;
> int err;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 12;
> diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
> index 934b97c..87bb231 100644
> --- a/arch/sparc/kernel/pci_schizo.c
> +++ b/arch/sparc/kernel/pci_schizo.c
> @@ -1347,7 +1347,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
> pbm->next = pci_pbm_root;
> pci_pbm_root = pbm;
>
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
>
> pbm->pci_ops = &sun4u_pci_ops;
> pbm->config_space_reg_bits = 8;
> diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
> index ee4c9a9..d5fe898 100644
> --- a/arch/sparc/kernel/pcic.c
> +++ b/arch/sparc/kernel/pcic.c
> @@ -476,7 +476,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
> unsigned long flags;
> int j;
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
> @@ -535,7 +535,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
> int i, ivec;
> char namebuf[64];
>
> - if (node == 0 || node == -1) {
> + if (node == 0 || node == NUMA_NO_NODE) {
> strcpy(namebuf, "???");
> } else {
> prom_getstring(node, "name", namebuf, sizeof(namebuf));
> @@ -625,7 +625,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
> list_for_each_entry(dev, &bus->devices, bus_list) {
> node = pdev_to_pnode(&pcic->pbm, dev);
> if(node == 0)
> - node = -1;
> + node = NUMA_NO_NODE;
>
> /* cookies */
> pcp = pci_devcookie_alloc();
> diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
> index 81aa91e..dcbf492 100644
> --- a/arch/sparc/kernel/psycho_common.c
> +++ b/arch/sparc/kernel/psycho_common.c
> @@ -454,7 +454,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
> struct device_node *dp = op->dev.of_node;
>
> pbm->name = dp->full_name;
> - pbm->numa_node = -1;
> + pbm->numa_node = NUMA_NO_NODE;
> pbm->chip_type = chip_type;
> pbm->chip_version = of_getintprop_default(dp, "version#", 0);
> pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
> diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
> index c133dfc..28a4aa9 100644
> --- a/arch/sparc/kernel/sbus.c
> +++ b/arch/sparc/kernel/sbus.c
> @@ -561,7 +561,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
>
> op->dev.archdata.iommu = iommu;
> op->dev.archdata.stc = strbuf;
> - op->dev.archdata.numa_node = -1;
> + op->dev.archdata.numa_node = NUMA_NO_NODE;
>
> reg_base = regs + SYSIO_IOMMUREG_BASE;
> iommu->iommu_control = reg_base + IOMMU_CONTROL;
> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
> index 3c8aac2..cb1bed1 100644
> --- a/arch/sparc/mm/init_64.c
> +++ b/arch/sparc/mm/init_64.c
> @@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
> {
> int prev_nid, new_nid;
>
> - prev_nid = -1;
> + prev_nid = NUMA_NO_NODE;
> for ( ; start < end; start += PAGE_SIZE) {
> for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
> struct node_mem_mask *p = &node_masks[new_nid];
>
> if ((start & p->mask) == p->match) {
> - if (prev_nid == -1)
> + if (prev_nid == NUMA_NO_NODE)
> prev_nid = new_nid;
> break;
> }
> @@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
> md = mdesc_grab();
>
> count = 0;
> - nid = -1;
> + nid = NUMA_NO_NODE;
> mdesc_for_each_node_by_name(md, grp, "group") {
> if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
> nid = count;
> diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
> index d204701..4c6e540 100644
> --- a/arch/sparc/prom/init_32.c
> +++ b/arch/sparc/prom/init_32.c
> @@ -58,7 +58,7 @@ void __init prom_init(struct linux_romvec *rp)
> prom_nodeops = romvec->pv_nodeops;
>
> prom_root_node = prom_getsibling(0);
> - if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
> + if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
> prom_halt();
>
> if((((unsigned long) prom_nodeops) == 0) ||
> diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
> index 103aa91..85669c0 100644
> --- a/arch/sparc/prom/init_64.c
> +++ b/arch/sparc/prom/init_64.c
> @@ -36,13 +36,13 @@ void __init prom_init(void *cif_handler)
> prom_cif_init(cif_handler);
>
> prom_chosen_node = prom_finddevice(prom_chosen_path);
> - if (!prom_chosen_node || (s32)prom_chosen_node == -1)
> + if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
> prom_halt();
>
> prom_stdout = prom_getint(prom_chosen_node, "stdout");
>
> node = prom_finddevice("/openprom");
> - if (!node || (s32)node == -1)
> + if (!node || (s32)node == NUMA_NO_NODE)
> prom_halt();
>
> prom_getstring(node, "version", prom_version, sizeof(prom_version));
> diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
> index 0fed893..2d0a204 100644
> --- a/arch/sparc/prom/tree_32.c
> +++ b/arch/sparc/prom/tree_32.c
> @@ -41,11 +41,11 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> cnode = __prom_getchild(node);
> - if (cnode == 0 || (s32)cnode == -1)
> + if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
> return 0;
>
> return cnode;
> @@ -73,11 +73,11 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> sibnode = __prom_getsibling(node);
> - if (sibnode == 0 || (s32)sibnode == -1)
> + if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -220,7 +220,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
> */
> char *prom_nextprop(phandle node, char *oprop, char *buffer)
> {
> - if (node == 0 || (s32)node == -1)
> + if (node == 0 || (s32)node == NUMA_NO_NODE)
> return "";
>
> return __prom_nextprop(node, oprop);
> @@ -304,7 +304,7 @@ phandle prom_inst2pkg(int inst)
> node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
> restore_current();
> spin_unlock_irqrestore(&prom_lock, flags);
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
> index 989e799..2b4c515 100644
> --- a/arch/sparc/prom/tree_64.c
> +++ b/arch/sparc/prom/tree_64.c
> @@ -44,10 +44,10 @@ phandle prom_getchild(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = __prom_getchild(node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -57,10 +57,10 @@ inline phandle prom_getparent(phandle node)
> {
> phandle cnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> cnode = prom_node_to_node("parent", node);
> - if ((s32)cnode == -1)
> + if ((s32)cnode == NUMA_NO_NODE)
> return 0;
> return cnode;
> }
> @@ -77,10 +77,10 @@ phandle prom_getsibling(phandle node)
> {
> phandle sibnode;
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> sibnode = __prom_getsibling(node);
> - if ((s32)sibnode == -1)
> + if ((s32)sibnode == NUMA_NO_NODE)
> return 0;
>
> return sibnode;
> @@ -241,7 +241,7 @@ char *prom_firstprop(phandle node, char *buffer)
> unsigned long args[7];
>
> *buffer = 0;
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return buffer;
>
> args[0] = (unsigned long) prom_nextprop_name;
> @@ -267,7 +267,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
> unsigned long args[7];
> char buf[32];
>
> - if ((s32)node == -1) {
> + if ((s32)node == NUMA_NO_NODE) {
> *buffer = 0;
> return buffer;
> }
> @@ -370,7 +370,7 @@ inline phandle prom_inst2pkg(int inst)
> p1275_cmd_direct(args);
>
> node = (int) args[4];
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
> return node;
> }
> diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
> index 6629636..dee2a31 100644
> --- a/arch/x86/include/asm/pci.h
> +++ b/arch/x86/include/asm/pci.h
> @@ -141,7 +141,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
> int node;
>
> node = __pcibus_to_node(bus);
> - return (node == -1) ? cpu_online_mask :
> + return (node == NUMA_NO_NODE) ? cpu_online_mask :
> cpumask_of_node(node);
> }
> #endif
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 391f358..3c3378a 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -1390,7 +1390,7 @@ static void __init build_socket_tables(void)
> }
>
> /* Set socket -> node values: */
> - lnid = -1;
> + lnid = NUMA_NO_NODE;
> for_each_present_cpu(cpu) {
> int nid = cpu_to_node(cpu);
> int apicid, sockid;
> @@ -1521,7 +1521,7 @@ static void __init uv_system_init_hub(void)
> new_hub->pnode = 0xffff;
>
> new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
> - new_hub->memory_nid = -1;
> + new_hub->memory_nid = NUMA_NO_NODE;
> new_hub->nr_possible_cpus = 0;
> new_hub->nr_online_cpus = 0;
> }
> @@ -1538,7 +1538,7 @@ static void __init uv_system_init_hub(void)
>
> uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
> uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
> - if (uv_cpu_hub_info(cpu)->memory_nid == -1)
> + if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
> uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
>
> /* Init memoryless node: */
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index a9134d1..c1d45dc 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -841,7 +841,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
> /* reduce the number of lines printed when booting a large cpu count system */
> static void announce_cpu(int cpu, int apicid)
> {
> - static int current_node = -1;
> + static int current_node = NUMA_NO_NODE;
> int node = early_cpu_to_node(cpu);
> static int width, node_width;
>
> diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
> index 24d2175..7098127 100644
> --- a/arch/x86/platform/olpc/olpc_dt.c
> +++ b/arch/x86/platform/olpc/olpc_dt.c
> @@ -29,10 +29,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("peer", args, res) || (s32)node == -1)
> + if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
> return 0;
>
> return node;
> @@ -43,10 +43,10 @@ static phandle __init olpc_dt_getchild(phandle node)
> const void *args[] = { (void *)node };
> void *res[] = { &node };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return 0;
>
> - if (olpc_ofw("child", args, res) || (s32)node == -1) {
> + if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
> pr_err("PROM: %s: fetching child failed!\n", __func__);
> return 0;
> }
> @@ -60,7 +60,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
> int len;
> void *res[] = { &len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("getproplen", args, res)) {
> @@ -100,7 +100,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
>
> buf[0] = '\0';
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("nextprop", args, res) || success != 1)
> @@ -115,7 +115,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
> const void *args[] = { (void *)node, buf, (void *)buflen };
> void *res[] = { len };
>
> - if ((s32)node == -1)
> + if ((s32)node == NUMA_NO_NODE)
> return -1;
>
> if (olpc_ofw("package-to-path", args, res) || *len < 1)
> @@ -176,7 +176,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
> return 0;
> }
>
> - if ((s32) node == -1)
> + if ((s32) node == NUMA_NO_NODE)
> return 0;
>
> return node;
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index a7daa8a..b889452 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -4084,9 +4084,9 @@ static int get_least_used_cpu_on_node(int node)
> /* Helper for selecting a node in round robin mode */
> static inline int mtip_get_next_rr_node(void)
> {
> - static int next_node = -1;
> + static int next_node = NUMA_NO_NODE;
>
> - if (next_node == -1) {
> + if (next_node == NUMA_NO_NODE) {
> next_node = first_online_node;
> return next_node;
> }
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index f1a441ab..1aeefc7 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
> static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
> {
> int node = dev_to_node(chan->device->dev);
> - return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
> + return node == NUMA_NO_NODE ||
> + cpumask_test_cpu(cpu, cpumask_of_node(node));
> }
>
> /**
> diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
> index 2baf38c..3e8acb8 100644
> --- a/drivers/infiniband/hw/hfi1/affinity.c
> +++ b/drivers/infiniband/hw/hfi1/affinity.c
> @@ -777,7 +777,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
> _dev_comp_vect_cpu_mask_clean_up(dd, entry);
> unlock:
> mutex_unlock(&node_affinity.lock);
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
> }
>
> /*
> diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
> index 0904490..0bf4577 100644
> --- a/drivers/infiniband/hw/hfi1/init.c
> +++ b/drivers/infiniband/hw/hfi1/init.c
> @@ -1303,7 +1303,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
> dd->unit = ret;
> list_add(&dd->list, &hfi1_dev_list);
> }
> - dd->node = -1;
> + dd->node = NUMA_NO_NODE;
>
> spin_unlock_irqrestore(&hfi1_devs_lock, flags);
> idr_preload_end();
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index d9c748b..86a9c19 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -477,7 +477,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
> int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
>
> if (!node_online(node))
> - node = -1;
> + node = NUMA_NO_NODE;
> drhd->iommu->node = node;
> return 0;
> }
> @@ -1062,7 +1062,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
> iommu->msagaw = msagaw;
> iommu->segment = drhd->segment;
>
> - iommu->node = -1;
> + iommu->node = NUMA_NO_NODE;
>
> ver = readl(iommu->reg + DMAR_VER_REG);
> pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index f3ccf02..9f6fb13 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -1772,7 +1772,7 @@ static struct dmar_domain *alloc_domain(int flags)
> return NULL;
>
> memset(domain, 0, sizeof(*domain));
> - domain->nid = -1;
> + domain->nid = NUMA_NO_NODE;
> domain->flags = flags;
> domain->has_iotlb_device = false;
> INIT_LIST_HEAD(&domain->devices);
> diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
> index 3e02de0..81bd41c 100644
> --- a/drivers/media/pci/ivtv/ivtvfb.c
> +++ b/drivers/media/pci/ivtv/ivtvfb.c
> @@ -1054,7 +1054,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
>
> /* Generate valid fb_info */
>
> - oi->ivtvfb_info.node = -1;
> + oi->ivtvfb_info.node = NUMA_NO_NODE;
> oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT;
> oi->ivtvfb_info.fbops = &ivtvfb_ops;
> oi->ivtvfb_info.par = itv;
> diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c
> index 1a89593..56a2d41 100644
> --- a/drivers/media/platform/vivid/vivid-osd.c
> +++ b/drivers/media/platform/vivid/vivid-osd.c
> @@ -309,7 +309,7 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev)
>
> /* Generate valid fb_info */
>
> - dev->fb_info.node = -1;
> + dev->fb_info.node = NUMA_NO_NODE;
> dev->fb_info.flags = FBINFO_FLAG_DEFAULT;
> dev->fb_info.fbops = &vivid_fb_ops;
> dev->fb_info.par = dev;
> diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
> index 0441abe..eef36dd 100644
> --- a/drivers/misc/sgi-xp/xpc_uv.c
> +++ b/drivers/misc/sgi-xp/xpc_uv.c
> @@ -61,7 +61,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
> XPC_NOTIFY_MSG_SIZE_UV)
> #define XPC_NOTIFY_IRQ_NAME "xpc_notify"
>
> -static int xpc_mq_node = -1;
> +static int xpc_mq_node = NUMA_NO_NODE;
>
> static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
> static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 113b38e..4fae85c 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6414,7 +6414,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
> {
> struct device *dev = tx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
> @@ -6508,7 +6508,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
> {
> struct device *dev = rx_ring->dev;
> int orig_node = dev_to_node(dev);
> - int ring_node = -1;
> + int ring_node = NUMA_NO_NODE;
> int size;
>
> size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
> diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
> index ee212be..298be9b 100644
> --- a/drivers/video/fbdev/mmp/fb/mmpfb.c
> +++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
> @@ -519,7 +519,7 @@ static int fb_info_setup(struct fb_info *info,
> /* Initialise static fb parameters.*/
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strcpy(info->fix.id, fbi->name);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
> index e31340f..7d775de 100644
> --- a/drivers/video/fbdev/pxa168fb.c
> +++ b/drivers/video/fbdev/pxa168fb.c
> @@ -649,7 +649,7 @@ static int pxa168fb_probe(struct platform_device *pdev)
> */
> info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK |
> FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> strlcpy(info->fix.id, mi->id, 16);
> info->fix.type = FB_TYPE_PACKED_PIXELS;
> info->fix.type_aux = 0;
> diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
> index 696106e..8b0f20c 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -703,7 +703,7 @@ int w100fb_probe(struct platform_device *pdev)
> info->fbops = &w100fb_ops;
> info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
> FBINFO_HWACCEL_FILLRECT;
> - info->node = -1;
> + info->node = NUMA_NO_NODE;
> info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
> info->screen_size = REMAPPED_FB_LEN;
>
> diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
> index d06e27e..11111f6 100644
> --- a/fs/ocfs2/dlm/dlmcommon.h
> +++ b/fs/ocfs2/dlm/dlmcommon.h
> @@ -1121,7 +1121,7 @@ static inline void dlm_node_iter_init(unsigned long *map,
> struct dlm_node_iter *iter)
> {
> memcpy(iter->node_map, map, sizeof(iter->node_map));
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> }
>
> static inline int dlm_node_iter_next(struct dlm_node_iter *iter)
> diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
> index 2acd58b..381a323 100644
> --- a/fs/ocfs2/dlm/dlmdomain.c
> +++ b/fs/ocfs2/dlm/dlmdomain.c
> @@ -546,7 +546,7 @@ static void dlm_mark_domain_leaving(struct dlm_ctxt *dlm)
>
> static void __dlm_print_nodes(struct dlm_ctxt *dlm)
> {
> - int node = -1, num = 0;
> + int node = NUMA_NO_NODE, num = 0;
>
> assert_spin_locked(&dlm->spinlock);
>
> @@ -613,7 +613,7 @@ static int dlm_send_one_domain_exit(struct dlm_ctxt *dlm, u32 msg_type,
>
> static void dlm_begin_exit_domain(struct dlm_ctxt *dlm)
> {
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> /* Support for begin exit domain was added in 1.2 */
> if (dlm->dlm_locking_proto.pv_major == 1 &&
> @@ -1407,7 +1407,7 @@ static int dlm_send_join_cancels(struct dlm_ctxt *dlm,
> }
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1547,7 +1547,7 @@ static void dlm_send_join_asserts(struct dlm_ctxt *dlm,
> int status, node, live;
>
> status = 0;
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(node_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> @@ -1631,7 +1631,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm)
>
> spin_unlock(&dlm->spinlock);
>
> - node = -1;
> + node = NUMA_NO_NODE;
> while ((node = find_next_bit(ctxt->live_map, O2NM_MAX_NODES,
> node + 1)) < O2NM_MAX_NODES) {
> if (node == dlm->node_num)
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 826f056..e54bbbc 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -1183,7 +1183,7 @@ static void dlm_bitmap_diff_iter_init(struct dlm_bitmap_diff_iter *iter,
> unsigned long p1, p2;
> int i;
>
> - iter->curnode = -1;
> + iter->curnode = NUMA_NO_NODE;
> iter->orig_bm = orig_bm;
> iter->cur_bm = cur_bm;
>
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index 802636d5..704fa8b 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -2903,7 +2903,7 @@ static int dlm_send_finalize_reco_message(struct dlm_ctxt *dlm)
> }
> if (stage == 1) {
> /* reset the node_iter back to the top and send finalize2 */
> - iter.curnode = -1;
> + iter.curnode = NUMA_NO_NODE;
> stage = 2;
> goto stage2;
> }
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index d2fb97b..a673efa 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -171,7 +171,7 @@ union ocfs2_control_message {
> static struct ocfs2_stack_plugin ocfs2_user_plugin;
>
> static atomic_t ocfs2_control_opened;
> -static int ocfs2_control_this_node = -1;
> +static int ocfs2_control_this_node = NUMA_NO_NODE;
> static struct ocfs2_protocol_version running_proto;
>
> static LIST_HEAD(ocfs2_live_connection_list);
> @@ -589,7 +589,7 @@ static int ocfs2_control_release(struct inode *inode, struct file *file)
> * Last valid close clears the node number and resets
> * the locking protocol version
> */
> - ocfs2_control_this_node = -1;
> + ocfs2_control_this_node = NUMA_NO_NODE;
> running_proto.pv_major = 0;
> running_proto.pv_minor = 0;
> }
> @@ -612,7 +612,7 @@ static int ocfs2_control_open(struct inode *inode, struct file *file)
> p = kzalloc(sizeof(struct ocfs2_control_private), GFP_KERNEL);
> if (!p)
> return -ENOMEM;
> - p->op_this_node = -1;
> + p->op_this_node = NUMA_NO_NODE;
>
> mutex_lock(&ocfs2_control_lock);
> file->private_data = p;
> diff --git a/init/init_task.c b/init/init_task.c
> index 5aebe3b..6641836 100644
> --- a/init/init_task.c
> +++ b/init/init_task.c
> @@ -154,7 +154,7 @@ struct task_struct init_task
> .vtime.state = VTIME_SYS,
> #endif
> #ifdef CONFIG_NUMA_BALANCING
> - .numa_preferred_nid = -1,
> + .numa_preferred_nid = NUMA_NO_NODE,
> .numa_group = NULL,
> .numa_faults = NULL,
> #endif
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 087d18d..77f3d94 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -675,7 +675,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
> {
> struct kthread_worker *worker;
> struct task_struct *task;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> worker = kzalloc(sizeof(*worker), GFP_KERNEL);
> if (!worker)
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index ee271bb..d830fa7 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> /* New address space, reset the preferred nid */
> if (!(clone_flags & CLONE_VM)) {
> - p->numa_preferred_nid = -1;
> + p->numa_preferred_nid = NUMA_NO_NODE;
> return;
> }
>
> @@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
>
> static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running += (p->numa_preferred_nid != -1);
> + rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
> }
>
> static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
> {
> - rq->nr_numa_running -= (p->numa_preferred_nid != -1);
> + rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
> rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
> }
>
> @@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
> * two full passes of the "multi-stage node selection" test that is
> * executed below.
> */
> - if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
> + if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
> (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
> return true;
>
> @@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
> unsigned long interval = HZ;
>
> /* This task has no NUMA fault statistics yet */
> - if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
> + if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
> return;
>
> /* Periodically retry migrating the task to the preferred node */
> @@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
>
> static void task_numa_placement(struct task_struct *p)
> {
> - int seq, nid, max_nid = -1;
> + int seq, nid, max_nid = NUMA_NO_NODE;
> unsigned long max_faults = 0;
> unsigned long fault_types[2] = { 0, 0 };
> unsigned long total_faults;
> @@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
> * the preferred node.
> */
> if (dst_nid == p->numa_preferred_nid ||
> - (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
> + (p->numa_preferred_nid != NUMA_NO_NODE &&
> + src_nid != p->numa_preferred_nid))
> return;
> }
>
> diff --git a/lib/cpumask.c b/lib/cpumask.c
> index 8d666ab..a089c3f 100644
> --- a/lib/cpumask.c
> +++ b/lib/cpumask.c
> @@ -206,7 +206,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
> /* Wrap: we always want a cpu. */
> i %= num_online_cpus();
>
> - if (node == -1) {
> + if (node == NUMA_NO_NODE) {
> for_each_cpu(cpu, cpu_online_mask)
> if (i-- == 0)
> return cpu;
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 55478ab..5ccf89e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1480,7 +1480,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> struct anon_vma *anon_vma = NULL;
> struct page *page;
> unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
> - int page_nid = -1, this_nid = numa_node_id();
> + int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
> int target_nid, last_cpupid = -1;
> bool page_locked;
> bool migrated = false;
> @@ -1526,7 +1526,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> */
> page_locked = trylock_page(page);
> target_nid = mpol_misplaced(page, vma, haddr);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> /* If the page was locked, there are no parallel migrations */
> if (page_locked)
> goto clear_pmdnuma;
> @@ -1534,7 +1534,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
>
> /* Migration could have started since the pmd_trans_migrating check */
> if (!page_locked) {
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> if (!get_page_unless_zero(page))
> goto out_unlock;
> spin_unlock(vmf->ptl);
> @@ -1556,14 +1556,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
> unlock_page(page);
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto out_unlock;
> }
>
> /* Bail if we fail to protect against THP splits for any reason */
> if (unlikely(!anon_vma)) {
> put_page(page);
> - page_nid = -1;
> + page_nid = NUMA_NO_NODE;
> goto clear_pmdnuma;
> }
>
> @@ -1625,7 +1625,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
> if (anon_vma)
> page_unlock_anon_vma_read(anon_vma);
>
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
> flags);
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c007fb5..b769db7 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -887,7 +887,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
> struct zonelist *zonelist;
> struct zone *zone;
> struct zoneref *z;
> - int node = -1;
> + int node = NUMA_NO_NODE;
>
> zonelist = node_zonelist(nid, gfp_mask);
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..d5f8834 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
> chain->chain_prune_time = jiffies;
> chain->rmap_hlist_len = STABLE_NODE_CHAIN;
> #if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
> - chain->nid = -1; /* debug */
> + chain->nid = NUMA_NO_NODE; /* debug */
> #endif
> ksm_stable_node_chains++;
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 4ad2d29..c0e0348 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3564,7 +3564,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> {
> struct vm_area_struct *vma = vmf->vma;
> struct page *page = NULL;
> - int page_nid = -1;
> + int page_nid = NUMA_NO_NODE;
> int last_cpupid;
> int target_nid;
> bool migrated = false;
> @@ -3631,7 +3631,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
> &flags);
> pte_unmap_unlock(vmf->pte, vmf->ptl);
> - if (target_nid == -1) {
> + if (target_nid == NUMA_NO_NODE) {
> put_page(page);
> goto out;
> }
> @@ -3645,7 +3645,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> flags |= TNF_MIGRATE_FAIL;
>
> out:
> - if (page_nid != -1)
> + if (page_nid != NUMA_NO_NODE)
> task_numa_fault(last_cpupid, page_nid, 1, flags);
> return 0;
> }
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 2b2b3cc..70e02f8 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
> {
> int nid = zone_to_nid(zone);
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> if (!node_state(nid, N_MEMORY))
> arg->status_change_nid = nid;
> @@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
> unsigned long present_pages = 0;
> enum zone_type zt;
>
> - arg->status_change_nid = -1;
> - arg->status_change_nid_normal = -1;
> - arg->status_change_nid_high = -1;
> + arg->status_change_nid = NUMA_NO_NODE;
> + arg->status_change_nid_normal = NUMA_NO_NODE;
> + arg->status_change_nid_high = NUMA_NO_NODE;
>
> /*
> * Check whether node_states[N_NORMAL_MEMORY] will be changed.
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 5837a06..e4f8248 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
> unsigned long pgoff;
> int thiscpu = raw_smp_processor_id();
> int thisnid = cpu_to_node(thiscpu);
> - int polnid = -1;
> + int polnid = NUMA_NO_NODE;
> int ret = -1;
>
> pol = get_vma_policy(vma, addr);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index a919ba5..9d38d9c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5846,7 +5846,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
> return state->last_nid;
>
> nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
> - if (nid != -1) {
> + if (nid != NUMA_NO_NODE) {
> state->last_start = start_pfn;
> state->last_end = end_pfn;
> state->last_nid = nid;
> @@ -6607,7 +6607,7 @@ unsigned long __init node_map_pfn_alignment(void)
> {
> unsigned long accl_mask = 0, last_end = 0;
> unsigned long start, end, mask;
> - int last_nid = -1;
> + int last_nid = NUMA_NO_NODE;
> int i, nid;
>
> for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index ae44f7a..dfb0206 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
> start = SECTION_ALIGN_DOWN(start_pfn);
> end = SECTION_ALIGN_UP(start_pfn + nr_pages);
>
> - if (nid == -1) {
> + if (nid == NUMA_NO_NODE) {
> /*
> * In this case, "nid" already exists and contains valid memory.
> * "start_pfn" passed to us is a pfn which is an arg for
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 6ac9198..af3a746 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3625,7 +3625,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
> pkt_dev->svlan_cfi = 0;
> pkt_dev->svlan_id = 0xffff;
> pkt_dev->burst = 1;
> - pkt_dev->node = -1;
> + pkt_dev->node = NUMA_NO_NODE;
>
> err = pktgen_setup_dev(t->net, pkt_dev, ifname);
> if (err)
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 86e1e37..0c56ae2 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -101,7 +101,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
> return container_of(sk, struct qrtr_sock, sk);
> }
>
> -static unsigned int qrtr_local_nid = -1;
> +static unsigned int qrtr_local_nid = NUMA_NO_NODE;
>
> /* for node ids */
> static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
> diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
> index 4419551..e0ad5f1 100644
> --- a/tools/perf/bench/numa.c
> +++ b/tools/perf/bench/numa.c
> @@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
>
> CPU_ZERO(&mask);
>
> - if (target_node == -1) {
> + if (target_node == NUMA_NO_NODE) {
> for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
> CPU_SET(cpu, &mask);
> } else {
> @@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
> unsigned long nodemask;
> int ret;
>
> - if (node == -1)
> + if (node == NUMA_NO_NODE)
> return;
>
> BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
> @@ -1363,7 +1363,7 @@ static void init_thread_data(void)
> int cpu;
>
> /* Allow all nodes by default: */
> - td->bind_node = -1;
> + td->bind_node = NUMA_NO_NODE;
>
> /* Allow all CPUs by default: */
> CPU_ZERO(&td->bind_cpumask);
>
^ permalink raw reply
* [RFC] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-12 11:47 UTC (permalink / raw)
To: Hans Verkuil, linux-mm, linux-kernel
Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
linux-media, iommu, linux-rdma, dmaengine, linux-block,
sparclinux, linuxppc-dev, linux-ia64, linux-alpha
On 11/12/2018 02:13 PM, Hans Verkuil wrote:
> On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
>> At present there are multiple places where invalid node number is encoded
>> as -1. Even though implicitly understood it is always better to have macros
>> in there. Replace these open encodings for an invalid node number with the
>> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
>> 'invalid node' from various places redirecting them to a common definition.
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> Build tested this with multiple cross compiler options like alpha, sparc,
>> arm64, x86, powerpc64le etc with their default config which might not have
>> compiled tested all driver related changes. I will appreciate folks giving
>> this a test in their respective build environment.
>>
>> All these places for replacement were found by running the following grep
>> patterns on the entire kernel code. Please let me know if this might have
>> missed some instances. This might also have replaced some false positives.
>> I will appreciate suggestions, inputs and review.
> The 'node' in the drivers/media and the drivers/video sources has nothing to
> do with numa. It's an index for a framebuffer instead (i.e. the X in /dev/fbX).
Thanks for the input. Will drop the changes there.
^ permalink raw reply
* [PATCH/RFC] dmaengine: sh: Remove R-Mobile APE6 support
From: Geert Uytterhoeven @ 2018-11-12 15:22 UTC (permalink / raw)
To: Vinod Koul, Dan Williams
Cc: Guennadi Liakhovetski, Laurent Pinchart, Wolfram Sang,
Simon Horman, Magnus Damm, dmaengine, linux-renesas-soc,
Geert Uytterhoeven
Renesas R-Mobile APE6 support is currently unused:
- DMA slaves were never enabled in r8a73a4.dtsi,
- The driver relies on legacy filter matching and describing all
slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
similar hardware like rcar-dmac,
- The driver doesn't seem to work well.
Remove the driver, it can be resurrected from git history when needed.
As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
sh-dma-engine driver core is now used on SuperH only.
Note that the DT bindings are still present, as r8a73a4.dtsi uses them.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Notes:
1. As Renesas ARM SoCs no longer use drivers/dma/sh/shdma-base.c, the
task to remove use of the deprecated dma_slave_config.direction
field gets thrown into the SuperH maintainers' basket ;-)
2. This affects shmobile_defconfig and renesas_defconfig
(CONFIG_SH_DMAE_BASE and CONFIG_SH_DMAE are no longer enabled by
default).
3. I tried to get SCIFA DMA to work by:
- Applying the DT and driver patches below,
- Reverting 219fb0c1436e4893 ("serial: sh-sci: Remove the
platform data dma slave rx/tx channel IDs").
After that, serial console output using DMA seems to work, but the
system locks up when receiving any serial console input.
Probably it is easier to add r8a73a4 support to rcar-dmac.
ignore --- a/arch/arm/boot/dts/r8a73a4.dtsi
ignore +++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -453,6 +453,8 @@
interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&mstp2_clks R8A73A4_CLK_SCIFA0>;
clock-names = "fck";
+ dmas = <&dmac 0x21>, <&dmac 0x22>;
+ dma-names = "tx", "rx";
power-domains = <&pd_a3sp>;
status = "disabled";
};
ignore --- a/drivers/dma/sh/shdma-r8a73a4.c
ignore +++ b/drivers/dma/sh/shdma-r8a73a4.c
@@ -12,6 +12,12 @@ static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
static const struct sh_dmae_slave_config dma_slaves[] = {
{
+ .chcr = CHCR_TX(XMIT_SZ_8BIT),
+ .mid_rid = 0x21, /* SCIFA0 Tx */
+ }, {
+ .chcr = CHCR_RX(XMIT_SZ_8BIT),
+ .mid_rid = 0x22, /* SCIFA0 Rx */
+ }, {
.chcr = CHCR_TX(XMIT_SZ_32BIT),
.mid_rid = 0xd1, /* MMC0 Tx */
}, {
---
drivers/dma/sh/Kconfig | 11 +----
drivers/dma/sh/Makefile | 1 -
drivers/dma/sh/shdma-r8a73a4.c | 74 ----------------------------------
drivers/dma/sh/shdma.h | 7 ----
drivers/dma/sh/shdmac.c | 7 ----
5 files changed, 1 insertion(+), 99 deletions(-)
delete mode 100644 drivers/dma/sh/shdma-r8a73a4.c
diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
index 6e0685f1a83814f4..b728cfaf4d700f96 100644
--- a/drivers/dma/sh/Kconfig
+++ b/drivers/dma/sh/Kconfig
@@ -12,7 +12,7 @@ config RENESAS_DMA
config SH_DMAE_BASE
bool "Renesas SuperH DMA Engine support"
- depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
+ depends on SUPERH || COMPILE_TEST
depends on !SUPERH || SH_DMA
depends on !SH_DMA_API
default y
@@ -30,15 +30,6 @@ config SH_DMAE
help
Enable support for the Renesas SuperH DMA controllers.
-if SH_DMAE
-
-config SH_DMAE_R8A73A4
- def_bool y
- depends on ARCH_R8A73A4
- depends on OF
-
-endif
-
config RCAR_DMAC
tristate "Renesas R-Car Gen2 DMA Controller"
depends on ARCH_RENESAS || COMPILE_TEST
diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
index 7d7c9491ade1216d..42110dd57a56fda8 100644
--- a/drivers/dma/sh/Makefile
+++ b/drivers/dma/sh/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o shdma-of.o
#
shdma-y := shdmac.o
-shdma-$(CONFIG_SH_DMAE_R8A73A4) += shdma-r8a73a4.o
shdma-objs := $(shdma-y)
obj-$(CONFIG_SH_DMAE) += shdma.o
diff --git a/drivers/dma/sh/shdma-r8a73a4.c b/drivers/dma/sh/shdma-r8a73a4.c
deleted file mode 100644
index ddc9a35783534bdd..0000000000000000
--- a/drivers/dma/sh/shdma-r8a73a4.c
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Renesas SuperH DMA Engine support for r8a73a4 (APE6) SoCs
- *
- * Copyright (C) 2013 Renesas Electronics, Inc.
- */
-#include <linux/sh_dma.h>
-
-#include "shdma-arm.h"
-
-static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
-
-static const struct sh_dmae_slave_config dma_slaves[] = {
- {
- .chcr = CHCR_TX(XMIT_SZ_32BIT),
- .mid_rid = 0xd1, /* MMC0 Tx */
- }, {
- .chcr = CHCR_RX(XMIT_SZ_32BIT),
- .mid_rid = 0xd2, /* MMC0 Rx */
- }, {
- .chcr = CHCR_TX(XMIT_SZ_32BIT),
- .mid_rid = 0xe1, /* MMC1 Tx */
- }, {
- .chcr = CHCR_RX(XMIT_SZ_32BIT),
- .mid_rid = 0xe2, /* MMC1 Rx */
- },
-};
-
-#define DMAE_CHANNEL(a, b) \
- { \
- .offset = (a) - 0x20, \
- .dmars = (a) - 0x20 + 0x40, \
- .chclr_bit = (b), \
- .chclr_offset = 0x80 - 0x20, \
- }
-
-static const struct sh_dmae_channel dma_channels[] = {
- DMAE_CHANNEL(0x8000, 0),
- DMAE_CHANNEL(0x8080, 1),
- DMAE_CHANNEL(0x8100, 2),
- DMAE_CHANNEL(0x8180, 3),
- DMAE_CHANNEL(0x8200, 4),
- DMAE_CHANNEL(0x8280, 5),
- DMAE_CHANNEL(0x8300, 6),
- DMAE_CHANNEL(0x8380, 7),
- DMAE_CHANNEL(0x8400, 8),
- DMAE_CHANNEL(0x8480, 9),
- DMAE_CHANNEL(0x8500, 10),
- DMAE_CHANNEL(0x8580, 11),
- DMAE_CHANNEL(0x8600, 12),
- DMAE_CHANNEL(0x8680, 13),
- DMAE_CHANNEL(0x8700, 14),
- DMAE_CHANNEL(0x8780, 15),
- DMAE_CHANNEL(0x8800, 16),
- DMAE_CHANNEL(0x8880, 17),
- DMAE_CHANNEL(0x8900, 18),
- DMAE_CHANNEL(0x8980, 19),
-};
-
-const struct sh_dmae_pdata r8a73a4_dma_pdata = {
- .slave = dma_slaves,
- .slave_num = ARRAY_SIZE(dma_slaves),
- .channel = dma_channels,
- .channel_num = ARRAY_SIZE(dma_channels),
- .ts_low_shift = TS_LOW_SHIFT,
- .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
- .ts_high_shift = TS_HI_SHIFT,
- .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
- .ts_shift = dma_ts_shift,
- .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
- .dmaor_init = DMAOR_DME,
- .chclr_present = 1,
- .chclr_bitwise = 1,
-};
diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
index bfb69909bd192759..9c121a4b33ad829c 100644
--- a/drivers/dma/sh/shdma.h
+++ b/drivers/dma/sh/shdma.h
@@ -58,11 +58,4 @@ struct sh_dmae_desc {
#define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
struct sh_dmae_device, shdma_dev.dma_dev)
-#ifdef CONFIG_SH_DMAE_R8A73A4
-extern const struct sh_dmae_pdata r8a73a4_dma_pdata;
-#define r8a73a4_shdma_devid (&r8a73a4_dma_pdata)
-#else
-#define r8a73a4_shdma_devid NULL
-#endif
-
#endif /* __DMA_SHDMA_H */
diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
index 7971ea2753877486..5aafe548ca5f3082 100644
--- a/drivers/dma/sh/shdmac.c
+++ b/drivers/dma/sh/shdmac.c
@@ -665,12 +665,6 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
.get_partial = sh_dmae_get_partial,
};
-static const struct of_device_id sh_dmae_of_match[] = {
- {.compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid,},
- {}
-};
-MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
-
static int sh_dmae_probe(struct platform_device *pdev)
{
const enum dma_slave_buswidth widths =
@@ -915,7 +909,6 @@ static struct platform_driver sh_dmae_driver = {
.driver = {
.pm = &sh_dmae_pm,
.name = SH_DMAE_DRV_NAME,
- .of_match_table = sh_dmae_of_match,
},
.remove = sh_dmae_remove,
};
^ permalink raw reply related
* [PATCH/RFC] dmaengine: sh: Remove R-Mobile APE6 support
From: Geert Uytterhoeven @ 2018-11-12 15:30 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Vinod, Dan Williams, Guennadi Liakhovetski, Laurent Pinchart,
Wolfram Sang, Simon Horman, Magnus Damm, dmaengine, Linux-Renesas,
Richard Weinberger, Yoshinori Sato, Linux-sh list
CC SuperH
On Mon, Nov 12, 2018 at 4:22 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Renesas R-Mobile APE6 support is currently unused:
> - DMA slaves were never enabled in r8a73a4.dtsi,
> - The driver relies on legacy filter matching and describing all
> slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
> similar hardware like rcar-dmac,
> - The driver doesn't seem to work well.
>
> Remove the driver, it can be resurrected from git history when needed.
>
> As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
> sh-dma-engine driver core is now used on SuperH only.
>
> Note that the DT bindings are still present, as r8a73a4.dtsi uses them.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Notes:
> 1. As Renesas ARM SoCs no longer use drivers/dma/sh/shdma-base.c, the
> task to remove use of the deprecated dma_slave_config.direction
> field gets thrown into the SuperH maintainers' basket ;-)
> 2. This affects shmobile_defconfig and renesas_defconfig
> (CONFIG_SH_DMAE_BASE and CONFIG_SH_DMAE are no longer enabled by
> default).
> 3. I tried to get SCIFA DMA to work by:
> - Applying the DT and driver patches below,
> - Reverting 219fb0c1436e4893 ("serial: sh-sci: Remove the
> platform data dma slave rx/tx channel IDs").
> After that, serial console output using DMA seems to work, but the
> system locks up when receiving any serial console input.
> Probably it is easier to add r8a73a4 support to rcar-dmac.
>
> ignore --- a/arch/arm/boot/dts/r8a73a4.dtsi
> ignore +++ b/arch/arm/boot/dts/r8a73a4.dtsi
> @@ -453,6 +453,8 @@
> interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&mstp2_clks R8A73A4_CLK_SCIFA0>;
> clock-names = "fck";
> + dmas = <&dmac 0x21>, <&dmac 0x22>;
> + dma-names = "tx", "rx";
> power-domains = <&pd_a3sp>;
> status = "disabled";
> };
> ignore --- a/drivers/dma/sh/shdma-r8a73a4.c
> ignore +++ b/drivers/dma/sh/shdma-r8a73a4.c
> @@ -12,6 +12,12 @@ static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
>
> static const struct sh_dmae_slave_config dma_slaves[] = {
> {
> + .chcr = CHCR_TX(XMIT_SZ_8BIT),
> + .mid_rid = 0x21, /* SCIFA0 Tx */
> + }, {
> + .chcr = CHCR_RX(XMIT_SZ_8BIT),
> + .mid_rid = 0x22, /* SCIFA0 Rx */
> + }, {
> .chcr = CHCR_TX(XMIT_SZ_32BIT),
> .mid_rid = 0xd1, /* MMC0 Tx */
> }, {
> ---
> drivers/dma/sh/Kconfig | 11 +----
> drivers/dma/sh/Makefile | 1 -
> drivers/dma/sh/shdma-r8a73a4.c | 74 ----------------------------------
> drivers/dma/sh/shdma.h | 7 ----
> drivers/dma/sh/shdmac.c | 7 ----
> 5 files changed, 1 insertion(+), 99 deletions(-)
> delete mode 100644 drivers/dma/sh/shdma-r8a73a4.c
>
> diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
> index 6e0685f1a83814f4..b728cfaf4d700f96 100644
> --- a/drivers/dma/sh/Kconfig
> +++ b/drivers/dma/sh/Kconfig
> @@ -12,7 +12,7 @@ config RENESAS_DMA
>
> config SH_DMAE_BASE
> bool "Renesas SuperH DMA Engine support"
> - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
> + depends on SUPERH || COMPILE_TEST
> depends on !SUPERH || SH_DMA
> depends on !SH_DMA_API
> default y
> @@ -30,15 +30,6 @@ config SH_DMAE
> help
> Enable support for the Renesas SuperH DMA controllers.
>
> -if SH_DMAE
> -
> -config SH_DMAE_R8A73A4
> - def_bool y
> - depends on ARCH_R8A73A4
> - depends on OF
> -
> -endif
> -
> config RCAR_DMAC
> tristate "Renesas R-Car Gen2 DMA Controller"
> depends on ARCH_RENESAS || COMPILE_TEST
> diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
> index 7d7c9491ade1216d..42110dd57a56fda8 100644
> --- a/drivers/dma/sh/Makefile
> +++ b/drivers/dma/sh/Makefile
> @@ -10,7 +10,6 @@ obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o shdma-of.o
> #
>
> shdma-y := shdmac.o
> -shdma-$(CONFIG_SH_DMAE_R8A73A4) += shdma-r8a73a4.o
> shdma-objs := $(shdma-y)
> obj-$(CONFIG_SH_DMAE) += shdma.o
>
> diff --git a/drivers/dma/sh/shdma-r8a73a4.c b/drivers/dma/sh/shdma-r8a73a4.c
> deleted file mode 100644
> index ddc9a35783534bdd..0000000000000000
> --- a/drivers/dma/sh/shdma-r8a73a4.c
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Renesas SuperH DMA Engine support for r8a73a4 (APE6) SoCs
> - *
> - * Copyright (C) 2013 Renesas Electronics, Inc.
> - */
> -#include <linux/sh_dma.h>
> -
> -#include "shdma-arm.h"
> -
> -static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
> -
> -static const struct sh_dmae_slave_config dma_slaves[] = {
> - {
> - .chcr = CHCR_TX(XMIT_SZ_32BIT),
> - .mid_rid = 0xd1, /* MMC0 Tx */
> - }, {
> - .chcr = CHCR_RX(XMIT_SZ_32BIT),
> - .mid_rid = 0xd2, /* MMC0 Rx */
> - }, {
> - .chcr = CHCR_TX(XMIT_SZ_32BIT),
> - .mid_rid = 0xe1, /* MMC1 Tx */
> - }, {
> - .chcr = CHCR_RX(XMIT_SZ_32BIT),
> - .mid_rid = 0xe2, /* MMC1 Rx */
> - },
> -};
> -
> -#define DMAE_CHANNEL(a, b) \
> - { \
> - .offset = (a) - 0x20, \
> - .dmars = (a) - 0x20 + 0x40, \
> - .chclr_bit = (b), \
> - .chclr_offset = 0x80 - 0x20, \
> - }
> -
> -static const struct sh_dmae_channel dma_channels[] = {
> - DMAE_CHANNEL(0x8000, 0),
> - DMAE_CHANNEL(0x8080, 1),
> - DMAE_CHANNEL(0x8100, 2),
> - DMAE_CHANNEL(0x8180, 3),
> - DMAE_CHANNEL(0x8200, 4),
> - DMAE_CHANNEL(0x8280, 5),
> - DMAE_CHANNEL(0x8300, 6),
> - DMAE_CHANNEL(0x8380, 7),
> - DMAE_CHANNEL(0x8400, 8),
> - DMAE_CHANNEL(0x8480, 9),
> - DMAE_CHANNEL(0x8500, 10),
> - DMAE_CHANNEL(0x8580, 11),
> - DMAE_CHANNEL(0x8600, 12),
> - DMAE_CHANNEL(0x8680, 13),
> - DMAE_CHANNEL(0x8700, 14),
> - DMAE_CHANNEL(0x8780, 15),
> - DMAE_CHANNEL(0x8800, 16),
> - DMAE_CHANNEL(0x8880, 17),
> - DMAE_CHANNEL(0x8900, 18),
> - DMAE_CHANNEL(0x8980, 19),
> -};
> -
> -const struct sh_dmae_pdata r8a73a4_dma_pdata = {
> - .slave = dma_slaves,
> - .slave_num = ARRAY_SIZE(dma_slaves),
> - .channel = dma_channels,
> - .channel_num = ARRAY_SIZE(dma_channels),
> - .ts_low_shift = TS_LOW_SHIFT,
> - .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
> - .ts_high_shift = TS_HI_SHIFT,
> - .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
> - .ts_shift = dma_ts_shift,
> - .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
> - .dmaor_init = DMAOR_DME,
> - .chclr_present = 1,
> - .chclr_bitwise = 1,
> -};
> diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
> index bfb69909bd192759..9c121a4b33ad829c 100644
> --- a/drivers/dma/sh/shdma.h
> +++ b/drivers/dma/sh/shdma.h
> @@ -58,11 +58,4 @@ struct sh_dmae_desc {
> #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
> struct sh_dmae_device, shdma_dev.dma_dev)
>
> -#ifdef CONFIG_SH_DMAE_R8A73A4
> -extern const struct sh_dmae_pdata r8a73a4_dma_pdata;
> -#define r8a73a4_shdma_devid (&r8a73a4_dma_pdata)
> -#else
> -#define r8a73a4_shdma_devid NULL
> -#endif
> -
> #endif /* __DMA_SHDMA_H */
> diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
> index 7971ea2753877486..5aafe548ca5f3082 100644
> --- a/drivers/dma/sh/shdmac.c
> +++ b/drivers/dma/sh/shdmac.c
> @@ -665,12 +665,6 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
> .get_partial = sh_dmae_get_partial,
> };
>
> -static const struct of_device_id sh_dmae_of_match[] = {
> - {.compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid,},
> - {}
> -};
> -MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
> -
> static int sh_dmae_probe(struct platform_device *pdev)
> {
> const enum dma_slave_buswidth widths =
> @@ -915,7 +909,6 @@ static struct platform_driver sh_dmae_driver = {
> .driver = {
> .pm = &sh_dmae_pm,
> .name = SH_DMAE_DRV_NAME,
> - .of_match_table = sh_dmae_of_match,
> },
> .remove = sh_dmae_remove,
> };
> --
> 2.17.1
^ permalink raw reply
* dma: cppi41: delete channel from pending list when stop channel
From: Bin Liu @ 2018-11-12 15:40 UTC (permalink / raw)
To: dmaengine; +Cc: linux-usb, Vinod Koul, stable
The driver defines three states for a cppi channel.
- idle: .chan_busy == 0 && not in .pending list
- pending: .chan_busy == 0 && in .pending list
- busy: .chan_busy == 1 && not in .pending list
There are cases in which the cppi channel could be in the pending state
when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
is called.
cppi41_stop_chan() has a bug for these cases to set channels to idle state.
It only checks the .chan_busy flag, but not the .pending list, then later
when cppi41_runtime_resume() is called the channels in .pending list will
be transitioned to busy state.
Removing channels from the .pending list solves the problem.
Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
index 1497da367710..e507ec36c0d3 100644
--- a/drivers/dma/ti/cppi41.c
+++ b/drivers/dma/ti/cppi41.c
@@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan)
desc_phys = lower_32_bits(c->desc_phys);
desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
- if (!cdd->chan_busy[desc_num])
+ if (!cdd->chan_busy[desc_num]) {
+ struct cppi41_channel *cc, *_ct;
+
+ /*
+ * channels might still be in the pendling list if
+ * cppi41_dma_issue_pending() is called after
+ * cppi41_runtime_suspend() is called
+ */
+ list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {
+ if (cc != c)
+ continue;
+ list_del(&cc->node);
+ break;
+ }
return 0;
+ }
ret = cppi41_tear_down_chan(c);
if (ret)
^ permalink raw reply related
* dma: cppi41: delete channel from pending list when stop channel
From: Bin Liu @ 2018-11-12 15:43 UTC (permalink / raw)
To: dmaengine; +Cc: linux-usb, Vinod Koul, stable
The driver defines three states for a cppi channel.
- idle: .chan_busy == 0 && not in .pending list
- pending: .chan_busy == 0 && in .pending list
- busy: .chan_busy == 1 && not in .pending list
There are cases in which the cppi channel could be in the pending state
when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
is called.
cppi41_stop_chan() has a bug for these cases to set channels to idle state.
It only checks the .chan_busy flag, but not the .pending list, then later
when cppi41_runtime_resume() is called the channels in .pending list will
be transitioned to busy state.
Removing channels from the .pending list solves the problem.
Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy")
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Bin Liu <b-liu@ti.com>
---
drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
index 1497da367710..e507ec36c0d3 100644
--- a/drivers/dma/ti/cppi41.c
+++ b/drivers/dma/ti/cppi41.c
@@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan)
desc_phys = lower_32_bits(c->desc_phys);
desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
- if (!cdd->chan_busy[desc_num])
+ if (!cdd->chan_busy[desc_num]) {
+ struct cppi41_channel *cc, *_ct;
+
+ /*
+ * channels might still be in the pendling list if
+ * cppi41_dma_issue_pending() is called after
+ * cppi41_runtime_suspend() is called
+ */
+ list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {
+ if (cc != c)
+ continue;
+ list_del(&cc->node);
+ break;
+ }
return 0;
+ }
ret = cppi41_tear_down_chan(c);
if (ret)
^ permalink raw reply related
* dma: cppi41: delete channel from pending list when stop channel
From: Bin Liu @ 2018-11-12 15:46 UTC (permalink / raw)
To: dmaengine; +Cc: linux-usb, stable
Sorry, please ignore this. Used incorrect Vinod email address.
On Mon, Nov 12, 2018 at 09:40:49AM -0600, Bin Liu wrote:
> The driver defines three states for a cppi channel.
> - idle: .chan_busy == 0 && not in .pending list
> - pending: .chan_busy == 0 && in .pending list
> - busy: .chan_busy == 1 && not in .pending list
>
> There are cases in which the cppi channel could be in the pending state
> when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
> is called.
>
> cppi41_stop_chan() has a bug for these cases to set channels to idle state.
> It only checks the .chan_busy flag, but not the .pending list, then later
> when cppi41_runtime_resume() is called the channels in .pending list will
> be transitioned to busy state.
>
> Removing channels from the .pending list solves the problem.
>
> Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy")
> Cc: stable@vger.kernel.org # v3.15+
> Signed-off-by: Bin Liu <b-liu@ti.com>
> ---
> drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
> index 1497da367710..e507ec36c0d3 100644
> --- a/drivers/dma/ti/cppi41.c
> +++ b/drivers/dma/ti/cppi41.c
> @@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan)
>
> desc_phys = lower_32_bits(c->desc_phys);
> desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
> - if (!cdd->chan_busy[desc_num])
> + if (!cdd->chan_busy[desc_num]) {
> + struct cppi41_channel *cc, *_ct;
> +
> + /*
> + * channels might still be in the pendling list if
> + * cppi41_dma_issue_pending() is called after
> + * cppi41_runtime_suspend() is called
> + */
> + list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {
> + if (cc != c)
> + continue;
> + list_del(&cc->node);
> + break;
> + }
> return 0;
> + }
>
> ret = cppi41_tear_down_chan(c);
> if (ret)
> --
> 2.17.1
>
^ permalink raw reply
* [v2,1/2] firmware: add nowarn variant of request_firmware_nowait()
From: Lucas Stach @ 2018-11-12 16:01 UTC (permalink / raw)
To: Greg Kroah-Hartman, Luis R . Rodriguez
Cc: linux-kernel, dmaengine, Vinod Koul, kernel, patchwork-lst
Device drivers with optional firmware may still want to use the
asynchronous firmware loading interface. To avoid printing a
warining into the kernel log when the optional firmware is
absent, add a nowarn variant of this interface.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
v2: Add missing documentation, as pointed out by 0-day bot.
---
drivers/base/firmware_loader/main.c | 92 ++++++++++++++++++++---------
include/linux/firmware.h | 12 ++++
2 files changed, 77 insertions(+), 27 deletions(-)
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index 8e9213b36e31..9fa4ee154147 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -790,34 +790,11 @@ static void request_firmware_work_func(struct work_struct *work)
kfree(fw_work);
}
-/**
- * request_firmware_nowait() - asynchronous version of request_firmware
- * @module: module requesting the firmware
- * @uevent: sends uevent to copy the firmware image if this flag
- * is non-zero else the firmware copy must be done manually.
- * @name: name of firmware file
- * @device: device for which firmware is being loaded
- * @gfp: allocation flags
- * @context: will be passed over to @cont, and
- * @fw may be %NULL if firmware request fails.
- * @cont: function will be called asynchronously when the firmware
- * request is over.
- *
- * Caller must hold the reference count of @device.
- *
- * Asynchronous variant of request_firmware() for user contexts:
- * - sleep for as small periods as possible since it may
- * increase kernel boot time of built-in device drivers
- * requesting firmware in their ->probe() methods, if
- * @gfp is GFP_KERNEL.
- *
- * - can't sleep at all if @gfp is GFP_ATOMIC.
- **/
-int
-request_firmware_nowait(
+
+static int _request_firmware_nowait(
struct module *module, bool uevent,
const char *name, struct device *device, gfp_t gfp, void *context,
- void (*cont)(const struct firmware *fw, void *context))
+ void (*cont)(const struct firmware *fw, void *context), bool nowarn)
{
struct firmware_work *fw_work;
@@ -835,7 +812,8 @@ request_firmware_nowait(
fw_work->context = context;
fw_work->cont = cont;
fw_work->opt_flags = FW_OPT_NOWAIT |
- (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
+ (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER) |
+ (nowarn ? FW_OPT_NO_WARN : 0);
if (!uevent && fw_cache_is_setup(device, name)) {
kfree_const(fw_work->name);
@@ -854,8 +832,68 @@ request_firmware_nowait(
schedule_work(&fw_work->work);
return 0;
}
+
+/**
+ * request_firmware_nowait() - asynchronous version of request_firmware
+ * @module: module requesting the firmware
+ * @uevent: sends uevent to copy the firmware image if this flag
+ * is non-zero else the firmware copy must be done manually.
+ * @name: name of firmware file
+ * @device: device for which firmware is being loaded
+ * @gfp: allocation flags
+ * @context: will be passed over to @cont, and
+ * @fw may be %NULL if firmware request fails.
+ * @cont: function will be called asynchronously when the firmware
+ * request is over.
+ *
+ * Caller must hold the reference count of @device.
+ *
+ * Asynchronous variant of request_firmware() for user contexts:
+ * - sleep for as small periods as possible since it may
+ * increase kernel boot time of built-in device drivers
+ * requesting firmware in their ->probe() methods, if
+ * @gfp is GFP_KERNEL.
+ *
+ * - can't sleep at all if @gfp is GFP_ATOMIC.
+ **/
+int request_firmware_nowait(
+ struct module *module, bool uevent,
+ const char *name, struct device *device, gfp_t gfp, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ return _request_firmware_nowait(module, uevent, name, device, gfp,
+ context, cont, false);
+
+}
EXPORT_SYMBOL(request_firmware_nowait);
+/**
+ * request_firmware_nowait_nowarn() - async version of request_firmware_nowarn
+ * @module: module requesting the firmware
+ * @uevent: sends uevent to copy the firmware image if this flag
+ * is non-zero else the firmware copy must be done manually.
+ * @name: name of firmware file
+ * @device: device for which firmware is being loaded
+ * @gfp: allocation flags
+ * @context: will be passed over to @cont, and
+ * @fw may be %NULL if firmware request fails.
+ * @cont: function will be called asynchronously when the firmware
+ * request is over.
+ *
+ * Similar in function to request_firmware_nowait(), but doesn't print a warning
+ * when the firmware file could not be found.
+ */
+int request_firmware_nowait_nowarn(
+ struct module *module, bool uevent,
+ const char *name, struct device *device, gfp_t gfp, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ return _request_firmware_nowait(module, uevent, name, device, gfp,
+ context, cont, true);
+
+}
+EXPORT_SYMBOL(request_firmware_nowait_nowarn);
+
#ifdef CONFIG_PM_SLEEP
static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 2dd566c91d44..a6d0bc8273a4 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -48,6 +48,10 @@ int request_firmware_nowait(
struct module *module, bool uevent,
const char *name, struct device *device, gfp_t gfp, void *context,
void (*cont)(const struct firmware *fw, void *context));
+int request_firmware_nowait_nowarn(
+ struct module *module, bool uevent,
+ const char *name, struct device *device, gfp_t gfp, void *context,
+ void (*cont)(const struct firmware *fw, void *context));
int request_firmware_direct(const struct firmware **fw, const char *name,
struct device *device);
int request_firmware_into_buf(const struct firmware **firmware_p,
@@ -77,6 +81,14 @@ static inline int request_firmware_nowait(
return -EINVAL;
}
+static inline int request_firmware_nowait_nowarn(
+ struct module *module, bool uevent,
+ const char *name, struct device *device, gfp_t gfp, void *context,
+ void (*cont)(const struct firmware *fw, void *context))
+{
+ return -EINVAL;
+}
+
static inline void release_firmware(const struct firmware *fw)
{
}
^ permalink raw reply related
* [v2,2/2] dmaengine: imx-sdma: don't print warning when firmware is absent
From: Lucas Stach @ 2018-11-12 16:01 UTC (permalink / raw)
To: Greg Kroah-Hartman, Luis R . Rodriguez
Cc: linux-kernel, dmaengine, Vinod Koul, kernel, patchwork-lst
The SDMA firmware is optional and a usable fallabck to the internal
ROM firmware is present in the driver. There is already a message
printed informing the user that the internal firmware is used, so
there is no need to print a scary warning for what is normal operation
on most systems.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
drivers/dma/imx-sdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index b4ec2d20e661..c2e7819cecb8 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1784,7 +1784,7 @@ static int sdma_get_firmware(struct sdma_engine *sdma,
{
int ret;
- ret = request_firmware_nowait(THIS_MODULE,
+ ret = request_firmware_nowait_nowarn(THIS_MODULE,
FW_ACTION_HOTPLUG, fw_name, sdma->dev,
GFP_KERNEL, sdma, sdma_load_firmware);
^ permalink raw reply related
* [2/5] dmaengine: sprd: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-12 18:06 UTC (permalink / raw)
To: Baolin Wang; +Cc: dmaengine
On 12-11-18, 10:47, Baolin Wang wrote:
> Hi Vinod,
>
> On 11 November 2018 at 23:47, Vinod Koul <vkoul@kernel.org> wrote:
> > dma_slave_config direction was marked as deprecated quite some
> > time back, remove the usage from this driver so that the field
> > can be removed
> >
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
>
> We already posted one patch set to fix this issue, could you have a
> look when you feel free? Thanks.
Thanks for fixing that, I will check the series and drop this one
^ permalink raw reply
* [3/5] dmaengine: imx-sdma: remove dma_slave_config direction usage
From: Vinod Koul @ 2018-11-12 18:09 UTC (permalink / raw)
To: Robin Gong; +Cc: dmaengine@vger.kernel.org
On 12-11-18, 07:18, Robin Gong wrote:
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
You cannot sign off, but you may test this patch and provide
Tested-by:.. or you may review the patch and provide Reviewed-by:... or
if you agree you may also provide Acked-by: ...
For more details, please see
Documentation/process/submitting-patches.rst Section 13.
Also, please do not top post you reply
Thanks
^ permalink raw reply
* [PATCH/RFC] dmaengine: sh: Remove R-Mobile APE6 support
From: Ulrich Hecht @ 2018-11-13 7:47 UTC (permalink / raw)
To: Geert Uytterhoeven, Vinod Koul, Dan Williams
Cc: Guennadi Liakhovetski, Laurent Pinchart, Wolfram Sang,
Simon Horman, Magnus Damm, dmaengine, linux-renesas-soc
Thank you for your patch.
> On November 12, 2018 at 4:22 PM Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
>
> Renesas R-Mobile APE6 support is currently unused:
> - DMA slaves were never enabled in r8a73a4.dtsi,
> - The driver relies on legacy filter matching and describing all
> slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
> similar hardware like rcar-dmac,
> - The driver doesn't seem to work well.
>
> Remove the driver, it can be resurrected from git history when needed.
>
> As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
> sh-dma-engine driver core is now used on SuperH only.
>
> Note that the DT bindings are still present, as r8a73a4.dtsi uses them.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Notes:
> 1. As Renesas ARM SoCs no longer use drivers/dma/sh/shdma-base.c, the
> task to remove use of the deprecated dma_slave_config.direction
> field gets thrown into the SuperH maintainers' basket ;-)
> 2. This affects shmobile_defconfig and renesas_defconfig
> (CONFIG_SH_DMAE_BASE and CONFIG_SH_DMAE are no longer enabled by
> default).
> 3. I tried to get SCIFA DMA to work by:
> - Applying the DT and driver patches below,
> - Reverting 219fb0c1436e4893 ("serial: sh-sci: Remove the
> platform data dma slave rx/tx channel IDs").
> After that, serial console output using DMA seems to work, but the
> system locks up when receiving any serial console input.
> Probably it is easier to add r8a73a4 support to rcar-dmac.
>
> ignore --- a/arch/arm/boot/dts/r8a73a4.dtsi
> ignore +++ b/arch/arm/boot/dts/r8a73a4.dtsi
> @@ -453,6 +453,8 @@
> interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&mstp2_clks R8A73A4_CLK_SCIFA0>;
> clock-names = "fck";
> + dmas = <&dmac 0x21>, <&dmac 0x22>;
> + dma-names = "tx", "rx";
> power-domains = <&pd_a3sp>;
> status = "disabled";
> };
> ignore --- a/drivers/dma/sh/shdma-r8a73a4.c
> ignore +++ b/drivers/dma/sh/shdma-r8a73a4.c
> @@ -12,6 +12,12 @@ static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
>
> static const struct sh_dmae_slave_config dma_slaves[] = {
> {
> + .chcr = CHCR_TX(XMIT_SZ_8BIT),
> + .mid_rid = 0x21, /* SCIFA0 Tx */
> + }, {
> + .chcr = CHCR_RX(XMIT_SZ_8BIT),
> + .mid_rid = 0x22, /* SCIFA0 Rx */
> + }, {
> .chcr = CHCR_TX(XMIT_SZ_32BIT),
> .mid_rid = 0xd1, /* MMC0 Tx */
> }, {
> ---
> drivers/dma/sh/Kconfig | 11 +----
> drivers/dma/sh/Makefile | 1 -
> drivers/dma/sh/shdma-r8a73a4.c | 74 ----------------------------------
> drivers/dma/sh/shdma.h | 7 ----
> drivers/dma/sh/shdmac.c | 7 ----
> 5 files changed, 1 insertion(+), 99 deletions(-)
> delete mode 100644 drivers/dma/sh/shdma-r8a73a4.c
>
> diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
> index 6e0685f1a83814f4..b728cfaf4d700f96 100644
> --- a/drivers/dma/sh/Kconfig
> +++ b/drivers/dma/sh/Kconfig
> @@ -12,7 +12,7 @@ config RENESAS_DMA
>
> config SH_DMAE_BASE
> bool "Renesas SuperH DMA Engine support"
> - depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
> + depends on SUPERH || COMPILE_TEST
> depends on !SUPERH || SH_DMA
> depends on !SH_DMA_API
> default y
> @@ -30,15 +30,6 @@ config SH_DMAE
> help
> Enable support for the Renesas SuperH DMA controllers.
>
> -if SH_DMAE
> -
> -config SH_DMAE_R8A73A4
> - def_bool y
> - depends on ARCH_R8A73A4
> - depends on OF
> -
> -endif
> -
> config RCAR_DMAC
> tristate "Renesas R-Car Gen2 DMA Controller"
> depends on ARCH_RENESAS || COMPILE_TEST
> diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
> index 7d7c9491ade1216d..42110dd57a56fda8 100644
> --- a/drivers/dma/sh/Makefile
> +++ b/drivers/dma/sh/Makefile
> @@ -10,7 +10,6 @@ obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o shdma-of.o
> #
>
> shdma-y := shdmac.o
> -shdma-$(CONFIG_SH_DMAE_R8A73A4) += shdma-r8a73a4.o
> shdma-objs := $(shdma-y)
> obj-$(CONFIG_SH_DMAE) += shdma.o
>
> diff --git a/drivers/dma/sh/shdma-r8a73a4.c b/drivers/dma/sh/shdma-r8a73a4.c
> deleted file mode 100644
> index ddc9a35783534bdd..0000000000000000
> --- a/drivers/dma/sh/shdma-r8a73a4.c
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Renesas SuperH DMA Engine support for r8a73a4 (APE6) SoCs
> - *
> - * Copyright (C) 2013 Renesas Electronics, Inc.
> - */
> -#include <linux/sh_dma.h>
> -
> -#include "shdma-arm.h"
> -
> -static const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT;
> -
> -static const struct sh_dmae_slave_config dma_slaves[] = {
> - {
> - .chcr = CHCR_TX(XMIT_SZ_32BIT),
> - .mid_rid = 0xd1, /* MMC0 Tx */
> - }, {
> - .chcr = CHCR_RX(XMIT_SZ_32BIT),
> - .mid_rid = 0xd2, /* MMC0 Rx */
> - }, {
> - .chcr = CHCR_TX(XMIT_SZ_32BIT),
> - .mid_rid = 0xe1, /* MMC1 Tx */
> - }, {
> - .chcr = CHCR_RX(XMIT_SZ_32BIT),
> - .mid_rid = 0xe2, /* MMC1 Rx */
> - },
> -};
> -
> -#define DMAE_CHANNEL(a, b) \
> - { \
> - .offset = (a) - 0x20, \
> - .dmars = (a) - 0x20 + 0x40, \
> - .chclr_bit = (b), \
> - .chclr_offset = 0x80 - 0x20, \
> - }
> -
> -static const struct sh_dmae_channel dma_channels[] = {
> - DMAE_CHANNEL(0x8000, 0),
> - DMAE_CHANNEL(0x8080, 1),
> - DMAE_CHANNEL(0x8100, 2),
> - DMAE_CHANNEL(0x8180, 3),
> - DMAE_CHANNEL(0x8200, 4),
> - DMAE_CHANNEL(0x8280, 5),
> - DMAE_CHANNEL(0x8300, 6),
> - DMAE_CHANNEL(0x8380, 7),
> - DMAE_CHANNEL(0x8400, 8),
> - DMAE_CHANNEL(0x8480, 9),
> - DMAE_CHANNEL(0x8500, 10),
> - DMAE_CHANNEL(0x8580, 11),
> - DMAE_CHANNEL(0x8600, 12),
> - DMAE_CHANNEL(0x8680, 13),
> - DMAE_CHANNEL(0x8700, 14),
> - DMAE_CHANNEL(0x8780, 15),
> - DMAE_CHANNEL(0x8800, 16),
> - DMAE_CHANNEL(0x8880, 17),
> - DMAE_CHANNEL(0x8900, 18),
> - DMAE_CHANNEL(0x8980, 19),
> -};
> -
> -const struct sh_dmae_pdata r8a73a4_dma_pdata = {
> - .slave = dma_slaves,
> - .slave_num = ARRAY_SIZE(dma_slaves),
> - .channel = dma_channels,
> - .channel_num = ARRAY_SIZE(dma_channels),
> - .ts_low_shift = TS_LOW_SHIFT,
> - .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
> - .ts_high_shift = TS_HI_SHIFT,
> - .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
> - .ts_shift = dma_ts_shift,
> - .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
> - .dmaor_init = DMAOR_DME,
> - .chclr_present = 1,
> - .chclr_bitwise = 1,
> -};
> diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h
> index bfb69909bd192759..9c121a4b33ad829c 100644
> --- a/drivers/dma/sh/shdma.h
> +++ b/drivers/dma/sh/shdma.h
> @@ -58,11 +58,4 @@ struct sh_dmae_desc {
> #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\
> struct sh_dmae_device, shdma_dev.dma_dev)
>
> -#ifdef CONFIG_SH_DMAE_R8A73A4
> -extern const struct sh_dmae_pdata r8a73a4_dma_pdata;
> -#define r8a73a4_shdma_devid (&r8a73a4_dma_pdata)
> -#else
> -#define r8a73a4_shdma_devid NULL
> -#endif
> -
> #endif /* __DMA_SHDMA_H */
> diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
> index 7971ea2753877486..5aafe548ca5f3082 100644
> --- a/drivers/dma/sh/shdmac.c
> +++ b/drivers/dma/sh/shdmac.c
> @@ -665,12 +665,6 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
> .get_partial = sh_dmae_get_partial,
> };
>
> -static const struct of_device_id sh_dmae_of_match[] = {
> - {.compatible = "renesas,shdma-r8a73a4", .data = r8a73a4_shdma_devid,},
> - {}
> -};
> -MODULE_DEVICE_TABLE(of, sh_dmae_of_match);
> -
> static int sh_dmae_probe(struct platform_device *pdev)
> {
> const enum dma_slave_buswidth widths =
> @@ -915,7 +909,6 @@ static struct platform_driver sh_dmae_driver = {
> .driver = {
> .pm = &sh_dmae_pm,
> .name = SH_DMAE_DRV_NAME,
> - .of_match_table = sh_dmae_of_match,
> },
> .remove = sh_dmae_remove,
> };
> --
> 2.17.1
>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
CU
Uli
^ permalink raw reply
* [PATCH/RFC] dmaengine: sh: Remove R-Mobile APE6 support
From: Simon Horman @ 2018-11-13 14:38 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Geert Uytterhoeven, Vinod, Dan Williams, Guennadi Liakhovetski,
Laurent Pinchart, Wolfram Sang, Magnus Damm, dmaengine,
Linux-Renesas, Richard Weinberger, Yoshinori Sato, Linux-sh list
On Mon, Nov 12, 2018 at 04:30:29PM +0100, Geert Uytterhoeven wrote:
> CC SuperH
>
> On Mon, Nov 12, 2018 at 4:22 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
> > Renesas R-Mobile APE6 support is currently unused:
> > - DMA slaves were never enabled in r8a73a4.dtsi,
> > - The driver relies on legacy filter matching and describing all
> > slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
> > similar hardware like rcar-dmac,
> > - The driver doesn't seem to work well.
> >
> > Remove the driver, it can be resurrected from git history when needed.
> >
> > As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
> > sh-dma-engine driver core is now used on SuperH only.
> >
> > Note that the DT bindings are still present, as r8a73a4.dtsi uses them.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > Notes:
> > 1. As Renesas ARM SoCs no longer use drivers/dma/sh/shdma-base.c, the
> > task to remove use of the deprecated dma_slave_config.direction
> > field gets thrown into the SuperH maintainers' basket ;-)
> > 2. This affects shmobile_defconfig and renesas_defconfig
> > (CONFIG_SH_DMAE_BASE and CONFIG_SH_DMAE are no longer enabled by
> > default).
> > 3. I tried to get SCIFA DMA to work by:
> > - Applying the DT and driver patches below,
> > - Reverting 219fb0c1436e4893 ("serial: sh-sci: Remove the
> > platform data dma slave rx/tx channel IDs").
> > After that, serial console output using DMA seems to work, but the
> > system locks up when receiving any serial console input.
> > Probably it is easier to add r8a73a4 support to rcar-dmac.
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
^ permalink raw reply
* [PATCH/RFC] dmaengine: sh: Remove R-Mobile APE6 support
From: Rob Landley @ 2018-11-13 19:32 UTC (permalink / raw)
To: Geert Uytterhoeven, Geert Uytterhoeven
Cc: Vinod, Dan Williams, Guennadi Liakhovetski, Laurent Pinchart,
Wolfram Sang, Simon Horman, Magnus Damm, dmaengine, Linux-Renesas,
Richard Weinberger, Yoshinori Sato, Linux-sh list
On 11/12/18 9:30 AM, Geert Uytterhoeven wrote:
> CC SuperH
>
> On Mon, Nov 12, 2018 at 4:22 PM Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Renesas R-Mobile APE6 support is currently unused:
>> - DMA slaves were never enabled in r8a73a4.dtsi,
>> - The driver relies on legacy filter matching and describing all
>> slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
>> similar hardware like rcar-dmac,
>> - The driver doesn't seem to work well.
>>
>> Remove the driver, it can be resurrected from git history when needed.
>>
>> As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
>> sh-dma-engine driver core is now used on SuperH only.
I'm trying to add dma support to smc91x on an sh7760 board:
https://www.spinics.net/lists/linux-sh/msg53400.html
I missed the ship window for the previous iteration so we had to use PIO, but
DMA's a huge speedup and it's cycling back around on my todo list...
Unfortunately due to a flash corruption bug we were stuck at 4.14 for that
release. I'm trying to track that down now, then need to redo this work on top
of 4.20 or 4.21.
Kernel board support patches are at the lawyers being frowned at expensively
before release, but it won't include DMA this time because I only got the first
half of it working. (Board's hooked up and can do memory-to-memory, but the
ethernet card couldn't use it because the smc91x claims of using dmaengine are
lies, it's hardwired to a specific arm chip ("mainstone" I think?), and when I
got QEMU to emulate that ARM board and tried to enable DMA: packet timeouts. I
dunno if it's broken in the kernel or QEMU doesn't emulate the DMA...)
>> Notes:
>> 1. As Renesas ARM SoCs no longer use drivers/dma/sh/shdma-base.c, the
>> task to remove use of the deprecated dma_slave_config.direction
>> field gets thrown into the SuperH maintainers' basket ;-)
At least in 4.14 there were two DMA apis, once of which is obsolete and unused,
and the other is modern dmaengine support which at least passes its self-test.
I left off boggling at the "slave API", I think...
>> 3. I tried to get SCIFA DMA to work by:
>> - Applying the DT and driver patches below,
>> - Reverting 219fb0c1436e4893 ("serial: sh-sci: Remove the
>> platform data dma slave rx/tx channel IDs").
The board I'm using is platform data, never got converted to device tree. (If I
can ever convince them to mail a board to Rich Felker I might try to hire him to
convert it _myself_. Or I could just get him an old board on ebay, current
cheapest one looks like
https://www.ebay.com/p/Johnson-Controls-Ms-nae3511-2-Metasys-Controller-NAE-and-2x-Unt1108/567230953?iid=283254042308
at the moment? Dead battery's fine for a dev/test system...)
But it's not happening this month.
>> After that, serial console output using DMA seems to work, but the
>> system locks up when receiving any serial console input.
>> Probably it is easier to add r8a73a4 support to rcar-dmac.
What _is_ the status of dmaengine? I thought it was the generic dma API the
kernel was moving towards? (The youtube videos suggested such...)
Rob
^ permalink raw reply
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