Commit 4b2a108c authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Pierre Ossman

cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG

the code allready uses flush_kernel_dcache_page(). This patch updates the
driver to the recent sg API changes which require that either SG_MITER_TO_SG
or SG_MITER_FROM_SG is set. SG_MITER_TO_SG calls flush_kernel_dcache_page()
in sg_mitter_stop()
Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
Acked-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarPierre Ossman <pierre@ossman.eu>
parent da60a91d
...@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data) ...@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data)
if (!left) if (!left)
return; return;
addr += len; addr += len;
flush_kernel_dcache_page(miter->page);
} while (sg_dwiter_next(miter)); } while (sg_dwiter_next(miter));
} }
...@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da ...@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da
return; return;
} else } else
sg_dwiter_write_slow(miter, data); sg_dwiter_write_slow(miter, data);
if (miter->length == miter->consumed)
flush_kernel_dcache_page(miter->page);
} }
EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block);
...@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) ...@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data)
if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8)))
return -EINVAL; return -EINVAL;
sg_miter_start(&miter, data->sg, data->sg_len, 0); sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG);
cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT,
15, CB710_MMC_C2_READ_PIO_SIZE_MASK); 15, CB710_MMC_C2_READ_PIO_SIZE_MASK);
...@@ -307,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) ...@@ -307,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data)
goto out; goto out;
} }
out: out:
cb710_sg_miter_stop_writing(&miter); sg_miter_stop(&miter);
return err; return err;
} }
...@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) ...@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data)
if (unlikely(data->blocks > 1 && data->blksz & 15)) if (unlikely(data->blocks > 1 && data->blksz & 15))
return -EINVAL; return -EINVAL;
sg_miter_start(&miter, data->sg, data->sg_len, 0); sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG);
cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT,
0, CB710_MMC_C2_READ_PIO_SIZE_MASK); 0, CB710_MMC_C2_READ_PIO_SIZE_MASK);
......
...@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump); ...@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
/**
* cb710_sg_miter_stop_writing - stop mapping iteration after writing
* @miter: sg mapping iter to be stopped
*
* Description:
* Stops mapping iterator @miter. @miter should have been started
* started using sg_miter_start(). A stopped iteration can be
* resumed by calling sg_miter_next() on it. This is useful when
* resources (kmap) need to be released during iteration.
*
* This is a convenience wrapper that will be optimized out for arches
* that don't need flush_kernel_dcache_page().
*
* Context:
* IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
*/
static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
{
if (miter->page)
flush_kernel_dcache_page(miter->page);
sg_miter_stop(miter);
}
/* /*
* 32-bit PIO mapping sg iterator * 32-bit PIO mapping sg iterator
* *
...@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) ...@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
* without DMA support). * without DMA support).
* *
* Best-case reading (transfer from device): * Best-case reading (transfer from device):
* sg_miter_start(); * sg_miter_start(, SG_MITER_TO_SG);
* cb710_sg_dwiter_write_from_io(); * cb710_sg_dwiter_write_from_io();
* cb710_sg_miter_stop_writing(); * sg_miter_stop();
* *
* Best-case writing (transfer to device): * Best-case writing (transfer to device):
* sg_miter_start(); * sg_miter_start(, SG_MITER_FROM_SG);
* cb710_sg_dwiter_read_to_io(); * cb710_sg_dwiter_read_to_io();
* sg_miter_stop(); * sg_miter_stop();
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment