[PATCH 4/4] powerpc/mpic: remove unused functions
Drop unused mpic_set_clk_ratio() and mpic_set_serial_int(). Both functions are almost nine years old[1] but still have no chance to be called even from out-of-tree modules because they both are __init and of course aren't exported. [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2006-June/023867.html Signed-off-by: Arseny Solokha Cc: Jia Hongtao --- arch/powerpc/include/asm/mpic.h | 11 --- arch/powerpc/sysdev/mpic.c | 25 - 2 files changed, 36 deletions(-) diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 754f93d..3b39c28 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h @@ -33,11 +33,6 @@ #defineMPIC_GREG_GCONF_NO_BIAS 0x1000 #defineMPIC_GREG_GCONF_BASE_MASK 0x000f #defineMPIC_GREG_GCONF_MCK 0x0800 -#define MPIC_GREG_GLOBAL_CONF_10x00030 -#defineMPIC_GREG_GLOBAL_CONF_1_SIE 0x0800 -#defineMPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK 0x7000 -#defineMPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(r)\ - (((r) << 28) & MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK) #define MPIC_GREG_VENDOR_0 0x00040 #define MPIC_GREG_VENDOR_1 0x00050 #define MPIC_GREG_VENDOR_2 0x00060 @@ -496,11 +491,5 @@ extern unsigned int mpic_get_coreint_irq(void); /* Fetch Machine Check interrupt from primary mpic */ extern unsigned int mpic_get_mcirq(void); -/* Set the EPIC clock ratio */ -void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio); - -/* Enable/Disable EPIC serial interrupt mode */ -void mpic_set_serial_int(struct mpic *mpic, int enable); - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MPIC_H */ diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index bbfbbf2..2c817a7 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -1676,31 +1676,6 @@ void __init mpic_init(struct mpic *mpic) mpic_err_int_init(mpic, MPIC_FSL_ERR_INT); } -void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio) -{ - u32 v; - - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - v &= ~MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK; - v |= MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(clock_ratio); - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); -} - -void __init mpic_set_serial_int(struct mpic *mpic, int enable) -{ - unsigned long flags; - u32 v; - - raw_spin_lock_irqsave(&mpic_lock, flags); - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - if (enable) - v |= MPIC_GREG_GLOBAL_CONF_1_SIE; - else - v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE; - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); - raw_spin_unlock_irqrestore(&mpic_lock, flags); -} - void mpic_irq_set_priority(unsigned int irq, unsigned int pri) { struct mpic *mpic = mpic_find(irq); -- 2.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
> @@ -1676,31 +1666,6 @@ void __init mpic_init(struct mpic *mpic) > mpic_err_int_init(mpic, MPIC_FSL_ERR_INT); > } > > -void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio) > -{ > - u32 v; > - > - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); > - v &= ~MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK; > - v |= MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(clock_ratio); > - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); > -} > - > -void __init mpic_set_serial_int(struct mpic *mpic, int enable) > -{ > - unsigned long flags; > - u32 v; > - > - raw_spin_lock_irqsave(&mpic_lock, flags); > - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); > - if (enable) > - v |= MPIC_GREG_GLOBAL_CONF_1_SIE; > - else > - v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE; > - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); > - raw_spin_unlock_irqrestore(&mpic_lock, flags); > -} > - > void mpic_irq_set_priority(unsigned int irq, unsigned int pri) > { > struct mpic *mpic = mpic_find(irq); Thinking about it some more, I wonder whether it makes sense to propagate these values through device tree (and refuse to apply them if they are 0), just like what timer_group_get_freq() and timer_group_get_irq() in arch/powerpc/sysdev/mpic_timer.c do. Does it have any real use? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Wed, 2015-02-25 at 20:39 -0600, Jia Hongtao-B38951 wrote: > Hi Scott, > > I'm really sorry for leave this patch like a zombie. > Now I have plan to revisit this patch. > > From the previous comments the compile error was fixed. > But beyond that I have had no plan to update it. > > Could you please comment on why it's still on hold? > Kumar had some comments. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 4/4] powerpc/mpic: remove unused functions
Hi Scott, I'm really sorry for leave this patch like a zombie. Now I have plan to revisit this patch. From the previous comments the compile error was fixed. But beyond that I have had no plan to update it. Could you please comment on why it's still on hold? Thanks. > -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, February 24, 2015 5:32 AM > To: Arseny Solokha > Cc: Michael Ellerman; Benjamin Herrenschmidt; Paul Mackerras; linuxppc- > d...@lists.ozlabs.org; linux-ker...@vger.kernel.org; Jia Hongtao-B38951 > Subject: Re: [PATCH 4/4] powerpc/mpic: remove unused functions > > On Thu, 2015-02-19 at 19:26 +0700, Arseny Solokha wrote: > > + fsl_mpic_primary_get_version() is just a safe wrapper around > > fsl_mpic_get_version() for SMP configurations. While the latter is > > called explicitly for handling PIC initialization and setting up error > > interrupt vector depending on PIC hardware version, the former isn't > > used for anything. > > It was meant to be used by http://patchwork.ozlabs.org/patch/233211/ > which never got respun. Hongtao, do you plan to revisit that patch? > > -Scott > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/4] powerpc/mpic: remove unused functions
Drop unused fsl_mpic_primary_get_version(), mpic_set_clk_ratio(), mpic_set_serial_int(). + fsl_mpic_primary_get_version() is just a safe wrapper around fsl_mpic_get_version() for SMP configurations. While the latter is called explicitly for handling PIC initialization and setting up error interrupt vector depending on PIC hardware version, the former isn't used for anything. + As for mpic_set_clk_ratio() and mpic_set_serial_int(), they both are almost nine years old[1] but still have no chance to be called even from out-of-tree modules because they both are __init and of course aren't exported. [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2006-June/023867.html Signed-off-by: Arseny Solokha Cc: hongtao@freescale.com --- arch/powerpc/include/asm/mpic.h | 20 arch/powerpc/sysdev/mpic.c | 35 --- 2 files changed, 55 deletions(-) diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 754f93d..6ce63a7 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h @@ -34,10 +34,6 @@ #defineMPIC_GREG_GCONF_BASE_MASK 0x000f #defineMPIC_GREG_GCONF_MCK 0x0800 #define MPIC_GREG_GLOBAL_CONF_10x00030 -#defineMPIC_GREG_GLOBAL_CONF_1_SIE 0x0800 -#defineMPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK 0x7000 -#defineMPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(r)\ - (((r) << 28) & MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK) #define MPIC_GREG_VENDOR_0 0x00040 #define MPIC_GREG_VENDOR_1 0x00050 #define MPIC_GREG_VENDOR_2 0x00060 @@ -395,16 +391,6 @@ extern struct bus_type mpic_subsys; #defineMPIC_REGSET_STANDARDMPIC_REGSET(0) /* Original MPIC */ #defineMPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */ -/* Get the version of primary MPIC */ -#ifdef CONFIG_MPIC -extern u32 fsl_mpic_primary_get_version(void); -#else -static inline u32 fsl_mpic_primary_get_version(void) -{ - return 0; -} -#endif - /* Allocate the controller structure and setup the linux irq descs * for the range if interrupts passed in. No HW initialization is * actually performed. @@ -496,11 +482,5 @@ extern unsigned int mpic_get_coreint_irq(void); /* Fetch Machine Check interrupt from primary mpic */ extern unsigned int mpic_get_mcirq(void); -/* Set the EPIC clock ratio */ -void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio); - -/* Enable/Disable EPIC serial interrupt mode */ -void mpic_set_serial_int(struct mpic *mpic, int enable); - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MPIC_H */ diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index bbfbbf2..f72b592 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -1219,16 +1219,6 @@ static u32 fsl_mpic_get_version(struct mpic *mpic) * Exported functions */ -u32 fsl_mpic_primary_get_version(void) -{ - struct mpic *mpic = mpic_primary; - - if (mpic) - return fsl_mpic_get_version(mpic); - - return 0; -} - struct mpic * __init mpic_alloc(struct device_node *node, phys_addr_t phys_addr, unsigned int flags, @@ -1676,31 +1666,6 @@ void __init mpic_init(struct mpic *mpic) mpic_err_int_init(mpic, MPIC_FSL_ERR_INT); } -void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio) -{ - u32 v; - - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - v &= ~MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK; - v |= MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(clock_ratio); - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); -} - -void __init mpic_set_serial_int(struct mpic *mpic, int enable) -{ - unsigned long flags; - u32 v; - - raw_spin_lock_irqsave(&mpic_lock, flags); - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - if (enable) - v |= MPIC_GREG_GLOBAL_CONF_1_SIE; - else - v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE; - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); - raw_spin_unlock_irqrestore(&mpic_lock, flags); -} - void mpic_irq_set_priority(unsigned int irq, unsigned int pri) { struct mpic *mpic = mpic_find(irq); -- 2.3.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Fri, 2015-02-20 at 11:40 +0700, Arseny Solokha wrote: > > If I just get a patch saying "removed unused foo()", I have to go and dig > > and > > find out: > > - was it recently added and will be used soon? > > - is it ancient and never used, if so can we work out why, ie. feature X > > never landed so this code is no longer needed. > > - is it old code that *was* used but isn't now because commit ... removed > > the > > last user. > > - is it code that *should* be used, but isn't for some odd reason? > > > > > > So if you can provide that sort of detail for me, that really adds value to > > the > > patch. Otherwise the patch is basically just a TODO for me, to go and work > > out > > why the code is unused. > > Got it. Will resend the whole series one of these days. Thanks. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Thu, 2015-02-19 at 19:26 +0700, Arseny Solokha wrote: > + fsl_mpic_primary_get_version() is just a safe wrapper around > fsl_mpic_get_version() for SMP configurations. While the latter is > called explicitly for handling PIC initialization and setting up error > interrupt vector depending on PIC hardware version, the former isn't > used for anything. It was meant to be used by http://patchwork.ozlabs.org/patch/233211/ which never got respun. Hongtao, do you plan to revisit that patch? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
> If I just get a patch saying "removed unused foo()", I have to go and dig and > find out: > - was it recently added and will be used soon? > - is it ancient and never used, if so can we work out why, ie. feature X > never landed so this code is no longer needed. > - is it old code that *was* used but isn't now because commit ... removed > the > last user. > - is it code that *should* be used, but isn't for some odd reason? > > > So if you can provide that sort of detail for me, that really adds value to > the > patch. Otherwise the patch is basically just a TODO for me, to go and work out > why the code is unused. Got it. Will resend the whole series one of these days. Arsény > cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Thu, 2015-02-19 at 19:26 +0700, Arseny Solokha wrote: > > On Mon, 2015-02-16 at 17:56 +0700, Arseny Solokha wrote: > >> Drop unused fsl_mpic_primary_get_version(), mpic_set_clk_ratio(), > >> mpic_set_serial_int(). > > > > I'm always happy to remove unused code, but the interesting question is why > > are > > they unused? Please tell me in the changelog. > > To being able to give a definitive answer, it's necessary to understand > the intentions of original developers of these pieces. I just can tell > these functions have no users and trivial grepping easily proves it; > I've got the impression they are here only for the sake of > implementation completeness. Yeah OK. I didn't expect you to read the minds of the developers who wrote the code :) > Two machines at hands, e300 and e500 based, boot and run without > regressions on my workload with this series applied. The removed code > seems also been rarely touched, so it seems the series is safe at least > in general. But I can't obviously express any strong point in support of > the series, so it's completely OK to leave things as is. OK that's a good data point. > + fsl_mpic_primary_get_version() is just a safe wrapper around > fsl_mpic_get_version() for SMP configurations. While the latter is > called explicitly for handling PIC initialization and setting up error > interrupt vector depending on PIC hardware version, the former isn't > used for anything. > > + As for mpic_set_clk_ratio() and mpic_set_serial_int(), they both > are almost nine years old[1] but still have no chance to be called even > from out-of-tree modules because they both are __init and of course > aren't exported. Non-demanded functionality? > > Of course I'll include the last two paragraphs into the V2 patch > description if the explanation is convincing enough and you ACK it. If > the patch is safe it's also necessary to extend it a bit, making its > second part actually a complete revert of [1]. > > [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2006-June/023867.html That is more like what I was looking for. If I just get a patch saying "removed unused foo()", I have to go and dig and find out: - was it recently added and will be used soon? - is it ancient and never used, if so can we work out why, ie. feature X never landed so this code is no longer needed. - is it old code that *was* used but isn't now because commit ... removed the last user. - is it code that *should* be used, but isn't for some odd reason? So if you can provide that sort of detail for me, that really adds value to the patch. Otherwise the patch is basically just a TODO for me, to go and work out why the code is unused. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
> On Mon, 2015-02-16 at 17:56 +0700, Arseny Solokha wrote: >> Drop unused fsl_mpic_primary_get_version(), mpic_set_clk_ratio(), >> mpic_set_serial_int(). > > I'm always happy to remove unused code, but the interesting question is why > are > they unused? Please tell me in the changelog. To being able to give a definitive answer, it's necessary to understand the intentions of original developers of these pieces. I just can tell these functions have no users and trivial grepping easily proves it; I've got the impression they are here only for the sake of implementation completeness. Two machines at hands, e300 and e500 based, boot and run without regressions on my workload with this series applied. The removed code seems also been rarely touched, so it seems the series is safe at least in general. But I can't obviously express any strong point in support of the series, so it's completely OK to leave things as is. + fsl_mpic_primary_get_version() is just a safe wrapper around fsl_mpic_get_version() for SMP configurations. While the latter is called explicitly for handling PIC initialization and setting up error interrupt vector depending on PIC hardware version, the former isn't used for anything. + As for mpic_set_clk_ratio() and mpic_set_serial_int(), they both are almost nine years old[1] but still have no chance to be called even from out-of-tree modules because they both are __init and of course aren't exported. Non-demanded functionality? Of course I'll include the last two paragraphs into the V2 patch description if the explanation is convincing enough and you ACK it. If the patch is safe it's also necessary to extend it a bit, making its second part actually a complete revert of [1]. [1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2006-June/023867.html Arsény > cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 4/4] powerpc/mpic: remove unused functions
On Mon, 2015-02-16 at 17:56 +0700, Arseny Solokha wrote: > Drop unused fsl_mpic_primary_get_version(), mpic_set_clk_ratio(), > mpic_set_serial_int(). I'm always happy to remove unused code, but the interesting question is why are they unused? Please tell me in the changelog. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/4] powerpc/mpic: remove unused functions
Drop unused fsl_mpic_primary_get_version(), mpic_set_clk_ratio(), mpic_set_serial_int(). Signed-off-by: Arseny Solokha --- arch/powerpc/include/asm/mpic.h | 16 arch/powerpc/sysdev/mpic.c | 35 --- 2 files changed, 51 deletions(-) diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 754f93d..3a2ab60 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h @@ -395,16 +395,6 @@ extern struct bus_type mpic_subsys; #defineMPIC_REGSET_STANDARDMPIC_REGSET(0) /* Original MPIC */ #defineMPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */ -/* Get the version of primary MPIC */ -#ifdef CONFIG_MPIC -extern u32 fsl_mpic_primary_get_version(void); -#else -static inline u32 fsl_mpic_primary_get_version(void) -{ - return 0; -} -#endif - /* Allocate the controller structure and setup the linux irq descs * for the range if interrupts passed in. No HW initialization is * actually performed. @@ -496,11 +486,5 @@ extern unsigned int mpic_get_coreint_irq(void); /* Fetch Machine Check interrupt from primary mpic */ extern unsigned int mpic_get_mcirq(void); -/* Set the EPIC clock ratio */ -void mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio); - -/* Enable/Disable EPIC serial interrupt mode */ -void mpic_set_serial_int(struct mpic *mpic, int enable); - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MPIC_H */ diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index bbfbbf2..f72b592 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -1219,16 +1219,6 @@ static u32 fsl_mpic_get_version(struct mpic *mpic) * Exported functions */ -u32 fsl_mpic_primary_get_version(void) -{ - struct mpic *mpic = mpic_primary; - - if (mpic) - return fsl_mpic_get_version(mpic); - - return 0; -} - struct mpic * __init mpic_alloc(struct device_node *node, phys_addr_t phys_addr, unsigned int flags, @@ -1676,31 +1666,6 @@ void __init mpic_init(struct mpic *mpic) mpic_err_int_init(mpic, MPIC_FSL_ERR_INT); } -void __init mpic_set_clk_ratio(struct mpic *mpic, u32 clock_ratio) -{ - u32 v; - - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - v &= ~MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO_MASK; - v |= MPIC_GREG_GLOBAL_CONF_1_CLK_RATIO(clock_ratio); - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); -} - -void __init mpic_set_serial_int(struct mpic *mpic, int enable) -{ - unsigned long flags; - u32 v; - - raw_spin_lock_irqsave(&mpic_lock, flags); - v = mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1); - if (enable) - v |= MPIC_GREG_GLOBAL_CONF_1_SIE; - else - v &= ~MPIC_GREG_GLOBAL_CONF_1_SIE; - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_1, v); - raw_spin_unlock_irqrestore(&mpic_lock, flags); -} - void mpic_irq_set_priority(unsigned int irq, unsigned int pri) { struct mpic *mpic = mpic_find(irq); -- 2.3.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev