aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/ipmi
AgeCommit message (Collapse)AuthorFilesLines
2021-10-14ipmi: ipmb: fix dependencies to eliminate build errorRandy Dunlap1-1/+1
When CONFIG_I2C=m, CONFIG_I2C_SLAVE=y (bool), and CONFIG_IPMI_IPMB=y, the build fails with: ld: drivers/char/ipmi/ipmi_ipmb.o: in function `ipmi_ipmb_remove': ipmi_ipmb.c:(.text+0x6b): undefined reference to `i2c_slave_unregister' ld: drivers/char/ipmi/ipmi_ipmb.o: in function `ipmi_ipmb_thread': ipmi_ipmb.c:(.text+0x2a4): undefined reference to `i2c_transfer' ld: drivers/char/ipmi/ipmi_ipmb.o: in function `ipmi_ipmb_probe': ipmi_ipmb.c:(.text+0x646): undefined reference to `i2c_slave_register' ld: drivers/char/ipmi/ipmi_ipmb.o: in function `ipmi_ipmb_driver_init': ipmi_ipmb.c:(.init.text+0xa): undefined reference to `i2c_register_driver' ld: drivers/char/ipmi/ipmi_ipmb.o: in function `ipmi_ipmb_driver_exit': ipmi_ipmb.c:(.exit.text+0x8): undefined reference to `i2c_del_driver' This is due to having a tristate depending on a bool symbol. By adding I2C (tristate) as a dependency, the desired dependencies are met, causing IPMI_IPMB to be changed from =y to =m: -CONFIG_IPMI_IPMB=y +CONFIG_IPMI_IPMB=m Fixes: 63c4eb347164 ("ipmi:ipmb: Add initial support for IPMI over IPMB") Signed-off-by: Randy Dunlap <[email protected]> Cc: Corey Minyard <[email protected]> Cc: [email protected] Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-10-14ipmi:ipmb: Add OF supportCorey Minyard1-5/+34
Add direct OF support for fetching control parameters from the device tree. Make it work like the device tree entries for the other IPMI devices. Also add documentation for this. Signed-off-by: Corey Minyard <[email protected]>
2021-10-07ipmi: bt: Add ast2600 compatible stringJoel Stanley1-0/+1
The AST2600 has the same register set as the previous generation SoCs. Signed-off-by: Joel Stanley <[email protected]> Acked-by: Rob Herring <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-10-06ipmi: bt-bmc: Use registers directlyJoel Stanley1-52/+16
This driver was originally written to use the regmap abstraction with no clear benefit. As the registers are always mmio and there is no sharing of the region with other devices, we can safely read and write without the locking that regmap provides. This reduces the code size of the driver by about 25%. Signed-off-by: Joel Stanley <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi: ipmb: Fix off-by-one size check on rcvlenColin Ian King1-1/+1
There is an off-by-one bounds check on the rcvlen causing a potential out of bounds write on iidev->rcvmsg. Fix this by using the >= operator on the bounds check rather than the > operator. Addresses-Coverity: ("Out-of-bounds write") Fixes: 0ba0c3c5d1c1 ("ipmi:ipmb: Add initial support for IPMI over IPMB") Signed-off-by: Colin Ian King <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi:ssif: Use depends on, not select, for I2CCorey Minyard1-1/+1
It's more appropriate here. Suggested-by: Randy Dunlap <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi:ipmb: Add initial support for IPMI over IPMBCorey Minyard3-0/+520
This provides access to the management controllers on an IPMB bus to a device sitting on the IPMB bus. It also provides slave capability to respond to received messages on the bus. Signed-off-by: Corey Minyard <[email protected]> Tested-by: Andrew Manley <[email protected]> Reviewed-by: Andrew Manley <[email protected]>
2021-10-05ipmi: Add support for IPMB direct messagesCorey Minyard1-33/+255
An application has come up that has a device sitting right on the IPMB that would like to communicate with the BMC on the IPMB using normal IPMI commands. Sending these commands and handling the responses is easy enough, no modifications are needed to the IPMI infrastructure. But if this is an application that also needs to receive IPMB commands and respond, some way is needed to handle these incoming commands and send the responses. Currently, the IPMI message handler only sends commands to the interface and only receives responses from interface. This change extends the interface to receive commands/responses and send commands/responses. These are formatted differently in support of receiving/sending IPMB messages directly. Signed-off-by: Corey Minyard <[email protected]> Tested-by: Andrew Manley <[email protected]> Reviewed-by: Andrew Manley <[email protected]>
2021-10-05ipmi: Export ipmb_checksum()Corey Minyard1-1/+2
It will be needed by the upcoming ipmb direct addressing. Signed-off-by: Corey Minyard <[email protected]> Tested-by: Andrew Manley <[email protected]> Reviewed-by: Andrew Manley <[email protected]>
2021-10-05ipmi: Check error code before processing BMC responseCorey Minyard1-1/+8
In case an error did occur, print out useful information. Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi:devintf: Return a proper error when recv buffer too smallCorey Minyard1-3/+5
The right error message wasn't being set in one location, and it would return success on a failure. Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi: Disable some operations during a panicCorey Minyard2-8/+19
Don't do kfree or other risky things when oops_in_progress is set. It's easy enough to avoid doing them Signed-off-by: Corey Minyard <[email protected]>
2021-10-05ipmi:watchdog: Set panic count to proper value on a panicCorey Minyard1-4/+4
You will get two decrements when the messages on a panic are sent, not one, since commit 2033f6858970 ("ipmi: Free receive messages when in an oops") was added, but the watchdog code had a bug where it didn't set the value properly. Reported-by: Anton Lundin <[email protected]> Cc: <[email protected]> # v5.4+ Fixes: 2033f6858970 ("ipmi: Free receive messages when in an oops") Signed-off-by: Corey Minyard <[email protected]>
2021-09-12Merge tag 'for-linus-5.15-1' of git://github.com/cminyard/linux-ipmiLinus Torvalds1-12/+11
Pull IPMI updates from Corey Minyard: "A couple of very minor fixes for style and rate limiting. Nothing big, but probably needs to go in" * tag 'for-linus-5.15-1' of git://github.com/cminyard/linux-ipmi: char: ipmi: use DEVICE_ATTR helper macro ipmi: rate limit ipmi smi_event failure message
2021-08-30parisc: Make struct parisc_driver::remove() return voidUwe Kleine-König4-9/+7
The caller of this function (parisc_driver_remove() in arch/parisc/kernel/drivers.c) ignores the return value, so better don't return any value at all to not wake wrong expectations in driver authors. The only function that could return a non-zero value before was ipmi_parisc_remove() which returns the return value of ipmi_si_remove_by_dev(). Make this function return void, too, as for all other callers the value is ignored, too. Also fold in a small checkpatch fix for: WARNING: Unnecessary space before function pointer arguments + void (*remove) (struct parisc_device *dev); Acked-by: Dmitry Torokhov <[email protected]> (for drivers/input) Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Sudip Mukherjee <[email protected]> Acked-by: Jiri Slaby <[email protected]> Signed-off-by: Helge Deller <[email protected]>
2021-08-12char: ipmi: use DEVICE_ATTR helper macroDwaipayan Ray1-5/+4
Instead of open coding DEVICE_ATTR, use the helper macro DEVICE_ATTR_RO to replace DEVICE_ATTR with 0444 octal permissions. This was detected as a part of checkpatch evaluation investigating all reports of DEVICE_ATTR_RO warning type. Signed-off-by: Dwaipayan Ray <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-08-12ipmi: rate limit ipmi smi_event failure messageWen Yang1-7/+7
Sometimes we can't get a valid si_sm_data, and we print an error message accordingly. But the ipmi module seem to like retrying a lot, in which case we flood the kernel log with a lot of messages, eg: [46318019.164726] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318020.109700] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318021.158677] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318022.212598] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318023.258564] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318024.210455] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318025.260473] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318026.308445] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318027.356389] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318028.298288] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. [46318029.363302] ipmi_si IPI0001:00: Could not set the global enables: 0xc1. Signed-off-by: Wen Yang <[email protected]> Cc: Baoyou Xie <[email protected]> Cc: Corey Minyard <[email protected]> Cc: [email protected] Cc: [email protected] Message-Id: <[email protected]> [Added a missing comma] Signed-off-by: Corey Minyard <[email protected]>
2021-07-02Merge branch 'akpm' (patches from Andrew)Linus Torvalds1-0/+1
Merge more updates from Andrew Morton: "190 patches. Subsystems affected by this patch series: mm (hugetlb, userfaultfd, vmscan, kconfig, proc, z3fold, zbud, ras, mempolicy, memblock, migration, thp, nommu, kconfig, madvise, memory-hotplug, zswap, zsmalloc, zram, cleanups, kfence, and hmm), procfs, sysctl, misc, core-kernel, lib, lz4, checkpatch, init, kprobes, nilfs2, hfs, signals, exec, kcov, selftests, compress/decompress, and ipc" * emailed patches from Andrew Morton <[email protected]>: (190 commits) ipc/util.c: use binary search for max_idx ipc/sem.c: use READ_ONCE()/WRITE_ONCE() for use_global_lock ipc: use kmalloc for msg_queue and shmid_kernel ipc sem: use kvmalloc for sem_undo allocation lib/decompressors: remove set but not used variabled 'level' selftests/vm/pkeys: exercise x86 XSAVE init state selftests/vm/pkeys: refill shadow register after implicit kernel write selftests/vm/pkeys: handle negative sys_pkey_alloc() return code selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random kcov: add __no_sanitize_coverage to fix noinstr for all architectures exec: remove checks in __register_bimfmt() x86: signal: don't do sas_ss_reset() until we are certain that sigframe won't be abandoned hfsplus: report create_date to kstat.btime hfsplus: remove unnecessary oom message nilfs2: remove redundant continue statement in a while-loop kprobes: remove duplicated strong free_insn_page in x86 and s390 init: print out unknown kernel parameters checkpatch: do not complain about positive return values starting with EPOLL checkpatch: improve the indented label test checkpatch: scripts/spdxcheck.py now requires python3 ...
2021-07-01kernel.h: split out panic and oops helpersAndy Shevchenko1-0/+1
kernel.h is being used as a dump for all kinds of stuff for a long time. Here is the attempt to start cleaning it up by splitting out panic and oops helpers. There are several purposes of doing this: - dropping dependency in bug.h - dropping a loop by moving out panic_notifier.h - unload kernel.h from something which has its own domain At the same time convert users tree-wide to use new headers, although for the time being include new header back to kernel.h to avoid twisted indirected includes for existing users. [[email protected]: thread_info.h needs limits.h] [[email protected]: ia64 fix] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Co-developed-by: Andrew Morton <[email protected]> Acked-by: Mike Rapoport <[email protected]> Acked-by: Corey Minyard <[email protected]> Acked-by: Christian Brauner <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Kees Cook <[email protected]> Acked-by: Wei Liu <[email protected]> Acked-by: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Acked-by: Luis Chamberlain <[email protected]> Acked-by: Stephen Boyd <[email protected]> Acked-by: Thomas Bogendoerfer <[email protected]> Acked-by: Helge Deller <[email protected]> # parisc Signed-off-by: Linus Torvalds <[email protected]>
2021-06-21ipmi: kcs_bmc_aspeed: Fix less than zero comparison of a unsigned intColin Ian King1-3/+5
The comparisons of the unsigned int hw_type to less than zero always false because it is unsigned. Fix this by using an int for the assignment and less than zero check. Addresses-Coverity: ("Unsigned compared against 0") Fixes: 9d2df9a0ad80 ("ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration") Signed-off-by: Colin Ian King <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc_aspeed: Optionally apply status addressAndrew Jeffery1-33/+83
Some Aspeed KCS devices can derive the status register address from the address of the data register. As such, the address of the status register can be implicit in the configuration if desired. On the other hand, sometimes address schemes might be requested that are incompatible with the default addressing scheme. Allow these requests where possible if the devicetree specifies the status register address. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Chia-Wei Wang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc_aspeed: Fix IBFIE typo from datasheetAndrew Jeffery1-12/+12
Input Buffer Full Interrupt Enable (IBFIE) is typoed as IBFIF for some registers in the datasheet. Fix the driver to use the sensible acronym. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configurationAndrew Jeffery1-2/+180
Apply the SerIRQ ID and level/sense behaviours from the devicetree if provided. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Add serio adaptorAndrew Jeffery3-0/+172
kcs_bmc_serio acts as a bridge between the KCS drivers in the IPMI subsystem and the existing userspace interfaces available through the serio subsystem. This is useful when userspace would like to make use of the BMC KCS devices for purposes that aren't IPMI. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Enable IBF on openAndrew Jeffery3-19/+12
This way devices don't get delivered IRQs when no-one is interested. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Allow clients to control KCS IRQ stateAndrew Jeffery6-57/+131
Add a mechanism for controlling whether the client associated with a KCS device will receive Input Buffer Full (IBF) and Output Buffer Empty (OBE) events. This enables an abstract implementation of poll() for KCS devices. A wart in the implementation is that the ASPEED KCS devices don't support an OBE interrupt for the BMC. Instead we pretend it has one by polling the status register waiting for the Output Buffer Full (OBF) bit to clear, and generating an event when OBE is observed. Cc: CS20 KWLiu <[email protected]> Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Decouple the IPMI chardev from the coreAndrew Jeffery5-13/+128
Now that we have untangled the data-structures, split the userspace interface out into its own module. Userspace interfaces and drivers are registered to the KCS BMC core to support arbitrary binding of either. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Strip private client data from struct kcs_bmcAndrew Jeffery7-294/+367
Move all client-private data out of `struct kcs_bmc` into the KCS client implementation. With this change the KCS BMC core code now only concerns itself with abstract `struct kcs_bmc` and `struct kcs_bmc_client` types, achieving expected separation of concerns. Further, the change clears the path for implementation of alternative userspace interfaces. The chardev data-structures are rearranged in the same manner applied to the KCS device driver data-structures in an earlier patch - `struct kcs_bmc_client` is embedded in the client's private data and we exploit container_of() to translate as required. Finally, now that it is free of client data, `struct kcs_bmc` is renamed to `struct kcs_bmc_device` to contrast `struct kcs_bmc_client`. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Split headers into device and clientAndrew Jeffery7-52/+117
Strengthen the distinction between code that abstracts the implementation of the KCS behaviours (device drivers) and code that exploits KCS behaviours (clients). Neither needs to know about the APIs required by the other, so provide separate headers. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Turn the driver data-structures inside-outAndrew Jeffery5-67/+110
Make the KCS device drivers responsible for allocating their own memory. Until now the private data for the device driver was allocated internal to the private data for the chardev interface. This coupling required the slightly awkward API of passing through the struct size for the driver private data to the chardev constructor, and then retrieving a pointer to the driver private data from the allocated chardev memory. In addition to being awkward, the arrangement prevents the implementation of alternative userspace interfaces as the device driver private data is not independent. Peel a layer off the onion and turn the data-structures inside out by exploiting container_of() and embedding `struct kcs_device` in the driver private data. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Split out kcs_bmc_cdev_ipmiAndrew Jeffery4-412/+451
Take steps towards defining a coherent API to separate the KCS device drivers from the userspace interface. Decreasing the coupling will improve the separation of concerns and enable the introduction of alternative userspace interfaces. For now, simply split the chardev logic out to a separate file. The code continues to build into the same module. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Rename {read,write}_{status,data}() functionsAndrew Jeffery1-27/+25
Rename the functions in preparation for separating the IPMI chardev out from the KCS BMC core. Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc: Make status update atomicAndrew Jeffery4-6/+21
Enable more efficient implementation of read-modify-write sequences. Both device drivers for the KCS BMC stack use regmaps. The new callback allows us to exploit regmap_update_bits(). Signed-off-by: Andrew Jeffery <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-06-21ipmi: kcs_bmc_aspeed: Use of match data to extract KCS propertiesAndrew Jeffery1-76/+76
Unpack and remove the aspeed_kcs_probe_of_v[12]() functions to aid rearranging how the private device-driver memory is allocated. Signed-off-by: Andrew Jeffery <[email protected]> Message-Id: <[email protected]> Reviewed-by: Zev Weiss <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-05-13ipmi/watchdog: Stop watchdog timer when the current action is 'none'Petr Pavlu1-10/+12
When an IPMI watchdog timer is being stopped in ipmi_close() or ipmi_ioctl(WDIOS_DISABLECARD), the current watchdog action is updated to WDOG_TIMEOUT_NONE and _ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB) is called to install this action. The latter function ends up invoking __ipmi_set_timeout() which makes the actual 'Set Watchdog Timer' IPMI request. For IPMI 1.0, this operation results in fully stopping the watchdog timer. For IPMI >= 1.5, function __ipmi_set_timeout() always specifies the "don't stop" flag in the prepared 'Set Watchdog Timer' IPMI request. This causes that the watchdog timer has its action correctly updated to 'none' but the timer continues to run. A problem is that IPMI firmware can then still log an expiration event when the configured timeout is reached, which is unexpected because the watchdog timer was requested to be stopped. The patch fixes this problem by not setting the "don't stop" flag in __ipmi_set_timeout() when the current action is WDOG_TIMEOUT_NONE which results in stopping the watchdog timer. This makes the behaviour for IPMI >= 1.5 consistent with IPMI 1.0. It also matches the logic in __ipmi_heartbeat() which does not allow to reset the watchdog if the current action is WDOG_TIMEOUT_NONE as that would start the timer. Signed-off-by: Petr Pavlu <[email protected]> Message-Id: <[email protected]> Cc: [email protected] Signed-off-by: Corey Minyard <[email protected]>
2021-04-28Merge tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmiLinus Torvalds9-266/+137
Pull IPMI updates from Corey Minyard: "A bunch of little cleanups Nothing major, no functional changes" * tag 'for-linus-5.13-1' of git://github.com/cminyard/linux-ipmi: ipmi_si: Join string literals back ipmi_si: Drop redundant check before calling put_device() ipmi_si: Use strstrip() to remove surrounding spaces ipmi_si: Get rid of ->addr_source_cleanup() ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one() ipmi_si: Introduce ipmi_panic_event_str[] array ipmi_si: Use proper ACPI macros to check error code for failures ipmi_si: Utilize temporary variable to hold device pointer ipmi_si: Remove bogus err_free label ipmi_si: Switch to use platform_get_mem_or_io() ipmi: Handle device properties with software node API ipmi:ssif: make ssif_i2c_send() void ipmi: Refine retry conditions for getting device id
2021-04-09ipmi: kcs: aspeed: Adapt to new LPC DTS layoutChia-Wei, Wang1-11/+16
Add check against LPC device v2 compatible string to ensure that the fixed device tree layout is adopted. The LPC register offsets are also fixed accordingly. Signed-off-by: Chia-Wei Wang <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Acked-by: Haiyue Wang <[email protected]> Reviewed-by: Joel Stanley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joel Stanley <[email protected]>
2021-04-02ipmi_si: Join string literals backAndy Shevchenko6-66/+38
For easy grepping on debug purposes join string literals back in the messages. No functional change. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Drop redundant check before calling put_device()Andy Shevchenko1-2/+1
put_device() is NULL aware, drop redundant check before calling it. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Use strstrip() to remove surrounding spacesAndy Shevchenko1-12/+4
Instead of home grown analogue, use strstrip() from the kernel library. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Get rid of ->addr_source_cleanup()Andy Shevchenko3-22/+2
The ->addr_source_cleanup() callback is solely used by PCI driver and only for one purpose, i.e. to disable device. Get rid of ->addr_source_cleanup() by switching to PCI managed API. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Reuse si_to_str[] array in ipmi_hardcode_init_one()Andy Shevchenko3-16/+16
Instead of making the comparison one by one, reuse si_to_str[] array in ipmi_hardcode_init_one() in conjunction with match_string() API. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Introduce ipmi_panic_event_str[] arrayAndy Shevchenko1-32/+19
Instead of repeating twice the constant literals, introduce ipmi_panic_event_str[] array. It allows to simplify the code with help of match_string() API. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Use proper ACPI macros to check error code for failuresAndy Shevchenko1-6/+6
Instead of direct comparison, use proper ACPI macros to check error code for failures. While at it, drop unneeded 'else' keyword. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Utilize temporary variable to hold device pointerAndy Shevchenko1-8/+7
Introduce a temporary variable to hold a device pointer. It can be utilized in the ->probe() and save a bit of LOCs. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Remove bogus err_free labelAndy Shevchenko1-12/+5
There is no more 'free' in the error path, so drop the label and return errors inline. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-04-02ipmi_si: Switch to use platform_get_mem_or_io()Andy Shevchenko1-20/+14
Switch to use new platform_get_mem_or_io() instead of home grown analogue. Note, we also introduce ipmi_set_addr_data_and_space() helper here. Signed-off-by: Andy Shevchenko <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-03-10ipmi: Handle device properties with software node APIHeikki Krogerus1-1/+1
The old device property API is going to be removed. Replacing the device_add_properties() call with the software node API equivalent, device_create_managed_software_node(). Signed-off-by: Heikki Krogerus <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-03-10ipmi:ssif: make ssif_i2c_send() voidLiguang Zhang1-61/+20
This function actually needs no return value. So remove the unneeded check and make it void. Signed-off-by: Liguang Zhang <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
2021-03-10ipmi: Refine retry conditions for getting device idTerry Duncan2-8/+4
Rarely but still failures are observed while getting BMC device ID so this commit changes the condition to retry to get device id when cc is not IPMI_CC_NO_ERROR. Signed-off-by: Terry Duncan <[email protected]> Signed-off-by: Jae Hyun Yoo <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>