From patchwork Wed Jun 4 12:09:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 31350 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2EFE0203AC for ; Wed, 4 Jun 2014 12:10:25 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 200sf21150779ykr.2 for ; Wed, 04 Jun 2014 05:10:24 -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=YvuDXm61TdqGTTCJJDDz0A3uh4L154Ih0wMRsROSZqs=; b=MhRAVzNcTD2di3gRvj/3Q1xk/PTjvdx69jcd2FUl9yN254DiFgCdf5qVEkdxsmnDuv qKI+TTajkJNYIxWzMOwFRxXuW/+UiyY5tOuIf64r4ityRk/BEojcvvWGYQW7Av9+u41M vGqSnYlWW9+bgidsnb2n1I6M0HigRDuPFBrFL+IiTdq5C3ef6gWabsaANXraPkg+VsSf 4TYYB+1cHXsSED3ayBVMv73TiY+Aw4g0KGd2ad7KFXlPwzXbdE5HJcNNTGuVd5MatHni yppvW+9LnBGWsnuDOizU29y/dX3E6YrtQAiWoPqxTkwPpIwAPDlYqxNIj4y0NpMSE1Za acew== X-Gm-Message-State: ALoCoQk54Xp3y2TTVBgvMz/gjlzhq8b4UTCGJ0Fcyk1J7fm99pwt1yN3dAyqLYNaUyuCCoARMGQZ X-Received: by 10.58.219.37 with SMTP id pl5mr21728887vec.8.1401883824885; Wed, 04 Jun 2014 05:10:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.203 with SMTP id h69ls3166430qgh.56.gmail; Wed, 04 Jun 2014 05:10:24 -0700 (PDT) X-Received: by 10.220.64.138 with SMTP id e10mr1243126vci.63.1401883824763; Wed, 04 Jun 2014 05:10:24 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id fe3si1372178vec.43.2014.06.04.05.10.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.178 as permitted sender) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id sa20so8615240veb.37 for ; Wed, 04 Jun 2014 05:10:24 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr509137vec.80.1401883824686; Wed, 04 Jun 2014 05:10:24 -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 vs6csp39882vcb; Wed, 4 Jun 2014 05:10:24 -0700 (PDT) X-Received: by 10.50.97.68 with SMTP id dy4mr6650645igb.8.1401883823978; Wed, 04 Jun 2014 05:10:23 -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 h5si9124154igg.14.2014.06.04.05.10.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:23 -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 lx4so7167785iec.32 for ; Wed, 04 Jun 2014 05:10:23 -0700 (PDT) X-Received: by 10.50.25.71 with SMTP id a7mr6454263igg.17.1401883823769; Wed, 04 Jun 2014 05:10:23 -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.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 05:10:23 -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 5/7] i2c: Make I2C ID tables non-mandatory for DT'ed and/or ACPI'ed devices Date: Wed, 4 Jun 2014 13:09:54 +0100 Message-Id: <1401883796-17841-6-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.178 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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index e8c2cba..71970da 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -100,7 +100,7 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) /* Attempt an OF style match */ - if (of_driver_match_device(dev, drv)) + if (i2c_of_match_device(drv->of_match_table, dev)) return 1; /* Then ACPI style match */ @@ -268,7 +268,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 mandatory, 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 && + !i2c_of_match_device(dev->driver->of_match_table, dev)) return -ENODEV; if (!device_can_wakeup(&client->dev))