Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1083016imm; Wed, 8 Aug 2018 10:25:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx0sWX9qsNdU5i/7Cl9D9qdp9QxJFNMsoxLMX5UY3cW72JLpW1b+tLUpuJ3xtsrrvkmJdng X-Received: by 2002:a17:902:7884:: with SMTP id q4-v6mr3411227pll.174.1533749127148; Wed, 08 Aug 2018 10:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533749127; cv=none; d=google.com; s=arc-20160816; b=HLyN1dSviCdvpuz98atYtpBm3uYXlWIugQWGmU5hLIpbA+hfOLZDyztkyaBFh6KMIL BxbFsOmlnxWeanQaYAfrfLOXERVHko06x6d03F7C8G41qpM59ylR9+llyT2jzCU1n4lv BkIJsGvv9FdZhHtjgJzCFluHhL126byh0nvPxHUMOKfpIHLMJte2cps8sEhYfFoVmIsL dnfi7uBHW68Clg2v3LVBD/OAJEgA5q8pi2csk2NqJubHHirXBPuo/pwZUxJ7tOOcf0r8 s+EqC55vl2VYc+tqd/wgyn/x5/katdtMN79RJUhcU2PKGhUt3ful0pzPo11cBqt3zA2o Dysg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=vLYtl6Yye1J6evlszTweUjzH/hlVZrMfBhW5aytAPZI=; b=VX61+kZiskN7+0F5sUa4rm07qV/qZaUrU89fOOff6LE31arcFmFTAXKR0GHAGyFAn9 apujOpQ4+hdErwHwMFCv700Z6gVDrsG/VjbCKsFnhFDo4tciM0DskYZyX7Gy/VaEm5A9 aFOnVlXbXLR0f8TD3bCGeymAShORER5RlISBE3QKGCQzfpXiPwa+3t2bsD9nqRUgEwVN UwFy0qRBJTxznN8E4bpICDdnlX16APu1pLIVoBGM9qa8V568kSeSFTx/4zyQRBVaq10o LNDGx5KzNVWBXKvCQZvsx0rMVsDJTOos1QlbVU9JU5m1sCeQzcKNNqYOfXfaOTox7Eov wbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JNp5HuQG; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si5314495pfk.75.2018.08.08.10.25.12; Wed, 08 Aug 2018 10:25:27 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b=JNp5HuQG; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbeHHTo5 (ORCPT + 99 others); Wed, 8 Aug 2018 15:44:57 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37369 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727295AbeHHTo4 (ORCPT ); Wed, 8 Aug 2018 15:44:56 -0400 Received: by mail-pf1-f194.google.com with SMTP id a26-v6so1471014pfo.4 for ; Wed, 08 Aug 2018 10:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vLYtl6Yye1J6evlszTweUjzH/hlVZrMfBhW5aytAPZI=; b=JNp5HuQGVSxwleAFcO4nzA0SflX28n+BSrJdRfbQ8tnHr9JyFFPynFiHYUczCRNPT2 NxexsHpBUvuAsTacZ9V8QC9QR53LKwH54IMOpmoOACw+QBaWhu7TcYD+W2OB274ydx7T TBNla6lDWgrmAf1QPtQmLKo5sCB41XWkW8Hhs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vLYtl6Yye1J6evlszTweUjzH/hlVZrMfBhW5aytAPZI=; b=IOPdzksqO7pD4rF3AeVE9kGfhIkvHYtde5OwBG2ji/Y7f3Tzv4UIQ06E6xesxD8ldF RVBzB73TkFYoHakgbaJoOkiIkc8hs7QTjUclFxFuOKNyCnUZg5mzgqMKJ9JjhA8IPjNS hUI654jXivJi4UkipA6dqBLyBl/98iStBZ6jxV+cjSHxbP323vJdxZKyA0//apSz/JGJ VSbAwib26Rl04YQV7CrhOh4DM7+VgZqp8mVWmx3Ry0S6RFFzJgFhbFVKSy4C1BvLC2bU h6ZAdqhI+Z/snP6c+jbZOXF5PIFxN0IsaDqeqvvrJtsRYuuRWSZgXOyOzTWlVWBkoD4w 7xWg== X-Gm-Message-State: AOUpUlFZqk1PeJIDqmEjsu3FfSpb6WmFiuHv0cdmvyLvAxBpa7jnj0ka 2vYQeEJqEFeakM7QvueEmBTptg== X-Received: by 2002:a63:9311:: with SMTP id b17-v6mr3404868pge.261.1533749057147; Wed, 08 Aug 2018 10:24:17 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:7e28:b9f3:6afc:5326]) by smtp.gmail.com with ESMTPSA id 1-v6sm9679503pfm.145.2018.08.08.10.24.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 10:24:16 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Wei-Ning Huang , Julius Werner , Brian Norris , Samuel Holland , Sudeep Holla Subject: [PATCH v2 1/2] firmware: coreboot: Let OF core populate platform device Date: Wed, 8 Aug 2018 10:24:13 -0700 Message-Id: <20180808172414.29983-2-swboyd@chromium.org> X-Mailer: git-send-email 2.18.0.597.ga71716f1ad-goog In-Reply-To: <20180808172414.29983-1-swboyd@chromium.org> References: <20180808172414.29983-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the /firmware/coreboot node in DT is populated by the core DT platform code with commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") we should and can remove the platform device creation here. Otherwise, the of_platform_device_create() call will fail, the coreboot of driver won't be registered, and this driver will never bind. At the same time, we should move this driver to use MODULE_DEVICE_TABLE so that module auto-load works properly when the coreboot device is auto-populated and we should drop the of_node handling that was presumably placed here to hold a reference to the DT node created during module init that no longer happens. Cc: Wei-Ning Huang Cc: Julius Werner Cc: Brian Norris Cc: Samuel Holland Cc: Sudeep Holla Fixes: 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") Signed-off-by: Stephen Boyd --- drivers/firmware/google/coreboot_table-of.c | 28 +++------------------ 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/drivers/firmware/google/coreboot_table-of.c b/drivers/firmware/google/coreboot_table-of.c index f15bf404c579..9b90c0fa4a0b 100644 --- a/drivers/firmware/google/coreboot_table-of.c +++ b/drivers/firmware/google/coreboot_table-of.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include "coreboot_table.h" @@ -30,7 +29,6 @@ static int coreboot_table_of_probe(struct platform_device *pdev) void __iomem *ptr; ptr = of_iomap(fw_dn, 0); - of_node_put(fw_dn); if (!ptr) return -ENOMEM; @@ -44,8 +42,9 @@ static int coreboot_table_of_remove(struct platform_device *pdev) static const struct of_device_id coreboot_of_match[] = { { .compatible = "coreboot" }, - {}, + {} }; +MODULE_DEVICE_TABLE(of, coreboot_of_match); static struct platform_driver coreboot_table_of_driver = { .probe = coreboot_table_of_probe, @@ -55,28 +54,7 @@ static struct platform_driver coreboot_table_of_driver = { .of_match_table = coreboot_of_match, }, }; - -static int __init platform_coreboot_table_of_init(void) -{ - struct platform_device *pdev; - struct device_node *of_node; - - /* Limit device creation to the presence of /firmware/coreboot node */ - of_node = of_find_node_by_path("/firmware/coreboot"); - if (!of_node) - return -ENODEV; - - if (!of_match_node(coreboot_of_match, of_node)) - return -ENODEV; - - pdev = of_platform_device_create(of_node, "coreboot_table_of", NULL); - if (!pdev) - return -ENODEV; - - return platform_driver_register(&coreboot_table_of_driver); -} - -module_init(platform_coreboot_table_of_init); +module_platform_driver(coreboot_table_of_driver); MODULE_AUTHOR("Google, Inc."); MODULE_LICENSE("GPL"); -- Sent by a computer through tubes