Skip to content

Commit 7106a97

Browse files
committed
RDMA/uverbs: Make write() handlers return 0 on success
Currently they return the command length, while all other handlers return 0. This makes the write path closer to the write_ex and ioctl path. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
1 parent 8313c10 commit 7106a97

7 files changed

Lines changed: 139 additions & 191 deletions

File tree

‎drivers/infiniband/core/rdma_core.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,11 @@ struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
245245
}
246246

247247
/*
248-
* Does both uobj_get_destroy() and uobj_put_destroy(). Returns success_res
249-
* on success (negative errno on failure). For use by callers that do not need
250-
* the uobj.
248+
* Does both uobj_get_destroy() and uobj_put_destroy(). Returns 0 on success
249+
* (negative errno on failure). For use by callers that do not need the uobj.
251250
*/
252251
int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
253-
const struct uverbs_attr_bundle *attrs,
254-
int success_res)
252+
const struct uverbs_attr_bundle *attrs)
255253
{
256254
struct ib_uobject *uobj;
257255

@@ -260,7 +258,7 @@ int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
260258
return PTR_ERR(uobj);
261259

262260
rdma_lookup_put_uobject(uobj, UVERBS_LOOKUP_WRITE);
263-
return success_res;
261+
return 0;
264262
}
265263

266264
/* alloc_uobj must be undone by uverbs_destroy_uobject() */

‎drivers/infiniband/core/rdma_core.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ struct uverbs_api_ioctl_method {
137137
};
138138

139139
struct uverbs_api_write_method {
140-
ssize_t (*handler)(struct uverbs_attr_bundle *attrs,
141-
const char __user *buf, int in_len, int out_len);
140+
int (*handler)(struct uverbs_attr_bundle *attrs, const char __user *buf,
141+
int in_len, int out_len);
142142
int (*handler_ex)(struct uverbs_attr_bundle *attrs,
143143
struct ib_udata *ucore, struct ib_udata *uhw);
144144
u8 disabled:1;

0 commit comments

Comments
 (0)