From: Michael S. Tsirkin Date: Thu, 1 Sep 2005 16:19:44 +0000 (-0700) Subject: [PATCH] IB/sa_query: avoid unnecessary list scan X-Git-Tag: v2.6.14-rc1~115^2~11 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=1d6801f9dd3ebb054ae685153a01b1a4ec817f46;p=linux-2.6-omap-h63xx.git [PATCH] IB/sa_query: avoid unnecessary list scan Using ib_get_client_data in SA event handler performs a list scan. It's better to use container_of to get the sa device directly. Signed-off-by: Michael S. Tsirkin Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 126ac80db7b..9191793c900 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -431,8 +431,8 @@ static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *event event->event == IB_EVENT_LID_CHANGE || event->event == IB_EVENT_PKEY_CHANGE || event->event == IB_EVENT_SM_CHANGE) { - struct ib_sa_device *sa_dev = - ib_get_client_data(event->device, &sa_client); + struct ib_sa_device *sa_dev; + sa_dev = container_of(handler, typeof(*sa_dev), event_handler); schedule_work(&sa_dev->port[event->element.port_num - sa_dev->start_port].update_task);