Skip to content

Commit

Permalink
cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG
Browse files Browse the repository at this point in the history
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: Sebastian Andrzej Siewior <[email protected]>
Acked-by: Michał Mirosław <[email protected]>
Signed-off-by: Pierre Ossman <[email protected]>
  • Loading branch information
sebastianas authored and ossman committed Jul 31, 2009
1 parent da60a91 commit 4b2a108
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
4 changes: 0 additions & 4 deletions drivers/misc/cb710/sgbuf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data)
if (!left)
return;
addr += len;
flush_kernel_dcache_page(miter->page);
} while (sg_dwiter_next(miter));
}

Expand Down Expand Up @@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da
return;
} else
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);

6 changes: 3 additions & 3 deletions drivers/mmc/host/cb710-mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
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,
15, CB710_MMC_C2_READ_PIO_SIZE_MASK);
Expand Down Expand Up @@ -307,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data)
goto out;
}
out:
cb710_sg_miter_stop_writing(&miter);
sg_miter_stop(&miter);
return err;
}

Expand All @@ -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))
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,
0, CB710_MMC_C2_READ_PIO_SIZE_MASK);
Expand Down
29 changes: 3 additions & 26 deletions include/linux/cb710.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
#include <linux/highmem.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
*
Expand All @@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
* without DMA support).
*
* Best-case reading (transfer from device):
* sg_miter_start();
* sg_miter_start(, SG_MITER_TO_SG);
* cb710_sg_dwiter_write_from_io();
* cb710_sg_miter_stop_writing();
* sg_miter_stop();
*
* Best-case writing (transfer to device):
* sg_miter_start();
* sg_miter_start(, SG_MITER_FROM_SG);
* cb710_sg_dwiter_read_to_io();
* sg_miter_stop();
*/
Expand Down

0 comments on commit 4b2a108

Please sign in to comment.