4747#define YU_GPIO_MODE0_SET 0x54
4848#define YU_GPIO_MODE0_CLEAR 0x58
4949
50- #ifdef CONFIG_PM
5150struct mlxbf2_gpio_context_save_regs {
5251 u32 gpio_mode0 ;
5352 u32 gpio_mode1 ;
5453};
55- #endif
5654
5755/* BlueField-2 gpio block context structure. */
5856struct mlxbf2_gpio_context {
@@ -61,9 +59,7 @@ struct mlxbf2_gpio_context {
6159 /* YU GPIO blocks address */
6260 void __iomem * gpio_io ;
6361
64- #ifdef CONFIG_PM
6562 struct mlxbf2_gpio_context_save_regs * csave_regs ;
66- #endif
6763};
6864
6965/* BlueField-2 gpio shared structure. */
@@ -284,11 +280,9 @@ mlxbf2_gpio_probe(struct platform_device *pdev)
284280 return 0 ;
285281}
286282
287- #ifdef CONFIG_PM
288- static int mlxbf2_gpio_suspend (struct platform_device * pdev ,
289- pm_message_t state )
283+ static int __maybe_unused mlxbf2_gpio_suspend (struct device * dev )
290284{
291- struct mlxbf2_gpio_context * gs = platform_get_drvdata ( pdev );
285+ struct mlxbf2_gpio_context * gs = dev_get_drvdata ( dev );
292286
293287 gs -> csave_regs -> gpio_mode0 = readl (gs -> gpio_io +
294288 YU_GPIO_MODE0 );
@@ -298,9 +292,9 @@ static int mlxbf2_gpio_suspend(struct platform_device *pdev,
298292 return 0 ;
299293}
300294
301- static int mlxbf2_gpio_resume (struct platform_device * pdev )
295+ static int __maybe_unused mlxbf2_gpio_resume (struct device * dev )
302296{
303- struct mlxbf2_gpio_context * gs = platform_get_drvdata ( pdev );
297+ struct mlxbf2_gpio_context * gs = dev_get_drvdata ( dev );
304298
305299 writel (gs -> csave_regs -> gpio_mode0 , gs -> gpio_io +
306300 YU_GPIO_MODE0 );
@@ -309,7 +303,7 @@ static int mlxbf2_gpio_resume(struct platform_device *pdev)
309303
310304 return 0 ;
311305}
312- #endif
306+ static SIMPLE_DEV_PM_OPS ( mlxbf2_pm_ops , mlxbf2_gpio_suspend , mlxbf2_gpio_resume ) ;
313307
314308static const struct acpi_device_id __maybe_unused mlxbf2_gpio_acpi_match [] = {
315309 { "MLNXBF22" , 0 },
@@ -321,12 +315,9 @@ static struct platform_driver mlxbf2_gpio_driver = {
321315 .driver = {
322316 .name = "mlxbf2_gpio" ,
323317 .acpi_match_table = ACPI_PTR (mlxbf2_gpio_acpi_match ),
318+ .pm = & mlxbf2_pm_ops ,
324319 },
325320 .probe = mlxbf2_gpio_probe ,
326- #ifdef CONFIG_PM
327- .suspend = mlxbf2_gpio_suspend ,
328- .resume = mlxbf2_gpio_resume ,
329- #endif
330321};
331322
332323module_platform_driver (mlxbf2_gpio_driver );
0 commit comments