Lines Matching refs:user
210 static struct ipmi_user *acquire_ipmi_user(struct ipmi_user *user, int *index) in acquire_ipmi_user() argument
211 __acquires(user->release_barrier) in acquire_ipmi_user()
215 *index = srcu_read_lock(&user->release_barrier); in acquire_ipmi_user()
216 ruser = srcu_dereference(user->self, &user->release_barrier); in acquire_ipmi_user()
218 srcu_read_unlock(&user->release_barrier, *index); in acquire_ipmi_user()
222 static void release_ipmi_user(struct ipmi_user *user, int index) in release_ipmi_user() argument
224 srcu_read_unlock(&user->release_barrier, index); in release_ipmi_user()
230 struct ipmi_user *user; member
932 if (!msg->user) { in deliver_response()
948 atomic_dec(&msg->user->nr_msgs); in deliver_response()
951 struct ipmi_user *user = acquire_ipmi_user(msg->user, &index); in deliver_response() local
953 if (user) { in deliver_response()
954 atomic_dec(&user->nr_msgs); in deliver_response()
955 user->handler->ipmi_recv_hndl(msg, user->handler_data); in deliver_response()
956 release_ipmi_user(user, index); in deliver_response()
1203 struct ipmi_user *user = container_of(work, struct ipmi_user, in free_user_work() local
1206 cleanup_srcu_struct(&user->release_barrier); in free_user_work()
1207 vfree(user); in free_user_work()
1213 struct ipmi_user **user) in ipmi_create_user() argument
1287 *user = new_user; in ipmi_create_user()
1326 struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); in free_user() local
1329 queue_work(remove_work_wq, &user->remove_work); in free_user()
1332 static void _ipmi_destroy_user(struct ipmi_user *user) in _ipmi_destroy_user() argument
1334 struct ipmi_smi *intf = user->intf; in _ipmi_destroy_user()
1340 if (!acquire_ipmi_user(user, &i)) { in _ipmi_destroy_user()
1345 synchronize_srcu(&user->release_barrier); in _ipmi_destroy_user()
1349 rcu_assign_pointer(user->self, NULL); in _ipmi_destroy_user()
1350 release_ipmi_user(user, i); in _ipmi_destroy_user()
1352 synchronize_srcu(&user->release_barrier); in _ipmi_destroy_user()
1354 if (user->handler->shutdown) in _ipmi_destroy_user()
1355 user->handler->shutdown(user->handler_data); in _ipmi_destroy_user()
1357 if (user->handler->ipmi_watchdog_pretimeout) in _ipmi_destroy_user()
1360 if (user->gets_events) in _ipmi_destroy_user()
1365 list_del_rcu(&user->link); in _ipmi_destroy_user()
1370 && (intf->seq_table[i].recv_msg->user == user)) { in _ipmi_destroy_user()
1387 if (rcvr->user == user) { in _ipmi_destroy_user()
1405 int ipmi_destroy_user(struct ipmi_user *user) in ipmi_destroy_user() argument
1407 _ipmi_destroy_user(user); in ipmi_destroy_user()
1409 kref_put(&user->refcount, free_user); in ipmi_destroy_user()
1415 int ipmi_get_version(struct ipmi_user *user, in ipmi_get_version() argument
1422 user = acquire_ipmi_user(user, &index); in ipmi_get_version()
1423 if (!user) in ipmi_get_version()
1426 rv = bmc_get_device_id(user->intf, NULL, &id, NULL, NULL); in ipmi_get_version()
1431 release_ipmi_user(user, index); in ipmi_get_version()
1437 int ipmi_set_my_address(struct ipmi_user *user, in ipmi_set_my_address() argument
1443 user = acquire_ipmi_user(user, &index); in ipmi_set_my_address()
1444 if (!user) in ipmi_set_my_address()
1451 user->intf->addrinfo[channel].address = address; in ipmi_set_my_address()
1453 release_ipmi_user(user, index); in ipmi_set_my_address()
1459 int ipmi_get_my_address(struct ipmi_user *user, in ipmi_get_my_address() argument
1465 user = acquire_ipmi_user(user, &index); in ipmi_get_my_address()
1466 if (!user) in ipmi_get_my_address()
1473 *address = user->intf->addrinfo[channel].address; in ipmi_get_my_address()
1475 release_ipmi_user(user, index); in ipmi_get_my_address()
1481 int ipmi_set_my_LUN(struct ipmi_user *user, in ipmi_set_my_LUN() argument
1487 user = acquire_ipmi_user(user, &index); in ipmi_set_my_LUN()
1488 if (!user) in ipmi_set_my_LUN()
1495 user->intf->addrinfo[channel].lun = LUN & 0x3; in ipmi_set_my_LUN()
1497 release_ipmi_user(user, index); in ipmi_set_my_LUN()
1503 int ipmi_get_my_LUN(struct ipmi_user *user, in ipmi_get_my_LUN() argument
1509 user = acquire_ipmi_user(user, &index); in ipmi_get_my_LUN()
1510 if (!user) in ipmi_get_my_LUN()
1517 *address = user->intf->addrinfo[channel].lun; in ipmi_get_my_LUN()
1519 release_ipmi_user(user, index); in ipmi_get_my_LUN()
1525 int ipmi_get_maintenance_mode(struct ipmi_user *user) in ipmi_get_maintenance_mode() argument
1530 user = acquire_ipmi_user(user, &index); in ipmi_get_maintenance_mode()
1531 if (!user) in ipmi_get_maintenance_mode()
1534 spin_lock_irqsave(&user->intf->maintenance_mode_lock, flags); in ipmi_get_maintenance_mode()
1535 mode = user->intf->maintenance_mode; in ipmi_get_maintenance_mode()
1536 spin_unlock_irqrestore(&user->intf->maintenance_mode_lock, flags); in ipmi_get_maintenance_mode()
1537 release_ipmi_user(user, index); in ipmi_get_maintenance_mode()
1550 int ipmi_set_maintenance_mode(struct ipmi_user *user, int mode) in ipmi_set_maintenance_mode() argument
1554 struct ipmi_smi *intf = user->intf; in ipmi_set_maintenance_mode()
1556 user = acquire_ipmi_user(user, &index); in ipmi_set_maintenance_mode()
1557 if (!user) in ipmi_set_maintenance_mode()
1586 release_ipmi_user(user, index); in ipmi_set_maintenance_mode()
1592 int ipmi_set_gets_events(struct ipmi_user *user, bool val) in ipmi_set_gets_events() argument
1595 struct ipmi_smi *intf = user->intf; in ipmi_set_gets_events()
1600 user = acquire_ipmi_user(user, &index); in ipmi_set_gets_events()
1601 if (!user) in ipmi_set_gets_events()
1607 if (user->gets_events == val) in ipmi_set_gets_events()
1610 user->gets_events = val; in ipmi_set_gets_events()
1627 while (user->gets_events && !list_empty(&intf->waiting_events)) { in ipmi_set_gets_events()
1640 msg->user = user; in ipmi_set_gets_events()
1641 kref_get(&user->refcount); in ipmi_set_gets_events()
1651 release_ipmi_user(user, index); in ipmi_set_gets_events()
1689 int ipmi_register_for_cmd(struct ipmi_user *user, in ipmi_register_for_cmd() argument
1694 struct ipmi_smi *intf = user->intf; in ipmi_register_for_cmd()
1698 user = acquire_ipmi_user(user, &index); in ipmi_register_for_cmd()
1699 if (!user) in ipmi_register_for_cmd()
1710 rcvr->user = user; in ipmi_register_for_cmd()
1728 release_ipmi_user(user, index); in ipmi_register_for_cmd()
1734 int ipmi_unregister_for_cmd(struct ipmi_user *user, in ipmi_unregister_for_cmd() argument
1739 struct ipmi_smi *intf = user->intf; in ipmi_unregister_for_cmd()
1744 user = acquire_ipmi_user(user, &index); in ipmi_unregister_for_cmd()
1745 if (!user) in ipmi_unregister_for_cmd()
1755 if (rcvr->user == user) { in ipmi_unregister_for_cmd()
1767 release_ipmi_user(user, index); in ipmi_unregister_for_cmd()
2297 static int i_ipmi_request(struct ipmi_user *user, in i_ipmi_request() argument
2315 if (user) { in i_ipmi_request()
2316 if (atomic_add_return(1, &user->nr_msgs) > max_msgs_per_user) { in i_ipmi_request()
2352 recv_msg->user = user; in i_ipmi_request()
2353 if (user) in i_ipmi_request()
2355 kref_get(&user->refcount); in i_ipmi_request()
2395 if (rv && user) in i_ipmi_request()
2396 atomic_dec(&user->nr_msgs); in i_ipmi_request()
2413 int ipmi_request_settime(struct ipmi_user *user, in ipmi_request_settime() argument
2425 if (!user) in ipmi_request_settime()
2428 user = acquire_ipmi_user(user, &index); in ipmi_request_settime()
2429 if (!user) in ipmi_request_settime()
2432 rv = check_addr(user->intf, addr, &saddr, &lun); in ipmi_request_settime()
2434 rv = i_ipmi_request(user, in ipmi_request_settime()
2435 user->intf, in ipmi_request_settime()
2447 release_ipmi_user(user, index); in ipmi_request_settime()
2452 int ipmi_request_supply_msgs(struct ipmi_user *user, in ipmi_request_supply_msgs() argument
2464 if (!user) in ipmi_request_supply_msgs()
2467 user = acquire_ipmi_user(user, &index); in ipmi_request_supply_msgs()
2468 if (!user) in ipmi_request_supply_msgs()
2471 rv = check_addr(user->intf, addr, &saddr, &lun); in ipmi_request_supply_msgs()
2473 rv = i_ipmi_request(user, in ipmi_request_supply_msgs()
2474 user->intf, in ipmi_request_supply_msgs()
2486 release_ipmi_user(user, index); in ipmi_request_supply_msgs()
3507 void ipmi_poll_interface(struct ipmi_user *user) in ipmi_poll_interface() argument
3509 ipmi_poll(user->intf); in ipmi_poll_interface()
3530 struct ipmi_user *user; in nr_msgs_show() local
3535 list_for_each_entry_rcu(user, &intf->users, link) in nr_msgs_show()
3536 count += atomic_read(&user->nr_msgs); in nr_msgs_show()
3792 struct ipmi_user *user = in ipmi_unregister_smi() local
3796 _ipmi_destroy_user(user); in ipmi_unregister_smi()
3883 struct ipmi_user *user = NULL; in handle_ipmb_get_msg_cmd() local
3905 user = rcvr->user; in handle_ipmb_get_msg_cmd()
3906 kref_get(&user->refcount); in handle_ipmb_get_msg_cmd()
3908 user = NULL; in handle_ipmb_get_msg_cmd()
3911 if (user == NULL) { in handle_ipmb_get_msg_cmd()
3952 kref_put(&user->refcount, free_user); in handle_ipmb_get_msg_cmd()
3965 recv_msg->user = user; in handle_ipmb_get_msg_cmd()
3994 struct ipmi_user *user = NULL; in handle_ipmb_direct_rcv_cmd() local
4004 user = rcvr->user; in handle_ipmb_direct_rcv_cmd()
4005 kref_get(&user->refcount); in handle_ipmb_direct_rcv_cmd()
4007 user = NULL; in handle_ipmb_direct_rcv_cmd()
4010 if (user == NULL) { in handle_ipmb_direct_rcv_cmd()
4043 kref_put(&user->refcount, free_user); in handle_ipmb_direct_rcv_cmd()
4057 recv_msg->user = user; in handle_ipmb_direct_rcv_cmd()
4183 struct ipmi_user *user = NULL; in handle_lan_get_msg_cmd() local
4205 user = rcvr->user; in handle_lan_get_msg_cmd()
4206 kref_get(&user->refcount); in handle_lan_get_msg_cmd()
4208 user = NULL; in handle_lan_get_msg_cmd()
4211 if (user == NULL) { in handle_lan_get_msg_cmd()
4228 kref_put(&user->refcount, free_user); in handle_lan_get_msg_cmd()
4244 recv_msg->user = user; in handle_lan_get_msg_cmd()
4282 struct ipmi_user *user = NULL; in handle_oem_get_msg_cmd() local
4312 user = rcvr->user; in handle_oem_get_msg_cmd()
4313 kref_get(&user->refcount); in handle_oem_get_msg_cmd()
4315 user = NULL; in handle_oem_get_msg_cmd()
4318 if (user == NULL) { in handle_oem_get_msg_cmd()
4337 kref_put(&user->refcount, free_user); in handle_oem_get_msg_cmd()
4351 recv_msg->user = user; in handle_oem_get_msg_cmd()
4398 struct ipmi_user *user; in handle_read_event_rsp() local
4424 list_for_each_entry_rcu(user, &intf->users, link) { in handle_read_event_rsp()
4425 if (!user->gets_events) in handle_read_event_rsp()
4448 recv_msg->user = user; in handle_read_event_rsp()
4449 kref_get(&user->refcount); in handle_read_event_rsp()
4802 struct ipmi_user *user; in handle_new_recv_msgs() local
4806 list_for_each_entry_rcu(user, &intf->users, link) { in handle_new_recv_msgs()
4807 if (user->handler->ipmi_watchdog_pretimeout) in handle_new_recv_msgs()
4808 user->handler->ipmi_watchdog_pretimeout( in handle_new_recv_msgs()
4809 user->handler_data); in handle_new_recv_msgs()
5164 rv->user = NULL; in ipmi_alloc_recv_msg()
5173 if (msg->user && !oops_in_progress) in ipmi_free_recv_msg()
5174 kref_put(&msg->user->refcount, free_user); in ipmi_free_recv_msg()
5407 struct ipmi_user *user; in panic_event() local
5444 list_for_each_entry_rcu(user, &intf->users, link) { in panic_event()
5445 if (user->handler->ipmi_panic_handler) in panic_event()
5446 user->handler->ipmi_panic_handler( in panic_event()
5447 user->handler_data); in panic_event()