From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751438AbcFXOU4 (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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.8.1