From patchwork Thu Jul 30 16:18:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 6904301 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3AA87C05AC for ; Thu, 30 Jul 2015 16:28:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B1AA20494 for ; Thu, 30 Jul 2015 16:28:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2901B203E5 for ; Thu, 30 Jul 2015 16:28:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4B55526656B; Thu, 30 Jul 2015 18:28:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id F2678265DEA; Thu, 30 Jul 2015 18:22:09 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D345A265CA5; Thu, 30 Jul 2015 18:20:36 +0200 (CEST) Received: from lists.s-osg.org (lists.s-osg.org [54.187.51.154]) by alsa0.perex.cz (Postfix) with ESMTP id 8CEE2265AF0 for ; Thu, 30 Jul 2015 18:20:29 +0200 (CEST) Received: from localhost.localdomain (119.3.11.37.dynamic.jazztel.es [37.11.3.119]) by lists.s-osg.org (Postfix) with ESMTPSA id 1A92C46328; Thu, 30 Jul 2015 09:20:20 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Date: Thu, 30 Jul 2015 18:18:52 +0200 Message-Id: <1438273132-20926-28-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1438273132-20926-1-git-send-email-javier@osg.samsung.com> References: <1438273132-20926-1-git-send-email-javier@osg.samsung.com> X-Mailman-Approved-At: Thu, 30 Jul 2015 18:22:08 +0200 Cc: alsa-devel@alsa-project.org, Dmitry Torokhov , Wolfram Sang , linux-iio@vger.kernel.org, Benjamin Herrenschmidt , linux-fbdev@vger.kernel.org, Takashi Iwai , Sjoerd Simons , Alexandre Belloni , linux-i2c@vger.kernel.org, Lee Jones , linux-leds@vger.kernel.org, Javier Martinez Canillas , linux-pm@vger.kernel.org, lm-sensors@lm-sensors.org, Chanwoo Choi , Tony Lindgren , Tomi Valkeinen , linux-input@vger.kernel.org, Guenter Roeck , linux-media@vger.kernel.org, Jean Delvare , rtc-linux@googlegroups.com, Mauro Carvalho Chehab , Liam Girdwood , Bryan Wu , Mark Brown , linux-omap@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, Sebastian Reichel , linux-spi@vger.kernel.org, Sakari Ailus , MyungJoo Ham , linuxppc-dev@lists.ozlabs.org, Jonathan Cameron Subject: [alsa-devel] [PATCH 27/27] i2c: (RFC, don't apply) report OF style modalias when probing using DT X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP An I2C driver that supports both OF and legacy platforms, will have both a OF and I2C ID table. This means that when built as a module, the aliases will be filled from both tables but currently always an alias of the form i2c: is reported, e.g: $ cat /sys/class/i2c-adapter/i2c-8/8-004b/modalias i2c:maxtouch So if a device is probed by matching its compatible string, udev can get a MODALIAS uevent env var that doesn't match with one of the valid aliases so the module won't be auto-loaded. This patch changes the I2C core to report a OF related MODALIAS uevent (of:N*T*C) env var instead so the module can be auto-loaded and also report the correct alias using sysfs: $ cat /sys/class/i2c-adapter/i2c-8/8-004b/modalias of:NtrackpadTCatmel,maxtouch Signed-off-by: Javier Martinez Canillas --- drivers/i2c/i2c-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 92dddfeb3f39..c0668c2ed9da 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -489,6 +489,10 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) struct i2c_client *client = to_i2c_client(dev); int rc; + rc = of_device_uevent_modalias(dev, env); + if (rc != -ENODEV) + return rc; + rc = acpi_device_uevent_modalias(dev, env); if (rc != -ENODEV) return rc; @@ -726,6 +730,10 @@ show_modalias(struct device *dev, struct device_attribute *attr, char *buf) struct i2c_client *client = to_i2c_client(dev); int len; + len = of_device_get_modalias(dev, buf, PAGE_SIZE - 1); + if (len != -ENODEV) + return len; + len = acpi_device_modalias(dev, buf, PAGE_SIZE -1); if (len != -ENODEV) return len;