Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp273588rdf; Thu, 2 Nov 2023 23:16:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGf3+/4yIfXwCnwJLZNc8zq4MYm9mY8o5ZiF6I1ZLYhN4GtmnFayzuEicfN1YXDmCiyX3+d X-Received: by 2002:a17:902:ecc8:b0:1c9:dba6:417a with SMTP id a8-20020a170902ecc800b001c9dba6417amr2476832plh.9.1698992207271; Thu, 02 Nov 2023 23:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698992207; cv=none; d=google.com; s=arc-20160816; b=Nq3Den5rHBcxq4KisLPu2vMMstE2IQIlcO6g3fS98RAZ0xy/6ZoihM72hqKtwz8m/p 5VdUq++V0ZK5wIeTV2NNhVeoTIOq38GXzBVeHJMmYVAoQp693NZruVuYG7QwGP4jmgjZ ejYOVWM68L/AaXndwX1K8egd7y84XXZf8tr48nllvv7xSNiKsUN9RGaLuf1Sr4i0y1/X YVfQvO3BGMJmS7zxL54w+vXzaNgJqhQ3z0yC8tqrW04IWNLbRTRV+J0145MA6paPogId y21DCs0DEH1AO+7BHNuzZiFciDx5niWPKaIPtA6KTX473nLK4GHhmvR0m+i8QkO7Ir2h GDDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PBzGQ9XdHybgB4MnC4pIf/AcZ42td+dcXGF6qrKn84c=; fh=J5fZGSGUmoD0NT+ZfFkgng7qPhvONoMGdVOrNctU85A=; b=QL0R2Mp05AfPG+O/LEAzCYAP6fSBonMVYJ9/EIl9bI7CS+vMKkfA6tUz9lNrLn/fMs 62wnygRtdnULq99HRSg98SdYlFOmiCoYoVWmh3T7RAxYxboTTkHkP7eQIlFXgeIZGIdP 1vA//VyqqNQpAAxvyUVtyZOICyrfdTHLCwcNhHyEEbSD74gnEa2oHGyJzWPA7M8cGAje YBL/tZ9nYRdsMrMjC/7GynFcMiFEuodz7eiA5+ECBK1Iz1sOzmm9LxRd9FudF+JQ3dHg F29/CvydQ6rBBVSrozgU84n3o3XZLuJ497FEvUeGk675TAGSPtd8xqaqx9GQAFkYWl9k 00Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=kVCSm2a6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i5-20020a170902cf0500b001cc1af09466si1000264plg.125.2023.11.02.23.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 23:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@codeconstruct.com.au header.s=2022a header.b=kVCSm2a6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codeconstruct.com.au Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A4E8581B894A; Thu, 2 Nov 2023 23:16:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231476AbjKCGQC (ORCPT + 99 others); Fri, 3 Nov 2023 02:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbjKCGPv (ORCPT ); Fri, 3 Nov 2023 02:15:51 -0400 Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AEF91B4 for ; Thu, 2 Nov 2023 23:15:48 -0700 (PDT) Received: from localhost.localdomain (ppp14-2-79-67.adl-apt-pir-bras31.tpg.internode.on.net [14.2.79.67]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id E6FFC2023B; Fri, 3 Nov 2023 14:15:43 +0800 (AWST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1698992144; bh=PBzGQ9XdHybgB4MnC4pIf/AcZ42td+dcXGF6qrKn84c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kVCSm2a6myZWDlqnkDlsyfh8Xpz8H2fzFwLKoagVmpeuvsRxVrhOVOpR2GUYpYyqq 6X25J916IpFiZ0Dy5MH4yhfTuPbt2/RawMfC5tuFyIpTloFKvcipogKzalPvPP98N1 gF9l07S4s4FGiLdiOEowTxFovr+r8XV7YR9hekifuuDmCTiCpEoewbSaffY9DC0OCB voqmRIPcs72ro0wCKnjZnBpvriCInCZJ9Oy9jXLP6Q6QcA1tHqprioPOVCQFDelsZA KUQhmKGwn4cM5yGTNrtGjw6UEvY9S+X6Cd4xWcetNnoyjqJNDrbT+EayEIgEvT4s6B 0wiMCdEGOMkgQ== From: Andrew Jeffery To: minyard@acm.org, openipmi-developer@lists.sourceforge.net Cc: Andrew Jeffery , linux-kernel@vger.kernel.org, Jonathan.Cameron@Huawei.com, aladyshev22@gmail.com, jk@codeconstruct.com.au Subject: [PATCH 09/10] ipmi: kcs_bmc: Add module_kcs_bmc_driver() Date: Fri, 3 Nov 2023 16:45:21 +1030 Message-Id: <20231103061522.1268637-10-andrew@codeconstruct.com.au> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231103061522.1268637-1-andrew@codeconstruct.com.au> References: <20231103061522.1268637-1-andrew@codeconstruct.com.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 02 Nov 2023 23:16:09 -0700 (PDT) Remove some cruft in the client modules by adding the usual module macro for the KCS subsystem. Signed-off-by: Andrew Jeffery --- drivers/char/ipmi/kcs_bmc.c | 4 +++- drivers/char/ipmi/kcs_bmc.h | 1 + drivers/char/ipmi/kcs_bmc_cdev_ipmi.c | 15 +-------------- drivers/char/ipmi/kcs_bmc_client.h | 7 ++++++- drivers/char/ipmi/kcs_bmc_serio.c | 15 +-------------- 5 files changed, 12 insertions(+), 30 deletions(-) diff --git a/drivers/char/ipmi/kcs_bmc.c b/drivers/char/ipmi/kcs_bmc.c index 203cb73faa91..c69eb671d9d0 100644 --- a/drivers/char/ipmi/kcs_bmc.c +++ b/drivers/char/ipmi/kcs_bmc.c @@ -174,7 +174,7 @@ void kcs_bmc_remove_device(struct kcs_bmc_device *dev) } EXPORT_SYMBOL(kcs_bmc_remove_device); -void kcs_bmc_register_driver(struct kcs_bmc_driver *drv) +int kcs_bmc_register_driver(struct kcs_bmc_driver *drv) { struct kcs_bmc_client *client; struct kcs_bmc_device *dev; @@ -191,6 +191,8 @@ void kcs_bmc_register_driver(struct kcs_bmc_driver *drv) list_add(&client->entry, &kcs_bmc_clients); } mutex_unlock(&kcs_bmc_lock); + + return 0; } EXPORT_SYMBOL(kcs_bmc_register_driver); diff --git a/drivers/char/ipmi/kcs_bmc.h b/drivers/char/ipmi/kcs_bmc.h index 880d835fb90c..979d673f8f56 100644 --- a/drivers/char/ipmi/kcs_bmc.h +++ b/drivers/char/ipmi/kcs_bmc.h @@ -7,6 +7,7 @@ #define __KCS_BMC_H__ #include +#include #include #define KCS_BMC_EVENT_TYPE_OBE BIT(0) diff --git a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c index 9fca31f8c7c2..21d4c4c11e07 100644 --- a/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c +++ b/drivers/char/ipmi/kcs_bmc_cdev_ipmi.c @@ -523,20 +523,7 @@ static struct kcs_bmc_driver kcs_bmc_ipmi_driver = { .ops = &kcs_bmc_ipmi_driver_ops, }; -static int __init kcs_bmc_ipmi_init(void) -{ - kcs_bmc_register_driver(&kcs_bmc_ipmi_driver); - - return 0; -} -module_init(kcs_bmc_ipmi_init); - -static void __exit kcs_bmc_ipmi_exit(void) -{ - kcs_bmc_unregister_driver(&kcs_bmc_ipmi_driver); -} -module_exit(kcs_bmc_ipmi_exit); - +module_kcs_bmc_driver(kcs_bmc_ipmi_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Haiyue Wang "); MODULE_AUTHOR("Andrew Jeffery "); diff --git a/drivers/char/ipmi/kcs_bmc_client.h b/drivers/char/ipmi/kcs_bmc_client.h index 1c6c812d6edc..afc9e71c9fc0 100644 --- a/drivers/char/ipmi/kcs_bmc_client.h +++ b/drivers/char/ipmi/kcs_bmc_client.h @@ -5,6 +5,7 @@ #define __KCS_BMC_CONSUMER_H__ #include +#include #include "kcs_bmc.h" @@ -44,9 +45,13 @@ struct kcs_bmc_driver { const struct kcs_bmc_driver_ops *ops; }; -void kcs_bmc_register_driver(struct kcs_bmc_driver *drv); +int kcs_bmc_register_driver(struct kcs_bmc_driver *drv); void kcs_bmc_unregister_driver(struct kcs_bmc_driver *drv); +#define module_kcs_bmc_driver(__kcs_bmc_driver) \ + module_driver(__kcs_bmc_driver, kcs_bmc_register_driver, \ + kcs_bmc_unregister_driver) + int kcs_bmc_enable_device(struct kcs_bmc_client *client); void kcs_bmc_disable_device(struct kcs_bmc_client *client); u8 kcs_bmc_read_data(struct kcs_bmc_client *client); diff --git a/drivers/char/ipmi/kcs_bmc_serio.c b/drivers/char/ipmi/kcs_bmc_serio.c index 3cfda39506f6..8bb598c2aa38 100644 --- a/drivers/char/ipmi/kcs_bmc_serio.c +++ b/drivers/char/ipmi/kcs_bmc_serio.c @@ -123,20 +123,7 @@ static struct kcs_bmc_driver kcs_bmc_serio_driver = { .ops = &kcs_bmc_serio_driver_ops, }; -static int __init kcs_bmc_serio_init(void) -{ - kcs_bmc_register_driver(&kcs_bmc_serio_driver); - - return 0; -} -module_init(kcs_bmc_serio_init); - -static void __exit kcs_bmc_serio_exit(void) -{ - kcs_bmc_unregister_driver(&kcs_bmc_serio_driver); -} -module_exit(kcs_bmc_serio_exit); - +module_kcs_bmc_driver(kcs_bmc_serio_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Andrew Jeffery "); MODULE_DESCRIPTION("Adapter driver for serio access to BMC KCS devices"); -- 2.39.2