From patchwork Wed Sep 9 18:33:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 53328 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id D091422B05 for ; Wed, 9 Sep 2015 18:34:59 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf6409406lbb.3 for ; Wed, 09 Sep 2015 11:34:58 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=otJbRBj2Liu7mY9zq4YTUNUQ0o9y9y43HndxXvc09Ic=; b=DPIJAF7HMLjYndeAclcZJz3Swu5/T/CFgg5LkxPfSJ93kHPPAPxsK6515oZo4ZR4r0 sHWqxWkTKOLRtitOans9TtN4oZngyID7ujDrwHeULyIabH6+LAQltXJbJ8RiiGbXKLhW KtyK4trojG55I2s0z656qD539O/fSfwDMcZSa4KITewWywA8OKGpm9yHUnRaj0+sLGzT yMkI9finBRhKe6ITjeBufk70O+NteLRZXoBI7+Z4NsZ0ZDHH7I1VOwLT8HRQpjZg/DFf VQ/VuXnVJV1Shwx5RdhPP6k0o5BPl8uBns9nW8DmtLhDn4lYj7IZEtuU0mxslVt0dqdG u95A== X-Gm-Message-State: ALoCoQndS1vwB6M+DcMm7KK7iahbxzpTCK8lJyAe8xeY4Q7ySigfl7PWt0o+FCRWRz1HLf4kE0HI X-Received: by 10.180.188.211 with SMTP id gc19mr5553311wic.6.1441823698886; Wed, 09 Sep 2015 11:34:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.102 with SMTP id db6ls91549lad.70.gmail; Wed, 09 Sep 2015 11:34:58 -0700 (PDT) X-Received: by 10.112.85.204 with SMTP id j12mr29694091lbz.47.1441823698530; Wed, 09 Sep 2015 11:34:58 -0700 (PDT) Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com. [2a00:1450:4010:c04::22a]) by mx.google.com with ESMTPS id wu8si7486575lbb.57.2015.09.09.11.34.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Sep 2015 11:34:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22a as permitted sender) client-ip=2a00:1450:4010:c04::22a; Received: by lbcjc2 with SMTP id jc2so10785488lbc.0 for ; Wed, 09 Sep 2015 11:34:58 -0700 (PDT) X-Received: by 10.152.170.230 with SMTP id ap6mr30591968lac.73.1441823698423; Wed, 09 Sep 2015 11:34:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp492195lbq; Wed, 9 Sep 2015 11:34:57 -0700 (PDT) X-Received: by 10.68.68.134 with SMTP id w6mr1288882pbt.61.1441823695834; Wed, 09 Sep 2015 11:34:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qu10si2304353pbb.181.2015.09.09.11.34.54; Wed, 09 Sep 2015 11:34:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755043AbbIISep (ORCPT + 28 others); Wed, 9 Sep 2015 14:34:45 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:34571 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754862AbbIISeb (ORCPT ); Wed, 9 Sep 2015 14:34:31 -0400 Received: by wicfx3 with SMTP id fx3so1572768wic.1; Wed, 09 Sep 2015 11:34:30 -0700 (PDT) X-Received: by 10.180.86.137 with SMTP id p9mr59141780wiz.38.1441823670577; Wed, 09 Sep 2015 11:34:30 -0700 (PDT) Received: from localhost.localdomain (cpc17-aztw24-2-0-cust759.aztw.cable.virginm.net. [92.237.134.248]) by smtp.gmail.com with ESMTPSA id u1sm5155141wiz.22.2015.09.09.11.34.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Sep 2015 11:34:29 -0700 (PDT) From: Kieran Bingham To: Wolfram Sang , Samuel Ortiz , Lee Jones Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, grant.likely@linaro.org Subject: [PATCH v4 5/8] i2c: Export i2c_match_id() for direct use by device drivers Date: Wed, 9 Sep 2015 19:33:44 +0100 Message-Id: <1441823627-6227-6-git-send-email-kieranbingham@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441823627-6227-1-git-send-email-kieranbingham@gmail.com> References: <1441823627-6227-1-git-send-email-kieranbingham@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: kieranbingham@gmail.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22a as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@gmail.com; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Lee Jones When there was no other way to match a I2C device to driver i2c_match_id() was exclusively used. However, now there are other types of tables which are commonly supplied, matching on an i2c_device_id table is used less frequently. Instead of _always_ calling i2c_match_id() from within the framework, we only need to do so from drivers which have no other way of matching. This patch makes i2c_match_id() available to the aforementioned device drivers. Acked-by: Grant Likely Signed-off-by: Lee Jones --- drivers/i2c/i2c-core.c | 3 ++- include/linux/i2c.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2ebc64d..0e40136 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -447,7 +447,7 @@ static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) /* ------------------------------------------------------------------------- */ -static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, +const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, const struct i2c_client *client) { if (!(id && client)) @@ -460,6 +460,7 @@ static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, } return NULL; } +EXPORT_SYMBOL_GPL(i2c_match_id); static int i2c_device_match(struct device *dev, struct device_driver *drv) { diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 48bbbab..126585c 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -232,6 +232,8 @@ struct i2c_client { extern struct i2c_client *i2c_verify_client(struct device *dev); extern struct i2c_adapter *i2c_verify_adapter(struct device *dev); +extern const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, + const struct i2c_client *client); static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) {