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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 19009C4727E for ; Thu, 1 Oct 2020 16:50:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C772C20872 for ; Thu, 1 Oct 2020 16:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601571039; bh=Dy9dlPDxuVQVw0d3xH0Da7njcTBnKG0XsUS0bZZr6oQ=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=2BaH54UffBi+zCYu86MnO2u+nSUibBe8w9Dzf2poGruhWT8W1mwbsWriyE1QyuvPW Mdr2v4InADrJo8VBlV8VQ5/IB5Kw+mR1N4/eCLH/w3yGHtZo90pRG65W0B4gfYdmuq cZB5HCJ3hz5uLxHAY99qlLga1wDUPcfDr7t2m/yM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732159AbgJAQuj (ORCPT ); Thu, 1 Oct 2020 12:50:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:59934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732016AbgJAQuj (ORCPT ); Thu, 1 Oct 2020 12:50:39 -0400 Received: from localhost (170.sub-72-107-125.myvzw.com [72.107.125.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56343206B5; Thu, 1 Oct 2020 16:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601571038; bh=Dy9dlPDxuVQVw0d3xH0Da7njcTBnKG0XsUS0bZZr6oQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=J/2REUJ+GJ7O698V4SUiSQRXbIQiWfVUPSlnnnm4Wl5YtkvFQpvCiGWYsSVsgSzC/ 81150HQvrAykbuOFVZlPg+yFZiycgeir5ViJ2e8nNGeC/uU+wcTxyjsFwXctEtcoLy rnnLoioVNTeQMJTJJW0oyvFkmXFxR/hy553rvFsw= Date: Thu, 1 Oct 2020 11:50:37 -0500 From: Bjorn Helgaas To: Rob Herring Cc: Pratyush Anand , Thomas Petazzoni , Lorenzo Pieralisi , PCI Subject: Re: of_match[] warnings Message-ID: <20201001165037.GA2702236@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Oct 01, 2020 at 11:43:12AM -0500, Rob Herring wrote: > On Thu, Oct 1, 2020 at 10:53 AM Bjorn Helgaas wrote: > > > > On Thu, Oct 01, 2020 at 07:48:23AM -0500, Rob Herring wrote: > > > On Wed, Sep 30, 2020 at 5:37 PM Bjorn Helgaas wrote: > > > > > > > > These warnings are sort of annoying. I guess most of the other > > > > drivers avoid this by depending on OF as well as COMPILE_TEST. > > > > > > Using the of_match_ptr() macro should prevent this. > > > > Both drivers *do* use of_match_ptr(), but the of_device_id table is > > unused when of_match_ptr() throws away the pointer. > > Oh right, it's actually we don't want to use of_match_ptr() in this case. > > > I guess we could add __maybe_unused to squelch the warning. Ugly, but > > I do think COMPILE_TEST has some value. > > We do that or an ifdef for drivers that actually work for !OF. > > We also have lot's of 'depends on OF' as proposed too, but that's not > really my preference given we have empty functions for most > everything. So just removing of_match_ptr() as below? That seems way nicer than any of the #ifdef, __maybe_unused, or "depends on OF" options. diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c index 62846562da0b..b2ef8ffde79e 100644 --- a/drivers/pci/controller/dwc/pcie-spear13xx.c +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c @@ -303,7 +303,7 @@ static struct platform_driver spear13xx_pcie_driver = { .probe = spear13xx_pcie_probe, .driver = { .name = "spear-pcie", - .of_match_table = of_match_ptr(spear13xx_pcie_of_match), + .of_match_table = spear13xx_pcie_of_match, .suppress_bind_attrs = true, }, };