Commit Graph

908 Commits

Author SHA1 Message Date
Linus Torvalds
d244f9bb59 Some small fixes for the IPMI driver
Nothing huge, some rate limiting on logs, a strncpy fix where the source
 and destination could be the same, and removal of some unused cruft.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmiTvX8ACgkQYfOMkJGb
 /4HUOBAAkHAytTqTsts+wCZmP5E7Omjg7dbxRpBrU/8n0wDy94JnM8ptMZZ9poUM
 KrALIod7429PJJCz+9/mMdnhqQoJV8SQUhk1pRd0pVPA5SJxN3wE4uPtG9HoZEDb
 3clr/K7xn96+MxyiitFqWAwNW6D6/S1VVcpiFWs3AuU9ghuoV/ytfkQYb1A8NrbX
 +Z54Rccqm7ZyuDtcLNkvlvhUKQMd/KjHeeH/uRepvc/586dEF+XLhJApqUT5ZWZF
 Xz8EoASkJq+PZCyiqXGK9yZhPR9bRu38ridxPHPOnbMNaF+4TAxt3I4SEeilCJGs
 ywcozsoa0phlub1VOENkmhLeWgQrSL+WY65wc0m132pkjWRFIP6OMtQaLnensd91
 PT++zRefU0AJ527j2D35B2bTkyYMKlkjR/eUtb9mF2+kA28+SExoNL2+p+hewNL2
 qEFBLUPkbYeN/m1xmJt9knOLEe41dEAGWbYvRJVtfSiatQ101MB/ixjASWRaRjYu
 M86MFgjb0TXmNeyvOkVC5V7GfHIuPMooKpPggqWjiWekyfpFnHCIj8eYSVYk/5ge
 Lm4yPTIJNgW374WX6Ou2ecJQg/NOlc016MUHkUdMUscoC33HUF8WL46DhKB4MiqR
 4vG+KrV5zkZNcc3rf9oVHwT3qGTtQMk9XprH/GESAx4ngXseMbg=
 =0zUC
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.17-1' of https://github.com/cminyard/linux-ipmi

Pull ipmi updates from Corey Minyard:
 "Some small fixes for the IPMI driver

  Nothing huge, some rate limiting on logs, a strncpy fix where the
  source and destination could be the same, and removal of some unused
  cruft"

* tag 'for-linus-6.17-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: Use dev_warn_ratelimited() for incorrect message warnings
  char: ipmi: remove redundant variable 'type' and check
  ipmi: Fix strcpy source and destination the same
2025-08-07 07:38:25 +03:00
Breno Leitao
ec50ec378e ipmi: Use dev_warn_ratelimited() for incorrect message warnings
During BMC firmware upgrades on live systems, the ipmi_msghandler
generates excessive "BMC returned incorrect response" warnings
while the BMC is temporarily offline. This can flood system logs
in large deployments.

Replace dev_warn() with dev_warn_ratelimited() to throttle these
warnings and prevent log spam during BMC maintenance operations.

Signed-off-by: Breno Leitao <leitao@debian.org>
Message-ID: <20250710-ipmi_ratelimit-v1-1-6d417015ebe9@debian.org>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-07-10 07:59:43 -05:00
Colin Ian King
f6f9760320 char: ipmi: remove redundant variable 'type' and check
The variable 'type' is assigned the value SI_INVALID which is zero
and later checks of 'type' is non-zero (which is always false). The
variable is not referenced anywhere else, so it is redundant and
so is the check, so remove these.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Message-ID: <20250708151805.1893858-1-colin.i.king@gmail.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-07-08 12:15:44 -05:00
Corey Minyard
8ffcb7560b ipmi: Fix strcpy source and destination the same
The source and destination of some strcpy operations was the same.
Split out the part of the operations that needed to be done for those
particular calls so the unnecessary copy wasn't done.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506140756.EFXXvIP4-lkp@intel.com/
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-06-13 19:06:26 -05:00
Ingo Molnar
41cb08555c treewide, timers: Rename from_timer() to timer_container_of()
Move this API to the canonical timer_*() namespace.

