Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765669AbXIMG5M (ORCPT ); Thu, 13 Sep 2007 02:57:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759669AbXIMG45 (ORCPT ); Thu, 13 Sep 2007 02:56:57 -0400 Received: from pasmtpa.tele.dk ([80.160.77.114]:44170 "EHLO pasmtpA.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759493AbXIMG44 (ORCPT ); Thu, 13 Sep 2007 02:56:56 -0400 Date: Thu, 13 Sep 2007 08:58:19 +0200 From: Sam Ravnborg To: Alexey Dobriyan Cc: Andrew Morton , Greg KH , Jeff Garzik , Kees Cook , linux-kernel@vger.kernel.org, Ben Collins , Michael Wu Subject: Re: [PATCH] pci: fix unterminated pci_device_id lists Message-ID: <20070913065819.GA23235@uranus.ravnborg.org> References: <20070912064134.GO7910@outflux.net> <46E7C91D.3070001@garzik.org> <20070912215356.GC23294@kroah.com> <20070912160827.e359a53b.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1720 Lines: 43 On Thu, Sep 13, 2007 at 10:34:02AM +0400, Alexey Dobriyan wrote: > [non-terminated PCI ids arrays] > > Here is compile-time hack (yep, warped and whitespace damaged :)) > It's better than modpost-time hack. because it triggers earlier. > It's worse than modpost-time hack, because of tree-wide changes. > > diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c > index f4e4298..b895b5f 100644 > --- a/drivers/net/8139too.c > +++ b/drivers/net/8139too.c > @@ -237,7 +237,7 @@ static const struct { > }; > > > -static struct pci_device_id rtl8139_pci_tbl[] = { > +PCI_MODULE_DEVICE_TABLE_BEGIN(rtl8139_pci_tbl) > {0x10ec, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, > {0x10ec, 0x8138, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, > {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, > @@ -273,10 +273,7 @@ static struct pci_device_id rtl8139_pci_tbl[] = { > {PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 }, > {PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, RTL8139 }, > {PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, RTL8139 }, > - > - {0,} > -}; > -MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl); > +PCI_MODULE_DEVICE_TABLE_END Looks at bit too magic to my taste. And anyway deferring the check until modpost time should not cause troubles anyway assuming people do build their kernel after adding a device ID. And the above requires one to use the special macro in all places whereas the modpost check will catch it also for new device ID users. Sam - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/