From patchwork Thu Aug 28 14:35:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 383874 X-Patchwork-Delegate: wolfram@the-dreams.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 30BD214007B for ; Fri, 29 Aug 2014 00:37:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751851AbaH1OgG (ORCPT ); Thu, 28 Aug 2014 10:36:06 -0400 Received: from mail-qg0-f44.google.com ([209.85.192.44]:40264 "EHLO mail-qg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751800AbaH1OgD (ORCPT ); Thu, 28 Aug 2014 10:36:03 -0400 Received: by mail-qg0-f44.google.com with SMTP id j5so806518qga.17 for ; Thu, 28 Aug 2014 07:36:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9pFZaf5aFTttuwG5cdlNMAI/gjjSo7xky7flozuxXdc=; b=Yq7CZSNt/LnblT+7qTFJBluRS0LwoxH41vXththZj5x2a0KvvfZsAVcAVnW0UVnmqS XEM6fJ6S9hFfYKcrL+gai+XabNkrNc1p3JNlapcGHWzSCaQ+aAHeaYk0sF5h31TB9KDX dV44yn+lW5K+CgO13uPRsPhM5hcGvBZhQ74IU9GAat1k7scUjtfbgBkpfscrJXTiKOcR z7uue+MCNk+rUskOOVkw/bKdaHICpMlH7WAa16LzFnwxCSxAguyB+Jk2TvczrpYDFdrg /ANWVRfuyvf5BGuRjL08vV6+T71wjfFBA6tsFQnQeaWP6ViZ/ZuY9sQ3Np8M1m7MiIo/ vJ9A== X-Gm-Message-State: ALoCoQldv5u0aSVczGqhdDTCMWGOUiC8xK+NTDWoP5zqhuCrXCd4w/n/d2m8EStiBEPfqUtpn8Ss X-Received: by 10.229.140.70 with SMTP id h6mr7221496qcu.3.1409236562726; Thu, 28 Aug 2014 07:36:02 -0700 (PDT) Received: from localhost.localdomain (host86-152-0-170.range86-152.btcentralplus.com. [86.152.0.170]) by mx.google.com with ESMTPSA id o2sm5797541qgo.17.2014.08.28.07.36.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Aug 2014 07:36:02 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com, wsa@the-dreams.de, grant.likely@linaro.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linus.walleij@linaro.org Subject: [PATCH 5/8] i2c: Export i2c_match_id() for direct use by device drivers Date: Thu, 28 Aug 2014 15:35:35 +0100 Message-Id: <1409236538-21274-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409236538-21274-1-git-send-email-lee.jones@linaro.org> References: <1409236538-21274-1-git-send-email-lee.jones@linaro.org> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 c6013cd..7c21f49 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -80,7 +80,7 @@ void i2c_transfer_trace_unreg(void) /* ------------------------------------------------------------------------- */ -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)) @@ -93,6 +93,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 a48eadd..79b674d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -229,6 +229,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) {