Re: [PATCH rdma-next v5 20/20] RDMA: Start use ib_device_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 10, 2018 at 09:09:48PM +0200, Kamal Heib wrote:
> diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
> index 2f56844fb7da..220dd324f870 100644
> +++ b/include/rdma/uverbs_ioctl.h
> @@ -419,10 +419,10 @@ struct uapi_definition {
>  		.kind = UAPI_DEF_IS_SUPPORTED_DEV_FN,                          \
>  		.scope = UAPI_SCOPE_OBJECT,                                    \
>  		.needs_fn_offset =                                             \
> -			offsetof(struct ib_device, ibdev_fn) +                 \
> +			offsetof(struct ib_device_ops, ibdev_fn) +             \
>  			BUILD_BUG_ON_ZERO(                                     \
> -				sizeof(((struct ib_device *)0)->ibdev_fn) !=   \
> -				sizeof(void *)),                               \
> +			    sizeof(((struct ib_device_ops *)0)->ibdev_fn) !=   \
> +			    sizeof(void *)),				       \
>  	}
>  
>  /*
> @@ -434,10 +434,10 @@ struct uapi_definition {
>  		.kind = UAPI_DEF_IS_SUPPORTED_DEV_FN,                          \
>  		.scope = UAPI_SCOPE_METHOD,                                    \
>  		.needs_fn_offset =                                             \
> -			offsetof(struct ib_device, ibdev_fn) +                 \
> +			offsetof(struct ib_device_ops, ibdev_fn) +             \
>  			BUILD_BUG_ON_ZERO(                                     \
> -				sizeof(((struct ib_device *)0)->ibdev_fn) !=   \
> -				sizeof(void *)),                               \
> +			    sizeof(((struct ib_device_ops *)0)->ibdev_fn) !=   \
> +			    sizeof(void *)),                                   \
>  	}

This is wrong, the reader has to be adjusted to make that work:

--- a/drivers/infiniband/core/uverbs_uapi.c
+++ b/drivers/infiniband/core/uverbs_uapi.c
@@ -300,7 +300,8 @@ static int uapi_merge_def(struct uverbs_api *uapi, struct ib
                        return 0;
 
                case UAPI_DEF_IS_SUPPORTED_DEV_FN: {
-                       void **ibdev_fn = (void *)ibdev + def->needs_fn_offset;
+                       void **ibdev_fn =
+                               (void *)(&ibdev->ops) + def->needs_fn_offset;
 
I fixed it..

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux