Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2980248imu; Mon, 19 Nov 2018 08:56:12 -0800 (PST) X-Google-Smtp-Source: AJdET5cAjxrFW6dORkCw3IO+FoOkVQ1jejg+8ND/GBP/vRx7iaYwEzaoTNnb2mR3YIUIN1kXYCRu X-Received: by 2002:a62:5881:: with SMTP id m123-v6mr24017730pfb.160.1542646572287; Mon, 19 Nov 2018 08:56:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646572; cv=none; d=google.com; s=arc-20160816; b=EILRervy8FysTKutYU32VltI+zJO4wiY71aKcofnipjqVS9x4F3gKQd1aKK5Aitm55 5p6DwwZh1f+swMg4I2FoZ8+FY7vMTXAi/VDDdn5009RvTFcEJwOS9Bo6cwj1iNpYPtZA 0U+nvOhOaz0kzLl2AkCrAxq1SBh9xqYknyJnRdhfR0BPs0QFfvZeUJLMxN9nI8xV5/wY mC0B6ijyyqTYVZxHvzt6MQjCYD01L7d66sv4wXREZLukRNK1qw8pZ02kyqTLRh5YGVVa iHj1QRAEvkIiyrsKJuej99QyUchjhkx/0eIzRF2qkchV4MN3pUkHykS5+6pHIRVa2MmS tZ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3viCXDKAQtjxe6hPQjKYb1GCOSSx/s4YJcmn5qfZNSk=; b=RNMvJQ9gP0MvcjpXWQBDc1A6QgZ9NeqvcIK6OyzNPjk955fzF/W5hxd/WWLpSlNLci 00J51k4jeqQB13mTVZ3GiAlKVG7Rzv9JTwYhHq2Kx9ecfvutP3MNwgg8Lzj0phb8L8M7 yqZmokirPf2nTd7BLzv2GAqOkq5d74zTan49EwaFcfxWIn52IS0QeLydRTZvj0QEF1RS WnoLeiyG6Lybs3KgXC5xNHMlfJOKQblrRnc2yJeTLL6aZ5qaJCZ14BHpVJk5Rk7T8p5b uMTshoKr/8+wnb/PPoTjMfgZAT4KCrNRcZL1bNDswT/05snDjqn411E9/M6fd0RweE0L eV9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cGr05+tS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si37480973pgk.49.2018.11.19.08.55.56; Mon, 19 Nov 2018 08:56:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cGr05+tS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403835AbeKTDTe (ORCPT + 99 others); Mon, 19 Nov 2018 22:19:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:58740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390118AbeKTDTd (ORCPT ); Mon, 19 Nov 2018 22:19:33 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8A932147A; Mon, 19 Nov 2018 16:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646519; bh=qZT3MOwh2L0w6dbmIrUtewbACQeOJvoe9miiYlp/X8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGr05+tSNNCZ0LVWQrIDnFRiEs0nKzpbq6Ldgjg+sT5hfQRjtg043wwR4xGOBorfO JVhkxADXF/O2jaKweCGMAG2b0Q37hYbma+CBSfj0QEuMfXXsSNgNOKf5gJKVWdy/Ox 7tbH6r7LmqDMSka4U6cebFwmBFInt3R0OxFrBxPY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd Subject: [PATCH 4.9 34/83] clk: s2mps11: Fix matching when built as module and DT node contains compatible Date: Mon, 19 Nov 2018 17:29:00 +0100 Message-Id: <20181119162619.288413072@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162612.046511542@linuxfoundation.org> References: <20181119162612.046511542@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Krzysztof Kozlowski commit 8985167ecf57f97061599a155bb9652c84ea4913 upstream. When driver is built as module and DT node contains clocks compatible (e.g. "samsung,s2mps11-clk"), the module will not be autoloaded because module aliases won't match. The modalias from uevent: of:NclocksTCsamsung,s2mps11-clk The modalias from driver: platform:s2mps11-clk The devices are instantiated by parent's MFD. However both Device Tree bindings and parent define the compatible for clocks devices. In case of module matching this DT compatible will be used. The issue will not happen if this is a built-in (no need for module matching) or when clocks DT node does not contain compatible (not correct from bindings perspective but working for driver). Note when backporting to stable kernels: adjust the list of device ID entries. Cc: Fixes: 53c31b3437a6 ("mfd: sec-core: Add of_compatible strings for clock MFD cells") Signed-off-by: Krzysztof Kozlowski Acked-by: Stephen Boyd Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index d44e0eea31ec..0934d3724495 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -245,6 +245,36 @@ static const struct platform_device_id s2mps11_clk_id[] = { }; MODULE_DEVICE_TABLE(platform, s2mps11_clk_id); +#ifdef CONFIG_OF +/* + * Device is instantiated through parent MFD device and device matching is done + * through platform_device_id. + * + * However if device's DT node contains proper clock compatible and driver is + * built as a module, then the *module* matching will be done trough DT aliases. + * This requires of_device_id table. In the same time this will not change the + * actual *device* matching so do not add .of_match_table. + */ +static const struct of_device_id s2mps11_dt_match[] = { + { + .compatible = "samsung,s2mps11-clk", + .data = (void *)S2MPS11X, + }, { + .compatible = "samsung,s2mps13-clk", + .data = (void *)S2MPS13X, + }, { + .compatible = "samsung,s2mps14-clk", + .data = (void *)S2MPS14X, + }, { + .compatible = "samsung,s5m8767-clk", + .data = (void *)S5M8767X, + }, { + /* Sentinel */ + }, +}; +MODULE_DEVICE_TABLE(of, s2mps11_dt_match); +#endif + static struct platform_driver s2mps11_clk_driver = { .driver = { .name = "s2mps11-clk",