From patchwork Mon Mar 6 10:47:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9605693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A8EB601D2 for ; Mon, 6 Mar 2017 11:12:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A49120410 for ; Mon, 6 Mar 2017 11:12:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EAB32094F; Mon, 6 Mar 2017 11:12:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EB3920700 for ; Mon, 6 Mar 2017 11:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753354AbdCFLKk (ORCPT ); Mon, 6 Mar 2017 06:10:40 -0500 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:47310 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753279AbdCFLJn (ORCPT ); Mon, 6 Mar 2017 06:09:43 -0500 Received: from [109.74.48.129] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ckqAd-0006zY-HH; Mon, 06 Mar 2017 10:47:17 +0000 Received: from broonie by finisterre with local (Exim 4.89) (envelope-from ) id 1ckqAZ-0002bo-Es; Mon, 06 Mar 2017 11:47:11 +0100 From: Mark Brown To: Javier Martinez Canillas Cc: Mark Brown , linux-kernel@vger.kernel.org, Mark Brown , linux-spi@vger.kernel.org, linux-spi@vger.kernel.org In-Reply-To: <20170222181420.25420-1-javier@osg.samsung.com> Message-Id: Date: Mon, 06 Mar 2017 11:47:11 +0100 X-SA-Exim-Connect-IP: 109.74.48.129 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Applied "spi: sc18is602: Add OF device ID table" to the spi tree X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch spi: sc18is602: Add OF device ID table has been applied to the spi tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 68c97b92c0a0dfdc134564f1f1c04b1c8ed27bba Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 22 Feb 2017 15:14:20 -0300 Subject: [PATCH] spi: sc18is602: Add OF device ID table The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas Signed-off-by: Mark Brown --- drivers/spi/spi-sc18is602.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index f63714ffb62f..52cf0e9189c2 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -271,7 +272,10 @@ static int sc18is602_probe(struct i2c_client *client, hw->dev = dev; hw->ctrl = 0xff; - hw->id = id->driver_data; + if (client->dev.of_node) + hw->id = (enum chips)of_device_get_match_data(&client->dev); + else + hw->id = id->driver_data; switch (hw->id) { case sc18is602: @@ -323,9 +327,27 @@ static const struct i2c_device_id sc18is602_id[] = { }; MODULE_DEVICE_TABLE(i2c, sc18is602_id); +static const struct of_device_id sc18is602_of_match[] = { + { + .compatible = "nxp,sc18is602", + .data = (void *)sc18is602 + }, + { + .compatible = "nxp,sc18is602b", + .data = (void *)sc18is602b + }, + { + .compatible = "nxp,sc18is603", + .data = (void *)sc18is603 + }, + { }, +}; +MODULE_DEVICE_TABLE(of, sc18is602_of_match); + static struct i2c_driver sc18is602_driver = { .driver = { .name = "sc18is602", + .of_match_table = of_match_ptr(sc18is602_of_match), }, .probe = sc18is602_probe, .id_table = sc18is602_id,