From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEFCA48A8CC for ; Fri, 21 Aug 2026 12:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787314492; cv=none; b=AGAB8L/E+xKvjoalyI1Ts5HgDV3DRZhQtyy9CmAOO8gbTK9AtUfPGJo5eyzsluge0+JQCHaD+UsEOXt77J9V+cgIjvZMg8OQg61cDvYRh/2W/+PyojPJpyBPPqzs8cTW4e1Q2jx9TGjCo4AzMcdtsZ/stV7aqpQ3e41Ais4Sryk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787314492; c=relaxed/simple; bh=Lw1a/rYKqm+RyUAzzMzlTqUx+ckiHYSWoPw7mBSrPn0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UBfRESRztGCKKwn6jG4RExPFSUbLu66snFg5eN4TCoc/T12OVoadI0qu2zcfVw9livlZ/0pNeDzBYuvzz9wNh4wD6twcmcWlcjBh691vDNFUXtZ6tkMSDd6w/oKyPer8bFxA3uiz7EHfIoo02fZSe7h566z2Fmnw3GT5ybrDMKw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JGfIsm/B; arc=none smtp.client-ip=209.85.214.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JGfIsm/B" Received: by mail-pl1-f196.google.com with SMTP id d9443c01a7336-2caced6038eso8481235ad.0 for ; Fri, 21 Aug 2026 05:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787314483; x=1787919283; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=J+E8LuoYvCaF6j8f9bwDC6szUAfpZDmjOIbjXyF9amA=; b=JGfIsm/B0WhMMWFAZ0nWQT1kikb+wsKpRqDBoYRGvSrlfvoQYEmI2QSNfKWTRiyyNC dOOcW2fVZmsPGDPHT61s5ZgPOX+YXqQpHemeRmCVguih6BJlTIApmhtz/kHPRXmUww6T elCp82fEP9ER7VQANGdSxMrkxQnuI3Y3VpDQN/Cmf0fUqZe5dgwZI+jFt3pd7VhkTqSm G7n32Tg8sarTeL22CZY9WCrP638aVA/1UrGdNhgFBX4ypR2Zzpb9gpYZdNQxYv8YEgSV gCC7naD/pnJZM7eXn46CnJfuGjaTieDF7E1HaNyRH6ijwPiOXwr3oIN8s6GsNFXy0W0H CIOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787314483; x=1787919283; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=J+E8LuoYvCaF6j8f9bwDC6szUAfpZDmjOIbjXyF9amA=; b=DHqlSq4KHlYmE4doIRP7aRIey+ylsl/2jyW1cikoXk18QjrCy47EFpeO70LMwhLymV UDb7zpPjss3ixQg56FngDYTspmuFpphGRYiUJ0F3Vyy+EEzLNzkgNQUuBSoxjoMUn7q8 xTXGf4MrN9tJqTHtlh/+qYCqrL1RxTMWwtXxWISzYJPuAN5lXov8yA1yVdiiXzx7j5vR jyRfgBNoZdPSWMbOPK5yKMt5pCndzHzCEL27XKdkedoVH5HZwSjksSj8Q9ANfYFhjb77 aXO0A4QTtitPxXv9KJT6KculkZsbaT0+yGyV0yHG5dmHApLniBs2is/mYiZuamH7HUtt 5VSg== X-Forwarded-Encrypted: i=1; AHgh+RoN8dDxQkobZcdYXM+MrganQl/qrBizm25/muaKz2/he4QfoiI004F3Kt8WYLmHxelKavR/6iC5F4ifhZg=@vger.kernel.org X-Gm-Message-State: AOJu0YxIdGA27snhPJ3CbHXBoBc68mqQdGbrofFSkmuvBmPsv8q9yoKx VWtI7i8zOdxcBMDIsIjGZxFvgM5aIt2j+ZHEh0U8mrJ6F+slOoTzlQE= X-Gm-Gg: AR+sD10rCXT234pDh8IFQLDhPfRo+R4sjsM11JOWvWTsSqpgwlH2tH+efFW7p9/1xd0 hpYbm0q2bOR8rdL8OLxJAsqzV5O1q33ApFmM7ou5HdaiEYJqQq46LDrT5UiI1RAwm8wO8Rsp2UP D1NojJcgl4WJAyJg9hNkOkzKn5/jsegHMO9zNuWsxVTZwKdShIGx6AMZPxRHBKV4Gv/ot0zZQTu tEeyeh2TrIHkU5NIV0+KsCb/C8s3dqJDikG52b+OTmSduWPJOvoB/nMz7o+nsOKlEsygq1Ih35J WXIx7+5WlsUdkmfvfhkKJMDeH/EB5jjwdxQLvsTFzEOZM3fn9AxZ4DYYmgZhrlTp0gt+2fRrbf8 GtVigGzlondjz2NJQ5H4jT1UrPMvISgFFzb4Pdem4qqxNsMIu00NlTPqKRw/vU85sT7qmdP39Wh euyTP0Ij/QIjulhJj64JuJyH1d4yE6v9M/Vzq23+jLYtHW1h51AdzpypKLrPmv3JiS4Vdn9bkcI vPfqmX6e0MZwyE1tiRd9vXmVoTAPmRGH1MhgZtq84l4Xpqz9CjgqT1A5NkhTKSVpMW8KkYI6sat /+I= X-Received: by 2002:a17:903:1aac:b0:2cf:af20:4254 with SMTP id d9443c01a7336-2d61a15e594mr180662765ad.10.1787314482734; Fri, 21 Aug 2026 05:14:42 -0700 (PDT) Received: from codespaces-2db70c.3gx5x4kts4veljes22u4ri2f3b.ix.internal.cloudapp.net ([23.97.62.144]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d62e36e1eesm18038125ad.42.2026.08.21.05.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2026 05:14:42 -0700 (PDT) From: Triet Hoang To: arnd@arndb.de Cc: gregkh@linuxfoundation.org, mirq-linux@rere.qmqm.pl, eric.piel@tremplin-utc.net, jirislaby@kernel.org, oakad@yahoo.com, triet.hoang.dev@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH] drivers: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Date: Fri, 21 Aug 2026 12:13:15 +0000 Message-ID: <20260821121315.23574-1-triet.hoang.dev@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Convert the deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). This lets us drop the __maybe_unused annotations from the suspend and resume callbacks, also reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled. Also allow to remove #ifdef CONFIG_PM_SLEEP. Signed-off-by: Triet Hoang --- drivers/misc/cardreader/alcor_pci.c | 6 ++---- drivers/misc/cb710/core.c | 8 ++++---- drivers/misc/isl29003.c | 10 ++-------- drivers/misc/lis3lv02d/lis3lv02d_spi.c | 6 ++---- drivers/misc/pch_phub.c | 8 ++++---- drivers/misc/phantom.c | 8 ++++---- drivers/misc/tifm_7xx1.c | 8 ++++---- drivers/misc/tsl2550.c | 13 ++----------- 8 files changed, 24 insertions(+), 43 deletions(-) diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c index 8e7ea2c9142d..f417ee8229f6 100644 --- a/drivers/misc/cardreader/alcor_pci.c +++ b/drivers/misc/cardreader/alcor_pci.c @@ -188,7 +188,6 @@ static void alcor_pci_remove(struct pci_dev *pdev) pci_set_drvdata(pdev, NULL); } -#ifdef CONFIG_PM_SLEEP static int alcor_suspend(struct device *dev) { return 0; @@ -203,9 +202,8 @@ static int alcor_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume); static struct pci_driver alcor_driver = { .name = DRV_NAME_ALCOR_PCI, @@ -213,7 +211,7 @@ static struct pci_driver alcor_driver = { .probe = alcor_pci_probe, .remove = alcor_pci_remove, .driver = { - .pm = &alcor_pci_pm_ops + .pm = pm_sleep_ptr(&alcor_pci_pm_ops) }, }; diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c index 2dd212f04fed..955c41b6d74d 100644 --- a/drivers/misc/cb710/core.c +++ b/drivers/misc/cb710/core.c @@ -166,7 +166,7 @@ void cb710_set_irq_handler(struct cb710_slot *slot, } EXPORT_SYMBOL_GPL(cb710_set_irq_handler); -static int __maybe_unused cb710_suspend(struct device *dev_d) +static int cb710_suspend(struct device *dev_d) { struct pci_dev *pdev = to_pci_dev(dev_d); struct cb710_chip *chip = pci_get_drvdata(pdev); @@ -175,7 +175,7 @@ static int __maybe_unused cb710_suspend(struct device *dev_d) return 0; } -static int __maybe_unused cb710_resume(struct device *dev_d) +static int cb710_resume(struct device *dev_d) { struct pci_dev *pdev = to_pci_dev(dev_d); struct cb710_chip *chip = pci_get_drvdata(pdev); @@ -297,14 +297,14 @@ static const struct pci_device_id cb710_pci_tbl[] = { { 0, } }; -static SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume); static struct pci_driver cb710_driver = { .name = KBUILD_MODNAME, .id_table = cb710_pci_tbl, .probe = cb710_probe, .remove = cb710_remove_one, - .driver.pm = &cb710_pm_ops, + .driver.pm = pm_sleep_ptr(&cb710_pm_ops), }; static int __init cb710_init_module(void) diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c index 95480e16ae5f..646eda7f22ea 100644 --- a/drivers/misc/isl29003.c +++ b/drivers/misc/isl29003.c @@ -416,7 +416,6 @@ static void isl29003_remove(struct i2c_client *client) kfree(i2c_get_clientdata(client)); } -#ifdef CONFIG_PM_SLEEP static int isl29003_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -441,12 +440,7 @@ static int isl29003_resume(struct device *dev) data->power_state_before_suspend); } -static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume); -#define ISL29003_PM_OPS (&isl29003_pm_ops) - -#else -#define ISL29003_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ +static DEFINE_SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume); static const struct i2c_device_id isl29003_id[] = { { "isl29003" }, @@ -457,7 +451,7 @@ MODULE_DEVICE_TABLE(i2c, isl29003_id); static struct i2c_driver isl29003_driver = { .driver = { .name = ISL29003_DRV_NAME, - .pm = ISL29003_PM_OPS, + .pm = pm_sleep_ptr(&isl29003_pm_ops), }, .probe = isl29003_probe, .remove = isl29003_remove, diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c index 203a108b8883..f36bf160a3f8 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c @@ -105,7 +105,6 @@ static void lis302dl_spi_remove(struct spi_device *spi) lis3lv02d_remove_fs(&lis3_dev); } -#ifdef CONFIG_PM_SLEEP static int lis3lv02d_spi_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -127,15 +126,14 @@ static int lis3lv02d_spi_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend, +static DEFINE_SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend, lis3lv02d_spi_resume); static struct spi_driver lis302dl_spi_driver = { .driver = { .name = DRV_NAME, - .pm = &lis3lv02d_spi_pm, + .pm = pm_sleep_ptr(&lis3lv02d_spi_pm), .of_match_table = of_match_ptr(lis302dl_spi_dt_ids), }, .probe = lis302dl_spi_probe, diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 19c4fa017f24..937efb367423 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c @@ -724,14 +724,14 @@ static void pch_phub_remove(struct pci_dev *pdev) kfree(chip); } -static int __maybe_unused pch_phub_suspend(struct device *dev_d) +static int pch_phub_suspend(struct device *dev_d) { device_wakeup_disable(dev_d); return 0; } -static int __maybe_unused pch_phub_resume(struct device *dev_d) +static int pch_phub_resume(struct device *dev_d) { device_wakeup_disable(dev_d); @@ -748,14 +748,14 @@ static const struct pci_device_id pch_phub_pcidev_id[] = { }; MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id); -static SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume); static struct pci_driver pch_phub_driver = { .name = "pch_phub", .id_table = pch_phub_pcidev_id, .probe = pch_phub_probe, .remove = pch_phub_remove, - .driver.pm = &pch_phub_pm_ops, + .driver.pm = pm_sleep_ptr(&pch_phub_pm_ops), }; module_pci_driver(pch_phub_driver); diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 34a5054a6b40..834792a2a3a8 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c @@ -459,7 +459,7 @@ static void phantom_remove(struct pci_dev *pdev) pci_disable_device(pdev); } -static int __maybe_unused phantom_suspend(struct device *dev_d) +static int phantom_suspend(struct device *dev_d) { struct phantom_device *dev = dev_get_drvdata(dev_d); @@ -471,7 +471,7 @@ static int __maybe_unused phantom_suspend(struct device *dev_d) return 0; } -static int __maybe_unused phantom_resume(struct device *dev_d) +static int phantom_resume(struct device *dev_d) { struct phantom_device *dev = dev_get_drvdata(dev_d); @@ -488,14 +488,14 @@ static struct pci_device_id phantom_pci_tbl[] = { }; MODULE_DEVICE_TABLE(pci, phantom_pci_tbl); -static SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume); static struct pci_driver phantom_pci_driver = { .name = "phantom", .id_table = phantom_pci_tbl, .probe = phantom_probe, .remove = phantom_remove, - .driver.pm = &phantom_pm_ops, + .driver.pm = pm_sleep_ptr(&phantom_pm_ops), }; static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION); diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index 4677d5a30941..50e7dc502f16 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c @@ -207,7 +207,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work) spin_unlock_irqrestore(&fm->lock, flags); } -static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d) +static int tifm_7xx1_suspend(struct device *dev_d) { struct pci_dev *dev = to_pci_dev(dev_d); struct tifm_adapter *fm = pci_get_drvdata(dev); @@ -224,7 +224,7 @@ static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d) return 0; } -static int __maybe_unused tifm_7xx1_resume(struct device *dev_d) +static int tifm_7xx1_resume(struct device *dev_d) { struct pci_dev *dev = to_pci_dev(dev_d); struct tifm_adapter *fm = pci_get_drvdata(dev); @@ -406,14 +406,14 @@ static const struct pci_device_id tifm_7xx1_pci_tbl[] = { { } }; -static SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume); static struct pci_driver tifm_7xx1_driver = { .name = DRIVER_NAME, .id_table = tifm_7xx1_pci_tbl, .probe = tifm_7xx1_probe, .remove = tifm_7xx1_remove, - .driver.pm = &tifm_7xx1_pm_ops, + .driver.pm = pm_sleep_ptr(&tifm_7xx1_pm_ops), }; module_pci_driver(tifm_7xx1_driver); diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c index 03f19eda641e..9ee720e3e81a 100644 --- a/drivers/misc/tsl2550.c +++ b/drivers/misc/tsl2550.c @@ -398,8 +398,6 @@ static void tsl2550_remove(struct i2c_client *client) kfree(i2c_get_clientdata(client)); } -#ifdef CONFIG_PM_SLEEP - static int tsl2550_suspend(struct device *dev) { return tsl2550_set_power_state(to_i2c_client(dev), 0); @@ -410,14 +408,7 @@ static int tsl2550_resume(struct device *dev) return tsl2550_set_power_state(to_i2c_client(dev), 1); } -static SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume); -#define TSL2550_PM_OPS (&tsl2550_pm_ops) - -#else - -#define TSL2550_PM_OPS NULL - -#endif /* CONFIG_PM_SLEEP */ +static DEFINE_SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume); static const struct i2c_device_id tsl2550_id[] = { { "tsl2550" }, @@ -435,7 +426,7 @@ static struct i2c_driver tsl2550_driver = { .driver = { .name = TSL2550_DRV_NAME, .of_match_table = tsl2550_of_match, - .pm = TSL2550_PM_OPS, + .pm = pm_sleep_ptr(&tsl2550_pm_ops), }, .probe = tsl2550_probe, .remove = tsl2550_remove, -- 2.53.0