Received: by 10.223.164.202 with SMTP id h10csp523589wrb; Tue, 14 Nov 2017 05:31:10 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ6NB/SgzlEfubvSJnP2kYyAwTljGGSqGS20q7cCyXFGEQsrwkATa3WVuhxu0WzFsAIL2Aq X-Received: by 10.101.74.129 with SMTP id b1mr12284668pgu.341.1510666270448; Tue, 14 Nov 2017 05:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510666270; cv=none; d=google.com; s=arc-20160816; b=Rx4iM1kN/TPPDGV/jPd22HTNlGXdcbsavxPFKmyxgqDpO4xarH0ILIatNvOaWwMe9Z dbzrZYlamFB90bupdIPGOuQunDtGtmT3hd2z1NyjIRcZqO78Ne5PPUT39lGSbwWPae8k IfOIXMIyVXHg4Vae3c3mUBP9/lH9en2U5xyLpAr7KMvMQDX1TURA2h0LnkIJKNV39Lik fM434pHgjAXkc3jtYi4jMezHI+lNezPVrDOqV2loicPAaFL79B4F+ukHyKK/AECjoXQa DbLbaXViSEuDN4pY2iZUT2OADHxhYut/ykPldDwdnqR0WxTlgWZyU+IxGbYzqdgCDkw9 6U5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=iVg9TqBdn740/UfgCUC6lZk3NsSHVrb3bh25Y+fqWj4=; b=QeJwaqh4M2Cn7j+1VfZj176GT/+GC0h25S/ZxLs5KCgYegcSrSODAKJQgljanLlH3d ELNmaNa6e3MaWlKPSrY0FNfXIJv/2ty3TXAcxTtrxD68uLazNlwoF36MDSgMxrPy49+n REm1SI81hsZ9lbs8EoQWbur82EcBWz50RbAbD4wRmTNvMyv0/Yzu2wcupxUYGkWUDBhK vMMlt00AN+DCcd6rMpdhpHQtsRGbXG68ZND7Du4VYNu3rfF7gp9/bhES4Rysfit6T8rv 9+JydZm/NhDsTn9H+nuc5c83MSu80zagJIP5iXn2hAKJmo6l6nfSShjMDk5w/b6izCDa CXvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m124si15900455pgm.684.2017.11.14.05.30.58; Tue, 14 Nov 2017 05:31:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755417AbdKNN3d (ORCPT + 88 others); Tue, 14 Nov 2017 08:29:33 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:41710 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754125AbdKNN32 (ORCPT ); Tue, 14 Nov 2017 08:29:28 -0500 Received: from localhost.localdomain ([127.0.0.1]:49778 "EHLO linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by eddie.linux-mips.org with ESMTP id S23992334AbdKNN30h-JD0 (ORCPT ); Tue, 14 Nov 2017 14:29:26 +0100 Received: from h7.dl5rb.org.uk (localhost [127.0.0.1]) by h7.dl5rb.org.uk (8.15.2/8.14.8) with ESMTP id vAEDTPHG012963; Tue, 14 Nov 2017 14:29:25 +0100 Received: (from ralf@localhost) by h7.dl5rb.org.uk (8.15.2/8.15.2/Submit) id vAEDTP0f012962; Tue, 14 Nov 2017 14:29:25 +0100 Date: Tue, 14 Nov 2017 14:29:25 +0100 From: Ralf Baechle To: jiaxun.yang@flygoat.com Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] MIPS: Loongson64: Load platform device during boot This patch just add pdev during boot to load the platform driver Message-ID: <20171114132925.GD13046@linux-mips.org> References: <20171112063617.26546-1-jiaxun.yang@flygoat.com> <20171112063617.26546-4-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171112063617.26546-4-jiaxun.yang@flygoat.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 12, 2017 at 02:36:17PM +0800, jiaxun.yang@flygoat.com wrote: > From: Jiaxun Yang > > Signed-off-by: Jiaxun Yang > --- > arch/mips/loongson64/lemote-2f/Makefile | 2 +- > arch/mips/loongson64/lemote-2f/platform.c | 45 +++++++++++++++++++++++++++++++ > 2 files changed, 46 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..c36efcccb9a9 > --- /dev/null > +++ b/arch/mips/loongson64/lemote-2f/platform.c > @@ -0,0 +1,45 @@ > +/* > + * 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 struct platform_device yeeloong_pdev = { > + .name = "yeeloong_laptop", > + .id = -1, > +}; > + > + > +static int __init lemote2f_platform_init(void) > +{ > + struct platform_device *pdev = NULL; > + > + switch (mips_machtype) { > + case MACH_LEMOTE_YL2F89: > + pdev = &yeeloong_pdev; > + break; > + > + default: > + break; > + > + } > + > + if (pdev != NULL) > + return platform_device_register(pdev); > + > + return -ENODEV; > +} > + > +arch_initcall(lemote2f_platform_init); Looks like you can simplify this by using something like: > +static int __init lemote2f_platform_init(void) > +{ > + struct platform_device *pdev = NULL; > + > + switch (mips_machtype) { > + case MACH_LEMOTE_YL2F89: > + pdev = &yeeloong_pdev; > + break; > + > + default: > + break; > + > + } > + > + if (pdev != NULL) > + return platform_device_register(pdev); > + > + return -ENODEV; > +} Looks like this can be simplified to: 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); } Ralf From 1583841756460479876@xxx Sun Nov 12 06:46:44 +0000 2017 X-GM-THRID: 1583841756460479876 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread