From patchwork Fri Dec 1 11:10:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 10086867 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 B1D3E603B4 for ; Fri, 1 Dec 2017 11:11:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F2792A44C for ; Fri, 1 Dec 2017 11:11:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 936AC2A452; Fri, 1 Dec 2017 11:11:23 +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=ham 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 B94FF2A44C for ; Fri, 1 Dec 2017 11:11:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752312AbdLALLT (ORCPT ); Fri, 1 Dec 2017 06:11:19 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34444 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752325AbdLALLN (ORCPT ); Fri, 1 Dec 2017 06:11:13 -0500 Received: by mail-wr0-f193.google.com with SMTP id y21so9665475wrc.1 for ; Fri, 01 Dec 2017 03:11:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ajjPbUBdY0ydXBoa9hvk1nPIhE1DUGBJHfvokUbgDAc=; b=LfTuJgdFF8N6VTIhYF5nWdUVHQVPTLUKC7gJjK7hNz4GkIIYYNL0I7RR+/LkZSFnVi rpxAlxPkF5fl+fwls2Od6euFQF4mNoN5pqOgIFPPJ1eD118fae7cr7ibxq6qCO4rb3P3 fX3gTFDCJBErrLb3SAvcjvTvKUVLxWvHXClD5aMEZR88pdruXqqHM7vvUEIYMGpl9sZn g+/5XOEaWb/jfNwQFgljqK7GYMaDpQr1wht3YmIPd93XVRgPaPFmcreI+gl7nGbekMLR P91DGieTQT916M54+840ABGpXiaq3c+F+FrnaF1eHtjnBTcC8XFj92IJvSS1X6CvyN3B 4oyg== X-Gm-Message-State: AJaThX7lN3Fk8sHkkOQIBV2pWIgGqdFgcMrfieLcuRRm4ncFNqLfpB+F S8uA/hvEAULd7qOfTDEwZqs+Kw== X-Google-Smtp-Source: AGs4zMbrP+fFsE3mXmarBA7A3NXG4OCYVjaAfpEgvb0cFDiTQojDgR6xLnJs5iFlYhEU/bC8hevF8w== X-Received: by 10.223.134.75 with SMTP id 11mr5160619wrw.37.1512126672407; Fri, 01 Dec 2017 03:11:12 -0800 (PST) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id 189sm926613wmu.3.2017.12.01.03.11.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Dec 2017 03:11:11 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , Hartmut Knaack , Hans de Goede , linux-iio@vger.kernel.org, Lars-Peter Clausen , Jonathan Cameron , Peter Meerwald-Stadler Subject: [PATCH] iio: accel: bmc150: Add OF device ID table Date: Fri, 1 Dec 2017 12:10:58 +0100 Message-Id: <20171201111058.13483-1-javierm@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. The I2C device ID table entries have the .driver_data field set, but they are not used in the driver so weren't set in the OF device table entries. Signed-off-by: Javier Martinez Canillas --- drivers/iio/accel/bmc150-accel-i2c.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c index f85014fbaa12..8ffc308d5fd0 100644 --- a/drivers/iio/accel/bmc150-accel-i2c.c +++ b/drivers/iio/accel/bmc150-accel-i2c.c @@ -81,9 +81,21 @@ static const struct i2c_device_id bmc150_accel_id[] = { MODULE_DEVICE_TABLE(i2c, bmc150_accel_id); +static const struct of_device_id bmc150_accel_of_match[] = { + { .compatible = "bosch,bmc150_accel" }, + { .compatible = "bosch,bmi055_accel" }, + { .compatible = "bosch,bma255" }, + { .compatible = "bosch,bma250e" }, + { .compatible = "bosch,bma222e" }, + { .compatible = "bosch,bma280" }, + { }, +}; +MODULE_DEVICE_TABLE(of, bmc150_accel_of_match); + static struct i2c_driver bmc150_accel_driver = { .driver = { .name = "bmc150_accel_i2c", + .of_match_table = bmc150_accel_of_match, .acpi_match_table = ACPI_PTR(bmc150_accel_acpi_match), .pm = &bmc150_accel_pm_ops, },