Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1097278pxf; Thu, 8 Apr 2021 23:08:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQ0UQd5BdrFuPKVPRcPcoS+otmL6ctDQQ+qjRdthbAMhHkD5/zwJDzv7yEW5lC5/MplcCY X-Received: by 2002:a63:1d41:: with SMTP id d1mr10347945pgm.135.1617948514469; Thu, 08 Apr 2021 23:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617948514; cv=none; d=google.com; s=arc-20160816; b=ze4jraGKt/ZgIHAQ80AcFRvMP5xJHhQrlUwwPoEURridiGcW1bg+mdi0oWD+jdLUbX 8UsQKkR8JZtNezTpKYxFPXwctDj9+mE5PnPrWW5whUTBP55yOR5nT4P+SVoT5vfLHyrB HeGjwlJSnI+4tIkvJtabz41j3hjmAhTkeD8qlyntktrXqrP/gkZUKH/caUIg4D+DZ75y Tu2re6HQZUnCHzf3lnHrz91bXMEUVTpxZSdgxE8e4jnz9us9m81xOKn0Rr0esKqw56mG pAzpGjsQifbqNtDu837mgSsWMTPF7k+Q5VK1/YJNdLrabLdr2nyYJQWguGXGIPL6+qLp HODA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=xv1zETl1iB5irtIRE5Ue6naQ2DCplT+Qow5AJr+u6Gs=; b=OMGKKatBKyleFH1knc15ZQv1k9WKQQzsUpxyQPkac5WuptjQLwP2S32DtcsSBoYbBu kRHFcIo/YbmooXraUfIpjP/H/56lZsxq00DeSYIuaxMGWtVMx5urDpS9kqTY7Jhi1jf+ 3dJ0HzQWk797cuLJDXrP+PnBLQET/JWTuIjlaLKeQlur3ID9GpQL8jKrXhCvXBRNuyMF uNQ2YfWgaslFhJbsgB0BtCpwLt0Nl7SQ5szNIWeGCdpzL22mK+h8QFRJEgBFNK6YNXiE 7Dfb181Hf1T+WiOfcQT2i17CaMq1kGNEUoyJyfqkA7QntnEdFMzzroo//k1v1JkCOxKs W2ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=pEb+ianf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=LNxNQJGg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u14si1724541plg.257.2021.04.08.23.08.21; Thu, 08 Apr 2021 23:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=pEb+ianf; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=LNxNQJGg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbhDIGHY (ORCPT + 99 others); Fri, 9 Apr 2021 02:07:24 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:53001 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbhDIGHX (ORCPT ); Fri, 9 Apr 2021 02:07:23 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 6DB6F5806D9; Fri, 9 Apr 2021 02:07:10 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Fri, 09 Apr 2021 02:07:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm2; bh=xv1zETl1iB5irtIRE5Ue6naQ2DCplT+ Qow5AJr+u6Gs=; b=pEb+ianfzwAfRDEaTJOMTUMGKZNZYn8XI6eeOcIkxBcld2V 0M0yMx7Ah9L4jojZhSlx4UtoSkAxW2Sr+BMNKvQoO7YIfRSTdGy4sR1AD21Szs27 QrM2oVZsX3Hwf7vdRudLdaGCs3savGhxKWLevdjJW/FMWR3BhLFt/MVWSE8ZrEQb M7Ar/Xi5NIVYWVhuK4+UoezUSbdQMEd4CIvReWCPtK6ofhCoqeq2cvkIT3IWt9tA tUiSZukAr+mAJTCB3BZqxOOx7PtBUlQ96Kz85MV7TUq+8kx0Q4QD0SHKW213E4IG 3O2KyER/4YH6taX4pASQVGSZbCYopHNoKiipe7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=xv1zET l1iB5irtIRE5Ue6naQ2DCplT+Qow5AJr+u6Gs=; b=LNxNQJGg/cAvzOj+gc1zjg bHwAZiLz6xx66pPDxqS3TOkm0gm/sRfbipxCup5hkiDOUVcGUm2taLQSKiCnGnXw ffv+D+EFJ/AuG1YlKvGL8vt5GekgU1VTKNE6jede9OVirWADAt/VMB8v0Tm61ez3 bWXhr6yOU3iQJPogaShBTLD5Cv9eTPuurqMskW6QZOJXvqIY6E7iCBkHyJkkBqo2 OxcKxvUy0xfCQADymsmWW/N6JbD+zCXI0ScTFLMBLCScEqRaAtZKvPwW5OE+2ruR m+z9FbTHN1XUHLvR/KVtcAb6RQBRcW5Z5dZIHx00NIS2fUCV2V3Ax/Uaqp67dcVA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudektddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedftehn ughrvgifucflvghffhgvrhihfdcuoegrnhgurhgvfiesrghjrdhiugdrrghuqeenucggtf frrghtthgvrhhnpedutddtkeeugeegvddttdeukeeiuddtgfeuuddtfeeiueetfeeileet tedvtdfhieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvfiesrghjrdhiugdrrghu X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7C074A0007C; Fri, 9 Apr 2021 02:07:09 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <20210319062752.145730-1-andrew@aj.id.au> <20210319062752.145730-11-andrew@aj.id.au> Date: Fri, 09 Apr 2021 15:36:48 +0930 From: "Andrew Jeffery" To: "Zev Weiss" Cc: "openipmi-developer@lists.sourceforge.net" , "openbmc@lists.ozlabs.org" , "Corey Minyard" , "devicetree@vger.kernel.org" , "Ryan Chen" , "Tomer Maimon" , "linux-aspeed@lists.ozlabs.org" , "Avi Fishman" , "Patrick Venture" , "Linus Walleij" , "linux-kernel@vger.kernel.org" , "Tali Perry" , "linux-gpio@vger.kernel.org" , "Rob Herring" , "Lee Jones" , "Chia-Wei, Wang" , "linux-arm-kernel@lists.infradead.org" , "Benjamin Fair" Subject: =?UTF-8?Q?Re:_[PATCH_v2_11/21]_ipmi:_kcs=5Fbmc:_Split_headers_into_devic?= =?UTF-8?Q?e_and_client?= Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 9 Apr 2021, at 13:31, Zev Weiss wrote: > On Fri, Mar 19, 2021 at 01:27:42AM CDT, Andrew Jeffery wrote: > >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 > >--- > > drivers/char/ipmi/kcs_bmc.c | 21 ++++++++++----- > > drivers/char/ipmi/kcs_bmc.h | 30 ++++++++++----------- > > drivers/char/ipmi/kcs_bmc_aspeed.c | 20 +++++++++----- > > drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 39 ++++++++++++++++++--------- > > drivers/char/ipmi/kcs_bmc_client.h | 29 ++++++++++++++++++++ > > drivers/char/ipmi/kcs_bmc_device.h | 19 +++++++++++++ > > drivers/char/ipmi/kcs_bmc_npcm7xx.c | 20 +++++++++----- > > 7 files changed, 129 insertions(+), 49 deletions(-) > > create mode 100644 drivers/char/ipmi/kcs_bmc_client.h > > create mode 100644 drivers/char/ipmi/kcs_bmc_device.h > > > >diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c > >index 709b6bdec165..1046ce2bbefc 100644 > >--- a/drivers/char/ipmi/kcs_bmc.c > >+++ b/drivers/char/ipmi/kcs_bmc.c > >@@ -1,46 +1,52 @@ > > // SPDX-License-Identifier: GPL-2.0 > > /* > > * Copyright (c) 2015-2018, Intel Corporation. > >+ * Copyright (c) 2021, IBM Corp. > > */ > > > > #include > > > > #include "kcs_bmc.h" > > > >+/* Implement both the device and client interfaces here */ > >+#include "kcs_bmc_device.h" > >+#include "kcs_bmc_client.h" > >+ > >+/* Consumer data access */ > >+ > > u8 kcs_bmc_read_data(struct kcs_bmc *kcs_bmc) > > { > >- return kcs_bmc->io_inputb(kcs_bmc, kcs_bmc->ioreg.idr); > >+ return kcs_bmc->ops->io_inputb(kcs_bmc, kcs_bmc->ioreg.idr); > > } > > EXPORT_SYMBOL(kcs_bmc_read_data); > > > > void kcs_bmc_write_data(struct kcs_bmc *kcs_bmc, u8 data) > > { > >- kcs_bmc->io_outputb(kcs_bmc, kcs_bmc->ioreg.odr, data); > >+ kcs_bmc->ops->io_outputb(kcs_bmc, kcs_bmc->ioreg.odr, data); > > } > > EXPORT_SYMBOL(kcs_bmc_write_data); > > > > u8 kcs_bmc_read_status(struct kcs_bmc *kcs_bmc) > > { > >- return kcs_bmc->io_inputb(kcs_bmc, kcs_bmc->ioreg.str); > >+ return kcs_bmc->ops->io_inputb(kcs_bmc, kcs_bmc->ioreg.str); > > } > > EXPORT_SYMBOL(kcs_bmc_read_status); > > > > void kcs_bmc_write_status(struct kcs_bmc *kcs_bmc, u8 data) > > { > >- kcs_bmc->io_outputb(kcs_bmc, kcs_bmc->ioreg.str, data); > >+ kcs_bmc->ops->io_outputb(kcs_bmc, kcs_bmc->ioreg.str, data); > > } > > EXPORT_SYMBOL(kcs_bmc_write_status); > > > > void kcs_bmc_update_status(struct kcs_bmc *kcs_bmc, u8 mask, u8 val) > > { > >- kcs_bmc->io_updateb(kcs_bmc, kcs_bmc->ioreg.str, mask, val); > >+ kcs_bmc->ops->io_updateb(kcs_bmc, kcs_bmc->ioreg.str, mask, val); > > } > > EXPORT_SYMBOL(kcs_bmc_update_status); > > > >-int kcs_bmc_ipmi_event(struct kcs_bmc *kcs_bmc); > > int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc) > > { > >- return kcs_bmc_ipmi_event(kcs_bmc); > >+ return kcs_bmc->client.ops->event(&kcs_bmc->client); > > } > > EXPORT_SYMBOL(kcs_bmc_handle_event); > > > >@@ -60,4 +66,5 @@ EXPORT_SYMBOL(kcs_bmc_remove_device); > > > > MODULE_LICENSE("GPL v2"); > > MODULE_AUTHOR("Haiyue Wang "); > >+MODULE_AUTHOR("Andrew Jeffery "); > > MODULE_DESCRIPTION("KCS BMC to handle the IPMI request from system software"); > >diff --git a/drivers/char/ipmi/kcs_bmc.h b/drivers/char/ipmi/kcs_bmc.h > >index bf0ae327997f..a1350e567723 100644 > >--- a/drivers/char/ipmi/kcs_bmc.h > >+++ b/drivers/char/ipmi/kcs_bmc.h > >@@ -8,6 +8,15 @@ > > > > #include > > > >+#include "kcs_bmc_client.h" > >+ > >+#define KCS_BMC_EVENT_NONE 0 > >+#define KCS_BMC_EVENT_HANDLED 1 > > Is there a particular reason we're introducing these macros and using an > int return type for kcs_bmc_client_ops.event instead of just having it > be irqreturn_t? Other event types or outcomes we're anticipating needing > to handle maybe? In earlier iterations of the patches I was doing some extra work in the event handling path and felt it was useful at the time. However I've refactored things a little and this may have outlived its usefulness. I'll reasses! > > >+ > >+#define KCS_BMC_STR_OBF BIT(0) > >+#define KCS_BMC_STR_IBF BIT(1) > >+#define KCS_BMC_STR_CMD_DAT BIT(3) > > The first two of these macros are used later in the series, but the third > doesn't end up used at all I think? I think I just added it as documentation as the hardware-defined bits aren't contiguous. Andrew