From 7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 7 Dec 2015 11:38:48 -0700 Subject: block: pass block dev not num to read/write/erase() This will allow the implementation to make use of data in the block_dev structure beyond the base device number. This will be useful so that eMMC block devices can encompass the HW partition ID rather than treating this out-of-band. Equally, the existence of the priv field is crying out for this patch to exist. Signed-off-by: Stephen Warren Reviewed-by: Tom Rini --- common/usb_storage.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'common/usb_storage.c') diff --git a/common/usb_storage.c b/common/usb_storage.c index e61a8c8adf..4fdb55f9fa 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -119,10 +119,10 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *us, block_dev_desc_t *dev_desc); int usb_storage_probe(struct usb_device *dev, unsigned int ifnum, struct us_data *ss); -unsigned long usb_stor_read(int device, lbaint_t blknr, - lbaint_t blkcnt, void *buffer); -unsigned long usb_stor_write(int device, lbaint_t blknr, - lbaint_t blkcnt, const void *buffer); +static unsigned long usb_stor_read(block_dev_desc_t *block_dev, lbaint_t blknr, + lbaint_t blkcnt, void *buffer); +static unsigned long usb_stor_write(block_dev_desc_t *block_dev, lbaint_t blknr, + lbaint_t blkcnt, const void *buffer); void uhci_show_temp_int_td(void); #ifdef CONFIG_PARTITIONS @@ -1027,9 +1027,10 @@ static void usb_bin_fixup(struct usb_device_descriptor descriptor, } #endif /* CONFIG_USB_BIN_FIXUP */ -unsigned long usb_stor_read(int device, lbaint_t blknr, - lbaint_t blkcnt, void *buffer) +static unsigned long usb_stor_read(block_dev_desc_t *block_dev, lbaint_t blknr, + lbaint_t blkcnt, void *buffer) { + int device = block_dev->dev; lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks; @@ -1097,9 +1098,10 @@ retry_it: return blkcnt; } -unsigned long usb_stor_write(int device, lbaint_t blknr, - lbaint_t blkcnt, const void *buffer) +static unsigned long usb_stor_write(block_dev_desc_t *block_dev, lbaint_t blknr, + lbaint_t blkcnt, const void *buffer) { + int device = block_dev->dev; lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks; -- cgit v1.2.1