Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756966AbdLPO6b (ORCPT ); Sat, 16 Dec 2017 09:58:31 -0500 Received: from forward106j.mail.yandex.net ([5.45.198.249]:40535 "EHLO forward106j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756928AbdLPO61 (ORCPT ); Sat, 16 Dec 2017 09:58:27 -0500 Authentication-Results: smtp3p.mail.yandex.net; dkim=pass header.i=@flygoat.com From: Jiaxun Yang To: James Hogan Cc: Ralf Baechle , linux-mips@linux-mips.org, Huacai Chan , linux-kernel@vger.kernel.org, Jiaxun Yang Subject: [PATCH v5 4/5] MIPS: Loongson64: Load platform device during boot Date: Sat, 16 Dec 2017 22:57:50 +0800 Message-Id: <20171216145751.3486-5-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171216145751.3486-1-jiaxun.yang@flygoat.com> References: <20171216145751.3486-1-jiaxun.yang@flygoat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1849 Lines: 58 This patch just add pdev during boot to load the platform driver Signed-off-by: Jiaxun Yang --- arch/mips/loongson64/lemote-2f/Makefile | 2 +- arch/mips/loongson64/lemote-2f/platform.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 arch/mips/loongson64/lemote-2f/platform.c diff --git a/arch/mips/loongson64/lemote-2f/Makefile b/arch/mips/loongson64/lemote-2f/Makefile index 08b8abcbfef5..31c90737b98c 100644 --- a/arch/mips/loongson64/lemote-2f/Makefile +++ b/arch/mips/loongson64/lemote-2f/Makefile @@ -2,7 +2,7 @@ # Makefile for lemote loongson2f family machines # -obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o +obj-y += clock.o machtype.o irq.o reset.o ec_kb3310b.o platform.o # # Suspend Support diff --git a/arch/mips/loongson64/lemote-2f/platform.c b/arch/mips/loongson64/lemote-2f/platform.c new file mode 100644 index 000000000000..46922f730a64 --- /dev/null +++ b/arch/mips/loongson64/lemote-2f/platform.c @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2017 Jiaxun Yang. + * Author: Jiaxun Yang, jiaxun.yang@flygoat.com + + * Copyright (C) 2009 Lemote Inc. + * Author: Wu Zhangjin, wuzhangjin@gmail.com + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include + +#include + +static int __init lemote2f_platform_init(void) +{ + if (mips_machtype != MACH_LEMOTE_YL2F89) + return -ENODEV; + + return platform_device_register_simple("yeeloong_laptop", -1, NULL, 0); +} + +arch_initcall(lemote2f_platform_init); \ No newline at end of file -- 2.15.1