Skip to content

Commit

Permalink
[PATCH] IB/sa_query: avoid unnecessary list scan
Browse files Browse the repository at this point in the history
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 <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Michael S. Tsirkin authored and Roland Dreier committed Sep 7, 2005
1 parent 06c56e4 commit 1d6801f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1d6801f

Please sign in to comment.