From patchwork Fri Jun 6 15:52:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 31498 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0AA41202DA for ; Fri, 6 Jun 2014 15:53:05 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lc6sf12325611vcb.2 for ; Fri, 06 Jun 2014 08:53:04 -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=6egDI31QpvjPW3gZruYSf3wp6NhwXLppKqV/o4ZtVYA=; b=DtYcyzyV70SXVZk4rZE3Pc5YSg0MrCxUYcKrqbGs4PWcxM4KyYdfPKY6cWy0jNJUxl qa7hLjmaNTqOt/dg7I71SR4cBRRlkjrAT0m2I7AHxdl/+9L+DS9gFxQn1Q5bCg1PRqBJ byR6quMW8EHUpwMJ4p8yI9RZsmmu2CweaCTYXwzemV25Ubo+KdQCqceHTjJPKDnimp54 OydSZ/eAFHLe1AP18nwl5NczloCyxRbe6WDcNztV+Y2SSX8ucTPjSaxAluuXQA0LMNZo uUBVnYGKhEXqAfAvL0UYXs9fUDHfZ8Y7EQPNmehaYYSrdBmoST8aRJJvPBmQPJlIPZON AUpA== X-Gm-Message-State: ALoCoQnofm/CNMch5qhbAp/MQocK52BSXDsCrH+muAuO4bkpc5tGrnnPyWISb6VoTH5QjtHxwj4D X-Received: by 10.52.175.3 with SMTP id bw3mr3034602vdc.5.1402069984827; Fri, 06 Jun 2014 08:53:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.239 with SMTP id l102ls769552qgd.81.gmail; Fri, 06 Jun 2014 08:53:04 -0700 (PDT) X-Received: by 10.58.246.164 with SMTP id xx4mr4678981vec.52.1402069984709; Fri, 06 Jun 2014 08:53:04 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id ee6si6667105vec.94.2014.06.06.08.53.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 08:53:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ik5so3251827vcb.32 for ; Fri, 06 Jun 2014 08:53:04 -0700 (PDT) X-Received: by 10.58.185.165 with SMTP id fd5mr4425754vec.41.1402069984637; Fri, 06 Jun 2014 08:53:04 -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 vs6csp115262vcb; Fri, 6 Jun 2014 08:53:04 -0700 (PDT) X-Received: by 10.50.178.203 with SMTP id da11mr7495023igc.0.1402069983997; Fri, 06 Jun 2014 08:53:03 -0700 (PDT) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by mx.google.com with ESMTPS id f17si48506463igt.12.2014.06.06.08.53.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 08:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of lee.jones@linaro.org designates 209.85.223.177 as permitted sender) client-ip=209.85.223.177; Received: by mail-ie0-f177.google.com with SMTP id tp5so1035311ieb.22 for ; Fri, 06 Jun 2014 08:53:03 -0700 (PDT) X-Received: by 10.50.46.35 with SMTP id s3mr7468721igm.40.1402069983776; Fri, 06 Jun 2014 08:53:03 -0700 (PDT) Received: from localhost.localdomain (host86-181-29-77.range86-181.btcentralplus.com. [86.181.29.77]) by mx.google.com with ESMTPSA id j1sm27388094ige.0.2014.06.06.08.53.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 08:53:03 -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, linus.walleij@linaro.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, Lee Jones Subject: [PATCH 7/9] of/device: Allow I2C devices to OF match without supplying an OF node Date: Fri, 6 Jun 2014 16:52:30 +0100 Message-Id: <1402069952-28022-8-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1402069952-28022-1-git-send-email-lee.jones@linaro.org> References: <1402069952-28022-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.220.173 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 rid the kernel of these tables 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 I2C generic i2c_of_match_device(). Signed-off-by: Lee Jones --- drivers/of/device.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index dafb973..3b1c8f9 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,25 @@ 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); + if (match) + dev_warn(dev, + "WARNING: Vendor ID missing from compatible string\n"); + + return match; } EXPORT_SYMBOL(of_match_device);