From patchwork Mon Sep 25 23:09:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9970631 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 D29BF6038E for ; Mon, 25 Sep 2017 23:09:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5A5928D09 for ; Mon, 25 Sep 2017 23:09:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA88D28D0C; Mon, 25 Sep 2017 23:09:47 +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 8F91B28D09 for ; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754149AbdIYXJo (ORCPT ); Mon, 25 Sep 2017 19:09:44 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:46395 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753950AbdIYXJn (ORCPT ); Mon, 25 Sep 2017 19:09:43 -0400 Received: by mail-pg0-f46.google.com with SMTP id i130so4870990pgc.3 for ; Mon, 25 Sep 2017 16:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/tQzff3J8Gs8uTAORjhO18dsF9NuIpoEX4ODfyyZvmw=; b=NNmj0AcV2c6hp0bqOGnFKIU4dKpCNivgyf0bhboFKC17O3HDWVc4Hp07ksyiHKsm3m jIuIlFxKS3m1mkBH2SN1qYUVxzLO7E/RYggYyhLWOVAKDS2dkBuEBdxWXZuug1m5ZC/c ToI7gebSwsmToPlbSDGTZeQgFsxML4h9y0JZc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/tQzff3J8Gs8uTAORjhO18dsF9NuIpoEX4ODfyyZvmw=; b=b42PNxQbduL25psO77AE91lD92aajPcohlO3tZj4DPTGEvpNtPFpyBUCGmuk75TlyF vaPrnKPphACzd4jbjXfplOuO+bNyVubF6s08YVJQM9slFnaz51j0+ivVV+kP4/M6uyy0 o19UqZpt++vDMKQHhy9ANdx0D6SQGRZq8si6tIhMrt1jxgrlm1e0y+G/BSJw1t1Zi2em ip8EItzwQTnRoS98ura2LV69qomrkt/ke4uaDN1nB4FyvQQo+9wNiQJsLX23HypeGHRl 5w/Nb5468vMvySaxEj54L1Qo9nVbQh2AyCpNMsLPdbEFWNtOlMTIjQcuAqWoCXazPv/x DXtg== X-Gm-Message-State: AHPjjUgrebvG5pleJn7iNNesw6JZ9kZJOiNDtofhsOJIPbO8ngzxI1xD NF1q8kKoA0LjRYDt/Pu/TrpbHg== X-Google-Smtp-Source: AOwi7QDw8+YkPkitc72TudjIsLYexs5dEBcoNVXcsmkB+hl97ZH2p2CpVHpqv8tC2gXygia/uBWlJw== X-Received: by 10.99.182.78 with SMTP id v14mr9421323pgt.325.1506380983467; Mon, 25 Sep 2017 16:09:43 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id a7sm12284532pgc.40.2017.09.25.16.09.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 16:09:42 -0700 (PDT) From: Linus Walleij To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Nishanth Menon , Simon Guinot , Jamie Lentin , Linus Walleij Subject: [PATCH 5/9] hwmon: gpio-fan: Mandate OF_GPIO and cut pdata path Date: Tue, 26 Sep 2017 01:09:07 +0200 Message-Id: <20170925230911.20824-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170925230911.20824-1-linus.walleij@linaro.org> References: <20170925230911.20824-1-linus.walleij@linaro.org> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have no users of platform data, we made platform data driver-local, so cut all #ifdefs for the platform data case, and depend on the Kconfig CONFIG_OF_GPIO symbol. Signed-off-by: Linus Walleij --- drivers/hwmon/Kconfig | 1 + drivers/hwmon/gpio-fan.c | 36 ++++++++++-------------------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index d65431417b17..9b0e1db2202d 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -552,6 +552,7 @@ config SENSORS_G762 config SENSORS_GPIO_FAN tristate "GPIO fan" + depends on OF_GPIO depends on GPIOLIB || COMPILE_TEST depends on THERMAL || THERMAL=n help diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index ad7d8fdf4f81..55dbdb223e02 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -453,7 +453,6 @@ static const struct thermal_cooling_device_ops gpio_fan_cool_ops = { .set_cur_state = gpio_fan_set_cur_state, }; -#ifdef CONFIG_OF_GPIO /* * Translate OpenFirmware node properties into platform_data */ @@ -556,7 +555,6 @@ static const struct of_device_id of_gpio_fan_match[] = { {}, }; MODULE_DEVICE_TABLE(of, of_gpio_fan_match); -#endif /* CONFIG_OF_GPIO */ static int gpio_fan_probe(struct platform_device *pdev) { @@ -564,29 +562,22 @@ static int gpio_fan_probe(struct platform_device *pdev) struct gpio_fan_data *fan_data; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - struct gpio_fan_platform_data *pdata = dev_get_platdata(dev); + struct gpio_fan_platform_data *pdata; fan_data = devm_kzalloc(dev, sizeof(struct gpio_fan_data), GFP_KERNEL); if (!fan_data) return -ENOMEM; -#ifdef CONFIG_OF_GPIO - if (!pdata) { - pdata = devm_kzalloc(dev, - sizeof(struct gpio_fan_platform_data), - GFP_KERNEL); - if (!pdata) - return -ENOMEM; - - err = gpio_fan_get_of_pdata(dev, pdata); - if (err) - return err; - } -#else /* CONFIG_OF_GPIO */ + pdata = devm_kzalloc(dev, + sizeof(struct gpio_fan_platform_data), + GFP_KERNEL); if (!pdata) - return -EINVAL; -#endif /* CONFIG_OF_GPIO */ + return -ENOMEM; + + err = gpio_fan_get_of_pdata(dev, pdata); + if (err) + return err; fan_data->dev = dev; platform_set_drvdata(pdev, fan_data); @@ -615,17 +606,12 @@ static int gpio_fan_probe(struct platform_device *pdev) gpio_fan_groups); if (IS_ERR(fan_data->hwmon_dev)) return PTR_ERR(fan_data->hwmon_dev); -#ifdef CONFIG_OF_GPIO + /* Optional cooling device register for Device tree platforms */ fan_data->cdev = thermal_of_cooling_device_register(np, "gpio-fan", fan_data, &gpio_fan_cool_ops); -#else /* CONFIG_OF_GPIO */ - /* Optional cooling device register for non Device tree platforms */ - fan_data->cdev = thermal_cooling_device_register("gpio-fan", fan_data, - &gpio_fan_cool_ops); -#endif /* CONFIG_OF_GPIO */ dev_info(dev, "GPIO fan initialized\n"); @@ -686,9 +672,7 @@ static struct platform_driver gpio_fan_driver = { .driver = { .name = "gpio-fan", .pm = GPIO_FAN_PM, -#ifdef CONFIG_OF_GPIO .of_match_table = of_match_ptr(of_gpio_fan_match), -#endif }, };