From: Faiz Abbas Date: Tue, 15 Oct 2019 12:54:32 +0000 (+0530) Subject: scsi: Simplify scsi_read()/_write() X-Git-Tag: v2020.01-rc1~9^2~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=66c54f1a3e467e25093253020a75f6b288b7281f;p=oweals%2Fu-boot.git scsi: Simplify scsi_read()/_write() With no non-DM driver using scsi_read()/_write() APIs, remove the legacy implementations. Signed-off-by: Faiz Abbas [trini: Reorder slightly and mark scsi_read/write behind BLK test to avoid warnings] Signed-off-by: Tom Rini --- diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 48cb2a2818..1b9f25ac33 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -83,6 +83,22 @@ void scsi_setup_read16(struct scsi_cmd *pccb, lbaint_t start, } #endif +static void scsi_setup_inquiry(struct scsi_cmd *pccb) +{ + pccb->cmd[0] = SCSI_INQUIRY; + pccb->cmd[1] = pccb->lun << 5; + pccb->cmd[2] = 0; + pccb->cmd[3] = 0; + if (pccb->datalen > 255) + pccb->cmd[4] = 255; + else + pccb->cmd[4] = (unsigned char)pccb->datalen; + pccb->cmd[5] = 0; + pccb->cmdlen = 6; + pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ +} + +#ifdef CONFIG_BLK static void scsi_setup_read_ext(struct scsi_cmd *pccb, lbaint_t start, unsigned short blocks) { @@ -126,35 +142,11 @@ static void scsi_setup_write_ext(struct scsi_cmd *pccb, lbaint_t start, pccb->cmd[7], pccb->cmd[8]); } -static void scsi_setup_inquiry(struct scsi_cmd *pccb) -{ - pccb->cmd[0] = SCSI_INQUIRY; - pccb->cmd[1] = pccb->lun << 5; - pccb->cmd[2] = 0; - pccb->cmd[3] = 0; - if (pccb->datalen > 255) - pccb->cmd[4] = 255; - else - pccb->cmd[4] = (unsigned char)pccb->datalen; - pccb->cmd[5] = 0; - pccb->cmdlen = 6; - pccb->msgout[0] = SCSI_IDENTIFY; /* NOT USED */ -} - -#ifdef CONFIG_BLK static ulong scsi_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) -#else -static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, - lbaint_t blkcnt, void *buffer) -#endif { -#ifdef CONFIG_BLK struct blk_desc *block_dev = dev_get_uclass_platdata(dev); struct udevice *bdev = dev->parent; -#else - struct udevice *bdev = NULL; -#endif lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks = 0; @@ -217,20 +209,11 @@ static ulong scsi_read(struct blk_desc *block_dev, lbaint_t blknr, /* Almost the maximum amount of the scsi_ext command.. */ #define SCSI_MAX_WRITE_BLK 0xFFFF -#ifdef CONFIG_BLK static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, const void *buffer) -#else -static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, - lbaint_t blkcnt, const void *buffer) -#endif { -#ifdef CONFIG_BLK struct blk_desc *block_dev = dev_get_uclass_platdata(dev); struct udevice *bdev = dev->parent; -#else - struct udevice *bdev = NULL; -#endif lbaint_t start, blks; uintptr_t buf_addr; unsigned short smallblks; @@ -273,6 +256,7 @@ static ulong scsi_write(struct blk_desc *block_dev, lbaint_t blknr, __func__, start, smallblks, buf_addr); return blkcnt; } +#endif #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) && \ !defined(CONFIG_DM_SCSI) @@ -450,10 +434,6 @@ static void scsi_init_dev_desc_priv(struct blk_desc *dev_desc) dev_desc->product[0] = 0; dev_desc->revision[0] = 0; dev_desc->removable = false; -#if !CONFIG_IS_ENABLED(BLK) - dev_desc->block_read = scsi_read; - dev_desc->block_write = scsi_write; -#endif } #if !defined(CONFIG_DM_SCSI)