diff options
Diffstat (limited to 'drivers/staging/rdma')
-rw-r--r-- | drivers/staging/rdma/hfi1/chip.c | 5 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/diag.c | 2 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/driver.c | 2 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/efivar.c | 3 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/file_ops.c | 5 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/init.c | 9 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/mad.c | 10 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/pcie.c | 2 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/pio_copy.c | 6 | ||||
-rw-r--r-- | drivers/staging/rdma/hfi1/user_sdma.c | 13 |
10 files changed, 23 insertions, 34 deletions
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index c29860c05ed4..16eb653903e0 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -1252,11 +1252,8 @@ CNTR_ELEM(#name, \ u64 read_csr(const struct hfi1_devdata *dd, u32 offset) { - u64 val; - if (dd->flags & HFI1_PRESENT) { - val = readq((void __iomem *)dd->kregbase + offset); - return val; + return readq((void __iomem *)dd->kregbase + offset); } return -1; } diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c index 6546e91f85b7..c5b520bf610e 100644 --- a/drivers/staging/rdma/hfi1/diag.c +++ b/drivers/staging/rdma/hfi1/diag.c @@ -255,7 +255,7 @@ static int hfi1_filter_ib_service_level(void *ibhdr, void *packet_data, static int hfi1_filter_ib_pkey(void *ibhdr, void *packet_data, void *value); static int hfi1_filter_direction(void *ibhdr, void *packet_data, void *value); -static struct hfi1_filter_array hfi1_filters[] = { +static const struct hfi1_filter_array hfi1_filters[] = { { hfi1_filter_lid }, { hfi1_filter_dlid }, { hfi1_filter_mad_mgmt_class }, diff --git a/drivers/staging/rdma/hfi1/driver.c b/drivers/staging/rdma/hfi1/driver.c index 914beedb556b..34511e5df1d5 100644 --- a/drivers/staging/rdma/hfi1/driver.c +++ b/drivers/staging/rdma/hfi1/driver.c @@ -260,7 +260,7 @@ static inline void *get_egrbuf(const struct hfi1_ctxtdata *rcd, u64 rhf, */ inline int hfi1_rcvbuf_validate(u32 size, u8 type, u16 *encoded) { - if (unlikely(!IS_ALIGNED(size, PAGE_SIZE))) + if (unlikely(!PAGE_ALIGNED(size))) return 0; if (unlikely(size < MIN_EAGER_BUFFER)) return 0; diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c index 3f014f96f9e0..106349fc1fb9 100644 --- a/drivers/staging/rdma/hfi1/efivar.c +++ b/drivers/staging/rdma/hfi1/efivar.c @@ -80,8 +80,7 @@ static int read_efi_var(const char *name, unsigned long *size, if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -EOPNOTSUPP; - uni_name = kzalloc(sizeof(efi_char16_t) * (strlen(name) + 1), - GFP_KERNEL); + uni_name = kcalloc(strlen(name) + 1, sizeof(efi_char16_t), GFP_KERNEL); temp_buffer = kzalloc(EFI_DATA_SIZE, GFP_KERNEL); if (!uni_name || !temp_buffer) { diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index e460261f94b7..8396dc5fb6c1 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -503,8 +503,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) * Map only the amount allocated to the context, not the * entire available context's PIO space. */ - memlen = ALIGN(uctxt->sc->credits * PIO_BLOCK_SIZE, - PAGE_SIZE); + memlen = PAGE_ALIGN(uctxt->sc->credits * PIO_BLOCK_SIZE); flags &= ~VM_MAYREAD; flags |= VM_DONTCOPY | VM_DONTEXPAND; vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); @@ -654,7 +653,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) goto done; } memaddr = (u64)cq->comps; - memlen = ALIGN(sizeof(*cq->comps) * cq->nentries, PAGE_SIZE); + memlen = PAGE_ALIGN(sizeof(*cq->comps) * cq->nentries); flags |= VM_IO | VM_DONTEXPAND; vmf = 1; break; diff --git a/drivers/staging/rdma/hfi1/init.c b/drivers/staging/rdma/hfi1/init.c index deabb0812023..cfcdc16b41c3 100644 --- a/drivers/staging/rdma/hfi1/init.c +++ b/drivers/staging/rdma/hfi1/init.c @@ -335,7 +335,6 @@ struct hfi1_ctxtdata *hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, u32 ctxt, } return rcd; bail: - kfree(rcd->opstats); kfree(rcd->egrbufs.rcvtids); kfree(rcd->egrbufs.buffers); kfree(rcd); @@ -744,8 +743,8 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) ret = lastfail; /* Allocate enough memory for user event notification. */ - len = ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS * - sizeof(*dd->events), PAGE_SIZE); + len = PAGE_ALIGN(dd->chip_rcv_contexts * HFI1_MAX_SHARED_CTXTS * + sizeof(*dd->events)); dd->events = vmalloc_user(len); if (!dd->events) dd_dev_err(dd, "Failed to allocate user events page\n"); @@ -1558,8 +1557,8 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) * rcvhdrqentsize is in DWs, so we have to convert to bytes * (* sizeof(u32)). */ - amt = ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize * - sizeof(u32), PAGE_SIZE); + amt = PAGE_ALIGN(rcd->rcvhdrq_cnt * rcd->rcvhdrqentsize * + sizeof(u32)); gfp_flags = (rcd->ctxt >= dd->first_user_ctxt) ? GFP_USER : GFP_KERNEL; diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c index 0ec748e7e7b6..d1e7f4d7cf6f 100644 --- a/drivers/staging/rdma/hfi1/mad.c +++ b/drivers/staging/rdma/hfi1/mad.c @@ -2630,7 +2630,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, return reply((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_dctrs *)&req->port[0]; + rsp = &req->port[0]; memset(rsp, 0, sizeof(*rsp)); rsp->port_number = port; @@ -2839,7 +2839,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, return reply((struct ib_mad_hdr *)pmp); } - rsp = (struct _port_ectrs *)&req->port[0]; + rsp = &req->port[0]; ibp = to_iport(ibdev, port_num); ppd = ppd_from_ibp(ibp); @@ -2859,7 +2859,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, rsp->uncorrectable_errors = tmp < 0x100 ? (tmp & 0xff) : 0xff; - vlinfo = (struct _vls_ectrs *)&rsp->vls[0]; + vlinfo = &rsp->vls[0]; vfi = 0; vl_select_mask = be32_to_cpu(req->vl_select_mask); for_each_set_bit(vl, (unsigned long *)&(vl_select_mask), @@ -2976,7 +2976,7 @@ static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp, u64 reg; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&req->port[0]; + rsp = &req->port[0]; num_ports = OPA_AM_NPORT(be32_to_cpu(pmp->mad_hdr.attr_mod)); num_pslm = hweight64(be64_to_cpu(req->port_select_mask[3])); @@ -3221,7 +3221,7 @@ static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp, u32 error_info_select; req = (struct opa_port_error_info_msg *)pmp->data; - rsp = (struct _port_ei *)&req->port[0]; + rsp = &req->port[0]; num_ports = OPA_AM_NPORT(be32_to_cpu(pmp->mad_hdr.attr_mod)); num_pslm = hweight64(be64_to_cpu(req->port_select_mask[3])); diff --git a/drivers/staging/rdma/hfi1/pcie.c b/drivers/staging/rdma/hfi1/pcie.c index 42a409f16449..0bac21e6a658 100644 --- a/drivers/staging/rdma/hfi1/pcie.c +++ b/drivers/staging/rdma/hfi1/pcie.c @@ -239,8 +239,6 @@ void hfi1_pcie_ddcleanup(struct hfi1_devdata *dd) iounmap(dd->rcvarray_wc); if (dd->piobase) iounmap(dd->piobase); - - pci_set_drvdata(dd->pcidev, NULL); } /* diff --git a/drivers/staging/rdma/hfi1/pio_copy.c b/drivers/staging/rdma/hfi1/pio_copy.c index 228e9fb76e08..8c25e1b58849 100644 --- a/drivers/staging/rdma/hfi1/pio_copy.c +++ b/drivers/staging/rdma/hfi1/pio_copy.c @@ -236,7 +236,7 @@ static inline void read_extra_bytes(struct pio_buf *pbuf, while (nbytes) { /* find the number of bytes in this u64 */ room = 8 - off; /* this u64 has room for this many bytes */ - xbytes = nbytes > room ? room : nbytes; + xbytes = min(room, nbytes); /* * shift down to zero lower bytes, shift up to zero upper @@ -570,7 +570,7 @@ static void mid_copy_mix(struct pio_buf *pbuf, const void *from, size_t nbytes) * comes first */ send = pbuf->start + PIO_BLOCK_SIZE; - xend = send < dend ? send : dend; + xend = min(send, dend); /* shift up to SOP=1 space */ dest += SOP_DISTANCE; @@ -666,7 +666,7 @@ static void mid_copy_straight(struct pio_buf *pbuf, * comes first */ send = pbuf->start + PIO_BLOCK_SIZE; - xend = send < dend ? send : dend; + xend = min(send, dend); /* shift up to SOP=1 space */ dest += SOP_DISTANCE; diff --git a/drivers/staging/rdma/hfi1/user_sdma.c b/drivers/staging/rdma/hfi1/user_sdma.c index 46e254d52dad..ab6b6a42000f 100644 --- a/drivers/staging/rdma/hfi1/user_sdma.c +++ b/drivers/staging/rdma/hfi1/user_sdma.c @@ -64,7 +64,6 @@ #include "hfi.h" #include "sdma.h" #include "user_sdma.h" -#include "sdma.h" #include "verbs.h" /* for the headers */ #include "common.h" /* for struct hfi1_tid_info */ #include "trace.h" @@ -351,7 +350,7 @@ static void activate_packet_queue(struct iowait *wait, int reason) static void sdma_kmem_cache_ctor(void *obj) { - struct user_sdma_txreq *tx = (struct user_sdma_txreq *)obj; + struct user_sdma_txreq *tx = obj; memset(tx, 0, sizeof(*tx)); } @@ -422,8 +421,7 @@ int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, struct file *fp) if (!cq) goto cq_nomem; - memsize = ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size, - PAGE_SIZE); + memsize = PAGE_ALIGN(sizeof(*cq->comps) * hfi1_sdma_comp_ring_size); cq->comps = vmalloc_user(memsize); if (!cq->comps) goto cq_comps_nomem; @@ -483,8 +481,7 @@ int hfi1_user_sdma_free_queues(struct hfi1_filedata *fd) fd->pq = NULL; } if (fd->cq) { - if (fd->cq->comps) - vfree(fd->cq->comps); + vfree(fd->cq->comps); kfree(fd->cq); fd->cq = NULL; } @@ -945,8 +942,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) unsigned pageidx, len; base = (unsigned long)iovec->iov.iov_base; - offset = ((base + iovec->offset + iov_offset) & - ~PAGE_MASK); + offset = offset_in_page(base + iovec->offset + + iov_offset); pageidx = (((iovec->offset + iov_offset + base) - (base & PAGE_MASK)) >> PAGE_SHIFT); len = offset + req->info.fragsize > PAGE_SIZE ? |