From patchwork Mon Sep 25 23:09:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9970629 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 B501D60365 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 A715428D0A for ; Mon, 25 Sep 2017 23:09:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BCE928D0C; 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 6FE9228D15 for ; Mon, 25 Sep 2017 23:09:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754112AbdIYXJm (ORCPT ); Mon, 25 Sep 2017 19:09:42 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:44075 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753950AbdIYXJl (ORCPT ); Mon, 25 Sep 2017 19:09:41 -0400 Received: by mail-pg0-f54.google.com with SMTP id j16so4871205pga.1 for ; Mon, 25 Sep 2017 16:09:41 -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=sRxuNjpg9qjh8E1nma5HaLJM1kBGhpTrzI4rezC7Y70=; b=AMDHLfAwZrgb/VAaNIwqIKD0q80hdqRolarfnPVO+7oinP+yYgb2CHaTPMTcLdt3f8 Kf0fVHjbuo4YEWTTyduubMFSQM41F8KdTMXfhuVdPGorb2DyvZVM1aSFnVX4bebokWoi 2Dg2+/jedfP2w52SYXhKO7prDxB66+5sArjys= 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=sRxuNjpg9qjh8E1nma5HaLJM1kBGhpTrzI4rezC7Y70=; b=jKx///G2x7lVauK4EVzCS/6aiY0Bb+YEgkv/UW0k7K5hLLUt+KBbQUI635f7e5Rdav xfSNBJxNUFQH3P5vDIOOYx679qL3+Hc3Anr9gRs1KzLxMZbdovdA9OPdEWI7DgD+1sRZ WnecOEFo7X6yZZ7n6D7SAY4pIJsd54bRjE0bcNsOotZ2zzKhJY/9tNNc7h9AIGD4xqy9 MlE+UyY95V9k8N4+n+F9l93r8kGYNSCQTpN8xrb3t3UCPcVVjzZWC91zEHLmRPkNEf0D Gh6hFI88JDI6dSW7Uf6YCfz6UwM7Pif/CjO5mP5jqHmPc2fwWNjCdPTm9SLcF/aKaNS7 Xyvg== X-Gm-Message-State: AHPjjUhe8rgP+kZ6PLo7TV9Q4J1/VrfhyLD+JVSNCoae1XMFZyG2RxJE 2bUsi2fuf+hizodLmEDjQs4KTw== X-Google-Smtp-Source: AOwi7QCc2PTk9ckVDwcHCwgDxtZ9VUbTef89mtt8P91pAJGzVM2wfdhNCwvwrZFqvs5g/VV9/xaSqg== X-Received: by 10.99.6.140 with SMTP id 134mr8823694pgg.199.1506380981423; Mon, 25 Sep 2017 16:09:41 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id a7sm12284532pgc.40.2017.09.25.16.09.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 16:09:40 -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 4/9] hwmon: gpio-fan: Send around device pointer Date: Tue, 26 Sep 2017 01:09:06 +0200 Message-Id: <20170925230911.20824-5-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 The driver is storing the struct platform_device *pdev pointer but what it is really using and want to pass around is a struct device *dev pointer. Signed-off-by: Linus Walleij --- drivers/hwmon/gpio-fan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index cfa8d9b578dd..ad7d8fdf4f81 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -58,7 +58,7 @@ struct gpio_fan_platform_data { }; struct gpio_fan_data { - struct platform_device *pdev; + struct device *dev; struct device *hwmon_dev; /* Cooling device if any */ struct thermal_cooling_device *cdev; @@ -85,8 +85,8 @@ static void fan_alarm_notify(struct work_struct *ws) struct gpio_fan_data *fan_data = container_of(ws, struct gpio_fan_data, alarm_work); - sysfs_notify(&fan_data->pdev->dev.kobj, NULL, "fan1_alarm"); - kobject_uevent(&fan_data->pdev->dev.kobj, KOBJ_CHANGE); + sysfs_notify(&fan_data->dev->kobj, NULL, "fan1_alarm"); + kobject_uevent(&fan_data->dev->kobj, KOBJ_CHANGE); } static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id) @@ -118,11 +118,11 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data, { int err; int alarm_irq; - struct platform_device *pdev = fan_data->pdev; + struct device *dev = fan_data->dev; fan_data->alarm = alarm; - err = devm_gpio_request(&pdev->dev, alarm->gpio, "GPIO fan alarm"); + err = devm_gpio_request(dev, alarm->gpio, "GPIO fan alarm"); if (err) return err; @@ -140,7 +140,7 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data, INIT_WORK(&fan_data->alarm_work, fan_alarm_notify); irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH); - err = devm_request_irq(&pdev->dev, alarm_irq, fan_alarm_irq_handler, + err = devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler, IRQF_SHARED, "GPIO fan alarm", fan_data); return err; } @@ -191,7 +191,7 @@ static int get_fan_speed_index(struct gpio_fan_data *fan_data) if (fan_data->speed[i].ctrl_val == ctrl_val) return i; - dev_warn(&fan_data->pdev->dev, + dev_warn(fan_data->dev, "missing speed array entry for GPIO value 0x%x\n", ctrl_val); return -ENODEV; @@ -382,13 +382,13 @@ static const struct attribute_group *gpio_fan_groups[] = { static int fan_ctrl_init(struct gpio_fan_data *fan_data, struct gpio_fan_platform_data *pdata) { - struct platform_device *pdev = fan_data->pdev; + struct device *dev = fan_data->dev; int num_ctrl = pdata->num_ctrl; unsigned *ctrl = pdata->ctrl; int i, err; for (i = 0; i < num_ctrl; i++) { - err = devm_gpio_request(&pdev->dev, ctrl[i], + err = devm_gpio_request(dev, ctrl[i], "GPIO fan control"); if (err) return err; @@ -588,7 +588,7 @@ static int gpio_fan_probe(struct platform_device *pdev) return -EINVAL; #endif /* CONFIG_OF_GPIO */ - fan_data->pdev = pdev; + fan_data->dev = dev; platform_set_drvdata(pdev, fan_data); mutex_init(&fan_data->lock);