From patchwork Thu Nov 30 18:12:57 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: 10085517 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 0FDB16035E for ; Thu, 30 Nov 2017 18:13:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0A1E2A216 for ; Thu, 30 Nov 2017 18:13:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2D6C2A220; Thu, 30 Nov 2017 18:13:02 +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 8C98B2A216 for ; Thu, 30 Nov 2017 18:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751779AbdK3SNB (ORCPT ); Thu, 30 Nov 2017 13:13:01 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:43110 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267AbdK3SNA (ORCPT ); Thu, 30 Nov 2017 13:13:00 -0500 Received: by mail-wm0-f66.google.com with SMTP id n138so3766017wmg.2 for ; Thu, 30 Nov 2017 10:13:00 -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=glIzbFEfNJODnRj/H8d8afs61SuWOXktEsbWejuSO74=; b=uY0heP16JMMMAQOL18li6dt56ChDwUj2hCk3qfdKsHl8kM1I6CSqWKG6Byvoxd6Qwn hPww47zB/VU5MBXLCu5B+ww9tAxl608dQnbIt2VBIKUeiPM+BnW7gJweaydmsII6oh8s rC2DBKxwqct1zyTAkVc7lB+fum2pBBWDvCYtQ0+eTWD+GgM5+cM5kwQnR4qFED2Z0Hdy c8Bqr+5/QyGOqXXsjbUBuZQdJq98QSOQ4QxHLHPVnxHUu0VRUDPpW2h9GaM5uBIQjuxj frKrFgk7t15nD2d/afB7rQOE9Pf+Ldt+w9teq4W9iBJJ48+mmkrLoS49se+LuSnObioG Bg8A== X-Gm-Message-State: AJaThX5pVKxSrJbzge8qIQ9Qucn9Xx+kjkLgmHoUft/BNPZlAh5ZgfcB umGOe8o1kBMEVAV0K5lj0JUNKQ== X-Google-Smtp-Source: AGs4zMZMJd2BAPVpLrSlT5SpxX63O0tPqBdCYKCsV4X75tIXIELi1sHFwmDol8WGYz6SM5ZKcm8zOw== X-Received: by 10.28.63.141 with SMTP id m135mr2794818wma.72.1512065579810; Thu, 30 Nov 2017 10:12:59 -0800 (PST) Received: from minerva.redhat.com ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id m11sm2986579wrf.56.2017.11.30.10.12.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Nov 2017 10:12:59 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , linux-hwmon@vger.kernel.org, Jean Delvare , Guenter Roeck Subject: [PATCH] hwmon: (max31785) Add OF device ID table Date: Thu, 30 Nov 2017 19:12:57 +0100 Message-Id: <20171130181257.3352-1-javierm@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@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. Before this patch: $ modinfo drivers/hwmon/pmbus/max31785.ko | grep alias alias: i2c:max31785a alias: i2c:max31785 After this patch: $ modinfo drivers/hwmon/pmbus/max31785.ko | grep alias alias: i2c:max31785a alias: i2c:max31785 alias: of:N*T*Cmaxim,max31785aC* alias: of:N*T*Cmaxim,max31785a alias: of:N*T*Cmaxim,max31785C* alias: of:N*T*Cmaxim,max31785 Signed-off-by: Javier Martinez Canillas --- drivers/hwmon/pmbus/max31785.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c index 9313849d5160..4666b5e95159 100644 --- a/drivers/hwmon/pmbus/max31785.c +++ b/drivers/hwmon/pmbus/max31785.c @@ -100,9 +100,18 @@ static const struct i2c_device_id max31785_id[] = { MODULE_DEVICE_TABLE(i2c, max31785_id); +static const struct of_device_id max31785_of_match[] = { + { .compatible = "maxim,max31785" }, + { .compatible = "maxim,max31785a" }, + { }, +}; + +MODULE_DEVICE_TABLE(of, max31785_of_match); + static struct i2c_driver max31785_driver = { .driver = { .name = "max31785", + .of_match_table = max31785_of_match, }, .probe = max31785_probe, .remove = pmbus_do_remove,