From patchwork Wed Jun 4 12:09:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 31351 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97882203AC for ; Wed, 4 Jun 2014 12:10:28 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id 29sf39669143yhl.6 for ; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=tm4momEckt72k64GK9Rdq9lyoQRo5FWq0VSb87rsEX0=; b=Bm2z1mCFPKTJ1j/1b3hZR0ZoIYCI6vs5EDYUu/RE4XXiJDTBM+Ex09zIFHJ2Dawwh5 Rs29rRCwhah9QY7a4a+A+qIX6yKAGRkkMSaCXmxmEEqUk0uSA47mkw0+pDaoJKUQpOwv s4uuMj4mYY6GTq61h+8nUYDCqax9SV3h3VA4a4Qa4VW6HjVRQ2hfDcZSEl5bhqpVwJQa b2ufMFK+BrTz9KoxVWmiuqT0wPYRy/w+qYtuU57bzN1o0t/tqEMsKxeoS12yWQSe5wrG CIgIumqp+wVKvB4SpMtH0BeORIoiFr9StuxozvRTVeAggnzUtluWpU0y+UfQmHmpzuLh igyA== X-Gm-Message-State: ALoCoQkWYImFA3pKayuPzYwR22DDT6Bgy5vKz/dKlx+JBCmk0bKRKDDvievgNK1P3XWYD01ghbUh X-Received: by 10.58.219.37 with SMTP id pl5mr21729013vec.8.1401883827901; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.203 with SMTP id m69ls3041178qga.84.gmail; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) X-Received: by 10.221.27.8 with SMTP id ro8mr3246327vcb.30.1401883827759; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id ee6si1358758vec.94.2014.06.04.05.10.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id jz11so8519168veb.7 for ; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr43072164vec.9.1401883827689; Wed, 04 Jun 2014 05:10:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp39885vcb; Wed, 4 Jun 2014 05:10:27 -0700 (PDT) X-Received: by 10.14.213.193 with SMTP id a41mr686909eep.68.1401883826509; Wed, 04 Jun 2014 05:10:26 -0700 (PDT) Received: from mail-ig0-f178.google.com (mail-ig0-f178.google.com [209.85.213.178]) by mx.google.com with ESMTPS id ii4si4789637icc.34.2014.06.04.05.10.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of lee.jones@linaro.org designates 209.85.213.178 as permitted sender) client-ip=209.85.213.178; Received: by mail-ig0-f178.google.com with SMTP id h18so935818igc.5 for ; Wed, 04 Jun 2014 05:10:26 -0700 (PDT) X-Received: by 10.50.57.37 with SMTP id f5mr2253246igq.3.1401883826227; Wed, 04 Jun 2014 05:10:26 -0700 (PDT) Received: from localhost.localdomain (host109-148-113-200.range109-148.btcentralplus.com. [109.148.113.200]) by mx.google.com with ESMTPSA id on9sm10028136igb.11.2014.06.04.05.10.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:25 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: wsa@the-dreams.de, grant.likely@linaro.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linus.walleij@linaro.org, Lee Jones Subject: [PATCH 6/7] of/device: Allow I2C devices to OF match without supplying an OF node Date: Wed, 4 Jun 2014 13:09:55 +0100 Message-Id: <1401883796-17841-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401883796-17841-1-git-send-email-lee.jones@linaro.org> References: <1401883796-17841-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The I2C framework supplies a means for devices to be registered without the requirement for platform_data, DT or ACPI. The current solution is that every single I2C device in the kernel is forced to supply a normally empty/sparse I2C ID table so the I2C subsystem can match to. In an effort to a) rid the kernel of these tables and b) generify all (OF, ACPI and I2C) matching we need to provide some temporary work arounds until we can straighten out the blocking factors. This change is meant to be temporary and will be stripped out once we've converted all I2C device drivers from of_match_device() over to the new generic match_device(). Signed-off-by: Lee Jones --- drivers/of/device.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index dafb973..28913bf 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -21,9 +22,22 @@ const struct of_device_id *of_match_device(const struct of_device_id *matches, const struct device *dev) { + const struct of_device_id *match; + if ((!matches) || (!dev->of_node)) return NULL; - return of_match_node(matches, dev->of_node); + + match = of_match_node(matches, dev->of_node); + if (match) + return match; + + /* + * Low impact workaround, until we can convert all I2C compatible + * strings over to the correctly specified , format. + */ + match = i2c_of_match_device_strip_vendor(matches, (struct device *)dev); + + return match; } EXPORT_SYMBOL(of_match_device);