diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 90ec010bffbd..677618e6f1f7 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -19,6 +19,8 @@ * and drives the real SMI state machine. */ +#define pr_fmt(fmt) "ipmi_si: " fmt + #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/sched.h> @@ -41,8 +43,6 @@ #include <linux/string.h> #include <linux/ctype.h> -#define PFX "ipmi_si: " - /* Measure times between events in the driver. */ #undef DEBUG_TIMING @@ -269,7 +269,7 @@ void debug_timestamp(char *msg) { struct timespec64 t; - getnstimeofday64(&t); + ktime_get_ts64(&t); pr_debug("**%s: %lld.%9.9ld\n", msg, (long long) t.tv_sec, t.tv_nsec); } #else @@ -961,12 +961,12 @@ static inline int ipmi_thread_busy_wait(enum si_sm_result smi_result, if (max_busy_us == 0 || smi_result != SI_SM_CALL_WITH_DELAY) ipmi_si_set_not_busy(busy_until); else if (!ipmi_si_is_busy(busy_until)) { - getnstimeofday64(busy_until); + ktime_get_ts64(busy_until); timespec64_add_ns(busy_until, max_busy_us*NSEC_PER_USEC); } else { struct timespec64 now; - getnstimeofday64(&now); + ktime_get_ts64(&now); if (unlikely(timespec64_compare(&now, busy_until) > 0)) { ipmi_si_set_not_busy(busy_until); return 0; @@ -1530,7 +1530,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) rv = wait_for_msg_done(smi_info); if (rv) { - pr_warn(PFX "Error getting response from get global enables command, the event buffer is not enabled.\n"); + pr_warn("Error getting response from get global enables command, the event buffer is not enabled\n"); goto out; } @@ -1541,7 +1541,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || resp[1] != IPMI_GET_BMC_GLOBAL_ENABLES_CMD || resp[2] != 0) { - pr_warn(PFX "Invalid return from get global enables command, cannot enable the event buffer.\n"); + pr_warn("Invalid return from get global enables command, cannot enable the event buffer\n"); rv = -EINVAL; goto out; } @@ -1559,7 +1559,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) rv = wait_for_msg_done(smi_info); if (rv) { - pr_warn(PFX "Error getting response from set global, enables command, the event buffer is not enabled.\n"); + pr_warn("Error getting response from set global, enables command, the event buffer is not enabled\n"); goto out; } @@ -1569,7 +1569,7 @@ static int try_enable_event_buffer(struct smi_info *smi_info) if (resp_len < 3 || resp[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 || resp[1] != IPMI_SET_BMC_GLOBAL_ENABLES_CMD) { - pr_warn(PFX "Invalid return from get global, enables command, not enable the event buffer.\n"); + pr_warn("Invalid return from get global, enables command, not enable the event buffer\n"); rv = -EINVAL; goto out; } @@ -1900,7 +1900,7 @@ int ipmi_si_add_smi(struct si_sm_io *io) } } - pr_info(PFX "Adding %s-specified %s state machine\n", + pr_info("Adding %s-specified %s state machine\n", ipmi_addr_src_to_str(new_smi->io.addr_source), si_to_str[new_smi->io.si_type]); @@ -1924,7 +1924,7 @@ static int try_smi_init(struct smi_info *new_smi) int i; char *init_name = NULL; - pr_info(PFX "Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n", + pr_info("Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n", ipmi_addr_src_to_str(new_smi->io.addr_source), si_to_str[new_smi->io.si_type], addr_space_to_str[new_smi->io.addr_type], @@ -1964,7 +1964,7 @@ static int try_smi_init(struct smi_info *new_smi) new_smi->pdev = platform_device_alloc("ipmi_si", new_smi->si_num); if (!new_smi->pdev) { - pr_err(PFX "Unable to allocate platform device\n"); + pr_err("Unable to allocate platform device\n"); rv = -ENOMEM; goto out_err; } @@ -2083,18 +2083,9 @@ static int try_smi_init(struct smi_info *new_smi) si_to_str[new_smi->io.si_type]); WARN_ON(new_smi->io.dev->init_name != NULL); - kfree(init_name); - - return 0; - -out_err: - if (new_smi->intf) { - ipmi_unregister_smi(new_smi->intf); - new_smi->intf = NULL; - } + out_err: kfree(init_name); - return rv; } @@ -2106,7 +2097,7 @@ static int init_ipmi_si(void) if (initialized) return 0; - pr_info("IPMI System Interface driver.\n"); + pr_info("IPMI System Interface driver\n"); /* If the user gave us a device, they presumably want us to use it */ if (!ipmi_si_hardcode_find_bmc()) @@ -2160,7 +2151,7 @@ skip_fallback_noirq: if (unload_when_empty && list_empty(&smi_infos)) { mutex_unlock(&smi_infos_lock); cleanup_ipmi_si(); - pr_warn(PFX "Unable to find any System Interface(s)\n"); + pr_warn("Unable to find any System Interface(s)\n"); return -ENODEV; } else { mutex_unlock(&smi_infos_lock); @@ -2227,6 +2218,8 @@ static void shutdown_smi(void *send_info) kfree(smi_info->si_sm); smi_info->si_sm = NULL; + + smi_info->intf = NULL; } /* @@ -2240,10 +2233,8 @@ static void cleanup_one_si(struct smi_info *smi_info) list_del(&smi_info->link); - if (smi_info->intf) { + if (smi_info->intf) ipmi_unregister_smi(smi_info->intf); - smi_info->intf = NULL; - } if (smi_info->pdev) { if (smi_info->pdev_registered) |