From patchwork Fri Jun 24 14:20:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 9197601 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 CE6496088F for ; Fri, 24 Jun 2016 14:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF7B7284B0 for ; Fri, 24 Jun 2016 14:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B45CE284BA; Fri, 24 Jun 2016 14:21:09 +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 5FACF284B8 for ; Fri, 24 Jun 2016 14:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751340AbcFXOU4 (ORCPT ); Fri, 24 Jun 2016 10:20:56 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35942 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbcFXOUy (ORCPT ); Fri, 24 Jun 2016 10:20:54 -0400 Received: by mail-wm0-f65.google.com with SMTP id c82so5378130wme.3; Fri, 24 Jun 2016 07:20:53 -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=VlHIiv1BokoG/h6xSjUeKO90RrQup/SOuJdMapl1uzs=; b=EPZ6LqukwPx+/YduifkdFzmHaUFPGP6GEc+1M2nzbCTswpp30+2zDfYWK0AFXvvxvE P3NxC/lpK36Q9g7gfenhbp9MktNGGpEQ8fdiFQ9YqiLPmb8O5+F2uPocdNbxnOHTmQAk vGNbjxBVZaCQdtgDRrmKf3SayAC1YbtJnhY9dijQa1hyvaZNaaRVQkr6lVh3hKgMkk7n DL3N/VtyXEWwHqJKjUqA/XqaeLDk+BowF3iA2VH6mVEqq0KEVJIK51ig7inzKudDrsVC vwyHJkA2b7Jb68PsZ9g9wLr5ni0lP9RQ8icfjuuvFME9l+lVGjvngPUuzPtM3I+xIzUO dZNg== 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=VlHIiv1BokoG/h6xSjUeKO90RrQup/SOuJdMapl1uzs=; b=R3yWuTgqdYzkx+4GSQ1741hFFBKde1D8DH5sgaYYz/HAW2ghPj+Ok+aRZrL0VQQ98Q k/RFfQmoNfvAie//fwkGyNBVTyOkjSgICzdJH6COF5QTuoPuY39E1Fmc9aCrAVoLeh6Z UOCYZDgrpFzIODyLwfguMBREIgjlfeNKCMUF/ygClRj5ILi/+BpOjC+tzp8C6Ixv/cwR uZdyiMkCHNIsNtk4a8TXDGWVgrL4v5HWK3mSESN9S0GZSu0MxBrSVEtsXuP8EsEMVhwu Ny07cXXdGrBPEqBYAtPt6gViBbAWZxfcduRzbG40njEzaB+wjPxD3fYBN8zyHNsowf9X appA== X-Gm-Message-State: ALyK8tK6mXSYrLRmTsZO2J3ZDKwUHjFo3WC3OD9BuQXGaSyw2bMjqC8e+edFK1RXwTCkOQ== X-Received: by 10.28.191.193 with SMTP id o62mr18530982wmi.64.1466778052553; Fri, 24 Jun 2016 07:20:52 -0700 (PDT) Received: from iscsi.burning-in.hell ([179.43.146.230]) by smtp.gmail.com with ESMTPSA id 124sm3369074wml.12.2016.06.24.07.20.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 07:20:51 -0700 (PDT) From: Michal Suchanek To: Greg Kroah-Hartman , Mark Brown , Ingo Molnar , Andrew Morton , Kees Cook , Thomas Gleixner , Dan Williams , Tejun Heo , "Paul E. McKenney" , Davidlohr Bueso , Andrey Ryabinin , Nikolay Aleksandrov , Dmitry Vyukov , Adrien Schildknecht , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Cc: Michal Suchanek Subject: [PATCH 1/3] spi: spidev: fix the check for spidev in dt Date: Fri, 24 Jun 2016 16:20:32 +0200 Message-Id: <8b66102e44829c5dc445c17f7bfad1050840b9f0.1466696079.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 check is supposed to warn about spidev specified directly in devicetree as compatible. This just does not work. I have a devicetree with no compatible whatsoever and hacked my kernel so I can manually bind spidev. This still triggers. Also I have no idea how this could have build with ! CONFIG_OF since the id table which the code checks is not compiled then. Signed-off-by: Michal Suchanek --- 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..8045baf 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 */