summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-08-17 22:12:59 +0200
committerJens Axboe <axboe@kernel.dk>2017-08-18 16:45:29 +0200
commit4854afe32fa7650c93e4fe97117bb144ea6915cf (patch)
treec8512fc03522b9518fa73114e128de71e7296b6a
parentskd: Switch from the pr_*() to the dev_*() logging functions (diff)
downloadlinux-4854afe32fa7650c93e4fe97117bb144ea6915cf.tar.xz
linux-4854afe32fa7650c93e4fe97117bb144ea6915cf.zip
skd: Fix endianness annotations
Ensure that sparse does not report any warnings when building the skd driver with sparse verification enabled (C=1 or C=2). Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/skd_main.c14
-rw-r--r--drivers/block/skd_s1120.h18
2 files changed, 15 insertions, 17 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 5174303d7db7..5a69e3288ab7 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -512,7 +512,7 @@ static void skd_request_fn(struct request_queue *q)
u32 lba;
u32 count;
int data_dir;
- u64 be_dmaa;
+ __be64 be_dmaa;
u64 cmdctxt;
u32 timo_slot;
void *cmd_ptr;
@@ -645,7 +645,7 @@ static void skd_request_fn(struct request_queue *q)
cmd_ptr = &skmsg->msg_buf[skmsg->length];
memset(cmd_ptr, 0, 32);
- be_dmaa = cpu_to_be64((u64)skreq->sksg_dma_address);
+ be_dmaa = cpu_to_be64(skreq->sksg_dma_address);
cmdctxt = skreq->id + SKD_ID_INCR;
scsi_req = cmd_ptr;
@@ -2402,9 +2402,7 @@ static void skd_do_inq_page_00(struct skd_device *skdev,
/* SCSI byte order increment of num_returned_bytes by 1 */
skcomp->num_returned_bytes =
- be32_to_cpu(skcomp->num_returned_bytes) + 1;
- skcomp->num_returned_bytes =
- be32_to_cpu(skcomp->num_returned_bytes);
+ cpu_to_be32(be32_to_cpu(skcomp->num_returned_bytes) + 1);
}
/* update page length field to reflect the driver's page too */
@@ -2502,7 +2500,7 @@ static void skd_do_inq_page_da(struct skd_device *skdev,
memcpy(buf, &inq, min_t(unsigned, max_bytes, sizeof(inq)));
skcomp->num_returned_bytes =
- be32_to_cpu(min_t(uint16_t, max_bytes, sizeof(inq)));
+ cpu_to_be32(min_t(uint16_t, max_bytes, sizeof(inq)));
}
static void skd_do_driver_inq(struct skd_device *skdev,
@@ -4674,7 +4672,7 @@ static void skd_pci_remove(struct pci_dev *pdev)
for (i = 0; i < SKD_MAX_BARS; i++)
if (skdev->mem_map[i])
- iounmap((u32 *)skdev->mem_map[i]);
+ iounmap(skdev->mem_map[i]);
if (skdev->pcie_error_reporting_is_enabled)
pci_disable_pcie_error_reporting(pdev);
@@ -4705,7 +4703,7 @@ static int skd_pci_suspend(struct pci_dev *pdev, pm_message_t state)
for (i = 0; i < SKD_MAX_BARS; i++)
if (skdev->mem_map[i])
- iounmap((u32 *)skdev->mem_map[i]);
+ iounmap(skdev->mem_map[i]);
if (skdev->pcie_error_reporting_is_enabled)
pci_disable_pcie_error_reporting(pdev);
diff --git a/drivers/block/skd_s1120.h b/drivers/block/skd_s1120.h
index 82ce34454dbf..f69d3d97744d 100644
--- a/drivers/block/skd_s1120.h
+++ b/drivers/block/skd_s1120.h
@@ -248,7 +248,7 @@ struct fit_msg_hdr {
* 20-23 of the FIT_MTD_FITFW_INIT response.
*/
struct fit_completion_entry_v1 {
- uint32_t num_returned_bytes;
+ __be32 num_returned_bytes;
uint16_t tag;
uint8_t status; /* SCSI status */
uint8_t cycle;
@@ -290,11 +290,11 @@ struct fit_comp_error_info {
* Version one has the last 32 bits sg_list_len_bytes;
*/
struct skd_command_header {
- uint64_t sg_list_dma_address;
+ __be64 sg_list_dma_address;
uint16_t tag;
uint8_t attribute;
uint8_t add_cdb_len; /* In 32 bit words */
- uint32_t sg_list_len_bytes;
+ __be32 sg_list_len_bytes;
};
struct skd_scsi_request {
@@ -307,16 +307,16 @@ struct driver_inquiry_data {
uint8_t peripheral_device_type:5;
uint8_t qualifier:3;
uint8_t page_code;
- uint16_t page_length;
- uint16_t pcie_bus_number;
+ __be16 page_length;
+ __be16 pcie_bus_number;
uint8_t pcie_device_number;
uint8_t pcie_function_number;
uint8_t pcie_link_speed;
uint8_t pcie_link_lanes;
- uint16_t pcie_vendor_id;
- uint16_t pcie_device_id;
- uint16_t pcie_subsystem_vendor_id;
- uint16_t pcie_subsystem_device_id;
+ __be16 pcie_vendor_id;
+ __be16 pcie_device_id;
+ __be16 pcie_subsystem_vendor_id;
+ __be16 pcie_subsystem_device_id;
uint8_t reserved1[2];
uint8_t reserved2[3];
uint8_t driver_version_length;