From patchwork Fri Sep 11 11:56:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 53444 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id BA039215BF for ; Fri, 11 Sep 2015 11:58:37 +0000 (UTC) Received: by lanb10 with SMTP id b10sf25109505lan.3 for ; Fri, 11 Sep 2015 04:58:36 -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=MHNJvDLi6/VhNu7ieA4YH4A9VLLkWcHsWEBK8UZ5PcU=; b=O1zUsDiMVBlCl2DDGs2kTZE6Q/FLQCUs0zk/vzupgNvi5E9sCWjhbudtiXW7AiUltz ONKO8ygAmL+Yg7yhlyj6UcEq0dr6osY8tTD4d9e+7AdvEeBbJwi9invTnrA55XMJadlq Uc/+B54k4vUOADBemmxlGL6CKG0mgNw4k2PkxDlhiliclEA7xiI3639JkH9jlp0wP2fL mp+TwD5UyX6a4Mu2ttNB6slDs5EKnljZjPrspT6tQ2osOgKTqnKrXn2oIml6GKJ6OdHH fVthdwCMQDHaBMv4kkT6aQrFiGHJ5qwhr/ik/gXueQc0IIBj0e5n2iBe/ku6ipxrDvQn PTpg== X-Gm-Message-State: ALoCoQn11DwsMdHXZt8g/ACsiMh1K0ePXRZTpoilkgwrmleNciUQDxplJ0o3Yzcxm93ibhvASTgr X-Received: by 10.180.81.165 with SMTP id b5mr2308849wiy.1.1441972716355; Fri, 11 Sep 2015 04:58:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.72 with SMTP id k8ls348698lam.10.gmail; Fri, 11 Sep 2015 04:58:36 -0700 (PDT) X-Received: by 10.152.23.167 with SMTP id n7mr18266920laf.18.1441972716155; Fri, 11 Sep 2015 04:58:36 -0700 (PDT) Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com. [2a00:1450:4010:c04::233]) by mx.google.com with ESMTPS id r5si764695lbw.126.2015.09.11.04.58.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 04:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::233 as permitted sender) client-ip=2a00:1450:4010:c04::233; Received: by lbbmp1 with SMTP id mp1so38307996lbb.1 for ; Fri, 11 Sep 2015 04:58:36 -0700 (PDT) X-Received: by 10.112.168.66 with SMTP id zu2mr30744426lbb.29.1441972715941; Fri, 11 Sep 2015 04:58:35 -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 w3csp1542058lbq; Fri, 11 Sep 2015 04:58:34 -0700 (PDT) X-Received: by 10.107.47.219 with SMTP id v88mr2966352iov.134.1441972713114; Fri, 11 Sep 2015 04:58:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si139331iod.80.2015.09.11.04.58.32; Fri, 11 Sep 2015 04:58:33 -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 S1752812AbbIKL54 (ORCPT + 28 others); Fri, 11 Sep 2015 07:57:56 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:34333 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbbIKL5x (ORCPT ); Fri, 11 Sep 2015 07:57:53 -0400 Received: by wicfx3 with SMTP id fx3so61312549wic.1; Fri, 11 Sep 2015 04:57:51 -0700 (PDT) X-Received: by 10.194.7.197 with SMTP id l5mr87024979wja.153.1441972671669; Fri, 11 Sep 2015 04:57:51 -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 wj4sm25354wjb.10.2015.09.11.04.57.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Sep 2015 04:57:50 -0700 (PDT) From: Kieran Bingham To: Wolfram Sang , Samuel Ortiz , Lee Jones Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, grant.likely@linaro.org, javier@osg.samsung.com, Kieran Bingham Subject: [RESEND PATCH v4 5/8] i2c: Export i2c_match_id() for direct use by device drivers Date: Fri, 11 Sep 2015 12:56:01 +0100 Message-Id: <1441972564-9621-6-git-send-email-kieranbingham@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441972564-9621-1-git-send-email-kieranbingham@gmail.com> References: <1441972564-9621-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::233 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 Signed-off-by: Kieran Bingham --- 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..787066b 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) {