Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752623AbbKOKTp (ORCPT ); Sun, 15 Nov 2015 05:19:45 -0500 Received: from mail-pa0-f65.google.com ([209.85.220.65]:33434 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbbKOKTm (ORCPT ); Sun, 15 Nov 2015 05:19:42 -0500 From: Saurabh Sengar To: galak@codeaurora.org, agross@codeaurora.org, davidb@codeaurora.org, lee.jones@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Sengar Subject: [PATCH] mfd: ssbi: removing unnecessary strcmp Date: Sun, 15 Nov 2015 15:49:20 +0530 Message-Id: <1447582760-6088-1-git-send-email-saurabh.truth@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6958 Lines: 190 passing the actual enum value for controller type from device tree, instead of passing the string and converting it to enum Signed-off-by: Saurabh Sengar --- Documentation/devicetree/bindings/arm/msm/ssbi.txt | 6 +++--- arch/arm/boot/dts/qcom-apq8064.dtsi | 3 ++- arch/arm/boot/dts/qcom-ipq8064.dtsi | 3 ++- arch/arm/boot/dts/qcom-msm8660.dtsi | 3 ++- arch/arm/boot/dts/qcom-msm8960.dtsi | 3 ++- drivers/mfd/ssbi.c | 17 ++++++----------- include/dt-bindings/mfd/qcom,ssbi.h | 19 +++++++++++++++++++ 7 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 include/dt-bindings/mfd/qcom,ssbi.h diff --git a/Documentation/devicetree/bindings/arm/msm/ssbi.txt b/Documentation/devicetree/bindings/arm/msm/ssbi.txt index 54fd5ce..61a37e0 100644 --- a/Documentation/devicetree/bindings/arm/msm/ssbi.txt +++ b/Documentation/devicetree/bindings/arm/msm/ssbi.txt @@ -10,9 +10,9 @@ These require the following properties: - qcom,controller-type indicates the SSBI bus variant the controller should use to talk - with the slave device. This should be one of "ssbi", "ssbi2", or - "pmic-arbiter". The type chosen is determined by the attached - slave. + with the slave device. This should be one of MSM_SBI_CTRL_SSBI, + MSM_SBI_CTRL_SSBI2 or MSM_SBI_CTRL_PMIC_ARBITER. + The type chosen is determined by the attached slave. The slave device should be the single child node of the ssbi device with a compatible field. diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi index a4c1762..e391a01 100644 --- a/arch/arm/boot/dts/qcom-apq8064.dtsi +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi @@ -5,6 +5,7 @@ #include #include #include +#include #include / { model = "Qualcomm APQ8064"; @@ -339,7 +340,7 @@ qcom,ssbi@500000 { compatible = "qcom,ssbi"; reg = <0x00500000 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8921"; diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi index fa69863..a3ba13a 100644 --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi @@ -3,6 +3,7 @@ #include "skeleton.dtsi" #include #include +#include #include / { @@ -307,7 +308,7 @@ qcom,ssbi@500000 { compatible = "qcom,ssbi"; reg = <0x00500000 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; }; gcc: clock-controller@900000 { diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi index e5f7f33..51b28d2 100644 --- a/arch/arm/boot/dts/qcom-msm8660.dtsi +++ b/arch/arm/boot/dts/qcom-msm8660.dtsi @@ -4,6 +4,7 @@ #include #include +#include #include / { @@ -112,7 +113,7 @@ qcom,ssbi@500000 { compatible = "qcom,ssbi"; reg = <0x500000 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8058"; diff --git a/arch/arm/boot/dts/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom-msm8960.dtsi index 134cd91..d01cee5 100644 --- a/arch/arm/boot/dts/qcom-msm8960.dtsi +++ b/arch/arm/boot/dts/qcom-msm8960.dtsi @@ -5,6 +5,7 @@ #include #include #include +#include #include / { @@ -171,7 +172,7 @@ qcom,ssbi@500000 { compatible = "qcom,ssbi"; reg = <0x500000 0x1000>; - qcom,controller-type = "pmic-arbiter"; + qcom,controller-type = ; pmicintc: pmic@0 { compatible = "qcom,pm8921"; diff --git a/drivers/mfd/ssbi.c b/drivers/mfd/ssbi.c index 27986f6..cf4d983 100644 --- a/drivers/mfd/ssbi.c +++ b/drivers/mfd/ssbi.c @@ -274,7 +274,7 @@ static int ssbi_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct resource *mem_res; struct ssbi *ssbi; - const char *type; + u32 type; ssbi = devm_kzalloc(&pdev->dev, sizeof(*ssbi), GFP_KERNEL); if (!ssbi) @@ -287,22 +287,17 @@ static int ssbi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ssbi); - type = of_get_property(np, "qcom,controller-type", NULL); - if (type == NULL) { + if (of_property_read_u32(np, "qcom,controller-type", &type)) { dev_err(&pdev->dev, "Missing qcom,controller-type property\n"); return -EINVAL; } - dev_info(&pdev->dev, "SSBI controller type: '%s'\n", type); - if (strcmp(type, "ssbi") == 0) - ssbi->controller_type = MSM_SBI_CTRL_SSBI; - else if (strcmp(type, "ssbi2") == 0) - ssbi->controller_type = MSM_SBI_CTRL_SSBI2; - else if (strcmp(type, "pmic-arbiter") == 0) - ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER; - else { + + dev_info(&pdev->dev, "SSBI controller type: '%d'\n", type); + if (type > MSM_SBI_CTRL_PMIC_ARBITER) { dev_err(&pdev->dev, "Unknown qcom,controller-type\n"); return -EINVAL; } + ssbi->controller_type = type; if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) { ssbi->read = ssbi_pa_read_bytes; diff --git a/include/dt-bindings/mfd/qcom,ssbi.h b/include/dt-bindings/mfd/qcom,ssbi.h new file mode 100644 index 0000000..b6bf5bc --- /dev/null +++ b/include/dt-bindings/mfd/qcom,ssbi.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef __DT_MFD_QCOM_SSBI_H +#define __DT_MFD_QCOM_SSBI_H + +#define MSM_SBI_CTRL_SSBI 0 +#define MSM_SBI_CTRL_SSBI2 1 +#define MSM_SBI_CTRL_PMIC_ARBITER 2 + +#endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/