[ tglx: Redone against pre rc1 ]

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-06-08 09:07:37 +02:00
Dan Carpenter
fa332f5dc6 ipmi:msghandler: Fix potential memory corruption in ipmi_create_user()
The "intf" list iterator is an invalid pointer if the correct
"intf->intf_num" is not found.  Calling atomic_dec(&intf->nr_users) on
and invalid pointer will lead to memory corruption.

We don't really need to call atomic_dec() if we haven't called
atomic_add_return() so update the if (intf->in_shutdown) path as well.

Fixes: 8e76741c3d ("ipmi: Add a limit on the number of users that may use IPMI")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Message-ID: <aBjMZ8RYrOt6NOgi@stanley.mountain>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-05-07 17:25:48 -05:00
Corey Minyard
971a00454d ipmi:watchdog: Use the new interface for panic messages
It's available, remove all the duplicate code.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
6f7f6605c9 ipmi:msghandler: Export and fix panic messaging capability
Don't have the other users that do things at panic time (the watchdog)
do all this themselves, provide a function to do it.

Also, with the new design where most stuff happens at thread context,
a few things needed to be fixed to avoid doing locking in a panic
context.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
6bd0eb6d75 ipmi:ssif: Fix a shutdown race
It was possible for the SSIF thread to stop and quit before the
kthread_stop() call because ssif->stopping was set before the
stop.  So only exit the SSIF thread is kthread_should_stop()
returns true.

There is no need to wake the thread, as the wait will be interrupted
by kthread_stop().

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
87105e0780 ipmi:msghandler: Don't deliver messages to deleted users
Check to see if they have been destroyed before trying to deliver a
message.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
ada2abadda ipmi:si: Rework startup of IPMI devices
It is possible in some situations that IPMI devices won't get started up
properly.  This change makes it so all non-duplicate devices will get
started up.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
ed59cd28af ipmi:msghandler: Add a error return from unhandle LAN cmds
If we get a command from a LAN channel, return an error instead of just
throwing it away.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
8871e77ec7 ipmi:msghandler: Shut down lower layer first at unregister
This makes sure any outstanding messages are returned to the user before
the interface is cleaned up.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
60afcc429c ipmi:msghandler: Remove proc_fs.h
It's no longer used.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
f2a31163d6 ipmi:msghandler: Don't check for shutdown when returning responses
The lower level interface shouldn't attempt to unregister if it has a
callback in the pending queue.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
ff2d2bc9f2 ipmi:msghandler: Don't acquire a user refcount for queued messages
Messages already have a refcount for the user, so there's no need to
account for a new one.

As part of this, grab a refcount to the interface when processing
received messages.  The messages can be freed there, cause the user
then the interface to be freed.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
84fe1ebcc9 ipmi:msghandler: Fix locking around users and interfaces
Now that SRCU is gone from IPMI, it can no longer be sloppy about
locking.  Use the users mutex now when sending a message, not the big
ipmi_interfaces mutex, because it can result in a recursive lock.  The
users mutex will work because the interface destroy code claims it after
setting the interface in shutdown mode.

Also, due to the same changes, rework the refcounting on users and
interfaces.  Remove the refcount to an interface when the user is
freed, not when it is destroyed.  If the interface is destroyed
while the user still exists, the user will still point to the
interface to test that it is valid if the user tries to do anything
but delete the user.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
83d19f03f3 ipmi:msghandler: Remove some user level processing in panic mode
When run to completion is set, don't call things that will claim
mutexes or call user callbacks.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:48 -05:00
Corey Minyard
b2b69ee34b ipmi:watchdog: Change lock to mutex
Now that the msghandler does all callbacks in user threads, there is
no need to have a lock any more, a mutex will work fine.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
9e91f8a6c8 ipmi:msghandler: Remove srcu for the ipmi_interfaces list
With reworks srcu is no longer necessary, this simplifies locking a lot.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
3be997d5a6 ipmi:msghandler: Remove srcu from the ipmi user structure
With the restructures done, srcu is no longer required, and it's fairly
onerous.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
8b85c0f3cb ipmi:msghandler: Use the system_wq, not system_bh_wq
Everything can be run in thread context now, don't use the bh one.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
646e40bbc7 ipmi_msghandler: Change the events lock to a mutex
It can only be called from thread context now.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
557602f233 ipmi:msghandler: Deliver user messages in a work queue
This simplifies the locking and lets us remove some weird event
handling code.  deliver_response() and friends can now be called
from an atomic context.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
742219863e ipmi:msghandler: Move timer handling into a work queue
Get all operations that manipulate the interface list into thread
context.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
305923bd3b ipmi:msghandler: Rename recv_work to smi_work
It handles both receive and transmit functions, make the name generic.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
8de2640e2c ipmi:msghandler: Use READ_ONCE on run_to_completion
It needs to be read only once because it's used in lock/unlock
scenarios.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2025-05-07 17:25:47 -05:00
Corey Minyard
9cba938aec ipmi:si: Move SI type information into an info structure
Andy reported:

