From patchwork Wed Mar 1 15:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 62960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3693340wrd; Wed, 1 Mar 2023 07:26:45 -0800 (PST) X-Google-Smtp-Source: AK7set8XrODLnmeCgLy9fvSsoHumYJABvv/7kKCba1gH/vQevZOo0DxBoR6Vc0Tqikr+mTxzLwZ4 X-Received: by 2002:aa7:dd4d:0:b0:4af:515d:57ce with SMTP id o13-20020aa7dd4d000000b004af515d57cemr8340351edw.15.1677684404961; Wed, 01 Mar 2023 07:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677684404; cv=none; d=google.com; s=arc-20160816; b=xtIskI8mjp+kt8ooiYUAhu1lkcXxKbvlpprQCmWrfIQqpm+w/F9iqB/a+Oy4sf53l5 VUdTzT0cMi2seMBC1IgNFquDnSWoXAtlmoOkSCIBpp/fsXceo8nY7GglyyGDhOuBZHBc /gOK80U6ClaGPjXMYOWZd4Mw18qSawQCKZRP165CvfqU3/SfH88c4L1DqkEq12icABQ4 gjkYucbHVTqgqtpVj+tQR1AMwP2XNUF6m7ptKmqtDKTEcGmV2WGB6/hiqOvtrm9YqaHv nHZPU33ze92J3hMpjr1pEVNNFCWiLG2Cf27CmSF2A4HTu63274pcWarpoRwxl1BgqwCg uqlA== 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=X48eOuQR9g5TMfWe2rTj2NLQ7Kg+37T7XdPWVVAdg/k=; b=jikPGh2PR5u8gvbEnCAhENQxm+TOddIcCDsIcJ1+qDpcFMB0WFYdRH1JM5kRUFfVs/ k33bxREO+WislExziYAk4/Q9tgwykAkEs4vsKYo89UO7PZa2EbLHckyw36cTFsvHjF3F yvjwMsZm5cdnea4HPHqKcpx5igbk6DC+FVz4eScx16XIWqnGHWl/sdmZAplg0R1mv2p4 b6VO1hOFquBzar3S+XzKxFcRD7t6ob6XeCkeTzLB6G8/aoP5/YOWwwWQv2vt/Z72yITe gCzmwma3UDOaFXHKAvHYMZL2moa4GuOQv+3g3baPZhEscBICtcAYQZVZM1Z+3mmD6TCL 4DXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YvX0uQbY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca24-20020aa7cd78000000b004acc5bb3e0esi1981499edb.562.2023.03.01.07.26.22; Wed, 01 Mar 2023 07:26:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=YvX0uQbY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbjCAPXV (ORCPT + 99 others); Wed, 1 Mar 2023 10:23:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbjCAPWz (ORCPT ); Wed, 1 Mar 2023 10:22:55 -0500 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73D4810DE; Wed, 1 Mar 2023 07:22:51 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id EE1226000F; Wed, 1 Mar 2023 15:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1677684170; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X48eOuQR9g5TMfWe2rTj2NLQ7Kg+37T7XdPWVVAdg/k=; b=YvX0uQbYrMLltUcObHa7M12j5xm3cWqbzZKlrX3RdCRhiXDscazjQPndiZTGwwtj2HcxgN b6n+ufqWUB2cDnewB0mCllYIBgQ+6/Q4/h3HFl0SLwtDT9Cf164VTEucnEP4dd7exyrS0P fdbA67QELtFZc0Gyorwu42Y1sc0UKehjAV3ET7mpmZSzyEYcQl+zH6biyPPJvnCRTxgZqx RVmXriiXlUYJHp8ejHFh631aSjV2DJ/MycrkvC+/3mSMbfqp0UBPKuL7z2ProgjOLUBNEM FMDVe4+404vvh5SE2TKmSzZqs0+oQeiQ9lrmcEpENBDmYfQoihfReuelBdKIKg== From: Miquel Raynal To: Srinivas Kandagatla , Cc: Greg Kroah-Hartman , Michael Walle , devicetree@vger.kernel.org, Rob Herring , Frank Rowand , Robert Marko , Luka Perkov , Thomas Petazzoni , rafal@milecki.pl, Miquel Raynal Subject: [PATCH 7/8] nvmem: layouts: sl28vpd: Convert layout driver into a module Date: Wed, 1 Mar 2023 16:22:38 +0100 Message-Id: <20230301152239.531194-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230301152239.531194-1-miquel.raynal@bootlin.com> References: <20230301152239.531194-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759179602646955483?= X-GMAIL-MSGID: =?utf-8?q?1759179602646955483?= The nvmem core has already been converted to accept layout drivers compiled as modules. So in order to make this change effective we need to convert this driver so it can also be compiled as a module. We then need to expose the match table, provide MODULE_* macros, use module_init/exit() instead of the early subsys_initcall() and of course update the Kconfig symbol type to tristate. Signed-off-by: Miquel Raynal --- drivers/nvmem/layouts/Kconfig | 2 +- drivers/nvmem/layouts/sl28vpd.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index 9ad50474cb77..3f2d73282242 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -3,7 +3,7 @@ menu "Layout Types" config NVMEM_LAYOUT_SL28_VPD - bool "Kontron sl28 VPD layout support" + tristate "Kontron sl28 VPD layout support" select CRC8 help Say Y here if you want to support the VPD layout of the Kontron diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vpd.c index a36800f201a3..9370e41bad73 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -139,6 +139,7 @@ static const struct of_device_id sl28vpd_of_match_table[] = { { .compatible = "kontron,sl28-vpd" }, {}, }; +MODULE_DEVICE_TABLE(of, sl28vpd_of_match_table); struct nvmem_layout sl28vpd_layout = { .name = "sl28-vpd", @@ -150,4 +151,15 @@ static int __init sl28vpd_init(void) { return nvmem_layout_register(&sl28vpd_layout); } -subsys_initcall(sl28vpd_init); + +static void __exit sl28vpd_exit(void) +{ + nvmem_layout_unregister(&sl28vpd_layout); +} + +module_init(sl28vpd_init); +module_exit(sl28vpd_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Michael Walle "); +MODULE_DESCRIPTION("NVMEM layout driver for the VPD of Kontron sl28 boards");