diff options
author | Dennis Dalessandro <dennis.dalessandro@intel.com> | 2016-01-06 09:52:40 -0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-03-10 20:37:05 -0500 |
commit | 4997870a0935b923d2ba67293fca0b8c05f74c1e (patch) | |
tree | d82ebc47dad071c314e28d0f68912b248fdd17f0 /drivers/infiniband/sw | |
parent | b1070a7a4d304e680eb6c1158d76645cf5a923f1 (diff) | |
download | blackbird-obmc-linux-4997870a0935b923d2ba67293fca0b8c05f74c1e.tar.gz blackbird-obmc-linux-4997870a0935b923d2ba67293fca0b8c05f74c1e.zip |
IB/rdmavt: Macroize override checks during driver registration
Add a macro to cut down on writing the same lines over and over again for
what will be a large number of functions that will be supported.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw')
-rw-r--r-- | drivers/infiniband/sw/rdmavt/vt.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c index b65cde435f19..8bd25c310052 100644 --- a/drivers/infiniband/sw/rdmavt/vt.c +++ b/drivers/infiniband/sw/rdmavt/vt.c @@ -64,29 +64,25 @@ static void rvt_cleanup(void) } module_exit(rvt_cleanup); +/* + * Check driver override. If driver passes a value use it, otherwise we use our + * own value. + */ +#define CHECK_DRIVER_OVERRIDE(rdi, x) \ + rdi->ibdev.x = rdi->ibdev.x ? : rvt_ ##x + int rvt_register_device(struct rvt_dev_info *rdi) { if (!rdi) return -EINVAL; - /* - * Drivers have the option to override anything in the ibdev that they - * want to specifically handle. VT needs to check for things it supports - * and if the driver wants to handle that functionality let it. We may - * come up with a better mechanism that simplifies the code at some - * point. - */ - /* DMA Operations */ rdi->ibdev.dma_ops = rdi->ibdev.dma_ops ? : &rvt_default_dma_mapping_ops; /* Protection Domain */ - rdi->ibdev.alloc_pd = - rdi->ibdev.alloc_pd ? : rvt_alloc_pd; - rdi->ibdev.dealloc_pd = - rdi->ibdev.dealloc_pd ? : rvt_dealloc_pd; - + CHECK_DRIVER_OVERRIDE(rdi, alloc_pd); + CHECK_DRIVER_OVERRIDE(rdi, dealloc_pd); spin_lock_init(&rdi->n_pds_lock); rdi->n_pds_allocated = 0; |