Debian clang version 19.1.7 is not happy when compiled with
`make W=1` (note, CONFIG_WERROR=y is the default):

ipmi_si_platform.c:268:15: error: cast to smaller integer type 'enum si_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast]
  268 |         io.si_type      = (enum si_type)device_get_match_data(&pdev->dev);

The IPMI SI type is an enum that was cast into a pointer that was
then cast into an enum again.  That's not the greatest style, so
instead create an info structure to hold the data and use that.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Closes: https://lore.kernel.org/lkml/20250415085156.446430-1-andriy.shevchenko@linux.intel.com/
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-05-07 17:25:47 -05:00
Thomas Gleixner
8fa7292fee treewide: Switch/rename to timer_delete[_sync]()
timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.

Conversion was done with coccinelle plus manual fixups where necessary.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-04-05 10:30:12 +02:00
Joel Granados
1751f872cc treewide: const qualify ctl_tables where applicable
Add the const qualifier to all the ctl_tables in the tree except for
watchdog_hardlockup_sysctl, memory_allocation_profiling_sysctls,
loadpin_sysctl_table and the ones calling register_net_sysctl (./net,
drivers/inifiniband dirs). These are special cases as they use a
registration function with a non-const qualified ctl_table argument or
modify the arrays before passing them on to the registration function.

