diff for duplicates of <1497732627.2897.128.camel@kernel.crashing.org> diff --git a/a/1.txt b/N1/1.txt index 5be8327..fef2e28 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -15,83 +15,3 @@ then *must* set the corresponding mask and use that ? I don't like a function that is a "boolean query" like this one to have such a major side effect. - -From an API standpoint, dma_set_mask() is when the mask is established, -and thus when the ops switch should happen. - -Ben. - -> Signed-off-by: Christoph Hellwig <hch@lst.de> -> --- -> arch/powerpc/platforms/cell/iommu.c | 25 +++++++++---------------- -> 1 file changed, 9 insertions(+), 16 deletions(-) -> -> diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c -> index 497bfbdbd967..29d4f96ed33e 100644 -> --- a/arch/powerpc/platforms/cell/iommu.c -> +++ b/arch/powerpc/platforms/cell/iommu.c -> @@ -644,20 +644,14 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg, -> direction, attrs); -> } -> -> -static int dma_fixed_dma_supported(struct device *dev, u64 mask) -> -{ -> - return mask == DMA_BIT_MASK(64); -> -} -> - -> -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask); -> +static int dma_suported_and_switch(struct device *dev, u64 dma_mask); -> -> static const struct dma_map_ops dma_iommu_fixed_ops = { -> .alloc = dma_fixed_alloc_coherent, -> .free = dma_fixed_free_coherent, -> .map_sg = dma_fixed_map_sg, -> .unmap_sg = dma_fixed_unmap_sg, -> - .dma_supported = dma_fixed_dma_supported, -> - .set_dma_mask = dma_set_mask_and_switch, -> + .dma_supported = dma_suported_and_switch, -> .map_page = dma_fixed_map_page, -> .unmap_page = dma_fixed_unmap_page, -> .mapping_error = dma_iommu_mapping_error, -> @@ -952,11 +946,8 @@ static u64 cell_iommu_get_fixed_address(struct device *dev) -> return dev_addr; -> } -> -> -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask) -> +static int dma_suported_and_switch(struct device *dev, u64 dma_mask) -> { -> - if (!dev->dma_mask || !dma_supported(dev, dma_mask)) -> - return -EIO; -> - -> if (dma_mask == DMA_BIT_MASK(64) && -> cell_iommu_get_fixed_address(dev) != OF_BAD_ADDR) { -> u64 addr = cell_iommu_get_fixed_address(dev) + -> @@ -965,14 +956,16 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask) -> dev_dbg(dev, "iommu: fixed addr = %llx\n", addr); -> set_dma_ops(dev, &dma_iommu_fixed_ops); -> set_dma_offset(dev, addr); -> - } else { -> + return 1; -> + } -> + -> + if (dma_iommu_dma_supported(dev, dma_mask)) { -> dev_dbg(dev, "iommu: not 64-bit, using default ops\n"); -> set_dma_ops(dev, get_pci_dma_ops()); -> cell_dma_dev_setup(dev); -> + return 1; -> } -> -> - *dev->dma_mask = dma_mask; -> - -> return 0; -> } -> -> @@ -1127,7 +1120,7 @@ static int __init cell_iommu_fixed_mapping_init(void) -> cell_iommu_setup_window(iommu, np, dbase, dsize, 0); -> } -> -> - dma_iommu_ops.set_dma_mask = dma_set_mask_and_switch; -> + dma_iommu_ops.dma_supported = dma_suported_and_switch; -> set_pci_dma_ops(&dma_iommu_ops); -> -> return 0; diff --git a/a/content_digest b/N1/content_digest index 78e4002..3d14dd2 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -42,86 +42,6 @@ "then *must* set the corresponding mask and use that ?\n" "\n" "I don't like a function that is a \"boolean query\" like this one to have\n" - "such a major side effect.\n" - "\n" - "From an API standpoint, dma_set_mask() is when the mask is established,\n" - "and thus when the ops switch should happen.\n" - "\n" - "Ben.\n" - "\n" - "> Signed-off-by: Christoph Hellwig <hch@lst.de>\n" - "> ---\n" - "> arch/powerpc/platforms/cell/iommu.c | 25 +++++++++----------------\n" - "> 1 file changed, 9 insertions(+), 16 deletions(-)\n" - "> \n" - "> diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c\n" - "> index 497bfbdbd967..29d4f96ed33e 100644\n" - "> --- a/arch/powerpc/platforms/cell/iommu.c\n" - "> +++ b/arch/powerpc/platforms/cell/iommu.c\n" - "> @@ -644,20 +644,14 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,\n" - "> \t\t\t\t direction, attrs);\n" - "> }\n" - "> \n" - "> -static int dma_fixed_dma_supported(struct device *dev, u64 mask)\n" - "> -{\n" - "> -\treturn mask == DMA_BIT_MASK(64);\n" - "> -}\n" - "> -\n" - "> -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask);\n" - "> +static int dma_suported_and_switch(struct device *dev, u64 dma_mask);\n" - "> \n" - "> static const struct dma_map_ops dma_iommu_fixed_ops = {\n" - "> \t.alloc = dma_fixed_alloc_coherent,\n" - "> \t.free = dma_fixed_free_coherent,\n" - "> \t.map_sg = dma_fixed_map_sg,\n" - "> \t.unmap_sg = dma_fixed_unmap_sg,\n" - "> -\t.dma_supported = dma_fixed_dma_supported,\n" - "> -\t.set_dma_mask = dma_set_mask_and_switch,\n" - "> +\t.dma_supported = dma_suported_and_switch,\n" - "> \t.map_page = dma_fixed_map_page,\n" - "> \t.unmap_page = dma_fixed_unmap_page,\n" - "> \t.mapping_error\t= dma_iommu_mapping_error,\n" - "> @@ -952,11 +946,8 @@ static u64 cell_iommu_get_fixed_address(struct device *dev)\n" - "> \treturn dev_addr;\n" - "> }\n" - "> \n" - "> -static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask)\n" - "> +static int dma_suported_and_switch(struct device *dev, u64 dma_mask)\n" - "> {\n" - "> -\tif (!dev->dma_mask || !dma_supported(dev, dma_mask))\n" - "> -\t\treturn -EIO;\n" - "> -\n" - "> \tif (dma_mask == DMA_BIT_MASK(64) &&\n" - "> \t cell_iommu_get_fixed_address(dev) != OF_BAD_ADDR) {\n" - "> \t\tu64 addr = cell_iommu_get_fixed_address(dev) +\n" - "> @@ -965,14 +956,16 @@ static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask)\n" - "> \t\tdev_dbg(dev, \"iommu: fixed addr = %llx\\n\", addr);\n" - "> \t\tset_dma_ops(dev, &dma_iommu_fixed_ops);\n" - "> \t\tset_dma_offset(dev, addr);\n" - "> -\t} else {\n" - "> +\t\treturn 1;\n" - "> +\t}\n" - "> +\n" - "> +\tif (dma_iommu_dma_supported(dev, dma_mask)) {\n" - "> \t\tdev_dbg(dev, \"iommu: not 64-bit, using default ops\\n\");\n" - "> \t\tset_dma_ops(dev, get_pci_dma_ops());\n" - "> \t\tcell_dma_dev_setup(dev);\n" - "> +\t\treturn 1;\n" - "> \t}\n" - "> \n" - "> -\t*dev->dma_mask = dma_mask;\n" - "> -\n" - "> \treturn 0;\n" - "> }\n" - "> \n" - "> @@ -1127,7 +1120,7 @@ static int __init cell_iommu_fixed_mapping_init(void)\n" - "> \t\tcell_iommu_setup_window(iommu, np, dbase, dsize, 0);\n" - "> \t}\n" - "> \n" - "> -\tdma_iommu_ops.set_dma_mask = dma_set_mask_and_switch;\n" - "> +\tdma_iommu_ops.dma_supported = dma_suported_and_switch;\n" - "> \tset_pci_dma_ops(&dma_iommu_ops);\n" - "> \n" - "> \treturn 0;" + such a major side effect. -79393173d92f3ce618112dc5e0d50efb0e8e89442c2231864f9ca7302d229ee8 +a036fc0477e61e89743314e04049e1aa0ec5a9ac7ac8a7836f3c23fa52adc54f
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox