From patchwork Tue Oct 2 08:35:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cao Van Dong X-Patchwork-Id: 10623271 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 987A915A6 for ; Tue, 2 Oct 2018 09:19:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D9A5287C9 for ; Tue, 2 Oct 2018 09:19:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71772287CD; Tue, 2 Oct 2018 09:19:34 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 29CC5287C9 for ; Tue, 2 Oct 2018 09:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726178AbeJBQBu (ORCPT ); Tue, 2 Oct 2018 12:01:50 -0400 Received: from www3345.sakura.ne.jp ([49.212.235.55]:34827 "EHLO www3345.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbeJBQBu (ORCPT ); Tue, 2 Oct 2018 12:01:50 -0400 Received: from fsav301.sakura.ne.jp (fsav301.sakura.ne.jp [153.120.85.132]) by www3345.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w928ZeLm092071; Tue, 2 Oct 2018 17:35:40 +0900 (JST) (envelope-from cv-dong@jinso.co.jp) Received: from www3345.sakura.ne.jp (49.212.235.55) by fsav301.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp); Tue, 02 Oct 2018 17:35:40 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav301.sakura.ne.jp) Received: from localhost (p14010-ipadfx41marunouchi.tokyo.ocn.ne.jp [61.118.107.10]) (authenticated bits=0) by www3345.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w928ZOCF091864 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Oct 2018 17:35:39 +0900 (JST) (envelope-from cv-dong@jinso.co.jp) From: Cao Van Dong To: broonie@kernel.org, geert+renesas@glider.be, linux-hwmon@vger.kernel.org Cc: kuninori.morimoto.gx@renesas.com, yoshihiro.shimoda.uh@renesas.com, linux-renesas-soc@vger.kernel.org, h-inayoshi@jinso.co.jp, nv-dung@jinso.co.jp, na-hoan@jinso.co.jp, cv-dong@jinso.co.jp Subject: [PATCH] hwmon: Fix the 'No sensors found' error after replacing the parameter NULL by the actual device Date: Tue, 2 Oct 2018 17:35:24 +0900 Message-Id: <1538469324-8028-1-git-send-email-cv-dong@jinso.co.jp> X-Mailer: git-send-email 2.7.4 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 In __hwmon_device_register() function of hwmon.c, we have assigned 'dev' directly to 'hdev->parent'. Formerly, when registering the hwmon device, we pass NULL as the device. This is not affected. Recently, the developer has replaced the parameter NULL as the device by the actual device. This causes the "No sensors found" error. This patch is to fix this error. This patch is based on the v4.19-rc3 tag. --- drivers/hwmon/hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 33d5128..7c8d3cb 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -610,7 +610,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, hwdev->name = name; hdev->class = &hwmon_class; - hdev->parent = dev; + hdev->parent = dev->parent; hdev->of_node = dev ? dev->of_node : NULL; hwdev->chip = chip; dev_set_drvdata(hdev, drvdata);