aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorFrank Haverkamp <haver@linux.vnet.ibm.com>2013-12-20 10:26:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-20 11:45:50 -0500
commit58d66ce732378fed7a35ca79c763057b8c1e8aed (patch)
tree377998e1088365050c9ceca0a9bb676c9e3986cf /drivers/misc
parent76f5adbcb371b01ae0ad42e55377d0579706fb20 (diff)
GenWQE: Fix endian issues detected by sparse
Fengguang Wu used CF=-D__CHECK_ENDIAN__ to check the GenWQE driver for endian issues. Sparse found a couple of those. Most of them were caused by not correctly handling __be64/32 and __u64/32. Those I was able to fix with appropriate castings. One more serious issue was the ATS entry in struct genwqe_ddcb_cmd. The kernel expected it in big-endian, but the type was defined __u64. I decided that it is better to keep the interface consistent using host endian byte-odering instead of having a mixture. With this change the kernel likes to see host endian byte order for the ATS entry. That would have been an interface change, if someone would have used the driver already. Since this is not the case, I hope it is ok to fix it now. For the genqwe_readq/writeq/readl/writel functions I enforced the casts. It still complains, as far as I can see, about some copy_to/from_user() usages: CHECK char-misc/drivers/misc/genwqe/card_dev.c char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from CC [M] drivers/misc/genwqe/card_dev.o CHECK char-misc/drivers/misc/genwqe/card_ddcb.c char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from char-misc/arch/x86/include/asm/uaccess.h:625:18: warning: incorrect type in argument 1 (different modifiers) char-misc/arch/x86/include/asm/uaccess.h:625:18: expected void *<noident> char-misc/arch/x86/include/asm/uaccess.h:625:18: got void const *from CC [M] drivers/misc/genwqe/card_ddcb.o LD [M] drivers/misc/genwqe/genwqe_card.o I appreciate some help from you to figure out what is causig those, and making a proposal how to fix them. I included the missing header file to fix the implicit-function-declaration warning when using dynamic_hex_dump. Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/genwqe/card_ddcb.c16
-rw-r--r--drivers/misc/genwqe/card_dev.c97
-rw-r--r--drivers/misc/genwqe/card_utils.c11
-rw-r--r--drivers/misc/genwqe/genwqe_driver.h3
4 files changed, 68 insertions, 59 deletions
diff --git a/drivers/misc/genwqe/card_ddcb.c b/drivers/misc/genwqe/card_ddcb.c
index cc6fca7a4851..b5a3206df3cd 100644
--- a/drivers/misc/genwqe/card_ddcb.c
+++ b/drivers/misc/genwqe/card_ddcb.c
@@ -276,7 +276,7 @@ static int enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue,
276 unsigned int try; 276 unsigned int try;
277 int prev_no; 277 int prev_no;
278 struct ddcb *prev_ddcb; 278 struct ddcb *prev_ddcb;
279 u32 old, new, icrc_hsi_shi; 279 __be32 old, new, icrc_hsi_shi;
280 u64 num; 280 u64 num;
281 281
282 /* 282 /*
@@ -623,9 +623,9 @@ int __genwqe_purge_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req)
623 unsigned long flags; 623 unsigned long flags;
624 struct ddcb_queue *queue = req->queue; 624 struct ddcb_queue *queue = req->queue;
625 struct pci_dev *pci_dev = cd->pci_dev; 625 struct pci_dev *pci_dev = cd->pci_dev;
626 u32 icrc_hsi_shi = 0x0000;
627 u64 queue_status; 626 u64 queue_status;
628 u32 old, new; 627 __be32 icrc_hsi_shi = 0x0000;
628 __be32 old, new;
629 629
630 /* unsigned long flags; */ 630 /* unsigned long flags; */
631 if (genwqe_ddcb_software_timeout <= 0) { 631 if (genwqe_ddcb_software_timeout <= 0) {
@@ -839,8 +839,8 @@ int __genwqe_enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req)
839 &req->cmd.__asiv[0], /* source */ 839 &req->cmd.__asiv[0], /* source */
840 DDCB_ASIV_LENGTH); /* req->cmd.asiv_length */ 840 DDCB_ASIV_LENGTH); /* req->cmd.asiv_length */
841 } else { 841 } else {
842 pddcb->n.ats_64 = req->cmd.ats; 842 pddcb->n.ats_64 = cpu_to_be64(req->cmd.ats);
843 memcpy(&pddcb->n.asiv[0], /* destination */ 843 memcpy(&pddcb->n.asiv[0], /* destination */
844 &req->cmd.asiv[0], /* source */ 844 &req->cmd.asiv[0], /* source */
845 DDCB_ASIV_LENGTH_ATS); /* req->cmd.asiv_length */ 845 DDCB_ASIV_LENGTH_ATS); /* req->cmd.asiv_length */
846 } 846 }
@@ -915,7 +915,8 @@ int __genwqe_execute_raw_ddcb(struct genwqe_dev *cd,
915 goto err_exit; 915 goto err_exit;
916 916
917 if (ddcb_requ_collect_debug_data(req)) { 917 if (ddcb_requ_collect_debug_data(req)) {
918 if (copy_to_user((void __user *)cmd->ddata_addr, 918 if (copy_to_user((struct genwqe_debug_data __user *)
919 (unsigned long)cmd->ddata_addr,
919 &req->debug_data, 920 &req->debug_data,
920 sizeof(struct genwqe_debug_data))) 921 sizeof(struct genwqe_debug_data)))
921 return -EFAULT; 922 return -EFAULT;
@@ -938,7 +939,8 @@ int __genwqe_execute_raw_ddcb(struct genwqe_dev *cd,
938 __genwqe_purge_ddcb(cd, req); 939 __genwqe_purge_ddcb(cd, req);
939 940
940 if (ddcb_requ_collect_debug_data(req)) { 941 if (ddcb_requ_collect_debug_data(req)) {
941 if (copy_to_user((void __user *)cmd->ddata_addr, 942 if (copy_to_user((struct genwqe_debug_data __user *)
943 (unsigned long)cmd->ddata_addr,
942 &req->debug_data, 944 &req->debug_data,
943 sizeof(struct genwqe_debug_data))) 945 sizeof(struct genwqe_debug_data)))
944 return -EFAULT; 946 return -EFAULT;
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 9b231bb1005c..bcd3081b55b9 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -587,30 +587,31 @@ static int do_flash_update(struct genwqe_file *cfile,
587 587
588 /* prepare invariant values */ 588 /* prepare invariant values */
589 if (genwqe_get_slu_id(cd) <= 0x2) { 589 if (genwqe_get_slu_id(cd) <= 0x2) {
590 *(u64 *)&req->__asiv[0] = cpu_to_be64(dma_addr); 590 *(__be64 *)&req->__asiv[0] = cpu_to_be64(dma_addr);
591 *(u64 *)&req->__asiv[8] = cpu_to_be64(tocopy); 591 *(__be64 *)&req->__asiv[8] = cpu_to_be64(tocopy);
592 *(u64 *)&req->__asiv[16] = cpu_to_be64(flash); 592 *(__be64 *)&req->__asiv[16] = cpu_to_be64(flash);
593 *(u32 *)&req->__asiv[24] = cpu_to_be32(0); 593 *(__be32 *)&req->__asiv[24] = cpu_to_be32(0);
594 req->__asiv[24] = load->uid; 594 req->__asiv[24] = load->uid;
595 *(u32 *)&req->__asiv[28] = cpu_to_be32(crc); 595 *(__be32 *)&req->__asiv[28] = cpu_to_be32(crc);
596 596
597 /* for simulation only */ 597 /* for simulation only */
598 *(u64 *)&req->__asiv[88] = cpu_to_be64(load->slu_id); 598 *(__be64 *)&req->__asiv[88] = cpu_to_be64(load->slu_id);
599 *(u64 *)&req->__asiv[96] = cpu_to_be64(load->app_id); 599 *(__be64 *)&req->__asiv[96] = cpu_to_be64(load->app_id);
600 req->asiv_length = 32; /* bytes included in crc calc */ 600 req->asiv_length = 32; /* bytes included in crc calc */
601 } else { /* setup DDCB for ATS architecture */ 601 } else { /* setup DDCB for ATS architecture */
602 *(u64 *)&req->asiv[0] = cpu_to_be64(dma_addr); 602 *(__be64 *)&req->asiv[0] = cpu_to_be64(dma_addr);
603 *(u32 *)&req->asiv[8] = cpu_to_be32(tocopy); 603 *(__be32 *)&req->asiv[8] = cpu_to_be32(tocopy);
604 *(u32 *)&req->asiv[12] = cpu_to_be32(0); /* resvd */ 604 *(__be32 *)&req->asiv[12] = cpu_to_be32(0); /* resvd */
605 *(u64 *)&req->asiv[16] = cpu_to_be64(flash); 605 *(__be64 *)&req->asiv[16] = cpu_to_be64(flash);
606 *(u32 *)&req->asiv[24] = cpu_to_be32(load->uid<<24); 606 *(__be32 *)&req->asiv[24] = cpu_to_be32(load->uid<<24);
607 *(u32 *)&req->asiv[28] = cpu_to_be32(crc); 607 *(__be32 *)&req->asiv[28] = cpu_to_be32(crc);
608 608
609 /* for simulation only */ 609 /* for simulation only */
610 *(u64 *)&req->asiv[80] = cpu_to_be64(load->slu_id); 610 *(__be64 *)&req->asiv[80] = cpu_to_be64(load->slu_id);
611 *(u64 *)&req->asiv[88] = cpu_to_be64(load->app_id); 611 *(__be64 *)&req->asiv[88] = cpu_to_be64(load->app_id);
612 612
613 req->ats = cpu_to_be64(0x4ULL << 44); /* Rd only */ 613 /* Rd only */
614 req->ats = 0x4ULL << 44;
614 req->asiv_length = 40; /* bytes included in crc calc */ 615 req->asiv_length = 40; /* bytes included in crc calc */
615 } 616 }
616 req->asv_length = 8; 617 req->asv_length = 8;
@@ -729,21 +730,23 @@ static int do_flash_read(struct genwqe_file *cfile,
729 730
730 /* prepare invariant values */ 731 /* prepare invariant values */
731 if (genwqe_get_slu_id(cd) <= 0x2) { 732 if (genwqe_get_slu_id(cd) <= 0x2) {
732 *(u64 *)&cmd->__asiv[0] = cpu_to_be64(dma_addr); 733 *(__be64 *)&cmd->__asiv[0] = cpu_to_be64(dma_addr);
733 *(u64 *)&cmd->__asiv[8] = cpu_to_be64(tocopy); 734 *(__be64 *)&cmd->__asiv[8] = cpu_to_be64(tocopy);
734 *(u64 *)&cmd->__asiv[16] = cpu_to_be64(flash); 735 *(__be64 *)&cmd->__asiv[16] = cpu_to_be64(flash);
735 *(u32 *)&cmd->__asiv[24] = cpu_to_be32(0); 736 *(__be32 *)&cmd->__asiv[24] = cpu_to_be32(0);
736 cmd->__asiv[24] = load->uid; 737 cmd->__asiv[24] = load->uid;
737 *(u32 *)&cmd->__asiv[28] = cpu_to_be32(0) /* CRC */; 738 *(__be32 *)&cmd->__asiv[28] = cpu_to_be32(0) /* CRC */;
738 cmd->asiv_length = 32; /* bytes included in crc calc */ 739 cmd->asiv_length = 32; /* bytes included in crc calc */
739 } else { /* setup DDCB for ATS architecture */ 740 } else { /* setup DDCB for ATS architecture */
740 *(u64 *)&cmd->asiv[0] = cpu_to_be64(dma_addr); 741 *(__be64 *)&cmd->asiv[0] = cpu_to_be64(dma_addr);
741 *(u32 *)&cmd->asiv[8] = cpu_to_be32(tocopy); 742 *(__be32 *)&cmd->asiv[8] = cpu_to_be32(tocopy);
742 *(u32 *)&cmd->asiv[12] = cpu_to_be32(0); /* resvd */ 743 *(__be32 *)&cmd->asiv[12] = cpu_to_be32(0); /* resvd */
743 *(u64 *)&cmd->asiv[16] = cpu_to_be64(flash); 744 *(__be64 *)&cmd->asiv[16] = cpu_to_be64(flash);
744 *(u32 *)&cmd->asiv[24] = cpu_to_be32(load->uid<<24); 745 *(__be32 *)&cmd->asiv[24] = cpu_to_be32(load->uid<<24);
745 *(u32 *)&cmd->asiv[28] = cpu_to_be32(0); /* CRC */ 746 *(__be32 *)&cmd->asiv[28] = cpu_to_be32(0); /* CRC */
746 cmd->ats = cpu_to_be64(0x5ULL << 44); /* rd/wr */ 747
748 /* rd/wr */
749 cmd->ats = 0x5ULL << 44;
747 cmd->asiv_length = 40; /* bytes included in crc calc */ 750 cmd->asiv_length = 40; /* bytes included in crc calc */
748 } 751 }
749 cmd->asv_length = 8; 752 cmd->asv_length = 8;
@@ -911,9 +914,9 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
911 914
912 u64 u_addr, d_addr; 915 u64 u_addr, d_addr;
913 u32 u_size = 0; 916 u32 u_size = 0;
914 unsigned long ats_flags; 917 u64 ats_flags;
915 918
916 ats_flags = ATS_GET_FLAGS(be64_to_cpu(cmd->ats), asiv_offs); 919 ats_flags = ATS_GET_FLAGS(cmd->ats, asiv_offs);
917 920
918 switch (ats_flags) { 921 switch (ats_flags) {
919 922
@@ -922,9 +925,9 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
922 925
923 case ATS_TYPE_FLAT_RDWR: 926 case ATS_TYPE_FLAT_RDWR:
924 case ATS_TYPE_FLAT_RD: { 927 case ATS_TYPE_FLAT_RD: {
925 u_addr = be64_to_cpu(*((u64 *)&cmd-> 928 u_addr = be64_to_cpu(*((__be64 *)&cmd->
926 asiv[asiv_offs])); 929 asiv[asiv_offs]));
927 u_size = be32_to_cpu(*((u32 *)&cmd-> 930 u_size = be32_to_cpu(*((__be32 *)&cmd->
928 asiv[asiv_offs + 0x08])); 931 asiv[asiv_offs + 0x08]));
929 932
930 /* 933 /*
@@ -933,7 +936,7 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
933 * fetch the buffer. 936 * fetch the buffer.
934 */ 937 */
935 if (u_size == 0x0) { 938 if (u_size == 0x0) {
936 *((u64 *)&cmd->asiv[asiv_offs]) = 939 *((__be64 *)&cmd->asiv[asiv_offs]) =
937 cpu_to_be64(0x0); 940 cpu_to_be64(0x0);
938 break; 941 break;
939 } 942 }
@@ -945,7 +948,8 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
945 goto err_out; 948 goto err_out;
946 } 949 }
947 950
948 *((u64 *)&cmd->asiv[asiv_offs]) = cpu_to_be64(d_addr); 951 *((__be64 *)&cmd->asiv[asiv_offs]) =
952 cpu_to_be64(d_addr);
949 break; 953 break;
950 } 954 }
951 955
@@ -953,9 +957,10 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
953 case ATS_TYPE_SGL_RD: { 957 case ATS_TYPE_SGL_RD: {
954 int page_offs, nr_pages, offs; 958 int page_offs, nr_pages, offs;
955 959
956 u_addr = be64_to_cpu(*((u64 *)&cmd->asiv[asiv_offs])); 960 u_addr = be64_to_cpu(*((__be64 *)
957 u_size = be32_to_cpu(*((u32 *)&cmd->asiv[asiv_offs + 961 &cmd->asiv[asiv_offs]));
958 0x08])); 962 u_size = be32_to_cpu(*((__be32 *)
963 &cmd->asiv[asiv_offs + 0x08]));
959 964
960 /* 965 /*
961 * No data available. Ignore u_addr in this 966 * No data available. Ignore u_addr in this
@@ -963,7 +968,7 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
963 * fetch the empty sgl. 968 * fetch the empty sgl.
964 */ 969 */
965 if (u_size == 0x0) { 970 if (u_size == 0x0) {
966 *((u64 *)&cmd->asiv[asiv_offs]) = 971 *((__be64 *)&cmd->asiv[asiv_offs]) =
967 cpu_to_be64(0x0); 972 cpu_to_be64(0x0);
968 break; 973 break;
969 } 974 }
@@ -1007,14 +1012,14 @@ static int ddcb_cmd_fixups(struct genwqe_file *cfile, struct ddcb_requ *req)
1007 page_offs, 1012 page_offs,
1008 nr_pages); 1013 nr_pages);
1009 1014
1010 *((u64 *)&cmd->asiv[asiv_offs]) = 1015 *((__be64 *)&cmd->asiv[asiv_offs]) =
1011 cpu_to_be64(req->sgl_dma_addr[i]); 1016 cpu_to_be64(req->sgl_dma_addr[i]);
1012 1017
1013 break; 1018 break;
1014 } 1019 }
1015 default: 1020 default:
1016 dev_err(&pci_dev->dev, 1021 dev_err(&pci_dev->dev,
1017 "[%s] err: invalid ATS flags %01lx\n", 1022 "[%s] err: invalid ATS flags %01llx\n",
1018 __func__, ats_flags); 1023 __func__, ats_flags);
1019 rc = -EINVAL; 1024 rc = -EINVAL;
1020 goto err_out; 1025 goto err_out;
@@ -1211,7 +1216,8 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd,
1211 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) 1216 if ((filp->f_flags & O_ACCMODE) == O_RDONLY)
1212 return -EPERM; 1217 return -EPERM;
1213 1218
1214 if (copy_from_user(&load, (void __user *)arg, sizeof(load))) { 1219 if (copy_from_user(&load, (void __user *)arg,
1220 sizeof(load))) {
1215 dev_err(&pci_dev->dev, 1221 dev_err(&pci_dev->dev,
1216 "err: could not copy params from user\n"); 1222 "err: could not copy params from user\n");
1217 return -EFAULT; 1223 return -EFAULT;
@@ -1236,7 +1242,8 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd,
1236 if (genwqe_flash_readback_fails(cd)) 1242 if (genwqe_flash_readback_fails(cd))
1237 return -ENOSPC; /* known to fail for old versions */ 1243 return -ENOSPC; /* known to fail for old versions */
1238 1244
1239 if (copy_from_user(&load, (void __user *)arg, sizeof(load))) { 1245 if (copy_from_user(&load, (void __user *)arg,
1246 sizeof(load))) {
1240 dev_err(&pci_dev->dev, 1247 dev_err(&pci_dev->dev,
1241 "err: could not copy params from user\n"); 1248 "err: could not copy params from user\n");
1242 return -EFAULT; 1249 return -EFAULT;
@@ -1256,7 +1263,8 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd,
1256 case GENWQE_PIN_MEM: { 1263 case GENWQE_PIN_MEM: {
1257 struct genwqe_mem m; 1264 struct genwqe_mem m;
1258 1265
1259 if (copy_from_user(&m, (void __user *)arg, sizeof(m))) { 1266 if (copy_from_user(&m, (void __user *)arg,
1267 sizeof(m))) {
1260 dev_err(&pci_dev->dev, 1268 dev_err(&pci_dev->dev,
1261 "err: could not copy params from user\n"); 1269 "err: could not copy params from user\n");
1262 return -EFAULT; 1270 return -EFAULT;
@@ -1267,7 +1275,8 @@ static long genwqe_ioctl(struct file *filp, unsigned int cmd,
1267 case GENWQE_UNPIN_MEM: { 1275 case GENWQE_UNPIN_MEM: {
1268 struct genwqe_mem m; 1276 struct genwqe_mem m;
1269 1277
1270 if (copy_from_user(&m, (void __user *)arg, sizeof(m))) { 1278 if (copy_from_user(&m, (void __user *)arg,
1279 sizeof(m))) {
1271 dev_err(&pci_dev->dev, 1280 dev_err(&pci_dev->dev,
1272 "err: could not copy params from user\n"); 1281 "err: could not copy params from user\n");
1273 return -EFAULT; 1282 return -EFAULT;
diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
index ff952bb81521..663157b3a0d4 100644
--- a/drivers/misc/genwqe/card_utils.c
+++ b/drivers/misc/genwqe/card_utils.c
@@ -59,7 +59,7 @@ int __genwqe_writeq(struct genwqe_dev *cd, u64 byte_offs, u64 val)
59 if (cd->mmio == NULL) 59 if (cd->mmio == NULL)
60 return -EIO; 60 return -EIO;
61 61
62 __raw_writeq(cpu_to_be64((val)), (cd->mmio + byte_offs)); 62 __raw_writeq((__force u32)cpu_to_be64(val), cd->mmio + byte_offs);
63 return 0; 63 return 0;
64} 64}
65 65
@@ -72,8 +72,6 @@ int __genwqe_writeq(struct genwqe_dev *cd, u64 byte_offs, u64 val)
72 */ 72 */
73u64 __genwqe_readq(struct genwqe_dev *cd, u64 byte_offs) 73u64 __genwqe_readq(struct genwqe_dev *cd, u64 byte_offs)
74{ 74{
75 u64 val;
76
77 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE) 75 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE)
78 return 0xffffffffffffffffull; 76 return 0xffffffffffffffffull;
79 77
@@ -88,8 +86,7 @@ u64 __genwqe_readq(struct genwqe_dev *cd, u64 byte_offs)
88 if (cd->mmio == NULL) 86 if (cd->mmio == NULL)
89 return 0xffffffffffffffffull; 87 return 0xffffffffffffffffull;
90 88
91 val = be64_to_cpu(__raw_readq(cd->mmio + byte_offs)); 89 return be64_to_cpu((__force __be64)__raw_readq(cd->mmio + byte_offs));
92 return val;
93} 90}
94 91
95/** 92/**
@@ -108,7 +105,7 @@ int __genwqe_writel(struct genwqe_dev *cd, u64 byte_offs, u32 val)
108 if (cd->mmio == NULL) 105 if (cd->mmio == NULL)
109 return -EIO; 106 return -EIO;
110 107
111 __raw_writel(cpu_to_be32((val)), cd->mmio + byte_offs); 108 __raw_writel((__force u32)cpu_to_be32(val), cd->mmio + byte_offs);
112 return 0; 109 return 0;
113} 110}
114 111
@@ -127,7 +124,7 @@ u32 __genwqe_readl(struct genwqe_dev *cd, u64 byte_offs)
127 if (cd->mmio == NULL) 124 if (cd->mmio == NULL)
128 return 0xffffffff; 125 return 0xffffffff;
129 126
130 return be32_to_cpu(__raw_readl(cd->mmio + byte_offs)); 127 return be32_to_cpu((__force __be32)__raw_readl(cd->mmio + byte_offs));
131} 128}
132 129
133/** 130/**
diff --git a/drivers/misc/genwqe/genwqe_driver.h b/drivers/misc/genwqe/genwqe_driver.h
index a1572037c0f9..b57538999bf1 100644
--- a/drivers/misc/genwqe/genwqe_driver.h
+++ b/drivers/misc/genwqe/genwqe_driver.h
@@ -31,8 +31,9 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <asm/byteorder.h> 34#include <linux/dynamic_debug.h>
35 35
36#include <asm/byteorder.h>
36#include <linux/genwqe/genwqe_card.h> 37#include <linux/genwqe/genwqe_card.h>
37 38
38#define DRV_VERS_STRING "2.0.0" 39#define DRV_VERS_STRING "2.0.0"