From patchwork Fri Jun 6 15:52:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 356906 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 D3BFC1400E4 for ; Sat, 7 Jun 2014 01:54:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752597AbaFFPxB (ORCPT ); Fri, 6 Jun 2014 11:53:01 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:51952 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752583AbaFFPw7 (ORCPT ); Fri, 6 Jun 2014 11:52:59 -0400 Received: by mail-ie0-f172.google.com with SMTP id at1so2487900iec.17 for ; Fri, 06 Jun 2014 08:52: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=u4ksBTwaCd2S0o6izwQk7htQ5cYQg0FhgmiefEO9vRk=; b=kouBEE/8LF14MeRT3AZ1juDqnB69bmajhZ8GdQsp24i3hhdTXiTFBGwhxtafvD/+aM DMlwc6drnyfjBNKH4otUcjfT2CbpKbZeiNIZhCQfkMLGash9s4x/5QD3s7xWhuD0KZt/ vNlE3mVIwnDx6Z5v490z3/ZWDjrAmJtyd+o9P2k6Aji+UE73yVLv+8KKyoJMC8OY6gR1 knWLypw8Trd6v6CuuNlsTkVY9yr+6Nj+f+jM3cZpwLchGs+QB9NDeWtkRKyTGkO02TsN 5fWaxvNAMkwm1x/bSSbxDS6HHq6ljz40BsNHGqy4k3j4l8YqvLpV9Yz+BtqVk1aua8sy +oVQ== X-Gm-Message-State: ALoCoQl9foi0+HSJJO1XDE1ihuN+Ld5MkY/XfLgL90FWc42QbmmBJ+JUubrqr9LW5aJrLC6DM214 X-Received: by 10.50.4.5 with SMTP id g5mr7465922igg.14.1402069978716; Fri, 06 Jun 2014 08:52:58 -0700 (PDT) Received: from localhost.localdomain (host86-181-29-77.range86-181.btcentralplus.com. [86.181.29.77]) by mx.google.com with ESMTPSA id j1sm27388094ige.0.2014.06.06.08.52.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Jun 2014 08:52:58 -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, linus.walleij@linaro.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, Lee Jones Subject: [PATCH 5/9] i2c: Export i2c_match_id() for direct use by device drivers Date: Fri, 6 Jun 2014 16:52:28 +0100 Message-Id: <1402069952-28022-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1402069952-28022-1-git-send-email-lee.jones@linaro.org> References: <1402069952-28022-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. 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 3507087..3fe8232 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -79,7 +79,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)) @@ -92,6 +92,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 ab5866f..9d36f86 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) {