From patchwork Mon Jun 2 13:41:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 31287 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 007D220AE6 for ; Mon, 2 Jun 2014 13:41:26 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id la4sf1880006vcb.3 for ; Mon, 02 Jun 2014 06:41:26 -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=bdN4g+NvHCpofNE5mqF2cwfEIWIhkrNb5OF7VDQ9+zU=; b=VLaXEwrWoy8o+dl2HB2G+rUWPBLgLI3N0ZvsIe47oP/w2QXGa4GXWnOV34BEOy7FXu PvjzgjWFbyTDl1sHrU2tUAeAN+8OhHeCdxlNkp7U68AYludiEr0+4xWUILwkIoPPg3+H xQ6qq86jJA2bmaseCRqixB1gjsCi4mxDOPrXFovwBhFdq5WLorFEkdHBaYaZapz60GJv x0qzWEvzs5IHuunyKBKv3VW1LTuLlv5aZsntcs33+9d7yu0SJKMFckX1KadyYaOwO3Qz 3DKY2qH3ILxkuIX5oQoGmMKLgXsPtUAC7+0HRNQ97eeca1KKMzcBB7c9f5OVdN5ap8pM lTjw== X-Gm-Message-State: ALoCoQmxLxX9witz8290JRaUAHb2YuoOE7o+TEsWviwi0BYAh6rkqw8fSL97PZL1sVRn812Ps7fn X-Received: by 10.58.18.200 with SMTP id y8mr13990024ved.20.1401716486793; Mon, 02 Jun 2014 06:41:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.85 with SMTP id 79ls2109144qgk.41.gmail; Mon, 02 Jun 2014 06:41:26 -0700 (PDT) X-Received: by 10.52.136.98 with SMTP id pz2mr426605vdb.70.1401716486699; Mon, 02 Jun 2014 06:41:26 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id og7si7884873vcb.23.2014.06.02.06.41.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 06:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id lf12so4925627vcb.31 for ; Mon, 02 Jun 2014 06:41:26 -0700 (PDT) X-Received: by 10.58.245.2 with SMTP id xk2mr30213519vec.9.1401716486628; Mon, 02 Jun 2014 06:41:26 -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.220.221.72 with SMTP id ib8csp98751vcb; Mon, 2 Jun 2014 06:41:26 -0700 (PDT) X-Received: by 10.50.79.201 with SMTP id l9mr16088433igx.11.1401716486016; Mon, 02 Jun 2014 06:41:26 -0700 (PDT) Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173]) by mx.google.com with ESMTPS id iz18si25038312icc.88.2014.06.02.06.41.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 06:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of lee.jones@linaro.org designates 209.85.223.173 as permitted sender) client-ip=209.85.223.173; Received: by mail-ie0-f173.google.com with SMTP id lx4so4476179iec.18 for ; Mon, 02 Jun 2014 06:41:25 -0700 (PDT) X-Received: by 10.50.176.167 with SMTP id cj7mr19392430igc.44.1401716485678; Mon, 02 Jun 2014 06:41:25 -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 hy3sm6561043igb.1.2014.06.02.06.41.23 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 06:41:25 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, wsa@the-dreams.de Cc: linus.walleij@linaro.org, grant.likely@linaro.org, linux-i2c@vger.kernel.org, Lee Jones Subject: [PATCH 3/3] i2c: Make I2C ID tables non-mandatory for DT'ed and/or ACPI'ed devices Date: Mon, 2 Jun 2014 14:41:03 +0100 Message-Id: <1401716463-23457-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1401716463-23457-1-git-send-email-lee.jones@linaro.org> References: <1401716463-23457-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.172 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: , Currently the I2C framework insists on devices supplying an I2C ID table. Many of the devices which do so unnecessarily adding quite a few wasted lines to kernel code. This patch allows drivers a means to 'not' supply the aforementioned table and match on either DT and/or ACPI match tables instead. Signed-off-by: Lee Jones Acked-by: Grant Likely --- drivers/i2c/i2c-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index d0c7180..811b78f 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -271,7 +271,18 @@ static int i2c_device_probe(struct device *dev) return 0; driver = to_i2c_driver(dev->driver); - if (!driver->probe || !driver->id_table) + if (!driver->probe) + return -EINVAL; + + /* + * An I2C ID table is not madatory, if and only if, a suitable Device + * Tree and/or ACPI match table entry is supplied for the probing + * device. + * + * TODO: Provide 'device type' to 'ACPI node' call and match here. + */ + if (!driver->id_table && + !of_match_device(dev->driver->of_match_table, dev)) return -ENODEV; if (!device_can_wakeup(&client->dev))