Constifying ctl_table structs will prevent the modification of
proc_handler function pointers as the arrays would reside in .rodata.
This is made possible after commit 78eb4ea25c ("sysctl: treewide:
constify the ctl_table argument of proc_handlers") constified all the
proc_handlers.

Created this by running an spatch followed by a sed command:
Spatch:
    virtual patch

    @
    depends on !(file in "net")
    disable optional_qualifier
    @

    identifier table_name != {
      watchdog_hardlockup_sysctl,
      iwcm_ctl_table,
      ucma_ctl_table,
      memory_allocation_profiling_sysctls,
      loadpin_sysctl_table
    };
    @@

    + const
    struct ctl_table table_name [] = { ... };

sed:
    sed --in-place \
      -e "s/struct ctl_table .table = &uts_kern/const struct ctl_table *table = \&uts_kern/" \
      kernel/utsname_sysctl.c

Reviewed-by: Song Liu <song@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> # for kernel/trace/
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> # SCSI
Reviewed-by: Darrick J. Wong <djwong@kernel.org> # xfs
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Acked-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
2025-01-28 13:48:37 +01:00
Linus Torvalds
df60eac9ef ipmi: Minor fixes and update my email address
I'm switching to a new email address, so update that.  This is a new
 commit, but shouldn't be an issue.
 
 Minor fixes for formats and return values and missing ifdefs.
 
 A fix for some error handling that causes a loss of messages.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmePqW0ACgkQYfOMkJGb
 /4Emww//SvcTgLWEz8+HoFHiFiaYmtY1e2Hq3G9pxZC8MlCQlglSU9qfM2W+Iug1
 97HmOI9KhN0oJy1jJLLkvCeFee9LoLfVLFwbuB1HVUWRS9y6bpJ+rc9C4zzvd1Vu
 ZvCPXpHeqQO6u+ZMpEVz87cG8bQ0zYxdVmE0xhNmRjJLTpw6fM3Ad8INS6rffm3r
 4L5b0NptQgjn7anJ+336RsuCE21T9m9qErrZ5pYJptN9eiJ2ITaTWuz3ghoLm4WA
 WgiMoD/Z857EcYtAn9V7mBpHs2uJ8Xw4kcZ1HAeGI8d69G1gw7TQHU3mp3atU+p5
 wOGGWGxLfJyI1w7nZQfbiFI76ja3mQk1wIN3TXm56QL7iPKsppsAqWrZwDjx6TJG
 +XBADoKdhTdRiYmqW7y8HD4lw7qX2NcPeDur4EKaM287L8MUrGh+pb6pm7kaf9Lr
 i6PFG328K63kiSNbr1WdzPgHGsM+j5wr5YGcWAVtYtuT4l90LEdgS2JhLjQVk3OS
 b153ksL47/QvKse7H/piLQUsuwca9Xpg58KsjqmNCl0Cpzqo+YxbCC6RI/AweX/i
 Q/Qaw0Tdo3/I6SE1yLdKbY8sYBE9ppRSnJkBHlmJhjhTcUSm+iujVpVZeBpCga27
 lKS8R9uLoMM4vhrWfuJ9iO4GUfSrbrEff4Si3fWJ6mHrJD+ECCo=
 =DhcZ
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.14-1' of https://github.com/cminyard/linux-ipmi

Pull ipmi updates from Corey Minyard:

 - I'm switching to a new email address, so update that

 - Minor fixes for formats and return values and missing ifdefs

 - A fix for some error handling that causes a loss of messages

* tag 'for-linus-6.14-1' of https://github.com/cminyard/linux-ipmi:
  MAINTAINERS: ipmi: update my email address
  ipmi: ssif_bmc: Fix new request loss when bmc ready for a response
  ipmi: make ipmi_destroy_user() return void
  char:ipmi: Fix a not-used variable on a non-ACPI system
  char:ipmi: Fix the wrong format specifier
  ipmi: ipmb: Add check devm_kasprintf() returned value
2025-01-22 10:57:57 -08:00
Quan Nguyen
83d8c79aa9 ipmi: ssif_bmc: Fix new request loss when bmc ready for a response
Cosmo found that when there is a new request comes in while BMC is
ready for a response, the complete_response(), which is called to
complete the pending response, would accidentally clear out that new
request and force ssif_bmc to move back to abort state again.

This commit is to address that issue.

Fixes: dd2bc5cc9e ("ipmi: ssif_bmc: Add SSIF BMC driver")
Reported-by: Cosmo Chou <chou.cosmo@gmail.com>
Closes: https://lore.kernel.org/lkml/20250101165431.2113407-1-chou.cosmo@gmail.com/
Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
Message-ID: <20250107034734.1842247-1-quan@os.amperecomputing.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-01-07 09:14:26 -06:00
Vitaliy Shevtsov
9b6442a3bd ipmi: make ipmi_destroy_user() return void
Return value of ipmi_destroy_user() has no meaning, because it's always
zero and callers can do nothing with it. And in most cases it's not
checked. So make this function return void. This also will eliminate static
code analyzer warnings such as unreachable code/redundant comparison when
the return value is checked against non-zero value.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru>
Message-ID: <20241225014532.20091-1-v.shevtsov@maxima.ru>
Signed-off-by: Corey Minyard <corey@minyard.net>
2025-01-02 21:11:52 -06:00
Corey Minyard
04626c3f1c char:ipmi: Fix a not-used variable on a non-ACPI system
Put some code into APCI ifdefs to avoid a not-used variable warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202412222349.R7qW7Q2t-lkp@intel.com/
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-12-22 14:57:47 -06:00
Linus Torvalds
e70140ba0d Get rid of 'remove_new' relic from platform driver struct
The continual trickle of small conversion patches is grating on me, and
is really not helping.  Just get rid of the 'remove_new' member
function, which is just an alias for the plain 'remove', and had a
comment to that effect:

  /*
   * .remove_new() is a relic from a prototype conversion of .remove().
   * New drivers are supposed to implement .remove(). Once all drivers are
   * converted to not use .remove_new any more, it will be dropped.
   */

This was just a tree-wide 'sed' script that replaced '.remove_new' with
'.remove', with some care taken to turn a subsequent tab into two tabs
to make things line up.

I did do some minimal manual whitespace adjustment for places that used
spaces to line things up.

Then I just removed the old (sic) .remove_new member function, and this
is the end result.  No more unnecessary conversion noise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-01 15:12:43 -08:00
liujing
7868b3a940 char:ipmi: Fix the wrong format specifier
Because the types of io.regsize and io.regspacing in the ipmipci_probe
function are unsigned int, they should be output in the %u format.

Signed-off-by: liujing <liujing@cmss.chinamobile.com>

Message-ID: <20241106111458.2157-1-liujing@cmss.chinamobile.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-11-06 06:54:46 -06:00
Al Viro
cb787f4ac0 [tree-wide] finally take no_llseek out
no_llseek had been defined to NULL two years ago, in commit 868941b144
("fs: remove no_llseek")

To quote that commit,

  At -rc1 we'll need do a mechanical removal of no_llseek -

  git grep -l -w no_llseek | grep -v porting.rst | while read i; do
	sed -i '/\<no_llseek\>/d' $i
  done

  would do it.

Unfortunately, that hadn't been done.  Linus, could you do that now, so
that we could finally put that thing to rest? All instances are of the
form
	.llseek = no_llseek,
so it's obviously safe.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-27 08:18:43 -07:00
Charles Han
2378bd0b26 ipmi: ipmb: Add check devm_kasprintf() returned value
devm_kasprintf() can return a NULL pointer on failure but this
returned value is not checked.

Fixes: 51bd6f2915 ("Add support for IPMB driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Message-ID: <20240926094419.25900-1-hanchunchao@inspur.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-09-26 19:18:48 -05:00
Linus Torvalds
18aa0ddd4c Some minor fixes and cleanups for IPMI. Nothing big.
Handle a bogus BMC a little better, fix autoload on some systems,
 remove some deprecated interfaces from the docs.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmbrSHIACgkQYfOMkJGb
 /4FzRA/+Kt2Yjp8er+Ap5fqGsRlRGjBOXcQFme3tB1fkM4iPOK9gbWt01YXD4XmX
 CQpsmUM6p1aSbWPxNmWuYQ7gyfxXCe7PujxlQ+H+g8sqRmYhd4Wgx7yI40vwyO8Y
 E71zzn7+C/OhbjYbT5Hfs/sEEYeMUgggTfuSRaVjqX86i7F3RnlR/SBcPkqneJDU
 UL/gCzzbTmDlTmfUsGo6rlXpe2GqZxlhWxoTrQ4YTG+AUT718iIhxR7QiwmYnIfA
 R8HWft/Rs7P3z+L3wYI0Gia/rdzFMRlLFF0njCr/ct73InV0yaG+Ie5UE6bQH1LC
 Eb87NcDP41I7bQXcZtAAwtm/EaVV80OxP8kSqsRT0Dw8745CNUEIbr62/j2oaRIK
 QO7ZQNCseweeth/ndW5mJuWXIe9h/U4f6ljoKDvxaMZ6euWgwKQ2Zvwz53rDs1h4
 vgMQoEW9bDQqrjIsti9FfuqazniABaLccfcYuY2UO62URuKcT2WC9PQHjFxxO1Ne
 ZPM77JRkUvKAXA4Bh32LMgDCzbisAzGr3pC0y2TSpQxbJpYfphN5rav5AOUfCiFo
 fvLnYLCyaTWQwORI5k2d5zWqsfrutV01yI7Bhw+oqULXeIYrajTCM/tf24fhPqaC
 8LShVQi9eabxXCEHKQuLRKbBJwvqP0f9JdKnI+h6GXtoUvcMa9M=
 =938Q
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.12-1' of https://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Some minor fixes and cleanups for IPMI. Nothing big.

  Handle a bogus BMC a little better, fix autoload on some systems,
  remove some deprecated interfaces from the docs"

* tag 'for-linus-6.12-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: docs: don't advertise deprecated sysfs entries
  ipmi:ssif: Improve detecting during probing
  ipmi: ipmi_ssif: fix module autoloading
2024-09-19 09:33:44 +02:00
Anna-Maria Behnsen
bd7c8ff9fe treewide: Fix wrong singular form of jiffies in comments
There are several comments all over the place, which uses a wrong singular
form of jiffies.

Replace 'jiffie' by 'jiffy'. No functional change.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Link: https://lore.kernel.org/all/20240904-devel-anna-maria-b4-timers-flseep-v1-3-e98760256370@linutronix.de
2024-09-08 20:47:40 +02:00
Corey Minyard
88f65f903d ipmi:ssif: Improve detecting during probing
If an IPMI SSIF device is probed and there is something there, but
probably not an actual BMC, the code would just issue a lot of errors
before it failed.  We kind of need these errors to help with certain
issues, and some of the failure reports are non-fatal.

However, a get device id command should alway work.  If that fails,
nothing else is going to work and it's a pretty good indication that
there's no valid BMC there.  So issue and check that command and bail
if it fails.

Reported-by: Ivan T. Ivanov <iivanov@suse.de>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-08-20 19:51:34 -05:00
Yuntao Liu
0e38f7ecb5 ipmi: ipmi_ssif: fix module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from platform_device_id table.

Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
Message-Id: <20240819113855.787149-10-liuyuntao12@huawei.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-08-20 19:11:34 -05:00
Uwe Kleine-König
19a01155dd ipmi: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

While at it, also remove commas after the sentinel entries.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-Id: <20240708150914.18190-2-u.kleine-koenig@baylibre.com>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-07-08 15:05:18 -05:00
Dan Carpenter
0627cef361 ipmi: ssif_bmc: prevent integer overflow on 32bit systems
There are actually two bugs here.  First, we need to ensure that count
is at least sizeof(u32) or msg.len will be uninitialized data.

The "msg.len" variable is a u32 that comes from the user.  On 32bit
systems the "sizeof_field(struct ipmi_ssif_msg, len) + msg.len"
addition can overflow if "msg.len" is greater than U32_MAX - 4.

Valid lengths for "msg.len" are 1-254.  Add a check for that to
prevent the integer overflow.

Fixes: dd2bc5cc9e ("ipmi: ssif_bmc: Add SSIF BMC driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Message-Id: <1431ca2e-4e9c-4520-bfc0-6879313c30e9@moroto.mountain>
Signed-off-by: Corey Minyard <corey@minyard.net>
2024-06-14 13:51:36 -05:00
Uwe Kleine-König
999dff3c13 ipmi: kcs_bmc_npcm7xx: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <16144ffaa6f40a1a126d5cf19ef4337218a04fbb.1709655755.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00
Uwe Kleine-König
c61090f4ef ipmi: kcs_bmc_aspeed: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <d125e83788ddc27fc52a3f11b2c329b40cbdd6f9.1709655755.git.u.kleine-koenig@pengutronix.de>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00
Uwe Kleine-König
a69da50299 ipmi: ipmi_ssif: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <c8a6cd95ad7a8220e211373c44cdaba2a8c06052.1709655755.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00
Uwe Kleine-König
f99a996574 ipmi: ipmi_si_platform: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <789cd7876780241430dd5604bc4322453fe4e581.1709655755.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00
Uwe Kleine-König
26edd74f5d ipmi: ipmi_powernv: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <22375be2dd616d8ccc2959586a08e49a5ad9e47b.1709655755.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00
Uwe Kleine-König
2348918407 ipmi: bt-bmc: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Message-Id: <dc5e67fb45c8c673cbf3cdbc4997c5deb3a700fe.1709655755.git.u.kleine-koenig@pengutronix.de>
Signed-off-by: Corey Minyard <minyard@acm.org>
2024-04-17 14:55:04 -05:00