Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM / PXA: Use struct syscore_ops for "core" power management

Replace sysdev classes and struct sys_device objects used for "core"
power management by the PXA platform code with struct syscore_ops
objects that are simpler.

This reduces the code size and the kernel memory footprint. It also
is necessary for removing sysdevs entirely from the kernel in the
future.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>

+110 -307
-1
arch/arm/mach-pxa/balloon3.c
··· 15 15 16 16 #include <linux/init.h> 17 17 #include <linux/platform_device.h> 18 - #include <linux/sysdev.h> 19 18 #include <linux/interrupt.h> 20 19 #include <linux/sched.h> 21 20 #include <linux/bitops.h>
+4 -14
arch/arm/mach-pxa/clock-pxa2xx.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/kernel.h> 11 11 #include <linux/init.h> 12 - #include <linux/sysdev.h> 12 + #include <linux/syscore_ops.h> 13 13 14 14 #include <mach/pxa2xx-regs.h> 15 15 ··· 33 33 #ifdef CONFIG_PM 34 34 static uint32_t saved_cken; 35 35 36 - static int pxa2xx_clock_suspend(struct sys_device *d, pm_message_t state) 36 + static int pxa2xx_clock_suspend(void) 37 37 { 38 38 saved_cken = CKEN; 39 39 return 0; 40 40 } 41 41 42 - static int pxa2xx_clock_resume(struct sys_device *d) 42 + static void pxa2xx_clock_resume(void) 43 43 { 44 44 CKEN = saved_cken; 45 - return 0; 46 45 } 47 46 #else 48 47 #define pxa2xx_clock_suspend NULL 49 48 #define pxa2xx_clock_resume NULL 50 49 #endif 51 50 52 - struct sysdev_class pxa2xx_clock_sysclass = { 53 - .name = "pxa2xx-clock", 51 + struct syscore_ops pxa2xx_clock_syscore_ops = { 54 52 .suspend = pxa2xx_clock_suspend, 55 53 .resume = pxa2xx_clock_resume, 56 54 }; 57 - 58 - static int __init pxa2xx_clock_init(void) 59 - { 60 - if (cpu_is_pxa2xx()) 61 - return sysdev_class_register(&pxa2xx_clock_sysclass); 62 - return 0; 63 - } 64 - postcore_initcall(pxa2xx_clock_init);
+4 -13
arch/arm/mach-pxa/clock-pxa3xx.c
··· 10 10 #include <linux/kernel.h> 11 11 #include <linux/init.h> 12 12 #include <linux/io.h> 13 + #include <linux/syscore_ops.h> 13 14 14 15 #include <mach/smemc.h> 15 16 #include <mach/pxa3xx-regs.h> ··· 183 182 static uint32_t cken[2]; 184 183 static uint32_t accr; 185 184 186 - static int pxa3xx_clock_suspend(struct sys_device *d, pm_message_t state) 185 + static int pxa3xx_clock_suspend(void) 187 186 { 188 187 cken[0] = CKENA; 189 188 cken[1] = CKENB; ··· 191 190 return 0; 192 191 } 193 192 194 - static int pxa3xx_clock_resume(struct sys_device *d) 193 + static void pxa3xx_clock_resume(void) 195 194 { 196 195 ACCR = accr; 197 196 CKENA = cken[0]; 198 197 CKENB = cken[1]; 199 - return 0; 200 198 } 201 199 #else 202 200 #define pxa3xx_clock_suspend NULL 203 201 #define pxa3xx_clock_resume NULL 204 202 #endif 205 203 206 - struct sysdev_class pxa3xx_clock_sysclass = { 207 - .name = "pxa3xx-clock", 204 + struct syscore_ops pxa3xx_clock_syscore_ops = { 208 205 .suspend = pxa3xx_clock_suspend, 209 206 .resume = pxa3xx_clock_resume, 210 207 }; 211 - 212 - static int __init pxa3xx_clock_init(void) 213 - { 214 - if (cpu_is_pxa3xx() || cpu_is_pxa95x()) 215 - return sysdev_class_register(&pxa3xx_clock_sysclass); 216 - return 0; 217 - } 218 - postcore_initcall(pxa3xx_clock_init);
+4 -3
arch/arm/mach-pxa/clock.h
··· 1 1 #include <linux/clkdev.h> 2 - #include <linux/sysdev.h> 2 + #include <linux/syscore_ops.h> 3 3 4 4 struct clkops { 5 5 void (*enable)(struct clk *); ··· 54 54 void clk_pxa2xx_cken_enable(struct clk *clk); 55 55 void clk_pxa2xx_cken_disable(struct clk *clk); 56 56 57 - extern struct sysdev_class pxa2xx_clock_sysclass; 57 + extern struct syscore_ops pxa2xx_clock_syscore_ops; 58 58 59 59 #if defined(CONFIG_PXA3xx) || defined(CONFIG_PXA95x) 60 60 #define DEFINE_PXA3_CKEN(_name, _cken, _rate, _delay) \ ··· 74 74 extern void clk_pxa3xx_cken_enable(struct clk *); 75 75 extern void clk_pxa3xx_cken_disable(struct clk *); 76 76 77 - extern struct sysdev_class pxa3xx_clock_sysclass; 77 + extern struct syscore_ops pxa3xx_clock_syscore_ops; 78 + 78 79 #endif
-1
arch/arm/mach-pxa/cm-x270.c
··· 10 10 */ 11 11 12 12 #include <linux/platform_device.h> 13 - #include <linux/sysdev.h> 14 13 #include <linux/irq.h> 15 14 #include <linux/gpio.h> 16 15 #include <linux/delay.h>
+7 -16
arch/arm/mach-pxa/cm-x2xx.c
··· 10 10 */ 11 11 12 12 #include <linux/platform_device.h> 13 - #include <linux/sysdev.h> 13 + #include <linux/syscore_ops.h> 14 14 #include <linux/irq.h> 15 15 #include <linux/gpio.h> 16 16 ··· 388 388 #ifdef CONFIG_PM 389 389 static unsigned long sleep_save_msc[10]; 390 390 391 - static int cmx2xx_suspend(struct sys_device *dev, pm_message_t state) 391 + static int cmx2xx_suspend(void) 392 392 { 393 393 cmx2xx_pci_suspend(); 394 394 ··· 412 412 return 0; 413 413 } 414 414 415 - static int cmx2xx_resume(struct sys_device *dev) 415 + static void cmx2xx_resume(void) 416 416 { 417 417 cmx2xx_pci_resume(); 418 418 ··· 420 420 __raw_writel(sleep_save_msc[0], MSC0); 421 421 __raw_writel(sleep_save_msc[1], MSC1); 422 422 __raw_writel(sleep_save_msc[2], MSC2); 423 - 424 - return 0; 425 423 } 426 424 427 - static struct sysdev_class cmx2xx_pm_sysclass = { 428 - .name = "pm", 425 + static struct syscore_ops cmx2xx_pm_syscore_ops = { 429 426 .resume = cmx2xx_resume, 430 427 .suspend = cmx2xx_suspend, 431 428 }; 432 429 433 - static struct sys_device cmx2xx_pm_device = { 434 - .cls = &cmx2xx_pm_sysclass, 435 - }; 436 - 437 430 static int __init cmx2xx_pm_init(void) 438 431 { 439 - int error; 440 - error = sysdev_class_register(&cmx2xx_pm_sysclass); 441 - if (error == 0) 442 - error = sysdev_register(&cmx2xx_pm_device); 443 - return error; 432 + register_syscore_ops(&cmx2xx_pm_syscore_ops); 433 + 434 + return 0; 444 435 } 445 436 #else 446 437 static int __init cmx2xx_pm_init(void) { return 0; }
-1
arch/arm/mach-pxa/colibri-evalboard.c
··· 13 13 #include <linux/init.h> 14 14 #include <linux/kernel.h> 15 15 #include <linux/platform_device.h> 16 - #include <linux/sysdev.h> 17 16 #include <linux/interrupt.h> 18 17 #include <linux/gpio.h> 19 18 #include <asm/mach-types.h>
-1
arch/arm/mach-pxa/colibri-pxa270-income.c
··· 22 22 #include <linux/platform_device.h> 23 23 #include <linux/pwm_backlight.h> 24 24 #include <linux/i2c/pxa-i2c.h> 25 - #include <linux/sysdev.h> 26 25 27 26 #include <asm/irq.h> 28 27 #include <asm/mach-types.h>
-1
arch/arm/mach-pxa/colibri-pxa270.c
··· 17 17 #include <linux/mtd/partitions.h> 18 18 #include <linux/mtd/physmap.h> 19 19 #include <linux/platform_device.h> 20 - #include <linux/sysdev.h> 21 20 #include <linux/ucb1400.h> 22 21 23 22 #include <asm/mach/arch.h>
+4 -4
arch/arm/mach-pxa/generic.h
··· 61 61 #define pxa3xx_get_clk_frequency_khz(x) (0) 62 62 #endif 63 63 64 - extern struct sysdev_class pxa_irq_sysclass; 65 - extern struct sysdev_class pxa_gpio_sysclass; 66 - extern struct sysdev_class pxa2xx_mfp_sysclass; 67 - extern struct sysdev_class pxa3xx_mfp_sysclass; 64 + extern struct syscore_ops pxa_irq_syscore_ops; 65 + extern struct syscore_ops pxa_gpio_syscore_ops; 66 + extern struct syscore_ops pxa2xx_mfp_syscore_ops; 67 + extern struct syscore_ops pxa3xx_mfp_syscore_ops; 68 68 69 69 void __init pxa_set_ffuart_info(void *info); 70 70 void __init pxa_set_btuart_info(void *info);
+4 -13
arch/arm/mach-pxa/irq.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/module.h> 17 17 #include <linux/interrupt.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/syscore_ops.h> 19 19 #include <linux/io.h> 20 20 #include <linux/irq.h> 21 21 ··· 183 183 static unsigned long saved_icmr[MAX_INTERNAL_IRQS/32]; 184 184 static unsigned long saved_ipr[MAX_INTERNAL_IRQS]; 185 185 186 - static int pxa_irq_suspend(struct sys_device *dev, pm_message_t state) 186 + static int pxa_irq_suspend(void) 187 187 { 188 188 int i; 189 189 ··· 202 202 return 0; 203 203 } 204 204 205 - static int pxa_irq_resume(struct sys_device *dev) 205 + static void pxa_irq_resume(void) 206 206 { 207 207 int i; 208 208 ··· 218 218 __raw_writel(saved_ipr[i], IRQ_BASE + IPR(i)); 219 219 220 220 __raw_writel(1, IRQ_BASE + ICCR); 221 - return 0; 222 221 } 223 222 #else 224 223 #define pxa_irq_suspend NULL 225 224 #define pxa_irq_resume NULL 226 225 #endif 227 226 228 - struct sysdev_class pxa_irq_sysclass = { 229 - .name = "irq", 227 + struct syscore_ops pxa_irq_syscore_ops = { 230 228 .suspend = pxa_irq_suspend, 231 229 .resume = pxa_irq_resume, 232 230 }; 233 - 234 - static int __init pxa_irq_init(void) 235 - { 236 - return sysdev_class_register(&pxa_irq_sysclass); 237 - } 238 - 239 - core_initcall(pxa_irq_init);
+6 -14
arch/arm/mach-pxa/lpd270.c
··· 15 15 16 16 #include <linux/init.h> 17 17 #include <linux/platform_device.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/syscore_ops.h> 19 19 #include <linux/interrupt.h> 20 20 #include <linux/sched.h> 21 21 #include <linux/bitops.h> ··· 159 159 160 160 161 161 #ifdef CONFIG_PM 162 - static int lpd270_irq_resume(struct sys_device *dev) 162 + static void lpd270_irq_resume(void) 163 163 { 164 164 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK); 165 - return 0; 166 165 } 167 166 168 - static struct sysdev_class lpd270_irq_sysclass = { 169 - .name = "cpld_irq", 167 + static struct syscore_ops lpd270_irq_syscore_ops = { 170 168 .resume = lpd270_irq_resume, 171 - }; 172 - 173 - static struct sys_device lpd270_irq_device = { 174 - .cls = &lpd270_irq_sysclass, 175 169 }; 176 170 177 171 static int __init lpd270_irq_device_init(void) 178 172 { 179 - int ret = -ENODEV; 180 173 if (machine_is_logicpd_pxa270()) { 181 - ret = sysdev_class_register(&lpd270_irq_sysclass); 182 - if (ret == 0) 183 - ret = sysdev_register(&lpd270_irq_device); 174 + register_syscore_ops(&lpd270_irq_syscore_ops); 175 + return 0; 184 176 } 185 - return ret; 177 + return -ENODEV; 186 178 } 187 179 188 180 device_initcall(lpd270_irq_device_init);
+6 -15
arch/arm/mach-pxa/lubbock.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/init.h> 17 17 #include <linux/platform_device.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/syscore_ops.h> 19 19 #include <linux/major.h> 20 20 #include <linux/fb.h> 21 21 #include <linux/interrupt.h> ··· 176 176 177 177 #ifdef CONFIG_PM 178 178 179 - static int lubbock_irq_resume(struct sys_device *dev) 179 + static void lubbock_irq_resume(void) 180 180 { 181 181 LUB_IRQ_MASK_EN = lubbock_irq_enabled; 182 - return 0; 183 182 } 184 183 185 - static struct sysdev_class lubbock_irq_sysclass = { 186 - .name = "cpld_irq", 184 + static struct syscore_ops lubbock_irq_syscore_ops = { 187 185 .resume = lubbock_irq_resume, 188 - }; 189 - 190 - static struct sys_device lubbock_irq_device = { 191 - .cls = &lubbock_irq_sysclass, 192 186 }; 193 187 194 188 static int __init lubbock_irq_device_init(void) 195 189 { 196 - int ret = -ENODEV; 197 - 198 190 if (machine_is_lubbock()) { 199 - ret = sysdev_class_register(&lubbock_irq_sysclass); 200 - if (ret == 0) 201 - ret = sysdev_register(&lubbock_irq_device); 191 + register_syscore_ops(&lubbock_irq_syscore_ops); 192 + return 0; 202 193 } 203 - return ret; 194 + return -ENODEV; 204 195 } 205 196 206 197 device_initcall(lubbock_irq_device_init);
+6 -16
arch/arm/mach-pxa/mainstone.c
··· 15 15 16 16 #include <linux/init.h> 17 17 #include <linux/platform_device.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/syscore_ops.h> 19 19 #include <linux/interrupt.h> 20 20 #include <linux/sched.h> 21 21 #include <linux/bitops.h> ··· 185 185 186 186 #ifdef CONFIG_PM 187 187 188 - static int mainstone_irq_resume(struct sys_device *dev) 188 + static void mainstone_irq_resume(void) 189 189 { 190 190 MST_INTMSKENA = mainstone_irq_enabled; 191 - return 0; 192 191 } 193 192 194 - static struct sysdev_class mainstone_irq_sysclass = { 195 - .name = "cpld_irq", 193 + static struct syscore_ops mainstone_irq_syscore_ops = { 196 194 .resume = mainstone_irq_resume, 197 - }; 198 - 199 - static struct sys_device mainstone_irq_device = { 200 - .cls = &mainstone_irq_sysclass, 201 195 }; 202 196 203 197 static int __init mainstone_irq_device_init(void) 204 198 { 205 - int ret = -ENODEV; 199 + if (machine_is_mainstone()) 200 + register_syscore_ops(&mainstone_irq_syscore_ops); 206 201 207 - if (machine_is_mainstone()) { 208 - ret = sysdev_class_register(&mainstone_irq_sysclass); 209 - if (ret == 0) 210 - ret = sysdev_register(&mainstone_irq_device); 211 - } 212 - return ret; 202 + return 0; 213 203 } 214 204 215 205 device_initcall(mainstone_irq_device_init);
+5 -7
arch/arm/mach-pxa/mfp-pxa2xx.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 - #include <linux/sysdev.h> 19 + #include <linux/syscore_ops.h> 20 20 21 21 #include <mach/gpio.h> 22 22 #include <mach/pxa2xx-regs.h> ··· 338 338 static unsigned long saved_gpdr[4]; 339 339 static unsigned long saved_pgsr[4]; 340 340 341 - static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state) 341 + static int pxa2xx_mfp_suspend(void) 342 342 { 343 343 int i; 344 344 ··· 365 365 return 0; 366 366 } 367 367 368 - static int pxa2xx_mfp_resume(struct sys_device *d) 368 + static void pxa2xx_mfp_resume(void) 369 369 { 370 370 int i; 371 371 ··· 376 376 PGSR(i) = saved_pgsr[i]; 377 377 } 378 378 PSSR = PSSR_RDH | PSSR_PH; 379 - return 0; 380 379 } 381 380 #else 382 381 #define pxa2xx_mfp_suspend NULL 383 382 #define pxa2xx_mfp_resume NULL 384 383 #endif 385 384 386 - struct sysdev_class pxa2xx_mfp_sysclass = { 387 - .name = "mfp", 385 + struct syscore_ops pxa2xx_mfp_syscore_ops = { 388 386 .suspend = pxa2xx_mfp_suspend, 389 387 .resume = pxa2xx_mfp_resume, 390 388 }; ··· 407 409 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) 408 410 gpdr_lpm[i] = GPDR(i * 32); 409 411 410 - return sysdev_class_register(&pxa2xx_mfp_sysclass); 412 + return 0; 411 413 } 412 414 postcore_initcall(pxa2xx_mfp_init);
+5 -16
arch/arm/mach-pxa/mfp-pxa3xx.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 19 #include <linux/io.h> 20 - #include <linux/sysdev.h> 20 + #include <linux/syscore_ops.h> 21 21 22 22 #include <mach/hardware.h> 23 23 #include <mach/mfp-pxa3xx.h> ··· 31 31 * a pull-down mode if they're an active low chip select, and we're 32 32 * just entering standby. 33 33 */ 34 - static int pxa3xx_mfp_suspend(struct sys_device *d, pm_message_t state) 34 + static int pxa3xx_mfp_suspend(void) 35 35 { 36 36 mfp_config_lpm(); 37 37 return 0; 38 38 } 39 39 40 - static int pxa3xx_mfp_resume(struct sys_device *d) 40 + static void pxa3xx_mfp_resume(void) 41 41 { 42 42 mfp_config_run(); 43 43 ··· 47 47 * preserve them here in case they will be referenced later 48 48 */ 49 49 ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 50 - return 0; 51 50 } 52 51 #else 53 52 #define pxa3xx_mfp_suspend NULL 54 53 #define pxa3xx_mfp_resume NULL 55 54 #endif 56 55 57 - struct sysdev_class pxa3xx_mfp_sysclass = { 58 - .name = "mfp", 56 + struct syscore_ops pxa3xx_mfp_syscore_ops = { 59 57 .suspend = pxa3xx_mfp_suspend, 60 - .resume = pxa3xx_mfp_resume, 58 + .resume = pxa3xx_mfp_resume, 61 59 }; 62 - 63 - static int __init mfp_init_devicefs(void) 64 - { 65 - if (cpu_is_pxa3xx()) 66 - return sysdev_class_register(&pxa3xx_mfp_sysclass); 67 - 68 - return 0; 69 - } 70 - postcore_initcall(mfp_init_devicefs);
+8 -35
arch/arm/mach-pxa/mioa701.c
··· 22 22 #include <linux/kernel.h> 23 23 #include <linux/init.h> 24 24 #include <linux/platform_device.h> 25 - #include <linux/sysdev.h> 25 + #include <linux/syscore_ops.h> 26 26 #include <linux/input.h> 27 27 #include <linux/delay.h> 28 28 #include <linux/gpio_keys.h> ··· 488 488 } 489 489 490 490 491 - static int mioa701_sys_suspend(struct sys_device *sysdev, pm_message_t state) 491 + static int mioa701_sys_suspend(void) 492 492 { 493 493 int i = 0, is_bt_on; 494 494 u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); ··· 514 514 return 0; 515 515 } 516 516 517 - static int mioa701_sys_resume(struct sys_device *sysdev) 517 + static void mioa701_sys_resume(void) 518 518 { 519 519 int i = 0; 520 520 u32 *mem_resume_vector = phys_to_virt(RESUME_VECTOR_ADDR); ··· 527 527 *mem_resume_enabler = save_buffer[i++]; 528 528 *mem_resume_bt = save_buffer[i++]; 529 529 *mem_resume_unknown = save_buffer[i++]; 530 - 531 - return 0; 532 530 } 533 531 534 - static struct sysdev_class mioa701_sysclass = { 535 - .name = "mioa701", 536 - }; 537 - 538 - static struct sys_device sysdev_bootstrap = { 539 - .cls = &mioa701_sysclass, 540 - }; 541 - 542 - static struct sysdev_driver driver_bootstrap = { 543 - .suspend = &mioa701_sys_suspend, 544 - .resume = &mioa701_sys_resume, 532 + static struct syscore_ops mioa701_syscore_ops = { 533 + .suspend = mioa701_sys_suspend, 534 + .resume = mioa701_sys_resume, 545 535 }; 546 536 547 537 static int __init bootstrap_init(void) 548 538 { 549 - int rc; 550 539 int save_size = mioa701_bootstrap_lg + (sizeof(u32) * 3); 551 540 552 - rc = sysdev_class_register(&mioa701_sysclass); 553 - if (rc) { 554 - printk(KERN_ERR "Failed registering mioa701 sys class\n"); 555 - return -ENODEV; 556 - } 557 - rc = sysdev_register(&sysdev_bootstrap); 558 - if (rc) { 559 - printk(KERN_ERR "Failed registering mioa701 sys device\n"); 560 - return -ENODEV; 561 - } 562 - rc = sysdev_driver_register(&mioa701_sysclass, &driver_bootstrap); 563 - if (rc) { 564 - printk(KERN_ERR "Failed registering PMU sys driver\n"); 565 - return -ENODEV; 566 - } 541 + register_syscore_ops(&mioa701_syscore_ops); 567 542 568 543 save_buffer = kmalloc(save_size, GFP_KERNEL); 569 544 if (!save_buffer) ··· 551 576 static void bootstrap_exit(void) 552 577 { 553 578 kfree(save_buffer); 554 - sysdev_driver_unregister(&mioa701_sysclass, &driver_bootstrap); 555 - sysdev_unregister(&sysdev_bootstrap); 556 - sysdev_class_unregister(&mioa701_sysclass); 579 + unregister_syscore_ops(&mioa701_syscore_ops); 557 580 558 581 printk(KERN_CRIT "Unregistering mioa701 suspend will hang next" 559 582 "resume !!!\n");
-1
arch/arm/mach-pxa/palmld.c
··· 24 24 #include <linux/gpio.h> 25 25 #include <linux/wm97xx.h> 26 26 #include <linux/power_supply.h> 27 - #include <linux/sysdev.h> 28 27 #include <linux/mtd/mtd.h> 29 28 #include <linux/mtd/partitions.h> 30 29 #include <linux/mtd/physmap.h>
-1
arch/arm/mach-pxa/palmtreo.c
··· 25 25 #include <linux/pwm_backlight.h> 26 26 #include <linux/gpio.h> 27 27 #include <linux/power_supply.h> 28 - #include <linux/sysdev.h> 29 28 #include <linux/w1-gpio.h> 30 29 31 30 #include <asm/mach-types.h>
+8 -16
arch/arm/mach-pxa/palmz72.c
··· 19 19 */ 20 20 21 21 #include <linux/platform_device.h> 22 - #include <linux/sysdev.h> 22 + #include <linux/syscore_ops.h> 23 23 #include <linux/delay.h> 24 24 #include <linux/irq.h> 25 25 #include <linux/gpio_keys.h> ··· 233 233 234 234 static unsigned long store_ptr; 235 235 236 - /* sys_device for Palm Zire 72 PM */ 236 + /* syscore_ops for Palm Zire 72 PM */ 237 237 238 - static int palmz72_pm_suspend(struct sys_device *dev, pm_message_t msg) 238 + static int palmz72_pm_suspend(void) 239 239 { 240 240 /* setup the resume_info struct for the original bootloader */ 241 241 palmz72_resume_info.resume_addr = (u32) cpu_resume; ··· 249 249 return 0; 250 250 } 251 251 252 - static int palmz72_pm_resume(struct sys_device *dev) 252 + static void palmz72_pm_resume(void) 253 253 { 254 254 *PALMZ72_SAVE_DWORD = store_ptr; 255 - return 0; 256 255 } 257 256 258 - static struct sysdev_class palmz72_pm_sysclass = { 259 - .name = "palmz72_pm", 257 + static struct syscore_ops palmz72_pm_syscore_ops = { 260 258 .suspend = palmz72_pm_suspend, 261 259 .resume = palmz72_pm_resume, 262 260 }; 263 261 264 - static struct sys_device palmz72_pm_device = { 265 - .cls = &palmz72_pm_sysclass, 266 - }; 267 - 268 262 static int __init palmz72_pm_init(void) 269 263 { 270 - int ret = -ENODEV; 271 264 if (machine_is_palmz72()) { 272 - ret = sysdev_class_register(&palmz72_pm_sysclass); 273 - if (ret == 0) 274 - ret = sysdev_register(&palmz72_pm_device); 265 + register_syscore_ops(&palmz72_pm_syscore_ops); 266 + return 0; 275 267 } 276 - return ret; 268 + return -ENODEV; 277 269 } 278 270 279 271 device_initcall(palmz72_pm_init);
+6 -19
arch/arm/mach-pxa/pxa25x.c
··· 21 21 #include <linux/init.h> 22 22 #include <linux/platform_device.h> 23 23 #include <linux/suspend.h> 24 - #include <linux/sysdev.h> 24 + #include <linux/syscore_ops.h> 25 25 #include <linux/irq.h> 26 26 27 27 #include <asm/mach/map.h> ··· 350 350 &pxa_device_asoc_platform, 351 351 }; 352 352 353 - static struct sys_device pxa25x_sysdev[] = { 354 - { 355 - .cls = &pxa_irq_sysclass, 356 - }, { 357 - .cls = &pxa2xx_mfp_sysclass, 358 - }, { 359 - .cls = &pxa_gpio_sysclass, 360 - }, { 361 - .cls = &pxa2xx_clock_sysclass, 362 - } 363 - }; 364 - 365 353 static int __init pxa25x_init(void) 366 354 { 367 - int i, ret = 0; 355 + int ret = 0; 368 356 369 357 if (cpu_is_pxa25x()) { 370 358 ··· 365 377 366 378 pxa25x_init_pm(); 367 379 368 - for (i = 0; i < ARRAY_SIZE(pxa25x_sysdev); i++) { 369 - ret = sysdev_register(&pxa25x_sysdev[i]); 370 - if (ret) 371 - pr_err("failed to register sysdev[%d]\n", i); 372 - } 380 + register_syscore_ops(&pxa_irq_syscore_ops); 381 + register_syscore_ops(&pxa2xx_mfp_syscore_ops); 382 + register_syscore_ops(&pxa_gpio_syscore_ops); 383 + register_syscore_ops(&pxa2xx_clock_syscore_ops); 373 384 374 385 ret = platform_add_devices(pxa25x_devices, 375 386 ARRAY_SIZE(pxa25x_devices));
+6 -19
arch/arm/mach-pxa/pxa27x.c
··· 16 16 #include <linux/init.h> 17 17 #include <linux/suspend.h> 18 18 #include <linux/platform_device.h> 19 - #include <linux/sysdev.h> 19 + #include <linux/syscore_ops.h> 20 20 #include <linux/io.h> 21 21 #include <linux/irq.h> 22 22 #include <linux/i2c/pxa-i2c.h> ··· 428 428 &pxa27x_device_pwm1, 429 429 }; 430 430 431 - static struct sys_device pxa27x_sysdev[] = { 432 - { 433 - .cls = &pxa_irq_sysclass, 434 - }, { 435 - .cls = &pxa2xx_mfp_sysclass, 436 - }, { 437 - .cls = &pxa_gpio_sysclass, 438 - }, { 439 - .cls = &pxa2xx_clock_sysclass, 440 - } 441 - }; 442 - 443 431 static int __init pxa27x_init(void) 444 432 { 445 - int i, ret = 0; 433 + int ret = 0; 446 434 447 435 if (cpu_is_pxa27x()) { 448 436 ··· 443 455 444 456 pxa27x_init_pm(); 445 457 446 - for (i = 0; i < ARRAY_SIZE(pxa27x_sysdev); i++) { 447 - ret = sysdev_register(&pxa27x_sysdev[i]); 448 - if (ret) 449 - pr_err("failed to register sysdev[%d]\n", i); 450 - } 458 + register_syscore_ops(&pxa_irq_syscore_ops); 459 + register_syscore_ops(&pxa2xx_mfp_syscore_ops); 460 + register_syscore_ops(&pxa_gpio_syscore_ops); 461 + register_syscore_ops(&pxa2xx_clock_syscore_ops); 451 462 452 463 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 453 464 }
+6 -19
arch/arm/mach-pxa/pxa3xx.c
··· 20 20 #include <linux/platform_device.h> 21 21 #include <linux/irq.h> 22 22 #include <linux/io.h> 23 - #include <linux/sysdev.h> 23 + #include <linux/syscore_ops.h> 24 24 #include <linux/i2c/pxa-i2c.h> 25 25 26 26 #include <asm/mach/map.h> ··· 427 427 &pxa27x_device_pwm1, 428 428 }; 429 429 430 - static struct sys_device pxa3xx_sysdev[] = { 431 - { 432 - .cls = &pxa_irq_sysclass, 433 - }, { 434 - .cls = &pxa3xx_mfp_sysclass, 435 - }, { 436 - .cls = &pxa_gpio_sysclass, 437 - }, { 438 - .cls = &pxa3xx_clock_sysclass, 439 - } 440 - }; 441 - 442 430 static int __init pxa3xx_init(void) 443 431 { 444 - int i, ret = 0; 432 + int ret = 0; 445 433 446 434 if (cpu_is_pxa3xx()) { 447 435 ··· 450 462 451 463 pxa3xx_init_pm(); 452 464 453 - for (i = 0; i < ARRAY_SIZE(pxa3xx_sysdev); i++) { 454 - ret = sysdev_register(&pxa3xx_sysdev[i]); 455 - if (ret) 456 - pr_err("failed to register sysdev[%d]\n", i); 457 - } 465 + register_syscore_ops(&pxa_irq_syscore_ops); 466 + register_syscore_ops(&pxa3xx_mfp_syscore_ops); 467 + register_syscore_ops(&pxa_gpio_syscore_ops); 468 + register_syscore_ops(&pxa3xx_clock_syscore_ops); 458 469 459 470 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 460 471 }
+4 -16
arch/arm/mach-pxa/pxa95x.c
··· 18 18 #include <linux/i2c/pxa-i2c.h> 19 19 #include <linux/irq.h> 20 20 #include <linux/io.h> 21 - #include <linux/sysdev.h> 21 + #include <linux/syscore_ops.h> 22 22 23 23 #include <mach/hardware.h> 24 24 #include <mach/gpio.h> ··· 260 260 &pxa27x_device_pwm1, 261 261 }; 262 262 263 - static struct sys_device pxa95x_sysdev[] = { 264 - { 265 - .cls = &pxa_irq_sysclass, 266 - }, { 267 - .cls = &pxa_gpio_sysclass, 268 - }, { 269 - .cls = &pxa3xx_clock_sysclass, 270 - } 271 - }; 272 - 273 263 static int __init pxa95x_init(void) 274 264 { 275 265 int ret = 0, i; ··· 283 293 if ((ret = pxa_init_dma(IRQ_DMA, 32))) 284 294 return ret; 285 295 286 - for (i = 0; i < ARRAY_SIZE(pxa95x_sysdev); i++) { 287 - ret = sysdev_register(&pxa95x_sysdev[i]); 288 - if (ret) 289 - pr_err("failed to register sysdev[%d]\n", i); 290 - } 296 + register_syscore_ops(&pxa_irq_syscore_ops); 297 + register_syscore_ops(&pxa_gpio_syscore_ops); 298 + register_syscore_ops(&pxa3xx_clock_syscore_ops); 291 299 292 300 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 293 301 }
-1
arch/arm/mach-pxa/raumfeld.c
··· 18 18 19 19 #include <linux/init.h> 20 20 #include <linux/kernel.h> 21 - #include <linux/sysdev.h> 22 21 #include <linux/platform_device.h> 23 22 #include <linux/interrupt.h> 24 23 #include <linux/gpio.h>
+7 -22
arch/arm/mach-pxa/smemc.c
··· 6 6 #include <linux/kernel.h> 7 7 #include <linux/init.h> 8 8 #include <linux/io.h> 9 - #include <linux/sysdev.h> 9 + #include <linux/syscore_ops.h> 10 10 11 11 #include <mach/hardware.h> 12 12 #include <mach/smemc.h> ··· 16 16 static unsigned long sxcnfg, memclkcfg; 17 17 static unsigned long csadrcfg[4]; 18 18 19 - static int pxa3xx_smemc_suspend(struct sys_device *dev, pm_message_t state) 19 + static int pxa3xx_smemc_suspend(void) 20 20 { 21 21 msc[0] = __raw_readl(MSC0); 22 22 msc[1] = __raw_readl(MSC1); ··· 30 30 return 0; 31 31 } 32 32 33 - static int pxa3xx_smemc_resume(struct sys_device *dev) 33 + static void pxa3xx_smemc_resume(void) 34 34 { 35 35 __raw_writel(msc[0], MSC0); 36 36 __raw_writel(msc[1], MSC1); ··· 40 40 __raw_writel(csadrcfg[1], CSADRCFG1); 41 41 __raw_writel(csadrcfg[2], CSADRCFG2); 42 42 __raw_writel(csadrcfg[3], CSADRCFG3); 43 - 44 - return 0; 45 43 } 46 44 47 - static struct sysdev_class smemc_sysclass = { 48 - .name = "smemc", 45 + static struct syscore_ops smemc_syscore_ops = { 49 46 .suspend = pxa3xx_smemc_suspend, 50 47 .resume = pxa3xx_smemc_resume, 51 48 }; 52 49 53 - static struct sys_device smemc_sysdev = { 54 - .id = 0, 55 - .cls = &smemc_sysclass, 56 - }; 57 - 58 50 static int __init smemc_init(void) 59 51 { 60 - int ret = 0; 52 + if (cpu_is_pxa3xx()) 53 + register_syscore_ops(&smemc_syscore_ops); 61 54 62 - if (cpu_is_pxa3xx()) { 63 - ret = sysdev_class_register(&smemc_sysclass); 64 - if (ret) 65 - return ret; 66 - 67 - ret = sysdev_register(&smemc_sysdev); 68 - } 69 - 70 - return ret; 55 + return 0; 71 56 } 72 57 subsys_initcall(smemc_init); 73 58 #endif
-1
arch/arm/mach-pxa/trizeps4.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/platform_device.h> 18 - #include <linux/sysdev.h> 19 18 #include <linux/interrupt.h> 20 19 #include <linux/sched.h> 21 20 #include <linux/bitops.h>
+6 -6
arch/arm/mach-pxa/viper.c
··· 44 44 #include <linux/mtd/mtd.h> 45 45 #include <linux/mtd/partitions.h> 46 46 #include <linux/mtd/physmap.h> 47 + #include <linux/syscore_ops.h> 47 48 48 49 #include <mach/pxa25x.h> 49 50 #include <mach/audio.h> ··· 131 130 return v1; 132 131 } 133 132 134 - /* CPU sysdev */ 135 - static int viper_cpu_suspend(struct sys_device *sysdev, pm_message_t state) 133 + /* CPU system core operations. */ 134 + static int viper_cpu_suspend(void) 136 135 { 137 136 viper_icr_set_bit(VIPER_ICR_R_DIS); 138 137 return 0; 139 138 } 140 139 141 - static int viper_cpu_resume(struct sys_device *sysdev) 140 + static void viper_cpu_resume(void) 142 141 { 143 142 viper_icr_clear_bit(VIPER_ICR_R_DIS); 144 - return 0; 145 143 } 146 144 147 - static struct sysdev_driver viper_cpu_sysdev_driver = { 145 + static struct syscore_ops viper_cpu_syscore_ops = { 148 146 .suspend = viper_cpu_suspend, 149 147 .resume = viper_cpu_resume, 150 148 }; ··· 945 945 viper_init_vcore_gpios(); 946 946 viper_init_cpufreq(); 947 947 948 - sysdev_driver_register(&cpu_sysdev_class, &viper_cpu_sysdev_driver); 948 + register_syscore_ops(&viper_cpu_syscore_ops); 949 949 950 950 if (version) { 951 951 pr_info("viper: hardware v%di%d detected. "
-1
arch/arm/mach-pxa/vpac270.c
··· 16 16 #include <linux/gpio_keys.h> 17 17 #include <linux/input.h> 18 18 #include <linux/gpio.h> 19 - #include <linux/sysdev.h> 20 19 #include <linux/usb/gpio_vbus.h> 21 20 #include <linux/mtd/mtd.h> 22 21 #include <linux/mtd/partitions.h>
+4 -13
arch/arm/plat-pxa/gpio.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/irq.h> 17 17 #include <linux/io.h> 18 - #include <linux/sysdev.h> 18 + #include <linux/syscore_ops.h> 19 19 #include <linux/slab.h> 20 20 21 21 #include <mach/gpio.h> ··· 295 295 } 296 296 297 297 #ifdef CONFIG_PM 298 - static int pxa_gpio_suspend(struct sys_device *dev, pm_message_t state) 298 + static int pxa_gpio_suspend(void) 299 299 { 300 300 struct pxa_gpio_chip *c; 301 301 int gpio; ··· 312 312 return 0; 313 313 } 314 314 315 - static int pxa_gpio_resume(struct sys_device *dev) 315 + static void pxa_gpio_resume(void) 316 316 { 317 317 struct pxa_gpio_chip *c; 318 318 int gpio; ··· 326 326 __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET); 327 327 __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET); 328 328 } 329 - return 0; 330 329 } 331 330 #else 332 331 #define pxa_gpio_suspend NULL 333 332 #define pxa_gpio_resume NULL 334 333 #endif 335 334 336 - struct sysdev_class pxa_gpio_sysclass = { 337 - .name = "gpio", 335 + struct syscore_ops pxa_gpio_syscore_ops = { 338 336 .suspend = pxa_gpio_suspend, 339 337 .resume = pxa_gpio_resume, 340 338 }; 341 - 342 - static int __init pxa_gpio_init(void) 343 - { 344 - return sysdev_class_register(&pxa_gpio_sysclass); 345 - } 346 - 347 - core_initcall(pxa_gpio_init);
-1
arch/arm/plat-pxa/mfp.c
··· 17 17 #include <linux/kernel.h> 18 18 #include <linux/init.h> 19 19 #include <linux/io.h> 20 - #include <linux/sysdev.h> 21 20 22 21 #include <plat/mfp.h> 23 22