MIPS:i8259.c remove resume and shutdown to syscore_ops
PATCH 1/1 MIPS:i8259.c remove resume and shutdown to syscore_ops
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?
Hi Ralf:
If these not moved to syscore_ops, building will get error.
Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?
Thanks
Best regards
Wanlong Gao
Quoted 11 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?
Quoted 5 lines
Hi Ralf:
If these not moved tosyscore_ops, building will get error.Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?
I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / MIPS: Use struct syscore_ops instead of sysdevs for PM (v2)
Convert some MIPS architecture's code to using struct syscore_ops objects for power management instead of sysdev classes and sysdevs.
This simplifies the code and reduces the kernel's memory footprint. It also is necessary for removing sysdevs from the kernel entirely in the future.
This change includes a build fix from Ralf Baechle.
--- arch/mips/alchemy/common/dbdma.c | 92 +++++++++++---------------------------- arch/mips/alchemy/common/irq.c | 62 +++++++++----------------- arch/mips/jz4740/gpio.c | 52 +++++++++------------- arch/mips/kernel/i8259.c | 26 +++-------- 4 files changed, 80 insertions(+), 152 deletions(-)
arch/mips/alchemy/common/irq.c +23 -39
@@ -30,7 +30,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h>
@@ -556,17 +556,15 @@ void __init arch_init_irq(void) } } -struct alchemy_ic_sysdev { -struct sys_device sysdev; +struct alchemy_ic {void __iomem *base;unsigned long pmdata[7 ]; }; -static int alchemy_ic_suspend (struct sys_device *dev,pm_message_t state) -{ -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); +static struct alchemy_ic alchemy_ic_data[2 ]; +static void alchemy_suspend_one_ic (struct alchemy_ic *icdev) +{ icdev->pmdata[0 ] =__raw_readl (icdev->base +IC_CFG0RD ); icdev->pmdata[1 ] =__raw_readl (icdev->base +IC_CFG1RD ); icdev->pmdata[2 ] =__raw_readl (icdev->base +IC_CFG2RD );
@@ -574,15 +572,17 @@ static int alchemy_ic_suspend(struct sys icdev->pmdata[4 ] =__raw_readl (icdev->base +IC_ASSIGNRD ); icdev->pmdata[5 ] =__raw_readl (icdev->base +IC_WAKERD ); icdev->pmdata[6 ] =__raw_readl (icdev->base +IC_MASKRD ); +} +static int alchemy_ic_suspend (void ) +{ +alchemy_suspend_one_ic (alchemy_ic_data); +alchemy_suspend_one_ic (alchemy_ic_data +1 );return 0 ; } -static int alchemy_ic_resume (struct sys_device *dev) +static void alchemy_resume_one_ic (struct alchemy_ic *icdev) { -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); -__raw_writel (0xffffffff , icdev->base +IC_MASKCLR );__raw_writel (0xffffffff , icdev->base +IC_CFG0CLR );__raw_writel (0xffffffff , icdev->base +IC_CFG1CLR );
@@ -604,42 +604,26 @@ static int alchemy_ic_resume(struct sys___raw_writel (icdev->pmdata[6 ], icdev->base +IC_MASKSET );wmb (); +} -return 0 ; +static void alchemy_ic_resume (void ) +{ +alchemy_resume_one_ic (alchemy_ic_data +1 ); +alchemy_resume_one_ic (alchemy_ic_data); } -static struct sysdev_class alchemy_ic_sysdev_class = { - .name ="ic" , +static struct syscore_ops alchemy_ic_syscore_ops = { .suspend = alchemy_ic_suspend, .resume = alchemy_ic_resume, }; -static int __init alchemy_ic_sysdev_init (void ) +static int __init alchemy_ic_syscore_init (void ) { -struct alchemy_ic_sysdev *icdev; -unsigned long icbase[2 ] = {IC0_PHYS_ADDR ,IC1_PHYS_ADDR }; -int err, i; - - err =sysdev_class_register (&alchemy_ic_sysdev_class); -if (err) -return err; - -for (i =0 ; i <2 ; i++) { - icdev =kzalloc (sizeof (struct alchemy_ic_sysdev ),GFP_KERNEL ); -if (!icdev) -return -ENOMEM ; - - icdev->base =ioremap (icbase[i],0x1000 ); - - icdev->sysdev.id = i; - icdev->sysdev.cls = &alchemy_ic_sysdev_class; - err =sysdev_register (&icdev->sysdev); -if (err) { -kfree (icdev); -return err; - } - } + alchemy_ic_data[0 ].base =ioremap (IC0_PHYS_ADDR ,0x1000 ); + alchemy_ic_data[1 ].base =ioremap (IC1_PHYS_ADDR ,0x1000 ); + +register_syscore_ops (&alchemy_ic_syscore_ops);return 0 ; } -device_initcall (alchemy_ic_sysdev_init); +device_initcall (alchemy_ic_syscore_init);
arch/mips/alchemy/common/dbdma.c +27 -65
144 lines not on this page · raw message
arch/mips/jz4740/gpio.c +22 -30
107 lines not on this page · raw message
arch/mips/kernel/i8259.c +8 -18
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/spinlock.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/i8259.h>
@@ -215,14 +215,13 @@ spurious_8259A_irq: } } -static int i8259A_resume (struct sys_device *dev) +static void i8259A_resume (void ) {if (i8259A_auto_eoi >=0 )init_8259A (i8259A_auto_eoi); -return 0 ; } -static int i8259A_shutdown (struct sys_device *dev) +static void i8259A_shutdown (void ) {/* Put the i8259A into a quiescent state that * the kernel initialization code can get it
@@ -232,29 +231,20 @@ static int i8259A_shutdown(struct sys_deoutb (0xff ,PIC_MASTER_IMR );/* mask all of 8259A-1 */ outb (0xff ,PIC_SLAVE_IMR );/* mask all of 8259A-1 */ } -return 0 ; } -static struct sysdev_class i8259_sysdev_class = { - .name ="i8259" , +static struct syscore_ops i8259_syscore_ops = { .resume = i8259A_resume, .shutdown = i8259A_shutdown, }; -static struct sys_device device_i8259A = { - .id =0 , - .cls = &i8259_sysdev_class, -}; - -static int __init i8259A_init_sysfs (void ) +static int __init i8259A_init_syscore (void ) { -int error =sysdev_class_register (&i8259_sysdev_class); -if (!error) - error =sysdev_register (&device_i8259A); -return error; +register_syscore_ops (&i8259_syscore_ops); +return 0 ; } -device_initcall (i8259A_init_sysfs); +device_initcall (i8259A_init_syscore);static void init_8259A (int auto_eoi) {
Quoted 21 lines · Rafael J. Wysocki
Quoted 11 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?Quoted 5 lines
Hi Ralf:
If these not moved tosyscore_ops, building will get error.Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Quoted 6 lines
Signed-off-by Rafael J. Wysocki <[email protected]>Acked-and-tested-by Lars-Peter Clausen <[email protected]>---
arch/mips/alchemy/common/dbdma.c | 92 +++++++++++----------------------------arch/mips/alchemy/common/irq.c| 62 +++++++++-----------------
I took care of these two, they were the reason for the conflict in -next.
Manuel
Quoted 21 lines · Rafael J. Wysocki
Quoted 11 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?Quoted 5 lines
Hi Ralf:
If these not moved tosyscore_ops, building will get error.Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Quoted 6 lines
Signed-off-by Rafael J. Wysocki <[email protected]>Acked-and-tested-by Lars-Peter Clausen <[email protected]>---
arch/mips/alchemy/common/dbdma.c | 92 +++++++++++----------------------------arch/mips/alchemy/common/irq.c| 62 +++++++++-----------------
I took care of these two, they were the reason for the conflict in -next.
Manuel
Quoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?Hi Ralf:
If these not moved tosyscore_ops, building will get error.
Quoted 8 lines
Quoted 2 lines
Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Rafael
Hi Rafael:
Quoted 6 lines · Ralf Baechle
Re: [PATCH] MIPS: Use struct
syscore_opsinstead of sysdevs for i8259 On Fri, May 20, 2011 at 10:41:41PM +0900, Yoichi Yuasa wrote:Thanks, applied.
Ralf
It seems already applied some about this?
Thanks
Best regards
Wanlong Gao
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 15 lines · Rafael J. Wysocki
Quoted 14 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?Hi Ralf:
If these not moved tosyscore_ops, building will get error.
Quoted 8 lines
Quoted 2 lines
Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Rafael
Hi Rafael:
Quoted 6 lines · Ralf Baechle
Re: [PATCH] MIPS: Use struct
syscore_opsinstead of sysdevs for i8259 On Fri, May 20, 2011 at 10:41:41PM +0900, Yoichi Yuasa wrote:Thanks, applied.
Ralf
It seems already applied some about this?
Thanks
Best regards
Wanlong Gao
Quoted 11 lines · Wanlong Gao
Quoted 11 lines · Pengfei Zhang
Quoted 4 lines
Remove the resume and shutdown of i8259A from the
sysdev_classto thesyscore_opssince these members had removed from the structuresysdev_class.I don't see why one would want to want to first call
register_syscore_ops
thensysdev_class_registerandsysdev_register?
Quoted 5 lines
Hi Ralf:
If these not moved tosyscore_ops, building will get error.Hi Thomas:
Does you mean that we can just remove the sysfs entry now ?
I had the appended patch in my tree before the merge window started, but it conflicted with analogous changes in the MIPS tree, so I had dropped it. Was it a mistake?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / MIPS: Use struct syscore_ops instead of sysdevs for PM (v2)
Convert some MIPS architecture's code to using struct syscore_ops objects for power management instead of sysdev classes and sysdevs.
This simplifies the code and reduces the kernel's memory footprint. It also is necessary for removing sysdevs from the kernel entirely in the future.
This change includes a build fix from Ralf Baechle.
--- arch/mips/alchemy/common/dbdma.c | 92 +++++++++++---------------------------- arch/mips/alchemy/common/irq.c | 62 +++++++++----------------- arch/mips/jz4740/gpio.c | 52 +++++++++------------- arch/mips/kernel/i8259.c | 26 +++-------- 4 files changed, 80 insertions(+), 152 deletions(-)
arch/mips/alchemy/common/irq.c +23 -39
@@ -30,7 +30,7 @@#include <linux/interrupt.h> #include <linux/irq.h> #include <linux/slab.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <asm/irq_cpu.h> #include <asm/mipsregs.h>
@@ -556,17 +556,15 @@ void __init arch_init_irq(void) } } -struct alchemy_ic_sysdev { -struct sys_device sysdev; +struct alchemy_ic {void __iomem *base;unsigned long pmdata[7 ]; }; -static int alchemy_ic_suspend (struct sys_device *dev,pm_message_t state) -{ -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); +static struct alchemy_ic alchemy_ic_data[2 ]; +static void alchemy_suspend_one_ic (struct alchemy_ic *icdev) +{ icdev->pmdata[0 ] =__raw_readl (icdev->base +IC_CFG0RD ); icdev->pmdata[1 ] =__raw_readl (icdev->base +IC_CFG1RD ); icdev->pmdata[2 ] =__raw_readl (icdev->base +IC_CFG2RD );
@@ -574,15 +572,17 @@ static int alchemy_ic_suspend(struct sys icdev->pmdata[4 ] =__raw_readl (icdev->base +IC_ASSIGNRD ); icdev->pmdata[5 ] =__raw_readl (icdev->base +IC_WAKERD ); icdev->pmdata[6 ] =__raw_readl (icdev->base +IC_MASKRD ); +} +static int alchemy_ic_suspend (void ) +{ +alchemy_suspend_one_ic (alchemy_ic_data); +alchemy_suspend_one_ic (alchemy_ic_data +1 );return 0 ; } -static int alchemy_ic_resume (struct sys_device *dev) +static void alchemy_resume_one_ic (struct alchemy_ic *icdev) { -struct alchemy_ic_sysdev *icdev = - container_of(dev, struct alchemy_ic_sysdev, sysdev); -__raw_writel (0xffffffff , icdev->base +IC_MASKCLR );__raw_writel (0xffffffff , icdev->base +IC_CFG0CLR );__raw_writel (0xffffffff , icdev->base +IC_CFG1CLR );
@@ -604,42 +604,26 @@ static int alchemy_ic_resume(struct sys___raw_writel (icdev->pmdata[6 ], icdev->base +IC_MASKSET );wmb (); +} -return 0 ; +static void alchemy_ic_resume (void ) +{ +alchemy_resume_one_ic (alchemy_ic_data +1 ); +alchemy_resume_one_ic (alchemy_ic_data); } -static struct sysdev_class alchemy_ic_sysdev_class = { - .name ="ic" , +static struct syscore_ops alchemy_ic_syscore_ops = { .suspend = alchemy_ic_suspend, .resume = alchemy_ic_resume, }; -static int __init alchemy_ic_sysdev_init (void ) +static int __init alchemy_ic_syscore_init (void ) { -struct alchemy_ic_sysdev *icdev; -unsigned long icbase[2 ] = {IC0_PHYS_ADDR ,IC1_PHYS_ADDR }; -int err, i; - - err =sysdev_class_register (&alchemy_ic_sysdev_class); -if (err) -return err; - -for (i =0 ; i <2 ; i++) { - icdev =kzalloc (sizeof (struct alchemy_ic_sysdev ),GFP_KERNEL ); -if (!icdev) -return -ENOMEM ; - - icdev->base =ioremap (icbase[i],0x1000 ); - - icdev->sysdev.id = i; - icdev->sysdev.cls = &alchemy_ic_sysdev_class; - err =sysdev_register (&icdev->sysdev); -if (err) { -kfree (icdev); -return err; - } - } + alchemy_ic_data[0 ].base =ioremap (IC0_PHYS_ADDR ,0x1000 ); + alchemy_ic_data[1 ].base =ioremap (IC1_PHYS_ADDR ,0x1000 ); + +register_syscore_ops (&alchemy_ic_syscore_ops);return 0 ; } -device_initcall (alchemy_ic_sysdev_init); +device_initcall (alchemy_ic_syscore_init);
arch/mips/alchemy/common/dbdma.c +27 -65
144 lines not on this page · raw message
arch/mips/jz4740/gpio.c +22 -30
107 lines not on this page · raw message
arch/mips/kernel/i8259.c +8 -18
@@ -14,7 +14,7 @@#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/spinlock.h> -#include <linux/sysdev.h> +#include <linux/syscore_ops.h> #include <linux/irq.h> #include <asm/i8259.h>
@@ -215,14 +215,13 @@ spurious_8259A_irq: } } -static int i8259A_resume (struct sys_device *dev) +static void i8259A_resume (void ) {if (i8259A_auto_eoi >=0 )init_8259A (i8259A_auto_eoi); -return 0 ; } -static int i8259A_shutdown (struct sys_device *dev) +static void i8259A_shutdown (void ) {/* Put the i8259A into a quiescent state that * the kernel initialization code can get it
@@ -232,29 +231,20 @@ static int i8259A_shutdown(struct sys_deoutb (0xff ,PIC_MASTER_IMR );/* mask all of 8259A-1 */ outb (0xff ,PIC_SLAVE_IMR );/* mask all of 8259A-1 */ } -return 0 ; } -static struct sysdev_class i8259_sysdev_class = { - .name ="i8259" , +static struct syscore_ops i8259_syscore_ops = { .resume = i8259A_resume, .shutdown = i8259A_shutdown, }; -static struct sys_device device_i8259A = { - .id =0 , - .cls = &i8259_sysdev_class, -}; - -static int __init i8259A_init_sysfs (void ) +static int __init i8259A_init_syscore (void ) { -int error =sysdev_class_register (&i8259_sysdev_class); -if (!error) - error =sysdev_register (&device_i8259A); -return error; +register_syscore_ops (&i8259_syscore_ops); +return 0 ; } -device_initcall (i8259A_init_sysfs); +device_initcall (i8259A_init_syscore);static void init_8259A (int auto_eoi) {