From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A606ECAAA1 for ; Fri, 28 Oct 2022 15:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U0SalGu5ZM4M5cBnH2EOWn5Np43DCsM0r1gok9mCSNQ=; b=jWpapoOFO7WhTk xVa9ZUHhNYJbMsp7hOLQKEHOn4/BqcIfBFj54TKy1ZsbQA6Qe+2WRwiU/iMJywDcpceB0CuXR8avO kA4qmuXFrrKLOQngTBRRpzFUkkIrwfcE6CVpZ+i2QI3Psh+fG281dy2PUzbksTt48b3k1lR/akMwr mKMoBJTEU6xw46LmLU4DdZU1ggipzt0FgHBD0LOfqf3PNCbqsIAsN7y101pl+TTLYuRksdL9csCcf 7xleL0eJHTT6woj1N5JOTTkDqujIDTBe9/YxoFC3Ux1KvL6L5EzKIcOlHe64QJ4kb0X15fhuk+cKZ QmxWvF6ZMx2ZRLCIIGGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooRX3-000c4q-QC; Fri, 28 Oct 2022 15:44:30 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooRPx-000Ylq-Pg for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 15:37:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q1F6yR8dYAxI+UJJtikY1mCKGi7/pORbcF6uO/72aDc=; b=B2KR2ciuxIEhgq3ERqvr+IdMPB FrSvvzKNSyXEdVgVy+JYbdLI0Hdkx3gIIt8BZ6xY+DXTarWIfJ9/8u6dQFUxoq6lKiOKg4RnXNFg7 wfim86HxozZh5E/PVv8yCm3N6UoODEeuG52qGrR8nxg3aFLAfTiqQ6wT1jbxsceBIPUSAaPC8qfwU m1b5E9ISh1Ulgc1mM9by1k7YNCCr/j0enaXE2OM6k58Y2AklQweB+OHHUQ4tLvZwrtrdudk8MTJoQ ovxs4YG2IjtqQIDHbc1xaEXP+Hi6j5ywZJes3/bElpjMDE0WkBS3omBNnbE7yyZkm8Qo1It6pZGw+ LjaRYnlA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35008) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ooRPf-0008S0-2H; Fri, 28 Oct 2022 16:36:51 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ooRPc-0002fe-Lc; Fri, 28 Oct 2022 16:36:48 +0100 Date: Fri, 28 Oct 2022 16:36:48 +0100 From: "Russell King (Oracle)" To: Lee Jones Cc: Hector Martin , Arnd Bergmann , Linus Walleij , Alyssa Rosenzweig , asahi@lists.linux.dev, Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Sven Peter Subject: Re: [PATCH 4/6] platform/apple: Add new Apple Mac SMC driver Message-ID: References: <45ed0a37-60ac-3a06-92d1-6b30e18261ff@marcan.st> <8f30a490-f970-6605-20cb-c2256daab9de@marcan.st> <82088b05-2a0d-69cc-ba2c-d61c74c9d855@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_083709_909237_233DDD02 X-CRM114-Status: GOOD ( 28.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 12, 2022 at 11:55:14AM +0100, Lee Jones wrote: > > I'm guessing this series is now dead, and Hector needs to re-spin the > > patch set according to your views. I'm guessing this is going to take > > a major re-work of the patch series. > > > > I suspect my attempt and trying to get this upstream has made things > > more complicated, because I doubt Hector has updated his patch set > > with the review comments that have been made so far... so this is > > now quite a mess. I think, once this is sorted, the entire series > > will need to be re-reviewed entirely afresh. > > I have no insight into what Hector is doing, or plans to do. It seems there's no plans by Hector to address this, so it comes down to me. So, guessing what you're after, would something like the following work for you? I don't see *any* point in creating more yet more platform devices unless we're on a mission to maximise wasted memory resources (which this split will already be doing by creating two small modules instead of one.) Obviously, this is not an official patch yet, it's just to find out what code structure you are looking for. diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 78c6d9d99c3f..8d4c0508a2c8 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -18,6 +18,8 @@ obj-$(CONFIG_MFD_ENE_KB3930) += ene-kb3930.o obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o obj-$(CONFIG_MFD_GATEWORKS_GSC) += gateworks-gsc.o +obj-$(CONFIG_APPLE_SMC) += apple-smc.o + obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o diff --git a/drivers/mfd/apple-smc.c b/drivers/mfd/apple-smc.c new file mode 100644 index 000000000000..bc59d1c5e13d --- /dev/null +++ b/drivers/mfd/apple-smc.c @@ -0,0 +1,38 @@ +#include +#include + +static const struct mfd_cell apple_smc_devs[] = { + { + .name = "macsmc-gpio", + .of_compatible = "apple,smc-gpio", + }, + { + .name = "macsmc-hid", + }, + { + .name = "macsmc-power", + }, + { + .name = "macsmc-reboot", + }, + { + .name = "macsmc-rtc", + }, +}; + +int apple_smc_mfd_probe(struct device *dev) +{ + return mfd_add_devices(dev, -1, apple_smc_devs, + ARRAY_SIZE(apple_smc_devs), NULL, 0, NULL); +} +EXPORT_SYMBOL(apple_smc_mfd_probe); + +void apple_smc_mfd_remove(struct device *dev) +{ + mfd_remove_devices(dev); +} +EXPORT_SYMBOL(apple_smc_mfd_remove); + +MODULE_AUTHOR("Hector Martin "); +MODULE_LICENSE("Dual MIT/GPL"); +MODULE_DESCRIPTION("Apple SMC MFD core"); diff --git a/drivers/platform/apple/smc_core.c b/drivers/platform/apple/smc_core.c index 148a3f8173d3..d4a502835b27 100644 --- a/drivers/platform/apple/smc_core.c +++ b/drivers/platform/apple/smc_core.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include "smc.h" @@ -25,25 +25,6 @@ struct apple_smc { struct blocking_notifier_head event_handlers; }; -static const struct mfd_cell apple_smc_devs[] = { - { - .name = "macsmc-gpio", - .of_compatible = "apple,smc-gpio", - }, - { - .name = "macsmc-hid", - }, - { - .name = "macsmc-power", - }, - { - .name = "macsmc-reboot", - }, - { - .name = "macsmc-rtc", - }, -}; - int apple_smc_read(struct apple_smc *smc, smc_key key, void *buf, size_t size) { int ret; @@ -226,7 +207,7 @@ struct apple_smc *apple_smc_probe(struct device *dev, const struct apple_smc_bac dev_set_drvdata(dev, smc); - ret = mfd_add_devices(dev, -1, apple_smc_devs, ARRAY_SIZE(apple_smc_devs), NULL, 0, NULL); + ret = apple_smc_mfd_probe(dev); if (ret) return ERR_PTR(dev_err_probe(dev, ret, "Subdevice initialization failed")); @@ -236,7 +217,7 @@ EXPORT_SYMBOL(apple_smc_probe); int apple_smc_remove(struct apple_smc *smc) { - mfd_remove_devices(smc->dev); + apple_smc_mfd_remove(smc->dev); /* Disable notifications */ apple_smc_write_flag(smc, SMC_KEY(NTAP), 1); diff --git a/include/linux/mfd/apple-smc.h b/include/linux/mfd/apple-smc.h new file mode 100644 index 000000000000..2f34ca0f07f3 --- /dev/null +++ b/include/linux/mfd/apple-smc.h @@ -0,0 +1,9 @@ +#ifndef LINUX_MFD_APPLE_SMC_H +#define LINUX_MFD_APPLE_SMC_H + +struct device; + +int apple_smc_mfd_probe(struct device *dev); +void apple_smc_mfd_remove(struct device *dev); + +#endif -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel