From patchwork Wed Oct 17 01:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 10644493 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 3E53715E2 for ; Wed, 17 Oct 2018 01:25:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6242A419 for ; Wed, 17 Oct 2018 01:25:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 220242A426; Wed, 17 Oct 2018 01:25: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 C38922A419 for ; Wed, 17 Oct 2018 01:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbeJQJRo (ORCPT ); Wed, 17 Oct 2018 05:17:44 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46049 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727020AbeJQJRo (ORCPT ); Wed, 17 Oct 2018 05:17:44 -0400 Received: by mail-pf1-f194.google.com with SMTP id u12-v6so12306999pfn.12; Tue, 16 Oct 2018 18:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jpZN/UlmIedOp/RKX94XiVdcF9ZfG+QGI91FHkbRWhk=; b=uQVuRfKtHlivOgY0ZxSOL9P+Hxz4gRsS2sD/9p0zKKEsIc6ZmC5IuhVYWLRVmUsbc8 68JSzV2PfmYzj/saIZcAjhnpJ4yKxEkGComQyCOnWDGkBXF8iwEs3axTdI94YRFkPDRR v55r5B7VJ1drDS3topuadQJPFtlctvYrCQmfwUzJuNy/4OB/RQyvpdExIZuCCn3Tb6Ia 1ZpekuXBaaV83/lD0icqDODzwTdHIqQbeBQgyW4rDVIxBuv0HNlWRIf4d7X+DsjOkbIy Bb6Yr+wLGPj6RgTqHMDTdkdyCVHWPQcch4RTnu4WUeeNfdQ7C2GnoYOBOHfNHHOoAs4I sjbw== 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=jpZN/UlmIedOp/RKX94XiVdcF9ZfG+QGI91FHkbRWhk=; b=Yabwtaiz8woRV13HMt4KqWlM83WOhCmeg6TapxlNYVBaepm9BnkJdYf8ePlbaXUJwf WYr46AMURpR4Ik43xCTtODeLOYyWugT6mY6bTADSkLpCBmtUlCJnA36tNSyPL4ioLTkX h0VeSMtVW1/QWqcH7/qLszqno4x2i/S4AjJmgIoRJvGe51RmgojE3iYkKzL5zpPA3rYb MqmP6DfKRseeVUU6gpX+LI/bmoXMmAGCgkFujQxioMyWxhFPgwZuzRPNS6mv/Y469YI4 xq0ixNFZA7xqbtBhlthY/La+kR1LNes1CvNNB1D0LNLtbI42Kt56uydy8CPmxPEwjt1H ThDg== X-Gm-Message-State: ABuFfoiTM1oDo4zVQMlQK8zmPcaMpfLsGrgPasN9a06Kx3+SReL2SMWQ g21w0OGjmgwwdZgXZ7NzOCE= X-Google-Smtp-Source: ACcGV62dkkPktNSuueU1ZXn0foP9qAQS7q6lJUax7eTR8b1CYQLGgSa6Gt0TlpFE97ivKlG7DrUPXQ== X-Received: by 2002:a62:15ce:: with SMTP id 197-v6mr15679172pfv.222.1539739473915; Tue, 16 Oct 2018 18:24:33 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id n64-v6sm22841851pfi.185.2018.10.16.18.24.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 18:24:33 -0700 (PDT) From: Nicolin Chen To: jdelvare@suse.com, linux@roeck-us.net Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] hwmon: (core) Inherit power properties to hdev Date: Tue, 16 Oct 2018 18:24:22 -0700 Message-Id: <20181017012426.26958-2-nicoleotsuka@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181017012426.26958-1-nicoleotsuka@gmail.com> References: <20181017012426.26958-1-nicoleotsuka@gmail.com> 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 new hdev is a child device related to the original parent hwmon driver and its device. However, it doesn't support the power features, typically being defined in the parent driver. So this patch inherits three necessary power properties from the parent dev to hdev: power, pm_domain and driver pointers. Note that the dev->driver pointer is the place that contains a dev_pm_ops pointer defined in the parent device driver and the pm runtime core also checks this pointer: if (!cb && dev->driver && dev->driver->pm) Signed-off-by: Nicolin Chen --- drivers/hwmon/hwmon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 975c95169884..7c064e1218ba 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -625,6 +625,9 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, hwdev->name = name; hdev->class = &hwmon_class; hdev->parent = dev; + hdev->driver = dev->driver; + hdev->power = dev->power; + hdev->pm_domain = dev->pm_domain; hdev->of_node = dev ? dev->of_node : NULL; hwdev->chip = chip; dev_set_drvdata(hdev, drvdata);