Re: [PATCH 05/10] ipmi: kcs_bmc: Define client actions in terms of kcs_bmc_client

From: Jonathan Cameron
Date: Fri Nov 03 2023 - 11:17:00 EST


On Fri, 3 Nov 2023 16:45:17 +1030
Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx> wrote:

> Operations such as reading and writing from hardware and updating the
> events of interest are operations in which the client is interested, but
> are applied to the device. Strengthen the concept of the client in the
> subsystem and clean up some call-sites by translating between the client
> and device types in the core of the KCS subsystem.
>
> Signed-off-by: Andrew Jeffery <andrew@xxxxxxxxxxxxxxxxxxxx>
> ---
> drivers/char/ipmi/kcs_bmc.c | 67 ++++++++++++++++++---------
> drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 50 ++++++++++----------
> drivers/char/ipmi/kcs_bmc_client.h | 15 +++---
> drivers/char/ipmi/kcs_bmc_serio.c | 10 ++--
> 4 files changed, 81 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c
> index 5a3f199241d2..d70e503041bd 100644
> --- a/drivers/char/ipmi/kcs_bmc.c
> +++ b/drivers/char/ipmi/kcs_bmc.c
> @@ -22,33 +22,53 @@ static LIST_HEAD(kcs_bmc_drivers);
>
> /* Consumer data access */
>
> -u8 kcs_bmc_read_data(struct kcs_bmc_device *kcs_bmc)
> +static void kcs_bmc_client_validate(struct kcs_bmc_client *client)
> {
> - return kcs_bmc->ops->io_inputb(kcs_bmc, kcs_bmc->ioreg.idr);
> + WARN_ONCE(client != READ_ONCE(client->dev->client), "KCS client confusion detected");

Is this intended as runtime validation or to catch bugs?
If just catch bugs then fair enough.

With that question answered based on my somewhat vague understanding of the kcs subsystem.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

> +}