From patchwork Mon Jun 27 19:02:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 9201131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86EB360757 for ; Mon, 27 Jun 2016 19:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78C0D285BB for ; Mon, 27 Jun 2016 19:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D9A2285BD; Mon, 27 Jun 2016 19:03:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C55B0285BC for ; Mon, 27 Jun 2016 19:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751644AbcF0TCk (ORCPT ); Mon, 27 Jun 2016 15:02:40 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35289 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751951AbcF0TCj (ORCPT ); Mon, 27 Jun 2016 15:02:39 -0400 Received: by mail-wm0-f66.google.com with SMTP id a66so27202757wme.2; Mon, 27 Jun 2016 12:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=gCz1BJkN/TNuUpVXMfSeuhGutUTyEVL+aE1AlCxMlPk=; b=r8M6k2CQ7APiMDzgwKi9LASlgBT4RE6R+stP5q4uarPNRh/thkWE1HJsgVcDuKt17g hSGnSEGOp2c8kfIxoHEZVe5LzNw+mg3DDeRVPwFn0siG6CUQJTmTh75PPMmpjsryhPsr 2J923ua6F8bBtarzh2vS+utBOezp29BXv1QajCEPmILMqm89S+fB5Ysy7fodWyECGCUH 2BeI3uk8fmHHb7l4aTSc8bVojSRVHBowLGVSG0RoOjj3iv4hYkPeD+kVZU/muBk6Plak /vpR8+sSaFD7mD1yvF2/gbRJTfnbB3OtfePNm68RZ30UCOnHDsHr8SHR11iwaVS5WsG0 fqFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=gCz1BJkN/TNuUpVXMfSeuhGutUTyEVL+aE1AlCxMlPk=; b=UfRfPKnGj4WuR46LwMWdIw2l+ORbRXMMfC08+LGnCg2oQySzqOi3fst2YV4EHvqPzv k25pMHbhmFxPaKcOqBR+ei2EvaA6liX0pn9aPKNqxzfv3XRI+ItJ9GwXMhHIcHugDIi/ rQX4qAvdRc172jhobcT3KOBdqGSoQbrz0aWmUOsxfewXSAKcpDoys45DRNrLZr+3xlXL 6IAdI489/qApreSrgdlZCgexHnaFZq470GH/KffxynnAsWqf9rqvevxSLE0U9ynlTDcO qHX/mI7jQvjBTY2yVXOQrVgtoQDMRaP66lmfKp3mnERlW/0OSjHgaQ0rU+m9ksRS9lWH MnIQ== X-Gm-Message-State: ALyK8tIbSQpV8fU92ibFfaTD7yZe+Grl2tLTtT84iucyLnzWrCwjC5w1fwzzpMeeJ4bUCg== X-Received: by 10.28.154.214 with SMTP id c205mr12516300wme.9.1467054157618; Mon, 27 Jun 2016 12:02:37 -0700 (PDT) Received: from iscsi.burning-in.hell (2-166-195-217.cust.centrio.cz. [217.195.166.2]) by smtp.gmail.com with ESMTPSA id zg10sm3278760wjb.1.2016.06.27.12.02.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2016 12:02:36 -0700 (PDT) From: Michal Suchanek To: Greg Kroah-Hartman , Mark Brown , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Michal Suchanek Subject: [PATCH v2 1/3] spi: spidev: fix the check for spidev in dt Date: Mon, 27 Jun 2016 21:02:30 +0200 Message-Id: <0123f28025f0a29a0771a43397ad14259a2094b7.1467053363.git.hramrach@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error message is "buggy DT: spidev listed directly in DT\n" That's not what the check does. It checks that one if the IDs listed in the driver match table matches what is set on the DT node. This does not work if you manage to convince the kernel to bind spidev on a node that has some other random compatible which is not "spidev". Also the spidev id match table is not compiled when !CONFIG_OF So add a match table that has just "spidev" entry in it so it can reliably detect what this message is supposed to warn about. Signed-off-by: Michal Suchanek --- - fix indent - update commit mesage --- drivers/spi/spidev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index e3c19f3..3c6ebe7 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -700,6 +700,11 @@ static const struct of_device_id spidev_dt_ids[] = { MODULE_DEVICE_TABLE(of, spidev_dt_ids); #endif +static const struct of_device_id spidev_check[] = { + { .compatible = "spidev" }, + {} +}; + /*-------------------------------------------------------------------------*/ static int spidev_probe(struct spi_device *spi) @@ -713,10 +718,10 @@ static int spidev_probe(struct spi_device *spi) * compatible string, it is a Linux implementation thing * rather than a description of the hardware. */ - if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) { + if (spi->dev.of_node && of_match_device(spidev_check, &spi->dev)) { dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n"); WARN_ON(spi->dev.of_node && - !of_match_device(spidev_dt_ids, &spi->dev)); + of_match_device(spidev_check, &spi->dev)); } /* Allocate driver data */