Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipmi: Add a maintenance mode sysfs file

So you can see if it's in maintenance mode and see how long is left.

Signed-off-by: Corey Minyard <corey@minyard.net>
Tested-by: Frederick Lawler <fred@cloudflare.com>

+23
+23
drivers/char/ipmi/ipmi_msghandler.c
··· 434 434 atomic_t nr_users; 435 435 struct device_attribute nr_users_devattr; 436 436 struct device_attribute nr_msgs_devattr; 437 + struct device_attribute maintenance_mode_devattr; 437 438 438 439 439 440 /* Used for wake ups at startup. */ ··· 3522 3521 } 3523 3522 static DEVICE_ATTR_RO(nr_msgs); 3524 3523 3524 + static ssize_t maintenance_mode_show(struct device *dev, 3525 + struct device_attribute *attr, 3526 + char *buf) 3527 + { 3528 + struct ipmi_smi *intf = container_of(attr, 3529 + struct ipmi_smi, 3530 + maintenance_mode_devattr); 3531 + 3532 + return sysfs_emit(buf, "%u %d\n", intf->maintenance_mode_state, 3533 + intf->auto_maintenance_timeout); 3534 + } 3535 + static DEVICE_ATTR_RO(maintenance_mode); 3536 + 3525 3537 static void redo_bmc_reg(struct work_struct *work) 3526 3538 { 3527 3539 struct ipmi_smi *intf = container_of(work, struct ipmi_smi, ··· 3671 3657 goto out_err_bmc_reg; 3672 3658 } 3673 3659 3660 + intf->maintenance_mode_devattr = dev_attr_maintenance_mode; 3661 + sysfs_attr_init(&intf->maintenance_mode_devattr.attr); 3662 + rv = device_create_file(intf->si_dev, &intf->maintenance_mode_devattr); 3663 + if (rv) { 3664 + device_remove_file(intf->si_dev, &intf->nr_users_devattr); 3665 + goto out_err_bmc_reg; 3666 + } 3667 + 3674 3668 intf->intf_num = i; 3675 3669 mutex_unlock(&ipmi_interfaces_mutex); 3676 3670 ··· 3786 3764 if (intf->handlers->shutdown) 3787 3765 intf->handlers->shutdown(intf->send_info); 3788 3766 3767 + device_remove_file(intf->si_dev, &intf->maintenance_mode_devattr); 3789 3768 device_remove_file(intf->si_dev, &intf->nr_msgs_devattr); 3790 3769 device_remove_file(intf->si_dev, &intf->nr_users_devattr); 3791 3770