From patchwork Fri Apr 8 16:52:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 8784841 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 1190EC0553 for ; Fri, 8 Apr 2016 16:54:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EAD7202F0 for ; Fri, 8 Apr 2016 16:54:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48C7D202EB for ; Fri, 8 Apr 2016 16:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754266AbcDHQx7 (ORCPT ); Fri, 8 Apr 2016 12:53:59 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:59084 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754046AbcDHQx6 (ORCPT ); Fri, 8 Apr 2016 12:53:58 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O5B015S9QXW0C00@mailout2.samsung.com> for linux-samsung-soc@vger.kernel.org; Sat, 09 Apr 2016 01:53:56 +0900 (KST) X-AuditID: cbfee61b-f792f6d000001a2b-ea-5707e224badb Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 7D.A7.06699.422E7075; Sat, 9 Apr 2016 01:53:56 +0900 (KST) Received: from AMDC1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O5B002U6QWFP890@mmp2.samsung.com>; Sat, 09 Apr 2016 01:53:56 +0900 (KST) From: Sylwester Nawrocki To: broonie@kernel.org Cc: alsa-devel@alsa-project.org, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH 3/3] ASoC: samsung: Use of_device_get_match_data() helper Date: Fri, 08 Apr 2016 18:52:45 +0200 Message-id: <1460134365-31500-3-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1460134365-31500-1-git-send-email-s.nawrocki@samsung.com> References: <1460134365-31500-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpiluLIzCtJLcpLzFFi42I5/e+xoK7KI/Zwg4U35C2uXDzEZDH14RM2 ixnn9zFZHH7TzurA4rHhcxObx6ZVnWwefVtWMXp83iQXwBLFZZOSmpNZllqkb5fAlXFy9Xq2 goX8Fbs3nmdtYHzE08XIwSEhYCKx+19tFyMnkCkmceHeerYuRi4OIYFZjBLvm6YxQji/GCUW bp/EDFLFJmAo0Xu0jxHEFgHquD2nEyzOLFAoserKJzBbWMBT4sndeawgNouAqkTzw5NsIDav gJvE7fMPWCG2yUmcPDYZzOYUcJdo+XqUCcQWAqqZd34R0wRG3gWMDKsYJVILkguKk9JzjfJS y/WKE3OLS/PS9ZLzczcxgkPmmfQOxsO73A8xCnAwKvHwXnjPFi7EmlhWXJl7iFGCg1lJhLfo Lnu4EG9KYmVValF+fFFpTmrxIUZpDhYlcd7H/9eFCQmkJ5akZqemFqQWwWSZODilGhi7eA79 4lkbeydL9r/DyXvC0++077/Pb7GG6bjepo6LkqtU3dtzf6htzpU/Kznr4fF9N3c9dw9dlMgf 9WXlPcaf92/WSb1+0G5orsP83uRR10lJIUGHc13rdv3IUlpw4C+v4Sf9da8CXp928NFYJNQh dHLZnriimDKXLyWpaxkqji+YcnLSrvNqSizFGYmGWsxFxYkAKZhj+BUCAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the code a little by using a standard function for getting the match data. Signed-off-by: Sylwester Nawrocki --- sound/soc/samsung/i2s.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 7ea030e..27ca116 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1106,21 +1107,6 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) return i2s; } -static const struct of_device_id exynos_i2s_match[]; - -static inline const struct samsung_i2s_dai_data *samsung_i2s_get_driver_data( - struct platform_device *pdev) -{ - if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { - const struct of_device_id *match; - match = of_match_node(exynos_i2s_match, pdev->dev.of_node); - return match ? match->data : NULL; - } else { - return (struct samsung_i2s_dai_data *) - platform_get_device_id(pdev)->driver_data; - } -} - #ifdef CONFIG_PM static int i2s_runtime_suspend(struct device *dev) { @@ -1233,9 +1219,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) const struct samsung_i2s_dai_data *i2s_dai_data; int ret; - /* Call during Seconday interface registration */ - i2s_dai_data = samsung_i2s_get_driver_data(pdev); + if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) + i2s_dai_data = of_device_get_match_data(&pdev->dev); + else + i2s_dai_data = (struct samsung_i2s_dai_data *) + platform_get_device_id(pdev)->driver_data; + /* Call during the secondary interface registration */ if (i2s_dai_data->dai_type == TYPE_SEC) { sec_dai = dev_get_drvdata(&pdev->dev); if (!sec_dai) {