From patchwork Thu Mar 17 08:47:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 652 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:44:22 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs33350ybj; Thu, 17 Mar 2011 01:47:38 -0700 (PDT) Received: by 10.42.147.9 with SMTP id l9mr1467750icv.476.1300351657956; Thu, 17 Mar 2011 01:47:37 -0700 (PDT) Received: from mail-iw0-f178.google.com (mail-iw0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id we8si4733548icb.37.2011.03.17.01.47.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Mar 2011 01:47:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linus.ml.walleij@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=linus.ml.walleij@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by iwn9 with SMTP id 9so3237352iwn.37 for ; Thu, 17 Mar 2011 01:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=FLz6LR/Fqwvjoft4+HUys54QZMOZV+YEYvHQ41es7co=; b=FEB9+dOQjZ0e+/O5m/OWF06DVVIHTfAMexOI76szNXc7vwhMLqS5+Nnr2BYG6JCKIH IE3GR/LwD0TUJSyxAarAcl6t8pm7GzAp6IjkC2hiIbfvXok452um7wyS3VZ4N1UuZ/Cu 0fUZZD45BSNbvobGcb7fqVerha1ks+vpcRVPM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Q8C0VSdd4NS3PhNWofN403fRaMg8ygK0qfvfkvXExN2NP7tl+ca8ZbGUGIVedYHuCM /2IPi85CRa49gDLgfCfX5OfxHp8tqmk2iMxC7qhYK9dQPq38zgaSCPQKLZlOC8fg9Mnp ftJPVFWaN1zGlCXE1rYibdLcY8JNpc7ry/HpE= MIME-Version: 1.0 Received: by 10.231.210.68 with SMTP id gj4mr980187ibb.7.1300351655960; Thu, 17 Mar 2011 01:47:35 -0700 (PDT) Sender: linus.ml.walleij@gmail.com Received: by 10.231.18.204 with HTTP; Thu, 17 Mar 2011 01:47:35 -0700 (PDT) In-Reply-To: <20110315144925.GG3921@n2100.arm.linux.org.uk> References: <1300200116-12185-1-git-send-email-philippe.langlais@stericsson.com> <1300200116-12185-2-git-send-email-philippe.langlais@stericsson.com> <20110315144925.GG3921@n2100.arm.linux.org.uk> Date: Thu, 17 Mar 2011 09:47:35 +0100 X-Google-Sender-Auth: d9ba66wROMpYPdQyiYb0yOLNYR0 Message-ID: Subject: Re: [PATCH 1/4] amba: add name based matching From: Linus Walleij To: Russell King - ARM Linux Cc: Philippe Langlais , STEricsson_nomadik_linux@list.st.com, st-ericsson@lists.linaro.org, Rabin Vincent , linux-arm-kernel@lists.infradead.org, patches@linaro.org 2011/3/15 Russell King - ARM Linux : > I really hate the idea of matching AMBA stuff by name.  Isn't there any > other solution to this? What do you think about this: * and use this for iomap @@ -643,6 +647,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) if (ret) goto err_release; + skip_probe: ret = device_add(&dev->dev); if (ret) goto err_release; This way, if we hardcode periphid in the platform, it will take precedence. Currently hardware will override such hard-codec values. There are a few instances using this in the kernel I think, but to my memory they are all of the type where the hardcoded number and the ID found in hardware are actually identical, and eiher make no harm or should be patched away with. Yours, Linus Walleij diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 6d2bb25..fcf355c 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -603,6 +603,10 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) if (ret) goto err_out; + /* Hard-coded primecell ID instead of plug-n-play */ + if (dev->periphid != 0) + goto skip_probe; + /* * Dynamically calculate the size of the resource