diff mbox series

[for-next] RDMA/core/sa_query: Remove unused function

Message ID 1628684831-26981-1-git-send-email-haakon.bugge@oracle.com (mailing list archive)
State Superseded
Headers show
Series [for-next] RDMA/core/sa_query: Remove unused function | expand

Commit Message

Haakon Bugge Aug. 11, 2021, 12:27 p.m. UTC
ib_sa_service_rec_query() was introduced in kernel v2.6.13 by commit
cbae32c56314 ("[PATCH] IB: Add Service Record support to SA client")
in 2005. It was not used then and have never been used since.

Removing it.

Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
---
 drivers/infiniband/core/sa_query.c | 101 -------------------------------------
 include/rdma/ib_sa.h               |  10 ----
 2 files changed, 111 deletions(-)

Comments

Leon Romanovsky Aug. 11, 2021, 12:33 p.m. UTC | #1
On Wed, Aug 11, 2021 at 02:27:11PM +0200, Håkon Bugge wrote:
> ib_sa_service_rec_query() was introduced in kernel v2.6.13 by commit
> cbae32c56314 ("[PATCH] IB: Add Service Record support to SA client")
> in 2005. It was not used then and have never been used since.
> 
> Removing it.
> 
> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
> ---
>  drivers/infiniband/core/sa_query.c | 101 -------------------------------------
>  include/rdma/ib_sa.h               |  10 ----
>  2 files changed, 111 deletions(-)

You shouldn't stop there and remove ib_sa_service_rec_callback,
ib_sa_service_rec_release, ib_sa_service_query and probably
ib_sa_service_rec.

Thanks
Haakon Bugge Aug. 11, 2021, 12:40 p.m. UTC | #2
> On 11 Aug 2021, at 14:33, Leon Romanovsky <leon@kernel.org> wrote:
> 
> On Wed, Aug 11, 2021 at 02:27:11PM +0200, Håkon Bugge wrote:
>> ib_sa_service_rec_query() was introduced in kernel v2.6.13 by commit
>> cbae32c56314 ("[PATCH] IB: Add Service Record support to SA client")
>> in 2005. It was not used then and have never been used since.
>> 
>> Removing it.
>> 
>> Signed-off-by: Håkon Bugge <haakon.bugge@oracle.com>
>> ---
>> drivers/infiniband/core/sa_query.c | 101 -------------------------------------
>> include/rdma/ib_sa.h               |  10 ----
>> 2 files changed, 111 deletions(-)
> 
> You shouldn't stop there and remove ib_sa_service_rec_callback,
> ib_sa_service_rec_release, ib_sa_service_query and probably
> ib_sa_service_rec.

I checked all functions called from ib_sa_service_rec_query() were used elsewhere, and they were indeed. But overlooked the function assignments :-) Thanks for pointing it out. A v2 will follow.


Thxs, Håkon
diff mbox series

Patch

diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index b61576f..7c31b91 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1656,107 +1656,6 @@  static void ib_sa_service_rec_release(struct ib_sa_query *sa_query)
 	kfree(container_of(sa_query, struct ib_sa_service_query, sa_query));
 }
 
-/**
- * ib_sa_service_rec_query - Start Service Record operation
- * @client:SA client
- * @device:device to send request on
- * @port_num: port number to send request on
- * @method:SA method - should be get, set, or delete
- * @rec:Service Record to send in request
- * @comp_mask:component mask to send in request
- * @timeout_ms:time to wait for response
- * @gfp_mask:GFP mask to use for internal allocations
- * @callback:function called when request completes, times out or is
- * canceled
- * @context:opaque user context passed to callback
- * @sa_query:request context, used to cancel request
- *
- * Send a Service Record set/get/delete to the SA to register,
- * unregister or query a service record.
- * The callback function will be called when the request completes (or
- * fails); status is 0 for a successful response, -EINTR if the query
- * is canceled, -ETIMEDOUT is the query timed out, or -EIO if an error
- * occurred sending the query.  The resp parameter of the callback is
- * only valid if status is 0.
- *
- * If the return value of ib_sa_service_rec_query() is negative, it is an
- * error code.  Otherwise it is a request ID that can be used to cancel
- * the query.
- */
-int ib_sa_service_rec_query(struct ib_sa_client *client,
-			    struct ib_device *device, u32 port_num, u8 method,
-			    struct ib_sa_service_rec *rec,
-			    ib_sa_comp_mask comp_mask,
-			    unsigned long timeout_ms, gfp_t gfp_mask,
-			    void (*callback)(int status,
-					     struct ib_sa_service_rec *resp,
-					     void *context),
-			    void *context,
-			    struct ib_sa_query **sa_query)
-{
-	struct ib_sa_service_query *query;
-	struct ib_sa_device *sa_dev = ib_get_client_data(device, &sa_client);
-	struct ib_sa_port   *port;
-	struct ib_mad_agent *agent;
-	struct ib_sa_mad *mad;
-	int ret;
-
-	if (!sa_dev)
-		return -ENODEV;
-
-	port  = &sa_dev->port[port_num - sa_dev->start_port];
-	agent = port->agent;
-
-	if (method != IB_MGMT_METHOD_GET &&
-	    method != IB_MGMT_METHOD_SET &&
-	    method != IB_SA_METHOD_DELETE)
-		return -EINVAL;
-
-	query = kzalloc(sizeof(*query), gfp_mask);
-	if (!query)
-		return -ENOMEM;
-
-	query->sa_query.port     = port;
-	ret = alloc_mad(&query->sa_query, gfp_mask);
-	if (ret)
-		goto err1;
-
-	ib_sa_client_get(client);
-	query->sa_query.client = client;
-	query->callback        = callback;
-	query->context         = context;
-
-	mad = query->sa_query.mad_buf->mad;
-	init_mad(&query->sa_query, agent);
-
-	query->sa_query.callback = callback ? ib_sa_service_rec_callback : NULL;
-	query->sa_query.release  = ib_sa_service_rec_release;
-	mad->mad_hdr.method	 = method;
-	mad->mad_hdr.attr_id	 = cpu_to_be16(IB_SA_ATTR_SERVICE_REC);
-	mad->sa_hdr.comp_mask	 = comp_mask;
-
-	ib_pack(service_rec_table, ARRAY_SIZE(service_rec_table),
-		rec, mad->data);
-
-	*sa_query = &query->sa_query;
-
-	ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
-	if (ret < 0)
-		goto err2;
-
-	return ret;
-
-err2:
-	*sa_query = NULL;
-	ib_sa_client_put(query->sa_query.client);
-	free_mad(&query->sa_query);
-
-err1:
-	kfree(query);
-	return ret;
-}
-EXPORT_SYMBOL(ib_sa_service_rec_query);
-
 static void ib_sa_mcmember_rec_callback(struct ib_sa_query *sa_query,
 					int status,
 					struct ib_sa_mad *mad)
diff --git a/include/rdma/ib_sa.h b/include/rdma/ib_sa.h
index ba3c808..b09f1f1 100644
--- a/include/rdma/ib_sa.h
+++ b/include/rdma/ib_sa.h
@@ -430,16 +430,6 @@  int ib_sa_path_rec_get(struct ib_sa_client *client, struct ib_device *device,
 					void *context),
 		       void *context, struct ib_sa_query **query);
 
-int ib_sa_service_rec_query(struct ib_sa_client *client,
-			    struct ib_device *device, u32 port_num, u8 method,
-			    struct ib_sa_service_rec *rec,
-			    ib_sa_comp_mask comp_mask, unsigned long timeout_ms,
-			    gfp_t gfp_mask,
-			    void (*callback)(int status,
-					     struct ib_sa_service_rec *resp,
-					     void *context),
-			    void *context, struct ib_sa_query **sa_query);
-
 struct ib_sa_multicast {
 	struct ib_sa_mcmember_rec rec;
 	ib_sa_comp_mask		comp_mask;