From patchwork Fri Jul 9 18:44:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12367829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F038C07E9B for ; Fri, 9 Jul 2021 18:45:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 124CA613B7 for ; Fri, 9 Jul 2021 18:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbhGISsN (ORCPT ); Fri, 9 Jul 2021 14:48:13 -0400 Received: from mout.gmx.net ([212.227.17.20]:53069 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230166AbhGISsM (ORCPT ); Fri, 9 Jul 2021 14:48:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1625856315; bh=9LcQpp3m/ahJecdV0AqlluddWgR2Iqf01zcdksGKoUc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=a+qKKTTQePnTwOj1h4gtNO8xF5mucFYY1+vOoPFeD5lC1Y5zU96WPbrAHr9SjouX+ RXhATML/T/LpvuSuRgcWyHqF33rVsVETiIC0/jfXU2TD/QdWe66jwT8fezIx5DFei3 T+tPfrdhMo8PyC8cae7R2jjLOzdqsMWrBOzbWHQU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([79.242.181.110]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mqb1c-1lOD183QYa-00mZOs; Fri, 09 Jul 2021 20:45:14 +0200 From: W_Armin@gmx.de To: linux@roeck-us.net Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 1/3] hwmon: (w83627ehf) Use platform_create_bundle Date: Fri, 9 Jul 2021 20:44:59 +0200 Message-Id: <20210709184501.6546-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210709184501.6546-1-W_Armin@gmx.de> References: <20210709184501.6546-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:mmeigJTo1DgUToqxfEjzd3hB/fLZvhNU+c/6VrP02ycb+hWb79m Dj4VvzSSHsMMsZsspE1BIx5KlhEfxNTvtZAQZJrXh0l74ARYTObgU3VfxPYM/kh/VQo0gIX xZI1K+CTSQJBE1BGpQ5gjAqGZywXjirTdkTU9lgCWb7uLTskcasurmVA8RPNicsFr6PzPo1 EJ8C9DzuJJeUA1Vmh4Z9A== X-UI-Out-Filterresults: notjunk:1;V03:K0:vuRYiIHDh0Q=:A5MBgr6EcDVwQezMEY5sMM LJ8ssweqU29rBdK37UpGk1l3+J/4tTPfi1ccGzKdiCMZesz4zyI3CKtip3t9L5N+46p+QI63E eG4PxaCds0XMBNDE2BWXCwfX9r2wD2P86Oxrv/ytP2jllYmCQsaP6fsD+KGJODcK9I/FFhkZm Rqc2A0UFO9PfNk0hsLoBJFWCbHLGjME9wTOqf0BZws2zSuTiBNbA0ZUg4UJ/MNTvS4YCDeIT1 ndI4n/SSUGkcgWKAtIcYr0FLhfli4rdmO+F6h00nltKkpf4fP/iRQthCGTzsJGyE1TL5oJ3DA zRjIMN6ncbOSNLdzmeGwlUYEyOzN4dpRSP+87YawGgSOeCmG1LeUYPt/zMNc/ODWS4kzoqqaF DkwTETWpK2JI2qYokyUXs4JWfmsVrdOqk7gva3T7tezFDUOU2BRsEaMl6ovoUPQqReiA93RxP 702nTbl6RCqTYVWAAksE35vLDVts670l0lX2E1/ZeuBU8uUByf3e6wWYSVTMEvuFVj9NMXGXu J1fOWqO66Cgh2fTwmZaQUTBLIUqzCiJA3esuYBWvWA0hseqPk4CE1MMUTeYxG7CeVAlA7iJbw YFOpH9xDHvZba3ZSVknnrMPwbV8HJ3iqOAvKW51WezUarPMaHKMkqyV64YKhasFpG7Lf1oVmO VajONqNm6c/GWmGCuQs6tSsspoVkf8hYQa0XHIualRpsNZE/A4D2sncQZT49AI2ahJnUyJqcA Y015pTn41Od1/GU0vXnoR70u8wiyT0oDJA/Ndk8jsoZEIje8DWTj2PXxwckOoH9EY6WnFoqLo 5PhSXPNT+BiO5uMkLWJSUCqj8/5Ovr10CYMxs7DGtsNYjtcfMnV7YShJeiX+gVF9uxi9gb4QS SJCC3VQw2+XEwIeNncDq+iHeIucWrO+ClTW+YQKqf55HA0X6QVsoUuVQkHwa12pBYrQ3E4SCY ln4fNYr/258ZpKiAmmtECs6XYOEZOm9nCSCSnIAVIuRKb6/DPkbePEU+gFRwVQVJY4THWSoBF S+4IQfey+3bKlvhf8iIz1QtEABo4E8sm926jGAtyXwgrXvc48lmcoH/I1aNJDXnPpcLXdUie1 iy+oGsblhUcgFjta+3R5H7xvL/JHhfFHz76 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Using platform_create_bundle() simplifies the module init code and allows w83627ehf_probe() to be marked as __init, lowering the runtime memory footprint. Signed-off-by: Armin Wolf --- drivers/hwmon/w83627ehf.c | 57 +++++++-------------------------------- 1 file changed, 10 insertions(+), 47 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 8618aaf32350..16aed90ca2ec 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1694,7 +1694,7 @@ static const struct hwmon_chip_info w83627ehf_chip_info = { .info = w83627ehf_info, }; -static int w83627ehf_probe(struct platform_device *pdev) +static int __init w83627ehf_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct w83627ehf_sio_data *sio_data = dev_get_platdata(dev); @@ -2057,7 +2057,6 @@ static struct platform_driver w83627ehf_driver = { .name = DRVNAME, .pm = W83627EHF_DEV_PM_OPS, }, - .probe = w83627ehf_probe, .remove = w83627ehf_remove, }; @@ -2150,8 +2149,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr, /* * when Super-I/O functions move to a separate file, the Super-I/O * bus will manage the lifetime of the device and this module will only keep - * track of the w83627ehf driver. But since we platform_device_alloc(), we - * must keep track of the device + * track of the w83627ehf driver. */ static struct platform_device *pdev; @@ -2159,7 +2157,10 @@ static int __init sensors_w83627ehf_init(void) { int err; unsigned short address; - struct resource res; + struct resource res = { + .name = DRVNAME, + .flags = IORESOURCE_IO, + }; struct w83627ehf_sio_data sio_data; /* @@ -2173,55 +2174,17 @@ static int __init sensors_w83627ehf_init(void) w83627ehf_find(0x4e, &address, &sio_data)) return -ENODEV; - err = platform_driver_register(&w83627ehf_driver); - if (err) - goto exit; - - pdev = platform_device_alloc(DRVNAME, address); - if (!pdev) { - err = -ENOMEM; - pr_err("Device allocation failed\n"); - goto exit_unregister; - } - - err = platform_device_add_data(pdev, &sio_data, - sizeof(struct w83627ehf_sio_data)); - if (err) { - pr_err("Platform data allocation failed\n"); - goto exit_device_put; - } - - memset(&res, 0, sizeof(res)); - res.name = DRVNAME; res.start = address + IOREGION_OFFSET; res.end = address + IOREGION_OFFSET + IOREGION_LENGTH - 1; - res.flags = IORESOURCE_IO; err = acpi_check_resource_conflict(&res); if (err) - goto exit_device_put; + return err; - err = platform_device_add_resources(pdev, &res, 1); - if (err) { - pr_err("Device resource addition failed (%d)\n", err); - goto exit_device_put; - } + pdev = platform_create_bundle(&w83627ehf_driver, w83627ehf_probe, &res, 1, &sio_data, + sizeof(struct w83627ehf_sio_data)); - /* platform_device_add calls probe() */ - err = platform_device_add(pdev); - if (err) { - pr_err("Device addition failed (%d)\n", err); - goto exit_device_put; - } - - return 0; - -exit_device_put: - platform_device_put(pdev); -exit_unregister: - platform_driver_unregister(&w83627ehf_driver); -exit: - return err; + return PTR_ERR_OR_ZERO(pdev); } static void __exit sensors_w83627ehf_exit(void) From patchwork Fri Jul 9 18:45:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12367831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD2D7C07E99 for ; Fri, 9 Jul 2021 18:45:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B60E5613B7 for ; Fri, 9 Jul 2021 18:45:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbhGISsP (ORCPT ); Fri, 9 Jul 2021 14:48:15 -0400 Received: from mout.gmx.net ([212.227.17.22]:56805 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbhGISsO (ORCPT ); Fri, 9 Jul 2021 14:48:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1625856316; bh=qXmLFM8Vc7mghqmZtcQPTuBtbivBqqPwG+BFTUVKu4I=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=bMlVABXc6N6owUZiC1AGPW4NhSZs7O1Ql754qQy7HkSKH77P6dFTqRz1cyG1P+HlQ EspkgjZis/a2WdBcC+yXpZdJ1SVZIH8wO/PgB0PJvZ8YUVNMYuLVLwk0bHPQLBpxsu AilrsyOm4UgM62Q9f2lkssPiczJAimnrAS6ZspP0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([79.242.181.110]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MgvrB-1lW8yf1Mkf-00hKRk; Fri, 09 Jul 2021 20:45:16 +0200 From: W_Armin@gmx.de To: linux@roeck-us.net Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 2/3] hwmon: (w83627ehf) Remove w83627ehf_remove() Date: Fri, 9 Jul 2021 20:45:00 +0200 Message-Id: <20210709184501.6546-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210709184501.6546-1-W_Armin@gmx.de> References: <20210709184501.6546-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:yuAfjSpuC/YcdjPHLTkzrqoykPrKTjcgRBPDASJdHx7pJibwfV9 /7UGomFYFMzuR2XbHUTC0S5CcG6c/OnnIq5rkQUBs/1Ix21+z2n5lwW8akoUuD5LKIjarAN BbTgmka5xyv+CZna6n/FtYO+ksDCjVeBm4ZpruPf11vpbHrUu0Y9zJTD92daDtBlladKnuD vyjqamAd+QPEBVlDD+QqA== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZTeBKDttopk=:lylYpCZO/D+6PGVwZVoxhY 4RTu+7qVD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+wsSq54AoWARzNUla5il6znbMF0 momAhKCpH3WOnbfjsWl0mBw8t3t3ZCvu2Rc Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Using devm_request_region() allows us to omit w83627ehf_remove() and also simplifies error handling during probe. Also fixed a checkpatch issue. Signed-off-by: Armin Wolf --- drivers/hwmon/w83627ehf.c | 42 +++++++-------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 16aed90ca2ec..19af84574324 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1705,20 +1705,12 @@ static int __init w83627ehf_probe(struct platform_device *pdev) struct device *hwmon_dev; res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (!request_region(res->start, IOREGION_LENGTH, DRVNAME)) { - err = -EBUSY; - dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", - (unsigned long)res->start, - (unsigned long)res->start + IOREGION_LENGTH - 1); - goto exit; - } + if (!devm_request_region(dev, res->start, IOREGION_LENGTH, DRVNAME)) + return -EBUSY; - data = devm_kzalloc(&pdev->dev, sizeof(struct w83627ehf_data), - GFP_KERNEL); - if (!data) { - err = -ENOMEM; - goto exit_release; - } + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; data->addr = res->start; mutex_init(&data->lock); @@ -1882,7 +1874,7 @@ static int __init w83627ehf_probe(struct platform_device *pdev) err = superio_enter(sio_data->sioreg); if (err) - goto exit_release; + return err; /* Read VID value */ if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { @@ -1951,26 +1943,7 @@ static int __init w83627ehf_probe(struct platform_device *pdev) data, &w83627ehf_chip_info, w83627ehf_groups); - if (IS_ERR(hwmon_dev)) { - err = PTR_ERR(hwmon_dev); - goto exit_release; - } - - return 0; - -exit_release: - release_region(res->start, IOREGION_LENGTH); -exit: - return err; -} - -static int w83627ehf_remove(struct platform_device *pdev) -{ - struct w83627ehf_data *data = platform_get_drvdata(pdev); - - release_region(data->addr, IOREGION_LENGTH); - - return 0; + return PTR_ERR_OR_ZERO(hwmon_dev); } #ifdef CONFIG_PM @@ -2057,7 +2030,6 @@ static struct platform_driver w83627ehf_driver = { .name = DRVNAME, .pm = W83627EHF_DEV_PM_OPS, }, - .remove = w83627ehf_remove, }; /* w83627ehf_find() looks for a '627 in the Super-I/O config space */ From patchwork Fri Jul 9 18:45:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12367833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3F0C07E9B for ; Fri, 9 Jul 2021 18:45:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68A48613BE for ; Fri, 9 Jul 2021 18:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230201AbhGISsQ (ORCPT ); Fri, 9 Jul 2021 14:48:16 -0400 Received: from mout.gmx.net ([212.227.17.21]:35043 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbhGISsQ (ORCPT ); Fri, 9 Jul 2021 14:48:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1625856318; bh=rGLVj4vDXRp4MVHS59LdfVoW4hm1SeuEwY8sZVvP+4Q=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=MrSWWngFufwe+IgRhDapEJu6eG16drr4SxYqny3Oi6n+HiNEjvBjSvMWbs1DVg4Kv y18XWtrdAwKMmeaKhxMPez9NGTQ+ruBmsxBQULgkFbfc26aAohMBusgwMxMlARmGwI JPWSgVOLdMHJEfBsele5ClUfbIti/uFYCaSLz4Nw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([79.242.181.110]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M5wPb-1m4vV03Xi7-007YQv; Fri, 09 Jul 2021 20:45:17 +0200 From: W_Armin@gmx.de To: linux@roeck-us.net Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 3/3] hwmon: (w83627ehf) Switch to SIMPLE_DEV_PM_OPS Date: Fri, 9 Jul 2021 20:45:01 +0200 Message-Id: <20210709184501.6546-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210709184501.6546-1-W_Armin@gmx.de> References: <20210709184501.6546-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:y6mHfLEhfV1wAFF7fPTMY4HjMDWwq+0GKBeP74p/3iA2CRdwfOl hrQnlFTEi6E/6wQ9eDPYZCNV48zBQox7mprTjoKuuKatVSPKB87MWFftatkZzWTNJIOIwnL fRlHz9BZwI9T4FUiMcOWTj9o8Bj3jTnsRrLPBAC3Jnvo0CcaF68QGlWaymAt56m9qIEYcgn sEU7M4Gh04iaI0CEfwOKw== X-UI-Out-Filterresults: notjunk:1;V03:K0:MiDXUwkujIA=:GWmaa6qnwWnDshKO2nVOzl CAbrHYRnU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6I1aB1K tdZNcF9V8MpEF1Y9NDwtbBqp1yn0vGUPAQz Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Use SIMPLE_DEV_PM_OPS() to also assign poweroff and thaw callbacks. Remove the now obsolete checking of CONFIG_PM too. Signed-off-by: Armin Wolf --- drivers/hwmon/w83627ehf.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 19af84574324..243b9bd8d64f 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1946,8 +1946,7 @@ static int __init w83627ehf_probe(struct platform_device *pdev) return PTR_ERR_OR_ZERO(hwmon_dev); } -#ifdef CONFIG_PM -static int w83627ehf_suspend(struct device *dev) +static int __maybe_unused w83627ehf_suspend(struct device *dev) { struct w83627ehf_data *data = w83627ehf_update_device(dev); @@ -1958,7 +1957,7 @@ static int w83627ehf_suspend(struct device *dev) return 0; } -static int w83627ehf_resume(struct device *dev) +static int __maybe_unused w83627ehf_resume(struct device *dev) { struct w83627ehf_data *data = dev_get_drvdata(dev); int i; @@ -2013,22 +2012,12 @@ static int w83627ehf_resume(struct device *dev) return 0; } -static const struct dev_pm_ops w83627ehf_dev_pm_ops = { - .suspend = w83627ehf_suspend, - .resume = w83627ehf_resume, - .freeze = w83627ehf_suspend, - .restore = w83627ehf_resume, -}; - -#define W83627EHF_DEV_PM_OPS (&w83627ehf_dev_pm_ops) -#else -#define W83627EHF_DEV_PM_OPS NULL -#endif /* CONFIG_PM */ +static SIMPLE_DEV_PM_OPS(w83627ehf_dev_pm_ops, w83627ehf_suspend, w83627ehf_resume); static struct platform_driver w83627ehf_driver = { .driver = { .name = DRVNAME, - .pm = W83627EHF_DEV_PM_OPS, + .pm = &w83627ehf_dev_pm_ops, }, };