From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AD75C43331 for ; Wed, 13 Nov 2019 02:02:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64DA8206B6 for ; Wed, 13 Nov 2019 02:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573610576; bh=W+ZYmJ3tALheWbUv4P01KUCmLl9oUrjKMEXFXL+OArg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nfBSSe+XmNa72ITLdemxZQTEH2b6axF/nK1D7V0QFYlNY5SaOm3zt96xZzkSGcEyG q5SZe20Pd4qzeOI+sdXEEGMSaszyA1wmH+JeZe7OPlsHnomAo3Oo6heu1DvMm6Cc9P l9V3y3MQ1krajMKF1ZpXq6FeEezHbwiWDwPO7a4c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730241AbfKMCCz (ORCPT ); Tue, 12 Nov 2019 21:02:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:59632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731068AbfKMCCp (ORCPT ); Tue, 12 Nov 2019 21:02:45 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 035C420674; Wed, 13 Nov 2019 02:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573610564; bh=W+ZYmJ3tALheWbUv4P01KUCmLl9oUrjKMEXFXL+OArg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z2+wH2FVUoUd5TeBBi0Un5L/D2dFDUCNh0yFPyzlQnqrRfaHTG9hr15sh+08r9D20 XJyoRylUg4B+uhIwJkAbC6OZteTcFz2Jpx8ELHedcZZDOG/3SKPyVsgrE1X23Qd2z6 pQ2KlrZV8UzVK7vxpeZBd/ND+avujTO83kHdoFIs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Trent Piepho , =?UTF-8?q?Jan=20Kundr=C3=83=C2=A1t?= , Geert Uytterhoeven , Mark Brown , Sasha Levin , linux-spi@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 43/48] spi: spidev: Fix OF tree warning logic Date: Tue, 12 Nov 2019 21:01:26 -0500 Message-Id: <20191113020131.13356-43-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191113020131.13356-1-sashal@kernel.org> References: <20191113020131.13356-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trent Piepho [ Upstream commit 605b3bec73cbd74b4ac937b580cd0b47d1300484 ] spidev will make a big fuss if a device tree node binds a device by using "spidev" as the node's compatible property. However, the logic for this isn't looking for "spidev" in the compatible, but rather checking that the device is NOT compatible with spidev's list of devices. This causes a false positive if a device not named "rohm,dh2228fv", etc. binds to spidev, even if a means other than putting "spidev" in the device tree was used. E.g., the sysfs driver_override attribute. Signed-off-by: Trent Piepho Reviewed-by: Jan Kundrát Tested-by: Jan Kundrát Reviewed-by: Geert Uytterhoeven Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spidev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index d0e7dfc647cf2..c5f1045561acc 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -713,11 +713,9 @@ 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)) { - 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)); - } + WARN(spi->dev.of_node && + of_device_is_compatible(spi->dev.of_node, "spidev"), + "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node); /* Allocate driver data */ spidev = kzalloc(sizeof(*spidev), GFP_KERNEL); -- 2.20.1