From patchwork Tue Feb 20 12:15:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Purski X-Patchwork-Id: 10229953 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 01C1B602DC for ; Tue, 20 Feb 2018 12:16:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E49C827CEA for ; Tue, 20 Feb 2018 12:16:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D929728653; Tue, 20 Feb 2018 12:16: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 01E3827CEA for ; Tue, 20 Feb 2018 12:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbeBTMQA (ORCPT ); Tue, 20 Feb 2018 07:16:00 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:41426 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbeBTMP7 (ORCPT ); Tue, 20 Feb 2018 07:15:59 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180220121556euoutp016dafba2cf15392bdb70d365041479309~VB7ywnm0E1642816428euoutp01Z; Tue, 20 Feb 2018 12:15:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180220121556euoutp016dafba2cf15392bdb70d365041479309~VB7ywnm0E1642816428euoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1519128956; bh=oq/ARqAwT/FSUucesBJsLU62MwIzowWydqlpT1BZ9JU=; h=From:To:Cc:Subject:Date:References:From; b=NKl41nTjnwR1ck2H1hLBibgkZuI0ymSAwV/lA7d80UW+4c4Xkj1CA66Bi8Q+k8i9Y +wCocJtt2KeE1HPPuG3cfNNc2wUal5jLWXtkeyNx6C+2ta/u3Hk0lqgvYNxkTokQOn qAWiJzAatHdPdMy7ez4gF3W10OYKiDgLuq+DWyQc= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180220121555eucas1p2b925764fdd30f34f3e505fcc4a278bea~VB7yBgUCN3220532205eucas1p28; Tue, 20 Feb 2018 12:15:55 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A4.D2.05700.A711C8A5; Tue, 20 Feb 2018 12:15:54 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180220121554eucas1p1e97fba2b784a024233d3537c33989f6a~VB7wzZkwh0132201322eucas1p1V; Tue, 20 Feb 2018 12:15:54 +0000 (GMT) X-AuditID: cbfec7f2-1c1ff70000011644-b1-5a8c117abed5 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BC.01.04178.A711C8A5; Tue, 20 Feb 2018 12:15:54 +0000 (GMT) Received: from AMDC2075.DIGITAL.local ([106.120.51.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P4G00J7C7EDH830@eusync4.samsung.com>; Tue, 20 Feb 2018 12:15:54 +0000 (GMT) From: Maciej Purski To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , Zhang Rui , Eduardo Valentin , Kukjin Kim , Krzysztof Kozlowski , Marek Szyprowski , Maciej Purski Subject: [PATCH] thermal: exynos: Read soc_type from match data Date: Tue, 20 Feb 2018 13:15:48 +0100 Message-id: <1519128948-11818-1-git-send-email-m.purski@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsWy7djPc7pVgj1RBrPvWllsnLGe1WL+lWus Fv2PXzNbnD+/gd1i02Mg93PvEUaLGef3MVkseHmLxWLtkbvsFk8e9rE5cHnsnHWX3WPxnpdM HptWdbJ5bF5S79G3ZRWjx+dNcgFsUVw2Kak5mWWpRfp2CVwZV6fcYy5YpFDxvKmftYFxj3QX IyeHhICJxKo12xm7GLk4hARWMEp8X7cIyvnMKPHsaDcLTNXqpe+ZIRLLGCW+TNnNAuH8Z5Q4 tvUAkMPBwSagJbGmPR6kQUQgXWLignOMIDazwAImia+/HEBsYQF7iTWfWxhBylkEVCVmthaD mLwCLhKLP5ZBrJKTuHmuE2yVhEAHm8T2r5dZIRIuEicuv2SGsIUlXh3fwg5hy0h0dhxkgrCr JS5+3cUGYddINN7eAFVjLfF50hZmiHP4JCZtm84MsldCgFeio00IosRDYnbne6jxjhKXDlwG s4UEYiVmvHzOPoFRcgEjwypG8dTS4tz01GLDvNRyveLE3OLSvHS95PzcTYzA+Dz97/inHYxf LyUdYhTgYFTi4RW42xUlxJpYVlyZe4hRgoNZSYT38vfuKCHelMTKqtSi/Pii0pzU4kOM0hws SuK8cRp1UUIC6YklqdmpqQWpRTBZJg5OqQbGnpfv2J46SidFMDR4vAqc0u0k9tt7Laf/g43y as3p6hZzfq0Ty+88NXnX6XxdtU9zJWd//18QfeVMdvkp7jeJMlcbKsVFyr6tbZl61nbLirW8 G/lna3a/uP7r1n1xz+zN9pO6tzz+2jKzvaY6/PDlK46vhHdPzPjlFcFiIbjtiq5jxM8TD73F lFiKMxINtZiLihMBBAxw5MsCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPJMWRmVeSWpSXmKPExsVy+t/xa7pVgj1RBpMfsVtsnLGe1WL+lWus Fv2PXzNbnD+/gd1i02Mg93PvEUaLGef3MVkseHmLxWLtkbvsFk8e9rE5cHnsnHWX3WPxnpdM HptWdbJ5bF5S79G3ZRWjx+dNcgFsUVw2Kak5mWWpRfp2CVwZV6fcYy5YpFDxvKmftYFxj3QX IyeHhICJxOql75lBbCGBJYwS+z7wdTFyAdmNTBJ7O1aydTFycLAJaEmsaY8HqRERSJf4+ug1 E0gNs8AiJomnk84ygSSEBewl1nxuYQSpZxFQlZjZWgxi8gq4SCz+WAaxSk7i5rlO5gmMXAsY GVYxiqSWFuem5xYb6hUn5haX5qXrJefnbmIEBsu2Yz8372C8tDH4EKMAB6MSD6/A3a4oIdbE suLK3EOMEhzMSiK8l793RwnxpiRWVqUW5ccXleakFh9ilOZgURLnPW9QGSUkkJ5YkpqdmlqQ WgSTZeLglGpgLEzfYFxRYfmbIWiWF69Cs0kEy/7KQ2ZHZt0W6nzl7Wuu0mtrHGmz6YVxn+F6 r1kzzp3/9nwXo+qvuILAQ6XyX0r4qiymrHyU+znGeY9ON2f5ZfWDPzPZW9jzfPdMvKzBV3vT u2TOqgvap44uvSO4Z/9Pb5EdJbtZdOexmz1US/5U/jLibNElJZbijERDLeai4kQARI8JnRIC AAA= X-CMS-MailID: 20180220121554eucas1p1e97fba2b784a024233d3537c33989f6a X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180220121554eucas1p1e97fba2b784a024233d3537c33989f6a X-RootMTR: 20180220121554eucas1p1e97fba2b784a024233d3537c33989f6a References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Device context's field data->soc is currently obtained by comparing of_compatible's. Provide soc_type as .data field in device's match table, as it is done in most drivers. Signed-off-by: Maciej Purski Acked-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 74 +++++++++++++++++------------------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index ed805c7..40c0d33 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -1097,47 +1097,41 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id) } static const struct of_device_id exynos_tmu_match[] = { - { .compatible = "samsung,exynos3250-tmu", }, - { .compatible = "samsung,exynos4210-tmu", }, - { .compatible = "samsung,exynos4412-tmu", }, - { .compatible = "samsung,exynos5250-tmu", }, - { .compatible = "samsung,exynos5260-tmu", }, - { .compatible = "samsung,exynos5420-tmu", }, - { .compatible = "samsung,exynos5420-tmu-ext-triminfo", }, - { .compatible = "samsung,exynos5433-tmu", }, - { .compatible = "samsung,exynos5440-tmu", }, - { .compatible = "samsung,exynos7-tmu", }, - { /* sentinel */ }, + { + .compatible = "samsung,exynos3250-tmu", + .data = (const void *)SOC_ARCH_EXYNOS3250, + }, { + .compatible = "samsung,exynos4210-tmu", + .data = (const void *)SOC_ARCH_EXYNOS4210, + }, { + .compatible = "samsung,exynos4412-tmu", + .data = (const void *)SOC_ARCH_EXYNOS4412, + }, { + .compatible = "samsung,exynos5250-tmu", + .data = (const void *)SOC_ARCH_EXYNOS5250, + }, { + .compatible = "samsung,exynos5260-tmu", + .data = (const void *)SOC_ARCH_EXYNOS5260, + }, { + .compatible = "samsung,exynos5420-tmu", + .data = (const void *)SOC_ARCH_EXYNOS5420, + }, { + .compatible = "samsung,exynos5420-tmu-ext-triminfo", + .data = (const void *)SOC_ARCH_EXYNOS5420_TRIMINFO, + }, { + .compatible = "samsung,exynos5433-tmu", + .data = (const void *)SOC_ARCH_EXYNOS5433, + }, { + .compatible = "samsung,exynos5440-tmu", + .data = (const void *)SOC_ARCH_EXYNOS5440, + }, { + .compatible = "samsung,exynos7-tmu", + .data = (const void *)SOC_ARCH_EXYNOS7, + }, + { }, }; MODULE_DEVICE_TABLE(of, exynos_tmu_match); -static int exynos_of_get_soc_type(struct device_node *np) -{ - if (of_device_is_compatible(np, "samsung,exynos3250-tmu")) - return SOC_ARCH_EXYNOS3250; - else if (of_device_is_compatible(np, "samsung,exynos4210-tmu")) - return SOC_ARCH_EXYNOS4210; - else if (of_device_is_compatible(np, "samsung,exynos4412-tmu")) - return SOC_ARCH_EXYNOS4412; - else if (of_device_is_compatible(np, "samsung,exynos5250-tmu")) - return SOC_ARCH_EXYNOS5250; - else if (of_device_is_compatible(np, "samsung,exynos5260-tmu")) - return SOC_ARCH_EXYNOS5260; - else if (of_device_is_compatible(np, "samsung,exynos5420-tmu")) - return SOC_ARCH_EXYNOS5420; - else if (of_device_is_compatible(np, - "samsung,exynos5420-tmu-ext-triminfo")) - return SOC_ARCH_EXYNOS5420_TRIMINFO; - else if (of_device_is_compatible(np, "samsung,exynos5433-tmu")) - return SOC_ARCH_EXYNOS5433; - else if (of_device_is_compatible(np, "samsung,exynos5440-tmu")) - return SOC_ARCH_EXYNOS5440; - else if (of_device_is_compatible(np, "samsung,exynos7-tmu")) - return SOC_ARCH_EXYNOS7; - - return -EINVAL; -} - static int exynos_of_sensor_conf(struct device_node *np, struct exynos_tmu_platform_data *pdata) { @@ -1211,7 +1205,7 @@ static int exynos_map_dt_data(struct platform_device *pdev) exynos_of_sensor_conf(pdev->dev.of_node, pdata); data->pdata = pdata; - data->soc = exynos_of_get_soc_type(pdev->dev.of_node); + data->soc = (enum soc_type)of_device_get_match_data(&pdev->dev); switch (data->soc) { case SOC_ARCH_EXYNOS4210: